\hypertarget{namespacescm__cvmix__tests}{}\doxysection{scm\+\_\+cvmix\+\_\+tests Module Reference}
\label{namespacescm__cvmix__tests}\index{scm\_cvmix\_tests@{scm\_cvmix\_tests}}


\doxysubsection{Detailed Description}
Initial conditions and forcing for the single column model (S\+CM) C\+V\+Mix test set. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\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}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\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 \mbox{\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 \mbox{\hyperlink{namespacescm__cvmix__tests_aac23f24159bc5eb342bcfe1643e516fd}{scm\+\_\+cvmix\+\_\+tests\+\_\+wind\+\_\+forcing}} (sfc\+\_\+state, forces, day, G, US, CS)
\item 
subroutine, public \mbox{\hyperlink{namespacescm__cvmix__tests_ad04f730fa495a891148e3c6d01f4c680}{scm\+\_\+cvmix\+\_\+tests\+\_\+buoyancy\+\_\+forcing}} (sfc\+\_\+state, fluxes, day, G, US, CS)
\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacescm__cvmix__tests_ae2f4e4f6283825ec24dd56858a6d58d9}\label{namespacescm__cvmix__tests_ae2f4e4f6283825ec24dd56858a6d58d9}} 
character(len=40) \mbox{\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}


