\hypertarget{namespacemom__cvmix__conv}{}\section{mom\+\_\+cvmix\+\_\+conv Module Reference}
\label{namespacemom__cvmix__conv}\index{mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}}


\subsection{Detailed Description}
Interface to C\+V\+Mix convection scheme. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structmom__cvmix__conv_1_1cvmix__conv__cs}{cvmix\+\_\+conv\+\_\+cs}
\begin{DoxyCompactList}\small\item\em Control structure including parameters for C\+V\+Mix convection. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \hyperlink{namespacemom__cvmix__conv_a96b32166eb7623c206f18549da8224ca}{cvmix\+\_\+conv\+\_\+init} (Time, G, GV, US, param\+\_\+file, diag, CS)
\begin{DoxyCompactList}\small\item\em Initialized the C\+V\+Mix convection mixing routine. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__cvmix__conv_a9fa2fba758d0df93a9d6219c21e5e06d}{calculate\+\_\+cvmix\+\_\+conv} (h, tv, G, GV, US, CS, hbl)
\begin{DoxyCompactList}\small\item\em Subroutine for calculating enhanced diffusivity/viscosity due to convection via C\+V\+Mix. \end{DoxyCompactList}\item 
logical function, public \hyperlink{namespacemom__cvmix__conv_a5e741c84ad14fae3e5801d00a9867bba}{cvmix\+\_\+conv\+\_\+is\+\_\+used} (param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Reads the parameter \char`\"{}\+U\+S\+E\+\_\+\+C\+V\+Mix\+\_\+\+C\+O\+N\+V\+E\+C\+T\+I\+O\+N\char`\"{} and returns state. This function allows other modules to know whether this parameterization will be used without needing to duplicate the log entry. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacemom__cvmix__conv_a4f35df3a407ded91cd67384a14da3a3c}{cvmix\+\_\+conv\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Clear pointers and dealocate memory. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__cvmix__conv_a877a4beb2eff515d903a17b5779adbee}\label{namespacemom__cvmix__conv_a877a4beb2eff515d903a17b5779adbee}} 
character(len=40) \hyperlink{namespacemom__cvmix__conv_a877a4beb2eff515d903a17b5779adbee}{mdl} = \char`\"{}M\+O\+M\+\_\+\+C\+V\+Mix\+\_\+conv\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__cvmix__conv_a9fa2fba758d0df93a9d6219c21e5e06d}\label{namespacemom__cvmix__conv_a9fa2fba758d0df93a9d6219c21e5e06d}} 
\index{mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}!calculate\+\_\+cvmix\+\_\+conv@{calculate\+\_\+cvmix\+\_\+conv}}
\index{calculate\+\_\+cvmix\+\_\+conv@{calculate\+\_\+cvmix\+\_\+conv}!mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}}
\subsubsection{\texorpdfstring{calculate\+\_\+cvmix\+\_\+conv()}{calculate\_cvmix\_conv()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+cvmix\+\_\+conv\+::calculate\+\_\+cvmix\+\_\+conv (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\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(\hyperlink{structmom__cvmix__conv_1_1cvmix__conv__cs}{cvmix\+\_\+conv\+\_\+cs}), pointer}]{CS,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(in)}]{hbl }\end{DoxyParamCaption})}



Subroutine for calculating enhanced diffusivity/viscosity due to convection via C\+V\+Mix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Grid structure.\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em tv} & Thermodynamics structure.\\
\hline
 & {\em cs} & The control structure returned by a previous call to C\+V\+Mix\+\_\+conv\+\_\+init.\\
\hline
\mbox{\tt in}  & {\em hbl} & Depth of ocean boundary layer \mbox{[}Z $\sim$$>$ m\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 153 of file M\+O\+M\+\_\+\+C\+V\+Mix\+\_\+conv.\+F90.


\begin{DoxyCode}
153 
154   \textcolor{keywordtype}{type}(ocean\_grid\_type),                      \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{  !< Grid structure.}
155   \textcolor{keywordtype}{type}(verticalgrid\_type),                    \textcolor{keywordtype}{intent(in)}  :: gv\textcolor{comment}{ !< Vertical grid structure.}
156   \textcolor{keywordtype}{type}(unit\_scale\_type),                      \textcolor{keywordtype}{intent(in)}  :: us\textcolor{comment}{ !< A dimensional unit scaling type}
157   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},   \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{  !< Layer thickness [H ~> m or kg m-2].}
158   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                      \textcolor{keywordtype}{intent(in)}  :: tv\textcolor{comment}{ !< Thermodynamics structure.}
159   \textcolor{keywordtype}{type}(cvmix\_conv\_cs),                        \textcolor{keywordtype}{pointer}     :: cs\textcolor{comment}{ !< The control structure returned}
160 \textcolor{comment}{                                                                !! by a previous call to CVMix\_conv\_init.}
161   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))},           \textcolor{keywordtype}{intent(in)}  :: hbl\textcolor{comment}{ !< Depth of ocean boundary layer [Z ~> m]}
162   \textcolor{comment}{! local variables}
163   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G))} :: rho\_lwr\textcolor{comment}{ !< Adiabatic Water Density, this is a dummy}
164 \textcolor{comment}{                                      !! variable since here convection is always}
165 \textcolor{comment}{                                      !! computed based on Brunt Vaisala.}
166   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G))} :: rho\_1d\textcolor{comment}{  !< water density in a column, this is also}
167 \textcolor{comment}{                                      !! a dummy variable, same reason as above.}
168   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G)+1)} :: kv\_col\textcolor{comment}{ !< Viscosities at interfaces in the column [m2 s-1]}
169   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G)+1)} :: kd\_col\textcolor{comment}{ !< Diffusivities at interfaces in the column [m2 s-1]}
170   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G)+1)} :: ifaceheight\textcolor{comment}{ !< Height of interfaces [m]}
171   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(G))}   :: cellheight\textcolor{comment}{  !< Height of cell centers [m]}
172   \textcolor{keywordtype}{integer} :: kobl\textcolor{comment}{                        !< level of OBL extent}
173   \textcolor{keywordtype}{real} :: g\_o\_rho0  \textcolor{comment}{! Gravitational acceleration divided by density times unit convserion factors}
174                     \textcolor{comment}{! [Z s-2 R-1 ~> m4 s-2 kg-1]}
175   \textcolor{keywordtype}{real} :: pref      \textcolor{comment}{! Interface pressures [R L2 T-2 ~> Pa]}
176   \textcolor{keywordtype}{real} :: rhok, rhokm1 \textcolor{comment}{! In situ densities of the layers above and below at the interface pressure [R ~> kg
       m-3]}
177   \textcolor{keywordtype}{real} :: hbl\_kpp   \textcolor{comment}{! The depth of the ocean boundary as used by KPP [m]}
178   \textcolor{keywordtype}{real} :: dz        \textcolor{comment}{! A thickness [Z ~> m]}
179   \textcolor{keywordtype}{real} :: dh, hcorr \textcolor{comment}{! Two thicknesses [m]}
180   \textcolor{keywordtype}{integer} :: i, j, k
181 
182   g\_o\_rho0 = us%L\_to\_Z**2*us%s\_to\_T**2 * gv%g\_Earth / gv%Rho0
183 
184   \textcolor{comment}{! initialize dummy variables}
185   rho\_lwr(:) = 0.0; rho\_1d(:) = 0.0
186 
187   \textcolor{keywordflow}{do} j = g%jsc, g%jec
188     \textcolor{keywordflow}{do} i = g%isc, g%iec
189 
190       \textcolor{comment}{! set N2 to zero at the top- and bottom-most interfaces}
191       cs%N2(i,j,1) = 0.
192       cs%N2(i,j,g%ke+1) = 0.
193 
194       \textcolor{comment}{! skip calling at land points}
195       \textcolor{comment}{!if (G%mask2dT(i,j) == 0.) cycle}
196 
197       pref = 0. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%p\_surf)) pref = tv%p\_surf(i,j)
198       \textcolor{comment}{! Compute Brunt-Vaisala frequency (static stability) on interfaces}
199       \textcolor{keywordflow}{do} k=2,g%ke
200 
201         \textcolor{comment}{! pRef is pressure at interface between k and km1 [R L2 T-2 ~> Pa].}
202         pref = pref + (gv%H\_to\_RZ*gv%g\_Earth) * h(i,j,k)
203         \textcolor{keyword}{call }calculate\_density(tv%t(i,j,k), tv%s(i,j,k), pref, rhok, tv%eqn\_of\_state)
204         \textcolor{keyword}{call }calculate\_density(tv%t(i,j,k-1), tv%s(i,j,k-1), pref, rhokm1, tv%eqn\_of\_state)
205 
206         dz = ((0.5*(h(i,j,k-1) + h(i,j,k))+gv%H\_subroundoff)*gv%H\_to\_Z)
207         cs%N2(i,j,k) = g\_o\_rho0 * (rhok - rhokm1) / dz \textcolor{comment}{! Can be negative}
208 
209 \textcolor{keywordflow}{      enddo}
210 
211       ifaceheight(1) = 0.0 \textcolor{comment}{! BBL is all relative to the surface}
212       hcorr = 0.0
213       \textcolor{comment}{! compute heights at cell center and interfaces}
214       \textcolor{keywordflow}{do} k=1,g%ke
215         dh = h(i,j,k) * gv%H\_to\_m \textcolor{comment}{! Nominal thickness to use for increment, in the units used by CVMix.}
216         dh = dh + hcorr \textcolor{comment}{! Take away the accumulated error (could temporarily make dh<0)}
217         hcorr = min( dh - cs%min\_thickness, 0. ) \textcolor{comment}{! If inflating then hcorr<0}
218         dh = max( dh, cs%min\_thickness ) \textcolor{comment}{! Limit increment dh>=min\_thickness}
219         cellheight(k)    = ifaceheight(k) - 0.5 * dh
220         ifaceheight(k+1) = ifaceheight(k) - dh
221 \textcolor{keywordflow}{      enddo}
222 
223       \textcolor{comment}{! gets index of the level and interface above hbl}
224       hbl\_kpp = us%Z\_to\_m*hbl(i,j)  \textcolor{comment}{! Convert to the units used by CVMix.}
225       kobl = cvmix\_kpp\_compute\_kobl\_depth(ifaceheight, cellheight, hbl\_kpp)
226 
227       kv\_col(:) = 0.0 ; kd\_col(:) = 0.0
228       \textcolor{keyword}{call }cvmix\_coeffs\_conv(mdiff\_out=kv\_col(:), &
229                                tdiff\_out=kd\_col(:), &
230                                nsqr=cs%N2(i,j,:), &
231                                dens=rho\_1d(:), &
232                                dens\_lwr=rho\_lwr(:), &
233                                nlev=g%ke,    &
234                                max\_nlev=g%ke, &
235                                obl\_ind=kobl)
236 
237       \textcolor{keywordflow}{do} k=1,g%ke+1
238         cs%kv\_conv(i,j,k) = us%m2\_s\_to\_Z2\_T * kv\_col(k)
239         cs%Kd\_conv(i,j,k) = us%m2\_s\_to\_Z2\_T * kd\_col(k)
240 \textcolor{keywordflow}{      enddo}
241       \textcolor{comment}{! Do not apply mixing due to convection within the boundary layer}
242       \textcolor{keywordflow}{do} k=1,kobl
243         cs%kv\_conv(i,j,k) = 0.0
244         cs%kd\_conv(i,j,k) = 0.0
245 \textcolor{keywordflow}{      enddo}
246 
247 \textcolor{keywordflow}{    enddo}
248 \textcolor{keywordflow}{  enddo}
249 
250   \textcolor{keywordflow}{if} (cs%debug) \textcolor{keywordflow}{then}
251     \textcolor{keyword}{call }hchksum(cs%N2, \textcolor{stringliteral}{"MOM\_CVMix\_conv: N2"},g%HI,haloshift=0)
252     \textcolor{keyword}{call }hchksum(cs%kd\_conv, \textcolor{stringliteral}{"MOM\_CVMix\_conv: kd\_conv"},g%HI,haloshift=0,scale=us%Z2\_T\_to\_m2\_s)
253     \textcolor{keyword}{call }hchksum(cs%kv\_conv, \textcolor{stringliteral}{"MOM\_CVMix\_conv: kv\_conv"},g%HI,haloshift=0,scale=us%m2\_s\_to\_Z2\_T)
254 \textcolor{keywordflow}{  endif}
255 
256   \textcolor{comment}{! send diagnostics to post\_data}
257   \textcolor{keywordflow}{if} (cs%id\_N2 > 0) \textcolor{keyword}{call }post\_data(cs%id\_N2, cs%N2, cs%diag)
258   \textcolor{keywordflow}{if} (cs%id\_kd\_conv > 0) \textcolor{keyword}{call }post\_data(cs%id\_kd\_conv, cs%kd\_conv, cs%diag)
259   \textcolor{keywordflow}{if} (cs%id\_kv\_conv > 0) \textcolor{keyword}{call }post\_data(cs%id\_kv\_conv, cs%kv\_conv, cs%diag)
260 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__cvmix__conv_a4f35df3a407ded91cd67384a14da3a3c}\label{namespacemom__cvmix__conv_a4f35df3a407ded91cd67384a14da3a3c}} 
\index{mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}!cvmix\+\_\+conv\+\_\+end@{cvmix\+\_\+conv\+\_\+end}}
\index{cvmix\+\_\+conv\+\_\+end@{cvmix\+\_\+conv\+\_\+end}!mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}}
\subsubsection{\texorpdfstring{cvmix\+\_\+conv\+\_\+end()}{cvmix\_conv\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+cvmix\+\_\+conv\+::cvmix\+\_\+conv\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structmom__cvmix__conv_1_1cvmix__conv__cs}{cvmix\+\_\+conv\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Clear pointers and dealocate memory. 


\begin{DoxyParams}{Parameters}
{\em cs} & Control structure for this module that will be deallocated in this subroutine \\
\hline
\end{DoxyParams}


Definition at line 275 of file M\+O\+M\+\_\+\+C\+V\+Mix\+\_\+conv.\+F90.


\begin{DoxyCode}
275   \textcolor{keywordtype}{type}(cvmix\_conv\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< Control structure for this module that}
276 \textcolor{comment}{                                     !! will be deallocated in this subroutine}
277 
278   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
279 
280   \textcolor{keyword}{deallocate}(cs%N2)
281   \textcolor{keyword}{deallocate}(cs%kd\_conv)
282   \textcolor{keyword}{deallocate}(cs%kv\_conv)
283   \textcolor{keyword}{deallocate}(cs)
284 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__cvmix__conv_a96b32166eb7623c206f18549da8224ca}\label{namespacemom__cvmix__conv_a96b32166eb7623c206f18549da8224ca}} 
\index{mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}!cvmix\+\_\+conv\+\_\+init@{cvmix\+\_\+conv\+\_\+init}}
\index{cvmix\+\_\+conv\+\_\+init@{cvmix\+\_\+conv\+\_\+init}!mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}}
\subsubsection{\texorpdfstring{cvmix\+\_\+conv\+\_\+init()}{cvmix\_conv\_init()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+cvmix\+\_\+conv\+::cvmix\+\_\+conv\+\_\+init (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\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[{type(diag\+\_\+ctrl), intent(inout), target}]{diag,  }\item[{type(\hyperlink{structmom__cvmix__conv_1_1cvmix__conv__cs}{cvmix\+\_\+conv\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Initialized the C\+V\+Mix convection mixing routine. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em time} & The current time.\\
\hline
\mbox{\tt in}  & {\em g} & Grid structure.\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid structure.\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Run-\/time parameter file handle\\
\hline
\mbox{\tt in,out}  & {\em diag} & Diagnostics control structure.\\
\hline
 & {\em cs} & This module\textquotesingle{}s control structure. \\
\hline
\end{DoxyParams}


Definition at line 56 of file M\+O\+M\+\_\+\+C\+V\+Mix\+\_\+conv.\+F90.


\begin{DoxyCode}
56 
57   \textcolor{keywordtype}{type}(time\_type),         \textcolor{keywordtype}{intent(in)}    :: time\textcolor{comment}{       !< The current time.}
58   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{          !< Grid structure.}
59   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{         !< Vertical grid structure.}
60   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: us\textcolor{comment}{         !< A dimensional unit scaling type}
61   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}    :: param\_file\textcolor{comment}{ !< Run-time parameter file handle}
62   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{       !< Diagnostics control structure.}
63   \textcolor{keywordtype}{type}(cvmix\_conv\_cs),     \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{         !< This module's control structure.}
64   \textcolor{comment}{! Local variables}
65   \textcolor{keywordtype}{real}    :: prandtl\_conv\textcolor{comment}{ !< Turbulent Prandtl number used in convective instabilities.}
66   \textcolor{keywordtype}{logical} :: useepbl\textcolor{comment}{      !< If True, use the ePBL boundary layer scheme.}
67 
68 \textcolor{comment}{! This include declares and sets the variable "version".}
69 \textcolor{preprocessor}{#include "version\_variable.h"}
70 \textcolor{preprocessor}{}
71   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
72     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"CVMix\_conv\_init called with an associated "}// &
73                             \textcolor{stringliteral}{"control structure."})
74     \textcolor{keywordflow}{return}
75 \textcolor{keywordflow}{  endif}
76   \textcolor{keyword}{allocate}(cs)
77 
78   \textcolor{comment}{! Read parameters}
79   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_CVMix\_CONVECTION"}, cvmix\_conv\_init, default=.false., do\_not\_log=.
      true.)
80   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, &
81            \textcolor{stringliteral}{"Parameterization of enhanced mixing due to convection via CVMix"}, &
82            all\_default=.not.cvmix\_conv\_init)
83   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_CVMix\_CONVECTION"}, cvmix\_conv\_init, &
84                  \textcolor{stringliteral}{"If true, turns on the enhanced mixing due to convection "}//&
85                  \textcolor{stringliteral}{"via CVMix. This scheme increases diapycnal diffs./viscs. "}//&
86                  \textcolor{stringliteral}{"at statically unstable interfaces. Relevant parameters are "}//&
87                  \textcolor{stringliteral}{"contained in the CVMix\_CONVECTION% parameter block."}, &
88                  default=.false.)
89 
90   \textcolor{keywordflow}{if} (.not. cvmix\_conv\_init) \textcolor{keywordflow}{return}
91 
92   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ENERGETICS\_SFC\_PBL"}, useepbl, default=.false., &
93                 do\_not\_log=.true.)
94 
95   \textcolor{comment}{! Warn user if EPBL is being used, since in this case mixing due to convection will}
96   \textcolor{comment}{! be aplied in the boundary layer}
97   \textcolor{keywordflow}{if} (useepbl) \textcolor{keywordflow}{then}
98      \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{'MOM\_CVMix\_conv\_init: '}// &
99            \textcolor{stringliteral}{'CVMix convection may not be properly applied when ENERGETICS\_SFC\_PBL = True'}//&
100            \textcolor{stringliteral}{'as convective mixing might occur in the boundary layer.'})
101 \textcolor{keywordflow}{  endif}
102 
103   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'DEBUG'}, cs%debug, default=.false., do\_not\_log=.true.)
104 
105   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'MIN\_THICKNESS'}, cs%min\_thickness, default=0.001, do\_not\_log=.true.)
106 
107   \textcolor{keyword}{call }openparameterblock(param\_file,\textcolor{stringliteral}{'CVMix\_CONVECTION'})
108 
109   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PRANDTL\_CONV"}, prandtl\_conv, &
110                  \textcolor{stringliteral}{"The turbulent Prandtl number applied to convective "}//&
111                  \textcolor{stringliteral}{"instabilities (i.e., used to convert KD\_CONV into KV\_CONV)"}, &
112                  units=\textcolor{stringliteral}{"nondim"}, default=1.0)
113 
114   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'KD\_CONV'}, cs%kd\_conv\_const, &
115                  \textcolor{stringliteral}{"Diffusivity used in convective regime. Corresponding viscosity "}//&
116                  \textcolor{stringliteral}{"(KV\_CONV) will be set to KD\_CONV * PRANDTL\_TURB."}, &
117                  units=\textcolor{stringliteral}{'m2/s'}, default=1.00)
118 
119   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{'BV\_SQR\_CONV'}, cs%bv\_sqr\_conv, &
120                  \textcolor{stringliteral}{"Threshold for squared buoyancy frequency needed to trigger "}//&
121                  \textcolor{stringliteral}{"Brunt-Vaisala parameterization."}, &
122                  units=\textcolor{stringliteral}{'1/s^2'}, default=0.0)
123 
124   \textcolor{keyword}{call }closeparameterblock(param\_file)
125 
126   \textcolor{comment}{! set kv\_conv\_const based on kd\_conv\_const and prandtl\_conv}
127   cs%kv\_conv\_const = cs%kd\_conv\_const * prandtl\_conv
128 
129   \textcolor{comment}{! allocate arrays and set them to zero}
130   \textcolor{keyword}{allocate}(cs%N2(szi\_(g), szj\_(g), szk\_(g)+1)); cs%N2(:,:,:) = 0.
131   \textcolor{keyword}{allocate}(cs%kd\_conv(szi\_(g), szj\_(g), szk\_(g)+1)); cs%kd\_conv(:,:,:) = 0.
132   \textcolor{keyword}{allocate}(cs%kv\_conv(szi\_(g), szj\_(g), szk\_(g)+1)); cs%kv\_conv(:,:,:) = 0.
133 
134   \textcolor{comment}{! Register diagnostics}
135   cs%diag => diag
136   cs%id\_N2 = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'N2\_conv'}, diag%axesTi, time, &
137       \textcolor{stringliteral}{'Square of Brunt-Vaisala frequency used by MOM\_CVMix\_conv module'}, \textcolor{stringliteral}{'1/s2'})
138   cs%id\_kd\_conv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'kd\_conv'}, diag%axesTi, time, &
139       \textcolor{stringliteral}{'Additional diffusivity added by MOM\_CVMix\_conv module'}, \textcolor{stringliteral}{'m2/s'}, conversion=us%Z2\_T\_to\_m2\_s)
140   cs%id\_kv\_conv = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'kv\_conv'}, diag%axesTi, time, &
141       \textcolor{stringliteral}{'Additional viscosity added by MOM\_CVMix\_conv module'}, \textcolor{stringliteral}{'m2/s'}, conversion=us%Z2\_T\_to\_m2\_s)
142 
143   \textcolor{keyword}{call }cvmix\_init\_conv(convect\_diff=cs%kd\_conv\_const, &
144                        convect\_visc=cs%kv\_conv\_const, &
145                        lbruntvaisala=.true.,    &
146                        bvsqr\_convect=cs%bv\_sqr\_conv)
147 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__cvmix__conv_a5e741c84ad14fae3e5801d00a9867bba}\label{namespacemom__cvmix__conv_a5e741c84ad14fae3e5801d00a9867bba}} 
\index{mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}!cvmix\+\_\+conv\+\_\+is\+\_\+used@{cvmix\+\_\+conv\+\_\+is\+\_\+used}}
\index{cvmix\+\_\+conv\+\_\+is\+\_\+used@{cvmix\+\_\+conv\+\_\+is\+\_\+used}!mom\+\_\+cvmix\+\_\+conv@{mom\+\_\+cvmix\+\_\+conv}}
\subsubsection{\texorpdfstring{cvmix\+\_\+conv\+\_\+is\+\_\+used()}{cvmix\_conv\_is\_used()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+cvmix\+\_\+conv\+::cvmix\+\_\+conv\+\_\+is\+\_\+used (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})}



Reads the parameter \char`\"{}\+U\+S\+E\+\_\+\+C\+V\+Mix\+\_\+\+C\+O\+N\+V\+E\+C\+T\+I\+O\+N\char`\"{} and returns state. This function allows other modules to know whether this parameterization will be used without needing to duplicate the log entry. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 267 of file M\+O\+M\+\_\+\+C\+V\+Mix\+\_\+conv.\+F90.


\begin{DoxyCode}
267   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
268   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"USE\_CVMix\_CONVECTION"}, cvmix\_conv\_is\_used, &
269                  default=.false., do\_not\_log = .true.)
270 
\end{DoxyCode}
