\hypertarget{namespacescm__cvmix__tests}{}\section{scm\+\_\+cvmix\+\_\+tests Module Reference}
\label{namespacescm__cvmix__tests}\index{scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}}


\subsection{Detailed Description}
Initial conditions and forcing for the single column model (S\+CM) C\+V\+Mix test set. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}
\begin{DoxyCompactList}\small\item\em Container for surface forcing parameters. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \hyperlink{namespacescm__cvmix__tests_ab4cadfaab1d9da76d9777d190040c93f}{scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init} (T, S, h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initializes temperature and salinity for the S\+CM C\+V\+Mix test example. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacescm__cvmix__tests_a28ab898c50fc4e959d40a62c08d81693}{scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init} (Time, G, param\+\_\+file, CS)
\begin{DoxyCompactList}\small\item\em Initializes surface forcing for the C\+V\+Mix test case suite. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacescm__cvmix__tests_aac23f24159bc5eb342bcfe1643e516fd}{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing} (sfc\+\_\+state, forces, day, G, US, CS)
\item 
subroutine, public \hyperlink{namespacescm__cvmix__tests_ad04f730fa495a891148e3c6d01f4c680}{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing} (sfc\+\_\+state, fluxes, day, G, US, CS)
\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacescm__cvmix__tests_ae2f4e4f6283825ec24dd56858a6d58d9}\label{namespacescm__cvmix__tests_ae2f4e4f6283825ec24dd56858a6d58d9}} 
character(len=40) \hyperlink{namespacescm__cvmix__tests_ae2f4e4f6283825ec24dd56858a6d58d9}{mdl} = \char`\"{}S\+C\+M\+\_\+\+C\+V\+Mix\+\_\+tests\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacescm__cvmix__tests_ad04f730fa495a891148e3c6d01f4c680}\label{namespacescm__cvmix__tests_ad04f730fa495a891148e3c6d01f4c680}} 
\index{scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}!scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing@{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing}}
\index{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing@{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing}!scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}}
\subsubsection{\texorpdfstring{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing()}{scm\_cvmix\_tests\_buoyancy\_forcing()}}
{\footnotesize\ttfamily subroutine, public scm\+\_\+cvmix\+\_\+tests\+::scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(surface), intent(in)}]{sfc\+\_\+state,  }\item[{type(forcing), intent(inout)}]{fluxes,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em sfc\+\_\+state} & Surface state structure\\
\hline
\mbox{\tt in,out}  & {\em fluxes} & Surface fluxes structure\\
\hline
\mbox{\tt in}  & {\em day} & Current model time\\
\hline
\mbox{\tt in,out}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & Container for S\+CM parameters \\
\hline
\end{DoxyParams}


Definition at line 237 of file S\+C\+M\+\_\+\+C\+V\+Mix\+\_\+tests.\+F90.


\begin{DoxyCode}
237   \textcolor{keywordtype}{type}(surface),            \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{  !< Surface state structure}
238   \textcolor{keywordtype}{type}(forcing),            \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< Surface fluxes structure}
239   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Current model time}
240   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(inout)} :: g\textcolor{comment}{      !< Grid structure}
241   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
242   \textcolor{keywordtype}{type}(scm\_cvmix\_tests\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{     !< Container for SCM parameters}
243 
244   \textcolor{comment}{! Local variables}
245   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isq, ieq, jsq, jeq
246   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, isdb, iedb, jsdb, jedb
247   \textcolor{keywordtype}{real} :: pi
248 
249   pi = 4.0*atan(1.0)
250 
251   \textcolor{comment}{! Bounds for loops and memory allocation}
252   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
253   isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
254   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
255   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
256 
257   \textcolor{keywordflow}{if} (cs%UseHeatFlux) \textcolor{keywordflow}{then}
258     \textcolor{comment}{! Note CVMix test inputs give Heat flux in [m K/s]}
259     \textcolor{comment}{! therefore must convert to W/m2 by multiplying}
260     \textcolor{comment}{! by Rho0*Cp}
261     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie
262       fluxes%sens(i,j) = cs%surf\_HF * cs%Rho0 * fluxes%C\_p
263 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
264 \textcolor{keywordflow}{  endif}
265 
266   \textcolor{keywordflow}{if} (cs%UseEvaporation) \textcolor{keywordflow}{then}
267     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie
268     \textcolor{comment}{! Note CVMix test inputs give evaporation in [m s-1]}
269     \textcolor{comment}{! This therefore must be converted to mass flux in [R Z T-1 ~> kg m-2 s-1]}
270     \textcolor{comment}{! by multiplying by density and some unit conversion factors.}
271       fluxes%evap(i,j) = cs%surf\_evap * cs%Rho0
272 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
273 \textcolor{keywordflow}{  endif}
274 
275   \textcolor{keywordflow}{if} (cs%UseDiurnalSW) \textcolor{keywordflow}{then}
276     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie
277     \textcolor{comment}{! Note CVMix test inputs give max sw rad in [m degC/s]}
278     \textcolor{comment}{! therefore must convert to W/m2 by multiplying by Rho0*Cp}
279     \textcolor{comment}{! Note diurnal cycle peaks at Noon.}
280       fluxes%sw(i,j) = cs%Max\_sw *  max(0.0, cos(2*pi*(time\_type\_to\_real(day)/86400.0 - 0.5))) * cs%RHO0 * 
      fluxes%C\_p
281 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
282 \textcolor{keywordflow}{  endif}
283 
\end{DoxyCode}
\mbox{\Hypertarget{namespacescm__cvmix__tests_a28ab898c50fc4e959d40a62c08d81693}\label{namespacescm__cvmix__tests_a28ab898c50fc4e959d40a62c08d81693}} 
\index{scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}!scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init@{scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init}}
\index{scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init@{scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init}!scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}}
\subsubsection{\texorpdfstring{scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init()}{scm\_cvmix\_tests\_surface\_forcing\_init()}}
{\footnotesize\ttfamily subroutine, public scm\+\_\+cvmix\+\_\+tests\+::scm\+\_\+cvmix\+\_\+tests\+\_\+surface\+\_\+forcing\+\_\+init (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Initializes surface forcing for the C\+V\+Mix test case suite. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & Model time\\
\hline
\mbox{\tt in}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Input parameter structure\\
\hline
 & {\em cs} & Parameter container \\
\hline
\end{DoxyParams}


Definition at line 129 of file S\+C\+M\+\_\+\+C\+V\+Mix\+\_\+tests.\+F90.


\begin{DoxyCode}
129   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{intent(in)} :: time\textcolor{comment}{       !< Model time}
130   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{          !< Grid structure}
131   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Input parameter structure}
132   \textcolor{keywordtype}{type}(scm\_cvmix\_tests\_cs), \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{         !< Parameter container}
133 
134 
135   \textcolor{comment}{! This include declares and sets the variable "version".}
136 \textcolor{preprocessor}{# include "version\_variable.h"}
137 \textcolor{preprocessor}{}  \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{pointer} :: us => null() \textcolor{comment}{!< A dimensional unit scaling type}
138 
139   us => g%US
140 
141   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
142     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"SCM\_CVMix\_tests\_surface\_forcing\_init called with an associated "}// &
143                           \textcolor{stringliteral}{"control structure."})
144     \textcolor{keywordflow}{return}
145 \textcolor{keywordflow}{  endif}
146   \textcolor{keyword}{allocate}(cs)
147 
148   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
149   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
150   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_WIND\_STRESS"},              &
151                  cs%UseWindStress, \textcolor{stringliteral}{"Wind Stress switch "}//            &
152                  \textcolor{stringliteral}{"used in the SCM CVMix surface forcing."},            &
153                  units=\textcolor{stringliteral}{''}, default=.false.)
154   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_HEAT\_FLUX"},                &
155                  cs%UseHeatFlux, \textcolor{stringliteral}{"Heat flux switch "}//                &
156                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
157                  units=\textcolor{stringliteral}{''}, default=.false.)
158   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_EVAPORATION"},              &
159                  cs%UseEvaporation, \textcolor{stringliteral}{"Evaporation switch "}//           &
160                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
161                  units=\textcolor{stringliteral}{''}, default=.false.)
162   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_DIURNAL\_SW"},               &
163                  cs%UseDiurnalSW, \textcolor{stringliteral}{"Diurnal sw radation switch "}//     &
164                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
165                  units=\textcolor{stringliteral}{''}, default=.false.)
166   \textcolor{keywordflow}{if} (cs%UseWindStress) \textcolor{keywordflow}{then}
167     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TAU\_X"},                      &
168                  cs%tau\_x, \textcolor{stringliteral}{"Constant X-dir wind stress "}//            &
169                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
170                  units=\textcolor{stringliteral}{'N/m2'}, scale=us%kg\_m2s\_to\_RZ\_T*us%m\_s\_to\_L\_T, fail\_if\_missing=.true.)
171     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TAU\_Y"},                      &
172                  cs%tau\_y, \textcolor{stringliteral}{"Constant y-dir wind stress "}//            &
173                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
174                  units=\textcolor{stringliteral}{'N/m2'}, scale=us%kg\_m2s\_to\_RZ\_T*us%m\_s\_to\_L\_T, fail\_if\_missing=.true.)
175 \textcolor{keywordflow}{  endif}
176   \textcolor{keywordflow}{if} (cs%UseHeatFlux) \textcolor{keywordflow}{then}
177     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_HEAT\_FLUX"},                  &
178                  cs%surf\_HF, \textcolor{stringliteral}{"Constant surface heat flux "}//          &
179                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
180                  units=\textcolor{stringliteral}{'m K/s'}, scale=us%m\_to\_Z*us%T\_to\_s, fail\_if\_missing=.true.)
181 \textcolor{keywordflow}{  endif}
182   \textcolor{keywordflow}{if} (cs%UseEvaporation) \textcolor{keywordflow}{then}
183     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_EVAPORATION"},                &
184                  cs%surf\_evap, \textcolor{stringliteral}{"Constant surface evaporation "}//      &
185                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
186                  units=\textcolor{stringliteral}{'m/s'}, scale=us%m\_to\_Z*us%T\_to\_s, fail\_if\_missing=.true.)
187 \textcolor{keywordflow}{  endif}
188   \textcolor{keywordflow}{if} (cs%UseDiurnalSW) \textcolor{keywordflow}{then}
189     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_DIURNAL\_SW\_MAX"},             &
190                  cs%Max\_sw, \textcolor{stringliteral}{"Maximum diurnal sw radiation "}//         &
191                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       &
192                  units=\textcolor{stringliteral}{'m K/s'}, scale=us%m\_to\_Z*us%T\_to\_s, fail\_if\_missing=.true.)
193 \textcolor{keywordflow}{  endif}
194   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, cs%Rho0, &
195                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//&
196                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//&
197                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//&
198                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-2."}, &
199                  units=\textcolor{stringliteral}{"kg m-3"}, default=1035.0, scale=us%kg\_m3\_to\_R)
200 
\end{DoxyCode}
\mbox{\Hypertarget{namespacescm__cvmix__tests_ab4cadfaab1d9da76d9777d190040c93f}\label{namespacescm__cvmix__tests_ab4cadfaab1d9da76d9777d190040c93f}} 
\index{scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}!scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init@{scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init}}
\index{scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init@{scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init}!scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}}
\subsubsection{\texorpdfstring{scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init()}{scm\_cvmix\_tests\_ts\_init()}}
{\footnotesize\ttfamily subroutine, public scm\+\_\+cvmix\+\_\+tests\+::scm\+\_\+cvmix\+\_\+tests\+\_\+ts\+\_\+init (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(out)}]{T,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(out)}]{S,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(in)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



Initializes temperature and salinity for the S\+CM C\+V\+Mix test example. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid structure\\
\hline
\mbox{\tt out}  & {\em t} & Potential temperature \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt out}  & {\em s} & Salinity \mbox{[}psu\mbox{]}\\
\hline
\mbox{\tt in}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Input parameter structure\\
\hline
\mbox{\tt in}  & {\em just\+\_\+read\+\_\+params} & If present and true, this call will only read parameters without changing h. \\
\hline
\end{DoxyParams}


Definition at line 56 of file S\+C\+M\+\_\+\+C\+V\+Mix\+\_\+tests.\+F90.


\begin{DoxyCode}
56   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{  !< Grid structure}
57   \textcolor{keywordtype}{type}(verticalgrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: gv\textcolor{comment}{ !< Vertical grid structure}
58   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(out)} :: t\textcolor{comment}{  !< Potential temperature [degC]}
59   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(out)} :: s\textcolor{comment}{  !< Salinity [psu]}
60   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{  !< Layer thickness [H ~> m or kg m-2]}
61   \textcolor{keywordtype}{type}(unit\_scale\_type),                     \textcolor{keywordtype}{intent(in)}  :: us\textcolor{comment}{ !< A dimensional unit scaling type}
62   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Input parameter structure}
63   \textcolor{keywordtype}{logical},                         \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this
       call}
64 \textcolor{comment}{                                                               !! will only read parameters without
       changing h.}
65   \textcolor{comment}{! Local variables}
66   \textcolor{keywordtype}{real} :: upperlayertempmld\textcolor{comment}{ !< Upper layer Temp MLD thickness [Z ~> m].}
67   \textcolor{keywordtype}{real} :: upperlayersaltmld\textcolor{comment}{ !< Upper layer Salt MLD thickness [Z ~> m].}
68   \textcolor{keywordtype}{real} :: upperlayertemp\textcolor{comment}{ !< Upper layer temperature (SST if thickness 0) [degC]}
69   \textcolor{keywordtype}{real} :: upperlayersalt\textcolor{comment}{ !< Upper layer salinity (SSS if thickness 0) [ppt]}
70   \textcolor{keywordtype}{real} :: lowerlayertemp\textcolor{comment}{ !< Temp at top of lower layer [degC]}
71   \textcolor{keywordtype}{real} :: lowerlayersalt\textcolor{comment}{ !< Salt at top of lower layer [ppt]}
72   \textcolor{keywordtype}{real} :: lowerlayerdtdz\textcolor{comment}{ !< Temp gradient in lower layer [degC / Z ~> degC m-1].}
73   \textcolor{keywordtype}{real} :: lowerlayerdsdz\textcolor{comment}{ !< Salt gradient in lower layer [ppt / Z ~> ppt m-1].}
74   \textcolor{keywordtype}{real} :: lowerlayermintemp\textcolor{comment}{ !< Minimum temperature in lower layer [degC]}
75   \textcolor{keywordtype}{real} :: zc, dz, top, bottom \textcolor{comment}{! Depths and thicknesses [Z ~> m].}
76   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
77   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
78 
79   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
80   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
81 
82 
83   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
84 
85   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version)
86   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TEMP\_MLD"}, upperlayertempmld, &
87                  \textcolor{stringliteral}{'Initial temp mixed layer depth'}, &
88                  units=\textcolor{stringliteral}{'m'}, default=0.0, scale=us%m\_to\_Z, do\_not\_log=just\_read)
89   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_SALT\_MLD"}, upperlayersaltmld, &
90                  \textcolor{stringliteral}{'Initial salt mixed layer depth'}, &
91                  units=\textcolor{stringliteral}{'m'}, default=0.0, scale=us%m\_to\_Z, do\_not\_log=just\_read)
92   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L1\_SALT"}, upperlayersalt, &
93                  \textcolor{stringliteral}{'Layer 2 surface salinity'}, units=\textcolor{stringliteral}{'1e-3'}, default=35.0, do\_not\_log=just\_read)
94   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L1\_TEMP"}, upperlayertemp, &
95                  \textcolor{stringliteral}{'Layer 1 surface temperature'}, units=\textcolor{stringliteral}{'C'}, default=20.0, do\_not\_log=just\_read)
96   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_SALT"}, lowerlayersalt, &
97                  \textcolor{stringliteral}{'Layer 2 surface salinity'}, units=\textcolor{stringliteral}{'1e-3'}, default=35.0, do\_not\_log=just\_read)
98   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_TEMP"}, lowerlayertemp, &
99                  \textcolor{stringliteral}{'Layer 2 surface temperature'}, units=\textcolor{stringliteral}{'C'}, default=20.0, do\_not\_log=just\_read)
100   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_DTDZ"}, lowerlayerdtdz,     &
101                  \textcolor{stringliteral}{'Initial temperature stratification in layer 2'}, &
102                  units=\textcolor{stringliteral}{'C/m'}, default=0.0, scale=us%Z\_to\_m, do\_not\_log=just\_read)
103   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_DSDZ"}, lowerlayerdsdz,  &
104                  \textcolor{stringliteral}{'Initial salinity stratification in layer 2'}, &
105                  units=\textcolor{stringliteral}{'PPT/m'}, default=0.0, scale=us%Z\_to\_m, do\_not\_log=just\_read)
106   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_MINTEMP"},lowerlayermintemp, &
107                  \textcolor{stringliteral}{'Layer 2 minimum temperature'}, units=\textcolor{stringliteral}{'C'}, default=4.0, do\_not\_log=just\_read)
108 
109   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
110 
111   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
112     top = 0. \textcolor{comment}{! Reference to surface}
113     bottom = 0.
114     \textcolor{keywordflow}{do} k=1,nz
115       bottom = bottom - h(i,j,k)*gv%H\_to\_Z \textcolor{comment}{! Interface below layer [Z ~> m]}
116       zc = 0.5*( top + bottom )        \textcolor{comment}{! Z of middle of layer [Z ~> m]}
117       dz = min(0., zc + upperlayertempmld)
118       t(i,j,k) = max(lowerlayermintemp,lowerlayertemp + lowerlayerdtdz * dz)
119       dz = min(0., zc + upperlayersaltmld)
120       s(i,j,k) = lowerlayersalt + lowerlayerdsdz * dz
121       top = bottom
122 \textcolor{keywordflow}{    enddo} \textcolor{comment}{! k}
123 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
124 
\end{DoxyCode}
\mbox{\Hypertarget{namespacescm__cvmix__tests_aac23f24159bc5eb342bcfe1643e516fd}\label{namespacescm__cvmix__tests_aac23f24159bc5eb342bcfe1643e516fd}} 
\index{scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}!scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing@{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing}}
\index{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing@{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing}!scm\+\_\+cvmix\+\_\+tests@{scm\+\_\+cvmix\+\_\+tests}}
\subsubsection{\texorpdfstring{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing()}{scm\_cvmix\_tests\_wind\_forcing()}}
{\footnotesize\ttfamily subroutine, public scm\+\_\+cvmix\+\_\+tests\+::scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(surface), intent(in)}]{sfc\+\_\+state,  }\item[{type(mech\+\_\+forcing), intent(inout)}]{forces,  }\item[{type(time\+\_\+type), intent(in)}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em sfc\+\_\+state} & Surface state structure\\
\hline
\mbox{\tt in,out}  & {\em forces} & A structure with the driving mechanical forces\\
\hline
\mbox{\tt in}  & {\em day} & Time in days\\
\hline
\mbox{\tt in,out}  & {\em g} & Grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & Container for S\+CM parameters \\
\hline
\end{DoxyParams}


Definition at line 204 of file S\+C\+M\+\_\+\+C\+V\+Mix\+\_\+tests.\+F90.


\begin{DoxyCode}
204   \textcolor{keywordtype}{type}(surface),            \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{  !< Surface state structure}
205   \textcolor{keywordtype}{type}(mech\_forcing),       \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}
206   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Time in days}
207   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(inout)} :: g\textcolor{comment}{      !< Grid structure}
208   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{     !< A dimensional unit scaling type}
209   \textcolor{keywordtype}{type}(scm\_cvmix\_tests\_cs), \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{     !< Container for SCM parameters}
210   \textcolor{comment}{! Local variables}
211   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isq, ieq, jsq, jeq
212   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, isdb, iedb, jsdb, jedb
213   \textcolor{keywordtype}{real}    :: mag\_tau
214   \textcolor{comment}{! Bounds for loops and memory allocation}
215   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
216   isq = g%IscB ; ieq = g%IecB ; jsq = g%JscB ; jeq = g%JecB
217   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
218   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
219 
220   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq
221     forces%taux(i,j) = cs%tau\_x
222 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
223   \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie
224     forces%tauy(i,j) = cs%tau\_y
225 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
226   \textcolor{keyword}{call }pass\_vector(forces%taux, forces%tauy, g%Domain, to\_all)
227 
228   mag\_tau = sqrt(cs%tau\_x*cs%tau\_x + cs%tau\_y*cs%tau\_y)
229   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces%ustar)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
230     forces%ustar(i,j) = sqrt( us%L\_to\_Z * mag\_tau / (cs%Rho0) )
231 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
232 
\end{DoxyCode}