\doxysubsection{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}}
\doxysubsubsection{\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(\mbox{\hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em sfc\+\_\+state} & Surface state structure\\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & Surface fluxes structure\\
\hline
\mbox{\texttt{ in}}  & {\em day} & Current model time\\
\hline
\mbox{\texttt{ in,out}}  & {\em g} & Grid structure\\
\hline
\mbox{\texttt{ 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}{0}
\DoxyCodeLine{237   \textcolor{keywordtype}{type}(surface),            \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{  !< Surface state structure}}
\DoxyCodeLine{238   \textcolor{keywordtype}{type}(forcing),            \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< Surface fluxes structure}}
\DoxyCodeLine{239   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{intent(in)}    :: day\textcolor{comment}{    !< Current model time}}
\DoxyCodeLine{240   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{      !< Grid structure}}
\DoxyCodeLine{241   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{     !< A dimensional unit scaling type}}
\DoxyCodeLine{242   \textcolor{keywordtype}{type}(SCM\_CVMix\_tests\_CS), \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{     !< Container for SCM parameters}}
\DoxyCodeLine{243 }
\DoxyCodeLine{244   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{245   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq}
\DoxyCodeLine{246   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{247 \textcolor{keywordtype}{  real} :: PI}
\DoxyCodeLine{248 }
\DoxyCodeLine{249   pi = 4.0*atan(1.0)}
\DoxyCodeLine{250 }
\DoxyCodeLine{251   \textcolor{comment}{! Bounds for loops and memory allocation}}
\DoxyCodeLine{252   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{253   isq = g\%IscB ; ieq = g\%IecB ; jsq = g\%JscB ; jeq = g\%JecB}
\DoxyCodeLine{254   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{255   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{256 }
\DoxyCodeLine{257   \textcolor{keywordflow}{if} (cs\%UseHeatFlux) \textcolor{keywordflow}{then}}
\DoxyCodeLine{258     \textcolor{comment}{! Note CVMix test inputs give Heat flux in [m K/s]}}
\DoxyCodeLine{259     \textcolor{comment}{! therefore must convert to W/m2 by multiplying}}
\DoxyCodeLine{260     \textcolor{comment}{! by Rho0*Cp}}
\DoxyCodeLine{261     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{262       fluxes\%sens(i,j) = cs\%surf\_HF * cs\%Rho0 * fluxes\%C\_p}
\DoxyCodeLine{263 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{264 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{265 }
\DoxyCodeLine{266   \textcolor{keywordflow}{if} (cs\%UseEvaporation) \textcolor{keywordflow}{then}}
\DoxyCodeLine{267     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{268     \textcolor{comment}{! Note CVMix test inputs give evaporation in [m s-\/1]}}
\DoxyCodeLine{269     \textcolor{comment}{! This therefore must be converted to mass flux in [R Z T-\/1 \string~> kg m-\/2 s-\/1]}}
\DoxyCodeLine{270     \textcolor{comment}{! by multiplying by density and some unit conversion factors.}}
\DoxyCodeLine{271       fluxes\%evap(i,j) = cs\%surf\_evap * cs\%Rho0}
\DoxyCodeLine{272 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{273 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{274 }
\DoxyCodeLine{275   \textcolor{keywordflow}{if} (cs\%UseDiurnalSW) \textcolor{keywordflow}{then}}
\DoxyCodeLine{276     \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{277     \textcolor{comment}{! Note CVMix test inputs give max sw rad in [m degC/s]}}
\DoxyCodeLine{278     \textcolor{comment}{! therefore must convert to W/m2 by multiplying by Rho0*Cp}}
\DoxyCodeLine{279     \textcolor{comment}{! Note diurnal cycle peaks at Noon.}}
\DoxyCodeLine{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}
\DoxyCodeLine{281 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{282 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\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{\texttt{ in}}  & {\em time} & Model time \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid structure \\
\hline
\mbox{\texttt{ 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}{0}
\DoxyCodeLine{129   \textcolor{keywordtype}{type}(time\_type),          \textcolor{keywordtype}{intent(in)} :: Time\textcolor{comment}{       !< Model time}}
\DoxyCodeLine{130   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{          !< Grid structure}}
\DoxyCodeLine{131   \textcolor{keywordtype}{type}(param\_file\_type),    \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Input parameter structure}}
\DoxyCodeLine{132   \textcolor{keywordtype}{type}(SCM\_CVMix\_tests\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{         !< Parameter container}}
\DoxyCodeLine{133 }
\DoxyCodeLine{134 }
\DoxyCodeLine{135   \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{136 \textcolor{preprocessor}{\# include "version\_variable.h"}}
\DoxyCodeLine{137 \textcolor{preprocessor}{}  \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{pointer} :: US => null() \textcolor{comment}{!< A dimensional unit scaling type}}
\DoxyCodeLine{138 }
\DoxyCodeLine{139   us => g\%US}
\DoxyCodeLine{140 }
\DoxyCodeLine{141   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{142     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"SCM\_CVMix\_tests\_surface\_forcing\_init called with an associated "}// \&}
\DoxyCodeLine{143                           \textcolor{stringliteral}{"control structure."})}
\DoxyCodeLine{144     \textcolor{keywordflow}{return}}
\DoxyCodeLine{145 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{146   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{147 }
\DoxyCodeLine{148   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{149   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{150   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_WIND\_STRESS"},              \&}
\DoxyCodeLine{151                  cs\%UseWindStress, \textcolor{stringliteral}{"Wind Stress switch "}//            \&}
\DoxyCodeLine{152                  \textcolor{stringliteral}{"used in the SCM CVMix surface forcing."},            \&}
\DoxyCodeLine{153                  units=\textcolor{stringliteral}{''}, default=.false.)}
\DoxyCodeLine{154   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_HEAT\_FLUX"},                \&}
\DoxyCodeLine{155                  cs\%UseHeatFlux, \textcolor{stringliteral}{"Heat flux switch "}//                \&}
\DoxyCodeLine{156                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{157                  units=\textcolor{stringliteral}{''}, default=.false.)}
\DoxyCodeLine{158   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_EVAPORATION"},              \&}
\DoxyCodeLine{159                  cs\%UseEvaporation, \textcolor{stringliteral}{"Evaporation switch "}//           \&}
\DoxyCodeLine{160                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{161                  units=\textcolor{stringliteral}{''}, default=.false.)}
\DoxyCodeLine{162   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_USE\_DIURNAL\_SW"},               \&}
\DoxyCodeLine{163                  cs\%UseDiurnalSW, \textcolor{stringliteral}{"Diurnal sw radation switch "}//     \&}
\DoxyCodeLine{164                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{165                  units=\textcolor{stringliteral}{''}, default=.false.)}
\DoxyCodeLine{166   \textcolor{keywordflow}{if} (cs\%UseWindStress) \textcolor{keywordflow}{then}}
\DoxyCodeLine{167     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TAU\_X"},                      \&}
\DoxyCodeLine{168                  cs\%tau\_x, \textcolor{stringliteral}{"Constant X-\/dir wind stress "}//            \&}
\DoxyCodeLine{169                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{170                  units=\textcolor{stringliteral}{'N/m2'}, scale=us\%kg\_m2s\_to\_RZ\_T*us\%m\_s\_to\_L\_T, fail\_if\_missing=.true.)}
\DoxyCodeLine{171     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TAU\_Y"},                      \&}
\DoxyCodeLine{172                  cs\%tau\_y, \textcolor{stringliteral}{"Constant y-\/dir wind stress "}//            \&}
\DoxyCodeLine{173                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{174                  units=\textcolor{stringliteral}{'N/m2'}, scale=us\%kg\_m2s\_to\_RZ\_T*us\%m\_s\_to\_L\_T, fail\_if\_missing=.true.)}
\DoxyCodeLine{175 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{176   \textcolor{keywordflow}{if} (cs\%UseHeatFlux) \textcolor{keywordflow}{then}}
\DoxyCodeLine{177     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_HEAT\_FLUX"},                  \&}
\DoxyCodeLine{178                  cs\%surf\_HF, \textcolor{stringliteral}{"Constant surface heat flux "}//          \&}
\DoxyCodeLine{179                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{180                  units=\textcolor{stringliteral}{'m K/s'}, scale=us\%m\_to\_Z*us\%T\_to\_s, fail\_if\_missing=.true.)}
\DoxyCodeLine{181 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{182   \textcolor{keywordflow}{if} (cs\%UseEvaporation) \textcolor{keywordflow}{then}}
\DoxyCodeLine{183     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_EVAPORATION"},                \&}
\DoxyCodeLine{184                  cs\%surf\_evap, \textcolor{stringliteral}{"Constant surface evaporation "}//      \&}
\DoxyCodeLine{185                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{186                  units=\textcolor{stringliteral}{'m/s'}, scale=us\%m\_to\_Z*us\%T\_to\_s, fail\_if\_missing=.true.)}
\DoxyCodeLine{187 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{188   \textcolor{keywordflow}{if} (cs\%UseDiurnalSW) \textcolor{keywordflow}{then}}
\DoxyCodeLine{189     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_DIURNAL\_SW\_MAX"},             \&}
\DoxyCodeLine{190                  cs\%Max\_sw, \textcolor{stringliteral}{"Maximum diurnal sw radiation "}//         \&}
\DoxyCodeLine{191                  \textcolor{stringliteral}{"used in the SCM CVMix test surface forcing."},       \&}
\DoxyCodeLine{192                  units=\textcolor{stringliteral}{'m K/s'}, scale=us\%m\_to\_Z*us\%T\_to\_s, fail\_if\_missing=.true.)}
\DoxyCodeLine{193 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{194   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_0"}, cs\%Rho0, \&}
\DoxyCodeLine{195                  \textcolor{stringliteral}{"The mean ocean density used with BOUSSINESQ true to "}//\&}
\DoxyCodeLine{196                  \textcolor{stringliteral}{"calculate accelerations and the mass for conservation "}//\&}
\DoxyCodeLine{197                  \textcolor{stringliteral}{"properties, or with BOUSSINSEQ false to convert some "}//\&}
\DoxyCodeLine{198                  \textcolor{stringliteral}{"parameters from vertical units of m to kg m-\/2."}, \&}
\DoxyCodeLine{199                  units=\textcolor{stringliteral}{"kg m-\/3"}, default=1035.0, scale=us\%kg\_m3\_to\_R)}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em g} & Grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em t} & Potential temperature \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em s} & Salinity \mbox{[}psu\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Input parameter structure \\
\hline
\mbox{\texttt{ 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}{0}
\DoxyCodeLine{56   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< Grid structure}}
\DoxyCodeLine{57   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< Vertical grid structure}}
\DoxyCodeLine{58 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(out)} :: T\textcolor{comment}{  !< Potential temperature [degC]}}
\DoxyCodeLine{59 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(out)} :: S\textcolor{comment}{  !< Salinity [psu]}}
\DoxyCodeLine{60 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{  !< Layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{61   \textcolor{keywordtype}{type}(unit\_scale\_type),                     \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{62   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Input parameter structure}}
\DoxyCodeLine{63   \textcolor{keywordtype}{logical},                         \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call}}
\DoxyCodeLine{64 \textcolor{comment}{                                                               !! will only read parameters without changing h.}}
\DoxyCodeLine{65   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{66 \textcolor{keywordtype}{  real} :: UpperLayerTempMLD\textcolor{comment}{ !< Upper layer Temp MLD thickness [Z \string~> m].}}
\DoxyCodeLine{67 \textcolor{keywordtype}{  real} :: UpperLayerSaltMLD\textcolor{comment}{ !< Upper layer Salt MLD thickness [Z \string~> m].}}
\DoxyCodeLine{68 \textcolor{keywordtype}{  real} :: UpperLayerTemp\textcolor{comment}{ !< Upper layer temperature (SST if thickness 0) [degC]}}
\DoxyCodeLine{69 \textcolor{keywordtype}{  real} :: UpperLayerSalt\textcolor{comment}{ !< Upper layer salinity (SSS if thickness 0) [ppt]}}
\DoxyCodeLine{70 \textcolor{keywordtype}{  real} :: LowerLayerTemp\textcolor{comment}{ !< Temp at top of lower layer [degC]}}
\DoxyCodeLine{71 \textcolor{keywordtype}{  real} :: LowerLayerSalt\textcolor{comment}{ !< Salt at top of lower layer [ppt]}}
\DoxyCodeLine{72 \textcolor{keywordtype}{  real} :: LowerLayerdTdz\textcolor{comment}{ !< Temp gradient in lower layer [degC / Z \string~> degC m-\/1].}}
\DoxyCodeLine{73 \textcolor{keywordtype}{  real} :: LowerLayerdSdz\textcolor{comment}{ !< Salt gradient in lower layer [ppt / Z \string~> ppt m-\/1].}}
\DoxyCodeLine{74 \textcolor{keywordtype}{  real} :: LowerLayerMinTemp\textcolor{comment}{ !< Minimum temperature in lower layer [degC]}}
\DoxyCodeLine{75 \textcolor{keywordtype}{  real} :: zC, DZ, top, bottom \textcolor{comment}{! Depths and thicknesses [Z \string~> m].}}
\DoxyCodeLine{76   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{77   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{78 }
\DoxyCodeLine{79   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{80   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{81 }
\DoxyCodeLine{82 }
\DoxyCodeLine{83   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{84 }
\DoxyCodeLine{85   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version)}
\DoxyCodeLine{86   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_TEMP\_MLD"}, upperlayertempmld, \&}
\DoxyCodeLine{87                  \textcolor{stringliteral}{'Initial temp mixed layer depth'}, \&}
\DoxyCodeLine{88                  units=\textcolor{stringliteral}{'m'}, default=0.0, scale=us\%m\_to\_Z, do\_not\_log=just\_read)}
\DoxyCodeLine{89   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_SALT\_MLD"}, upperlayersaltmld, \&}
\DoxyCodeLine{90                  \textcolor{stringliteral}{'Initial salt mixed layer depth'}, \&}
\DoxyCodeLine{91                  units=\textcolor{stringliteral}{'m'}, default=0.0, scale=us\%m\_to\_Z, do\_not\_log=just\_read)}
\DoxyCodeLine{92   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L1\_SALT"}, upperlayersalt, \&}
\DoxyCodeLine{93                  \textcolor{stringliteral}{'Layer 2 surface salinity'}, units=\textcolor{stringliteral}{'1e-\/3'}, default=35.0, do\_not\_log=just\_read)}
\DoxyCodeLine{94   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L1\_TEMP"}, upperlayertemp, \&}
\DoxyCodeLine{95                  \textcolor{stringliteral}{'Layer 1 surface temperature'}, units=\textcolor{stringliteral}{'C'}, default=20.0, do\_not\_log=just\_read)}
\DoxyCodeLine{96   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_SALT"}, lowerlayersalt, \&}
\DoxyCodeLine{97                  \textcolor{stringliteral}{'Layer 2 surface salinity'}, units=\textcolor{stringliteral}{'1e-\/3'}, default=35.0, do\_not\_log=just\_read)}
\DoxyCodeLine{98   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_TEMP"}, lowerlayertemp, \&}
\DoxyCodeLine{99                  \textcolor{stringliteral}{'Layer 2 surface temperature'}, units=\textcolor{stringliteral}{'C'}, default=20.0, do\_not\_log=just\_read)}
\DoxyCodeLine{100   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_DTDZ"}, lowerlayerdtdz,     \&}
\DoxyCodeLine{101                  \textcolor{stringliteral}{'Initial temperature stratification in layer 2'}, \&}
\DoxyCodeLine{102                  units=\textcolor{stringliteral}{'C/m'}, default=0.0, scale=us\%Z\_to\_m, do\_not\_log=just\_read)}
\DoxyCodeLine{103   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_DSDZ"}, lowerlayerdsdz,  \&}
\DoxyCodeLine{104                  \textcolor{stringliteral}{'Initial salinity stratification in layer 2'}, \&}
\DoxyCodeLine{105                  units=\textcolor{stringliteral}{'PPT/m'}, default=0.0, scale=us\%Z\_to\_m, do\_not\_log=just\_read)}
\DoxyCodeLine{106   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SCM\_L2\_MINTEMP"},lowerlayermintemp, \&}
\DoxyCodeLine{107                  \textcolor{stringliteral}{'Layer 2 minimum temperature'}, units=\textcolor{stringliteral}{'C'}, default=4.0, do\_not\_log=just\_read)}
\DoxyCodeLine{108 }
\DoxyCodeLine{109   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{110 }
\DoxyCodeLine{111   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{112     top = 0. \textcolor{comment}{! Reference to surface}}
\DoxyCodeLine{113     bottom = 0.}
\DoxyCodeLine{114     \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{115       bottom = bottom -\/ h(i,j,k)*gv\%H\_to\_Z \textcolor{comment}{! Interface below layer [Z \string~> m]}}
\DoxyCodeLine{116       zc = 0.5*( top + bottom )        \textcolor{comment}{! Z of middle of layer [Z \string~> m]}}
\DoxyCodeLine{117       dz = min(0., zc + upperlayertempmld)}
\DoxyCodeLine{118       t(i,j,k) = max(lowerlayermintemp,lowerlayertemp + lowerlayerdtdz * dz)}
\DoxyCodeLine{119       dz = min(0., zc + upperlayersaltmld)}
\DoxyCodeLine{120       s(i,j,k) = lowerlayersalt + lowerlayerdsdz * dz}
\DoxyCodeLine{121       top = bottom}
\DoxyCodeLine{122 \textcolor{keywordflow}{    enddo} \textcolor{comment}{! k}}
\DoxyCodeLine{123 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\hyperlink{structscm__cvmix__tests_1_1scm__cvmix__tests__cs}{scm\+\_\+cvmix\+\_\+tests\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}


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

\end{DoxyCode}
