\hypertarget{namespacedumbbell__surface__forcing}{}\doxysection{dumbbell\+\_\+surface\+\_\+forcing Module Reference}
\label{namespacedumbbell__surface__forcing}\index{dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}}


\doxysubsection{Detailed Description}
Surface forcing for the dumbbell test case. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structdumbbell__surface__forcing_1_1dumbbell__surface__forcing__cs}{dumbbell\+\_\+surface\+\_\+forcing\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em Control structure for the dumbbell test case forcing. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__surface__forcing_afe54ddb38a7f5b3fa914cd6abc9865e3}{dumbbell\+\_\+buoyancy\+\_\+forcing}} (sfc\+\_\+state, fluxes, day, dt, G, US, CS)
\begin{DoxyCompactList}\small\item\em Surface buoyancy (heat and fresh water) fluxes for the dumbbell test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__surface__forcing_ae28ac9160579667217d24e8ac4001cff}{dumbbell\+\_\+dynamic\+\_\+forcing}} (sfc\+\_\+state, fluxes, day, dt, G, CS)
\begin{DoxyCompactList}\small\item\em Dynamic forcing for the dumbbell test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__surface__forcing_a555241e1be1a78c0f9016012b5cfbbf7}{dumbbell\+\_\+surface\+\_\+forcing\+\_\+init}} (Time, G, US, param\+\_\+file, diag, CS)
\begin{DoxyCompactList}\small\item\em Reads and sets up the forcing for the dumbbell test case. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedumbbell__surface__forcing_afe54ddb38a7f5b3fa914cd6abc9865e3}\label{namespacedumbbell__surface__forcing_afe54ddb38a7f5b3fa914cd6abc9865e3}} 
\index{dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}!dumbbell\_buoyancy\_forcing@{dumbbell\_buoyancy\_forcing}}
\index{dumbbell\_buoyancy\_forcing@{dumbbell\_buoyancy\_forcing}!dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}}
\doxysubsubsection{\texorpdfstring{dumbbell\_buoyancy\_forcing()}{dumbbell\_buoyancy\_forcing()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+surface\+\_\+forcing\+::dumbbell\+\_\+buoyancy\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1surface}{surface}}), intent(inout)}]{sfc\+\_\+state,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{real, intent(in)}]{dt,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structdumbbell__surface__forcing_1_1dumbbell__surface__forcing__cs}{dumbbell\+\_\+surface\+\_\+forcing\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Surface buoyancy (heat and fresh water) fluxes for the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean. \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing pointers to any possible forcing fields. Unused fields have N\+U\+LL ptrs. \\
\hline
\mbox{\texttt{ in}}  & {\em day} & Time of the fluxes. \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The amount of time over which the fluxes apply \mbox{[}s\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
 & {\em cs} & A control structure returned by a previous call to dumbbell\+\_\+surface\+\_\+forcing\+\_\+init \\
\hline
\end{DoxyParams}


Definition at line 48 of file dumbbell\+\_\+surface\+\_\+forcing.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{49   \textcolor{keywordtype}{type}(surface),                 \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{  !< A structure containing fields that}}
\DoxyCodeLine{50 \textcolor{comment}{                                                         !! describe the surface state of the ocean.}}
\DoxyCodeLine{51   \textcolor{keywordtype}{type}(forcing),                 \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to any}}
\DoxyCodeLine{52 \textcolor{comment}{                                                         !! possible forcing fields. Unused fields}}
\DoxyCodeLine{53 \textcolor{comment}{                                                         !! have NULL ptrs.}}
\DoxyCodeLine{54   \textcolor{keywordtype}{type}(time\_type),               \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Time of the fluxes.}}
\DoxyCodeLine{55 \textcolor{keywordtype}{  real},                          \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{     !< The amount of time over which}}
\DoxyCodeLine{56 \textcolor{comment}{                                                         !! the fluxes apply [s]}}
\DoxyCodeLine{57   \textcolor{keywordtype}{type}(ocean\_grid\_type),         \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{      !< The ocean's grid structure}}
\DoxyCodeLine{58   \textcolor{keywordtype}{type}(unit\_scale\_type),         \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{     !< A dimensional unit scaling type}}
\DoxyCodeLine{59   \textcolor{keywordtype}{type}(dumbbell\_surface\_forcing\_CS),  \textcolor{keywordtype}{pointer}  :: CS\textcolor{comment}{     !< A control structure returned by a previous}}
\DoxyCodeLine{60 \textcolor{comment}{                                                         !! call to dumbbell\_surface\_forcing\_init}}
\DoxyCodeLine{61   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{62 \textcolor{keywordtype}{  real} :: Temp\_restore   \textcolor{comment}{! The temperature that is being restored toward [degC].}}
\DoxyCodeLine{63 \textcolor{keywordtype}{  real} :: Salin\_restore  \textcolor{comment}{! The salinity that is being restored toward [ppt].}}
\DoxyCodeLine{64   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{65   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed}
\DoxyCodeLine{66 }
\DoxyCodeLine{67   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{68   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{69 }
\DoxyCodeLine{70 }
\DoxyCodeLine{71   \textcolor{comment}{! Allocate and zero out the forcing arrays, as necessary.}}
\DoxyCodeLine{72   \textcolor{keywordflow}{if} (cs\%use\_temperature) \textcolor{keywordflow}{then}}
\DoxyCodeLine{73     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%evap, isd, ied, jsd, jed)}
\DoxyCodeLine{74     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%lprec, isd, ied, jsd, jed)}
\DoxyCodeLine{75     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%fprec, isd, ied, jsd, jed)}
\DoxyCodeLine{76     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%lrunoff, isd, ied, jsd, jed)}
\DoxyCodeLine{77     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%frunoff, isd, ied, jsd, jed)}
\DoxyCodeLine{78     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%vprec, isd, ied, jsd, jed)}
\DoxyCodeLine{79 }
\DoxyCodeLine{80     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%sw, isd, ied, jsd, jed)}
\DoxyCodeLine{81     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%lw, isd, ied, jsd, jed)}
\DoxyCodeLine{82     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%latent, isd, ied, jsd, jed)}
\DoxyCodeLine{83     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%sens, isd, ied, jsd, jed)}
\DoxyCodeLine{84   \textcolor{keywordflow}{else} \textcolor{comment}{! This is the buoyancy only mode.}}
\DoxyCodeLine{85     \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%buoy, isd, ied, jsd, jed)}
\DoxyCodeLine{86 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{87 }
\DoxyCodeLine{88 }
\DoxyCodeLine{89   \textcolor{comment}{! MODIFY THE CODE IN THE FOLLOWING LOOPS TO SET THE BUOYANCY FORCING TERMS.}}
\DoxyCodeLine{90 }
\DoxyCodeLine{91   \textcolor{keywordflow}{if} ( cs\%use\_temperature ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{92     \textcolor{comment}{! Set whichever fluxes are to be used here.  Any fluxes that}}
\DoxyCodeLine{93     \textcolor{comment}{! are always zero do not need to be changed here.}}
\DoxyCodeLine{94     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{95       \textcolor{comment}{! Fluxes of fresh water through the surface are in units of [R Z T-\/1 \string~> kg m-\/2 s-\/1]}}
\DoxyCodeLine{96       \textcolor{comment}{! and are positive downward -\/ i.e. evaporation should be negative.}}
\DoxyCodeLine{97       fluxes\%evap(i,j) = -\/0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{98       fluxes\%lprec(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{99 }
\DoxyCodeLine{100       \textcolor{comment}{! vprec will be set later, if it is needed for salinity restoring.}}
\DoxyCodeLine{101       fluxes\%vprec(i,j) = 0.0}
\DoxyCodeLine{102 }
\DoxyCodeLine{103       \textcolor{comment}{! Heat fluxes are in units of [Q R Z T-\/1 \string~> W m-\/2] and are positive into the ocean.}}
\DoxyCodeLine{104       fluxes\%lw(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{105       fluxes\%latent(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{106       fluxes\%sens(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{107       fluxes\%sw(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{108 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{109   \textcolor{keywordflow}{else} \textcolor{comment}{! This is the buoyancy only mode.}}
\DoxyCodeLine{110     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{111       \textcolor{comment}{!   fluxes\%buoy is the buoyancy flux into the ocean [L2 T-\/3 \string~> m2 s-\/3].  A positive}}
\DoxyCodeLine{112       \textcolor{comment}{! buoyancy flux is of the same sign as heating the ocean.}}
\DoxyCodeLine{113       fluxes\%buoy(i,j) = 0.0 * g\%mask2dT(i,j)}
\DoxyCodeLine{114 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{115 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{116 }
\DoxyCodeLine{117   \textcolor{keywordflow}{if} (cs\%use\_temperature .and. cs\%restorebuoy) \textcolor{keywordflow}{then}}
\DoxyCodeLine{118     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{119       \textcolor{keywordflow}{if} (cs\%forcing\_mask(i,j)>0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{120         fluxes\%vprec(i,j) = -\/ (g\%mask2dT(i,j) * (cs\%Rho0*cs\%Flux\_const)) * \&}
\DoxyCodeLine{121                 ((cs\%S\_restore(i,j) -\/ sfc\_state\%SSS(i,j)) /  (0.5 * (cs\%S\_restore(i,j) + sfc\_state\%SSS(i,j))))}
\DoxyCodeLine{122 }
\DoxyCodeLine{123 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{124 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{125 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{126 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedumbbell__surface__forcing_ae28ac9160579667217d24e8ac4001cff}\label{namespacedumbbell__surface__forcing_ae28ac9160579667217d24e8ac4001cff}} 
\index{dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}!dumbbell\_dynamic\_forcing@{dumbbell\_dynamic\_forcing}}
\index{dumbbell\_dynamic\_forcing@{dumbbell\_dynamic\_forcing}!dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}}
\doxysubsubsection{\texorpdfstring{dumbbell\_dynamic\_forcing()}{dumbbell\_dynamic\_forcing()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+surface\+\_\+forcing\+::dumbbell\+\_\+dynamic\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1surface}{surface}}), intent(inout)}]{sfc\+\_\+state,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{real, intent(in)}]{dt,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structdumbbell__surface__forcing_1_1dumbbell__surface__forcing__cs}{dumbbell\+\_\+surface\+\_\+forcing\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Dynamic forcing for the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean. \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing pointers to any possible forcing fields. Unused fields have N\+U\+LL ptrs. \\
\hline
\mbox{\texttt{ in}}  & {\em day} & Time of the fluxes. \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The amount of time over which the fluxes apply \mbox{[}s\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
 & {\em cs} & A control structure returned by a previous call to dumbbell\+\_\+surface\+\_\+forcing\+\_\+init \\
\hline
\end{DoxyParams}


Definition at line 130 of file dumbbell\+\_\+surface\+\_\+forcing.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{131   \textcolor{keywordtype}{type}(surface),                 \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{  !< A structure containing fields that}}
\DoxyCodeLine{132 \textcolor{comment}{                                                       !! describe the surface state of the ocean.}}
\DoxyCodeLine{133   \textcolor{keywordtype}{type}(forcing),                 \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to any}}
\DoxyCodeLine{134 \textcolor{comment}{                                                       !! possible forcing fields. Unused fields}}
\DoxyCodeLine{135 \textcolor{comment}{                                                       !! have NULL ptrs.}}
\DoxyCodeLine{136   \textcolor{keywordtype}{type}(time\_type),               \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{  !< Time of the fluxes.}}
\DoxyCodeLine{137 \textcolor{keywordtype}{  real},                          \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{   !< The amount of time over which}}
\DoxyCodeLine{138 \textcolor{comment}{                                                       !! the fluxes apply [s]}}
\DoxyCodeLine{139   \textcolor{keywordtype}{type}(ocean\_grid\_type),         \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{140   \textcolor{keywordtype}{type}(dumbbell\_surface\_forcing\_CS),  \textcolor{keywordtype}{pointer}  :: CS\textcolor{comment}{   !< A control structure returned by a previous}}
\DoxyCodeLine{141 \textcolor{comment}{                                                       !! call to dumbbell\_surface\_forcing\_init}}
\DoxyCodeLine{142   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{143   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{144   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed}
\DoxyCodeLine{145   \textcolor{keywordtype}{integer} :: idays, isecs}
\DoxyCodeLine{146 \textcolor{keywordtype}{  real} :: deg\_rad, rdays}
\DoxyCodeLine{147 }
\DoxyCodeLine{148 }
\DoxyCodeLine{149   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{150   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{151 }
\DoxyCodeLine{152   deg\_rad = atan(1.0)*4.0/180.}
\DoxyCodeLine{153 }
\DoxyCodeLine{154   \textcolor{keyword}{call }get\_time(day,isecs,idays)}
\DoxyCodeLine{155   rdays = real(idays) + real(isecs)/8.64e4}
\DoxyCodeLine{156   \textcolor{comment}{! This could be:  rdays = time\_type\_to\_real(day)/8.64e4}}
\DoxyCodeLine{157 }
\DoxyCodeLine{158   \textcolor{comment}{! Allocate and zero out the forcing arrays, as necessary.}}
\DoxyCodeLine{159   \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%p\_surf, isd, ied, jsd, jed)}
\DoxyCodeLine{160   \textcolor{keyword}{call }safe\_alloc\_ptr(fluxes\%p\_surf\_full, isd, ied, jsd, jed)}
\DoxyCodeLine{161 }
\DoxyCodeLine{162   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{163     fluxes\%p\_surf(i,j) = cs\%forcing\_mask(i,j)* cs\%slp\_amplitude * \&}
\DoxyCodeLine{164                          g\%mask2dT(i,j) * sin(deg\_rad*(rdays/cs\%slp\_period))}
\DoxyCodeLine{165     fluxes\%p\_surf\_full(i,j) = cs\%forcing\_mask(i,j) * cs\%slp\_amplitude * \&}
\DoxyCodeLine{166                          g\%mask2dT(i,j) * sin(deg\_rad*(rdays/cs\%slp\_period))}
\DoxyCodeLine{167 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{168 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedumbbell__surface__forcing_a555241e1be1a78c0f9016012b5cfbbf7}\label{namespacedumbbell__surface__forcing_a555241e1be1a78c0f9016012b5cfbbf7}} 
\index{dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}!dumbbell\_surface\_forcing\_init@{dumbbell\_surface\_forcing\_init}}
\index{dumbbell\_surface\_forcing\_init@{dumbbell\_surface\_forcing\_init}!dumbbell\_surface\_forcing@{dumbbell\_surface\_forcing}}
\doxysubsubsection{\texorpdfstring{dumbbell\_surface\_forcing\_init()}{dumbbell\_surface\_forcing\_init()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+surface\+\_\+forcing\+::dumbbell\+\_\+surface\+\_\+forcing\+\_\+init (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag,  }\item[{type(\mbox{\hyperlink{structdumbbell__surface__forcing_1_1dumbbell__surface__forcing__cs}{dumbbell\+\_\+surface\+\_\+forcing\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Reads and sets up the forcing for the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em time} & The current model time. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure that is used to regulate diagnostic output. \\
\hline
 & {\em cs} & A pointer to the control structure for this module \\
\hline
\end{DoxyParams}


Definition at line 172 of file dumbbell\+\_\+surface\+\_\+forcing.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{173   \textcolor{keywordtype}{type}(time\_type),              \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{ !< The current model time.}}
\DoxyCodeLine{174   \textcolor{keywordtype}{type}(ocean\_grid\_type),        \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{175   \textcolor{keywordtype}{type}(unit\_scale\_type),        \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{176   \textcolor{keywordtype}{type}(param\_file\_type),        \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{177   \textcolor{keywordtype}{type}(diag\_ctrl),      \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< A structure that is used to}}
\DoxyCodeLine{178 \textcolor{comment}{                                                   !! regulate diagnostic output.}}
\DoxyCodeLine{179   \textcolor{keywordtype}{type}(dumbbell\_surface\_forcing\_CS), \&}
\DoxyCodeLine{180                                 \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{   !< A pointer to the control structure for this module}}
\DoxyCodeLine{181   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{182 \textcolor{keywordtype}{  real} :: S\_surf, S\_range}
\DoxyCodeLine{183 \textcolor{keywordtype}{  real} :: x, y}
\DoxyCodeLine{184   \textcolor{keywordtype}{integer} :: i, j}
\DoxyCodeLine{185   \textcolor{keywordtype}{logical} :: dbrotate    \textcolor{comment}{! If true, rotate the domain.}}
\DoxyCodeLine{186 \textcolor{preprocessor}{\#include "{}version\_variable.h"{}}}
\DoxyCodeLine{187 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}dumbbell\_surface\_forcing"{}} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{188 }
\DoxyCodeLine{189   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{190     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"{}dumbbell\_surface\_forcing\_init called with an associated "{}}// \&}
\DoxyCodeLine{191                              \textcolor{stringliteral}{"{}control structure."{}})}
\DoxyCodeLine{192     \textcolor{keywordflow}{return}}
\DoxyCodeLine{193 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{194   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{195   cs\%diag => diag}
\DoxyCodeLine{196 }
\DoxyCodeLine{197   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{198   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{"{}"{}})}
\DoxyCodeLine{199   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}ENABLE\_THERMODYNAMICS"{}}, cs\%use\_temperature, \&}
\DoxyCodeLine{200                  \textcolor{stringliteral}{"{}If true, Temperature and salinity are used as state variables."{}}, default=.true.)}
\DoxyCodeLine{201 }
\DoxyCodeLine{202   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}G\_EARTH"{}}, cs\%G\_Earth, \&}
\DoxyCodeLine{203                  \textcolor{stringliteral}{"{}The gravitational acceleration of the Earth."{}}, \&}
\DoxyCodeLine{204                  units=\textcolor{stringliteral}{"{}m s-\/2"{}}, default = 9.80, scale=us\%m\_to\_L**2*us\%Z\_to\_m*us\%T\_to\_s**2)}
\DoxyCodeLine{205   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}RHO\_0"{}}, cs\%Rho0, \&}
\DoxyCodeLine{206                  \textcolor{stringliteral}{"{}The mean ocean density used with BOUSSINESQ true to "{}}//\&}
\DoxyCodeLine{207                  \textcolor{stringliteral}{"{}calculate accelerations and the mass for conservation "{}}//\&}
\DoxyCodeLine{208                  \textcolor{stringliteral}{"{}properties, or with BOUSSINSEQ false to convert some "{}}//\&}
\DoxyCodeLine{209                  \textcolor{stringliteral}{"{}parameters from vertical units of m to kg m-\/2."{}}, \&}
\DoxyCodeLine{210                  units=\textcolor{stringliteral}{"{}kg m-\/3"{}}, default=1035.0, scale=us\%kg\_m3\_to\_R)}
\DoxyCodeLine{211   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DUMBBELL\_SLP\_AMP"{}}, cs\%slp\_amplitude, \&}
\DoxyCodeLine{212                  \textcolor{stringliteral}{"{}Amplitude of SLP forcing in reservoirs."{}}, \&}
\DoxyCodeLine{213                  units=\textcolor{stringliteral}{"{}Pa"{}}, default = 10000.0, scale=us\%kg\_m3\_to\_R*us\%m\_s\_to\_L\_T**2)}
\DoxyCodeLine{214   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DUMBBELL\_SLP\_PERIOD"{}}, cs\%slp\_period, \&}
\DoxyCodeLine{215                  \textcolor{stringliteral}{"{}Periodicity of SLP forcing in reservoirs."{}}, \&}
\DoxyCodeLine{216                  units=\textcolor{stringliteral}{"{}days"{}}, default = 1.0)}
\DoxyCodeLine{217   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}DUMBBELL\_ROTATION"{}}, dbrotate, \&}
\DoxyCodeLine{218                 \textcolor{stringliteral}{'Logical for rotation of dumbbell domain.'},\&}
\DoxyCodeLine{219                  units=\textcolor{stringliteral}{'nondim'}, default=.false., do\_not\_log=.true.)}
\DoxyCodeLine{220   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"{}INITIAL\_SSS"{}}, s\_surf, \&}
\DoxyCodeLine{221                  \textcolor{stringliteral}{"{}Initial surface salinity"{}}, units=\textcolor{stringliteral}{"{}1e-\/3"{}}, default=34.0, do\_not\_log=.true.)}
\DoxyCodeLine{222   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"{}INITIAL\_S\_RANGE"{}}, s\_range, \&}
\DoxyCodeLine{223                  \textcolor{stringliteral}{"{}Initial salinity range (bottom -\/ surface)"{}}, units=\textcolor{stringliteral}{"{}1e-\/3"{}}, \&}
\DoxyCodeLine{224                  default=2., do\_not\_log=.true.)}
\DoxyCodeLine{225 }
\DoxyCodeLine{226   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}RESTOREBUOY"{}}, cs\%restorebuoy, \&}
\DoxyCodeLine{227                  \textcolor{stringliteral}{"{}If true, the buoyancy fluxes drive the model back "{}}//\&}
\DoxyCodeLine{228                  \textcolor{stringliteral}{"{}toward some specified surface state with a rate "{}}//\&}
\DoxyCodeLine{229                  \textcolor{stringliteral}{"{}given by FLUXCONST."{}}, default= .false.)}
\DoxyCodeLine{230   \textcolor{keywordflow}{if} (cs\%restorebuoy) \textcolor{keywordflow}{then}}
\DoxyCodeLine{231     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}FLUXCONST"{}}, cs\%Flux\_const, \&}
\DoxyCodeLine{232                  \textcolor{stringliteral}{"{}The constant that relates the restoring surface fluxes to the relative "{}}//\&}
\DoxyCodeLine{233                  \textcolor{stringliteral}{"{}surface anomalies (akin to a piston velocity).  Note the non-\/MKS units."{}}, \&}
\DoxyCodeLine{234                  default=0.0, units=\textcolor{stringliteral}{"{}m day-\/1"{}}, scale=us\%m\_to\_Z*us\%T\_to\_s)}
\DoxyCodeLine{235     \textcolor{comment}{! Convert CS\%Flux\_const from m day-\/1 to m s-\/1.}}
\DoxyCodeLine{236     cs\%Flux\_const = cs\%Flux\_const / 86400.0}
\DoxyCodeLine{237 }
\DoxyCodeLine{238 }
\DoxyCodeLine{239     \textcolor{keyword}{allocate}(cs\%forcing\_mask(g\%isd:g\%ied, g\%jsd:g\%jed)); cs\%forcing\_mask(:,:)=0.0}
\DoxyCodeLine{240     \textcolor{keyword}{allocate}(cs\%S\_restore(g\%isd:g\%ied, g\%jsd:g\%jed))}
\DoxyCodeLine{241 }
\DoxyCodeLine{242     \textcolor{keywordflow}{do} j=g\%jsc,g\%jec}
\DoxyCodeLine{243       \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{244         \textcolor{comment}{! Compute normalized zonal coordinates (x,y=0 at center of domain)}}
\DoxyCodeLine{245 \textcolor{comment}{!       x = ( G\%geoLonT(i,j) -\/ G\%west\_lon ) / G\%len\_lon -\/ 0.5}}
\DoxyCodeLine{246 \textcolor{comment}{!       y = ( G\%geoLatT(i,j) -\/ G\%south\_lat ) / G\%len\_lat -\/ 0.5}}
\DoxyCodeLine{247         \textcolor{keywordflow}{if} (dbrotate) \textcolor{keywordflow}{then}}
\DoxyCodeLine{248           \textcolor{comment}{! This is really y in the rotated case}}
\DoxyCodeLine{249           x = ( g\%geoLatT(i,j) -\/ g\%south\_lat ) / g\%len\_lat -\/ 0.5}
\DoxyCodeLine{250         \textcolor{keywordflow}{else}}
\DoxyCodeLine{251           x = ( g\%geoLonT(i,j) -\/ g\%west\_lon ) / g\%len\_lon -\/ 0.5}
\DoxyCodeLine{252 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{253         cs\%forcing\_mask(i,j)=0}
\DoxyCodeLine{254         cs\%S\_restore(i,j) = s\_surf}
\DoxyCodeLine{255         \textcolor{keywordflow}{if} ((x>0.25)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{256           cs\%forcing\_mask(i,j) = 1}
\DoxyCodeLine{257           cs\%S\_restore(i,j) = s\_surf + s\_range}
\DoxyCodeLine{258         \textcolor{keywordflow}{elseif} ((x<-\/0.25)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{259           cs\%forcing\_mask(i,j) = 1}
\DoxyCodeLine{260           cs\%S\_restore(i,j) = s\_surf -\/ s\_range}
\DoxyCodeLine{261 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{262 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{263 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{264 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{265 }

\end{DoxyCode}
