\hypertarget{namespacemom__variables}{}\doxysection{mom\+\_\+variables Module Reference}
\label{namespacemom__variables}\index{mom\_variables@{mom\_variables}}


\doxysubsection{Detailed Description}
Provides transparent structures with groups of M\+O\+M6 variables and supporting routines. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structmom__variables_1_1accel__diag__ptrs}{accel\+\_\+diag\+\_\+ptrs}}
\begin{DoxyCompactList}\small\item\em Pointers to arrays with accelerations, which can later be used for derived diagnostics, like energy balances. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1bt__cont__type}{bt\+\_\+cont\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Container for information about the summed layer transports and how they will vary as the barotropic velocity is changed. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1cont__diag__ptrs}{cont\+\_\+diag\+\_\+ptrs}}
\begin{DoxyCompactList}\small\item\em Pointers to arrays with transports, which can later be used for derived diagnostics, like energy balances. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1ocean__internal__state}{ocean\+\_\+internal\+\_\+state}}
\begin{DoxyCompactList}\small\item\em Pointers to all of the prognostic variables allocated in \mbox{\hyperlink{MOM__variables_8F90_source}{M\+O\+M\+\_\+variables.\+F90}} and \mbox{\hyperlink{MOM_8F90_source}{M\+O\+M.\+F90}}. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1p2d}{p2d}}
\begin{DoxyCompactList}\small\item\em A structure for creating arrays of pointers to 2D arrays. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1p3d}{p3d}}
\begin{DoxyCompactList}\small\item\em A structure for creating arrays of pointers to 3D arrays. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1surface}{surface}}
\begin{DoxyCompactList}\small\item\em Pointers to various fields which may be used describe the surface state of M\+OM, and which will be returned to a the calling program. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}
\begin{DoxyCompactList}\small\item\em Pointers to an assortment of thermodynamic fields that may be available, including potential temperature, salinity, heat capacity, and the equation of state control structure. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__variables_1_1vertvisc__type}{vertvisc\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Vertical viscosities, drag coefficients, and related fields. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__variables_ae582d6c5e152ff9463850159324846b6}{allocate\+\_\+surface\+\_\+state}} (sfc\+\_\+state, G, use\+\_\+temperature, do\+\_\+integrals, gas\+\_\+fields\+\_\+ocn, use\+\_\+meltpot, use\+\_\+iceshelves, omit\+\_\+frazil)
\begin{DoxyCompactList}\small\item\em Allocates the fields for the surface (return) properties of the ocean model. Unused fields are unallocated. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__variables_a7e4d7328df7ff02b8e55f9932d1afa7f}{deallocate\+\_\+surface\+\_\+state}} (sfc\+\_\+state)
\begin{DoxyCompactList}\small\item\em Deallocates the elements of a surface state type. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__variables_a880f21fbfee383e8ee7c5ec114036f2f}\label{namespacemom__variables_a880f21fbfee383e8ee7c5ec114036f2f}} 
subroutine, public \mbox{\hyperlink{namespacemom__variables_a880f21fbfee383e8ee7c5ec114036f2f}{rotate\+\_\+surface\+\_\+state}} (sfc\+\_\+state\+\_\+in, G\+\_\+in, sfc\+\_\+state, G, turns)
\begin{DoxyCompactList}\small\item\em Rotate the surface state fields from the input to the model indices. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__variables_a26d7f4002ba856a1929f5a3962eb0e99}{alloc\+\_\+bt\+\_\+cont\+\_\+type}} (B\+T\+\_\+cont, G, alloc\+\_\+faces)
\begin{DoxyCompactList}\small\item\em Allocates the arrays contained within a B\+T\+\_\+cont\+\_\+type and initializes them to 0. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__variables_a3ca9ae6d8b8322afe3a53b66afae4c1b}{dealloc\+\_\+bt\+\_\+cont\+\_\+type}} (B\+T\+\_\+cont)
\begin{DoxyCompactList}\small\item\em Deallocates the arrays contained within a B\+T\+\_\+cont\+\_\+type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__variables_a3a49e8f236529824956f8c5c3e147893}{mom\+\_\+thermovar\+\_\+chksum}} (mesg, tv, G)
\begin{DoxyCompactList}\small\item\em Diagnostic checksums on various elements of a \mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}} type for debugging. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__variables_a26d7f4002ba856a1929f5a3962eb0e99}\label{namespacemom__variables_a26d7f4002ba856a1929f5a3962eb0e99}} 
\index{mom\_variables@{mom\_variables}!alloc\_bt\_cont\_type@{alloc\_bt\_cont\_type}}
\index{alloc\_bt\_cont\_type@{alloc\_bt\_cont\_type}!mom\_variables@{mom\_variables}}
\doxysubsubsection{\texorpdfstring{alloc\_bt\_cont\_type()}{alloc\_bt\_cont\_type()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+variables\+::alloc\+\_\+bt\+\_\+cont\+\_\+type (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1bt__cont__type}{bt\+\_\+cont\+\_\+type}}), pointer}]{B\+T\+\_\+cont,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{logical, intent(in), optional}]{alloc\+\_\+faces }\end{DoxyParamCaption})}



Allocates the arrays contained within a B\+T\+\_\+cont\+\_\+type and initializes them to 0. 


\begin{DoxyParams}[1]{Parameters}
 & {\em bt\+\_\+cont} & The B\+T\+\_\+cont\+\_\+type whose elements will be allocated \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em alloc\+\_\+faces} & If present and true, allocate memory for effective face thicknesses. \\
\hline
\end{DoxyParams}


Definition at line 476 of file M\+O\+M\+\_\+variables.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{477   \textcolor{keywordtype}{type}(BT\_cont\_type),    \textcolor{keywordtype}{pointer}    :: BT\_cont\textcolor{comment}{ !< The BT\_cont\_type whose elements will be allocated}}
\DoxyCodeLine{478   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{479   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: alloc\_faces\textcolor{comment}{ !< If present and true, allocate}}
\DoxyCodeLine{480 \textcolor{comment}{                                            !! memory for effective face thicknesses.}}
\DoxyCodeLine{481 }
\DoxyCodeLine{482   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{483   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{484   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{485 }
\DoxyCodeLine{486   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(bt\_cont)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{487     \textcolor{stringliteral}{"alloc\_BT\_cont\_type called with an associated BT\_cont\_type pointer."})}
\DoxyCodeLine{488 }
\DoxyCodeLine{489   \textcolor{keyword}{allocate}(bt\_cont)}
\DoxyCodeLine{490   \textcolor{keyword}{allocate}(bt\_cont\%FA\_u\_WW(isdb:iedb,jsd:jed)) ; bt\_cont\%FA\_u\_WW(:,:) = 0.0}
\DoxyCodeLine{491   \textcolor{keyword}{allocate}(bt\_cont\%FA\_u\_W0(isdb:iedb,jsd:jed)) ; bt\_cont\%FA\_u\_W0(:,:) = 0.0}
\DoxyCodeLine{492   \textcolor{keyword}{allocate}(bt\_cont\%FA\_u\_E0(isdb:iedb,jsd:jed)) ; bt\_cont\%FA\_u\_E0(:,:) = 0.0}
\DoxyCodeLine{493   \textcolor{keyword}{allocate}(bt\_cont\%FA\_u\_EE(isdb:iedb,jsd:jed)) ; bt\_cont\%FA\_u\_EE(:,:) = 0.0}
\DoxyCodeLine{494   \textcolor{keyword}{allocate}(bt\_cont\%uBT\_WW(isdb:iedb,jsd:jed))  ; bt\_cont\%uBT\_WW(:,:) = 0.0}
\DoxyCodeLine{495   \textcolor{keyword}{allocate}(bt\_cont\%uBT\_EE(isdb:iedb,jsd:jed))  ; bt\_cont\%uBT\_EE(:,:) = 0.0}
\DoxyCodeLine{496 }
\DoxyCodeLine{497   \textcolor{keyword}{allocate}(bt\_cont\%FA\_v\_SS(isd:ied,jsdb:jedb)) ; bt\_cont\%FA\_v\_SS(:,:) = 0.0}
\DoxyCodeLine{498   \textcolor{keyword}{allocate}(bt\_cont\%FA\_v\_S0(isd:ied,jsdb:jedb)) ; bt\_cont\%FA\_v\_S0(:,:) = 0.0}
\DoxyCodeLine{499   \textcolor{keyword}{allocate}(bt\_cont\%FA\_v\_N0(isd:ied,jsdb:jedb)) ; bt\_cont\%FA\_v\_N0(:,:) = 0.0}
\DoxyCodeLine{500   \textcolor{keyword}{allocate}(bt\_cont\%FA\_v\_NN(isd:ied,jsdb:jedb)) ; bt\_cont\%FA\_v\_NN(:,:) = 0.0}
\DoxyCodeLine{501   \textcolor{keyword}{allocate}(bt\_cont\%vBT\_SS(isd:ied,jsdb:jedb))  ; bt\_cont\%vBT\_SS(:,:) = 0.0}
\DoxyCodeLine{502   \textcolor{keyword}{allocate}(bt\_cont\%vBT\_NN(isd:ied,jsdb:jedb))  ; bt\_cont\%vBT\_NN(:,:) = 0.0}
\DoxyCodeLine{503 }
\DoxyCodeLine{504   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alloc\_faces)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (alloc\_faces) \textcolor{keywordflow}{then}}
\DoxyCodeLine{505     \textcolor{keyword}{allocate}(bt\_cont\%h\_u(isdb:iedb,jsd:jed,1:g\%ke)) ; bt\_cont\%h\_u(:,:,:) = 0.0}
\DoxyCodeLine{506     \textcolor{keyword}{allocate}(bt\_cont\%h\_v(isd:ied,jsdb:jedb,1:g\%ke)) ; bt\_cont\%h\_v(:,:,:) = 0.0}
\DoxyCodeLine{507 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{508 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__variables_ae582d6c5e152ff9463850159324846b6}\label{namespacemom__variables_ae582d6c5e152ff9463850159324846b6}} 
\index{mom\_variables@{mom\_variables}!allocate\_surface\_state@{allocate\_surface\_state}}
\index{allocate\_surface\_state@{allocate\_surface\_state}!mom\_variables@{mom\_variables}}
\doxysubsubsection{\texorpdfstring{allocate\_surface\_state()}{allocate\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+variables\+::allocate\+\_\+surface\+\_\+state (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1surface}{surface}}), intent(inout)}]{sfc\+\_\+state,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{logical, intent(in), optional}]{use\+\_\+temperature,  }\item[{logical, intent(in), optional}]{do\+\_\+integrals,  }\item[{type(coupler\+\_\+1d\+\_\+bc\+\_\+type), intent(in), optional}]{gas\+\_\+fields\+\_\+ocn,  }\item[{logical, intent(in), optional}]{use\+\_\+meltpot,  }\item[{logical, intent(in), optional}]{use\+\_\+iceshelves,  }\item[{logical, intent(in), optional}]{omit\+\_\+frazil }\end{DoxyParamCaption})}



Allocates the fields for the surface (return) properties of the ocean model. Unused fields are unallocated. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em sfc\+\_\+state} & ocean surface state type to be allocated. \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+temperature} & If true, allocate the space for thermodynamic variables. \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+integrals} & If true, allocate the space for vertically integrated fields. \\
\hline
\mbox{\texttt{ in}}  & {\em gas\+\_\+fields\+\_\+ocn} & If present, this type describes the ocean \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+meltpot} & If true, allocate the space for melt potential \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+iceshelves} & If true, allocate the space for the stresses under ice shelves. \\
\hline
\mbox{\texttt{ in}}  & {\em omit\+\_\+frazil} & If present and false, do not allocate the space to pass frazil fluxes to the coupler \\
\hline
\end{DoxyParams}


Definition at line 298 of file M\+O\+M\+\_\+variables.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{300   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{                !< ocean grid structure}}
\DoxyCodeLine{301   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{        !< ocean surface state type to be allocated.}}
\DoxyCodeLine{302   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: use\_temperature\textcolor{comment}{  !< If true, allocate the space for thermodynamic variables.}}
\DoxyCodeLine{303   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: do\_integrals\textcolor{comment}{     !< If true, allocate the space for vertically}}
\DoxyCodeLine{304 \textcolor{comment}{                                                           !! integrated fields.}}
\DoxyCodeLine{305   \textcolor{keywordtype}{type}(coupler\_1d\_bc\_type), \&}
\DoxyCodeLine{306                \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: gas\_fields\_ocn\textcolor{comment}{  !< If present, this type describes the ocean}}
\DoxyCodeLine{307 \textcolor{comment}{                                              !! ocean and surface-\/ice fields that will participate}}
\DoxyCodeLine{308 \textcolor{comment}{                                              !! in the calculation of additional gas or other}}
\DoxyCodeLine{309 \textcolor{comment}{                                              !! tracer fluxes, and can be used to spawn related}}
\DoxyCodeLine{310 \textcolor{comment}{                                              !! internal variables in the ice model.}}
\DoxyCodeLine{311   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: use\_meltpot\textcolor{comment}{      !< If true, allocate the space for melt potential}}
\DoxyCodeLine{312   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: use\_iceshelves\textcolor{comment}{   !< If true, allocate the space for the stresses}}
\DoxyCodeLine{313 \textcolor{comment}{                                                           !! under ice shelves.}}
\DoxyCodeLine{314   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: omit\_frazil\textcolor{comment}{      !< If present and false, do not allocate the space to}}
\DoxyCodeLine{315 \textcolor{comment}{                                                           !! pass frazil fluxes to the coupler}}
\DoxyCodeLine{316 }
\DoxyCodeLine{317   \textcolor{comment}{! local variables}}
\DoxyCodeLine{318   \textcolor{keywordtype}{logical} :: use\_temp, alloc\_integ, use\_melt\_potential, alloc\_iceshelves, alloc\_frazil}
\DoxyCodeLine{319   \textcolor{keywordtype}{integer} :: is, ie, js, je, isd, ied, jsd, jed}
\DoxyCodeLine{320   \textcolor{keywordtype}{integer} :: isdB, iedB, jsdB, jedB}
\DoxyCodeLine{321 }
\DoxyCodeLine{322   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec}
\DoxyCodeLine{323   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{324   isdb = g\%isdB ; iedb = g\%iedB; jsdb = g\%jsdB ; jedb = g\%jedB}
\DoxyCodeLine{325 }
\DoxyCodeLine{326   use\_temp = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(use\_temperature)) use\_temp = use\_temperature}
\DoxyCodeLine{327   alloc\_integ = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(do\_integrals)) alloc\_integ = do\_integrals}
\DoxyCodeLine{328   use\_melt\_potential = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(use\_meltpot)) use\_melt\_potential = use\_meltpot}
\DoxyCodeLine{329   alloc\_iceshelves = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(use\_iceshelves)) alloc\_iceshelves = use\_iceshelves}
\DoxyCodeLine{330   alloc\_frazil = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(omit\_frazil)) alloc\_frazil = .not.omit\_frazil}
\DoxyCodeLine{331 }
\DoxyCodeLine{332   \textcolor{keywordflow}{if} (sfc\_state\%arrays\_allocated) \textcolor{keywordflow}{return}}
\DoxyCodeLine{333 }
\DoxyCodeLine{334   \textcolor{keywordflow}{if} (use\_temp) \textcolor{keywordflow}{then}}
\DoxyCodeLine{335     \textcolor{keyword}{allocate}(sfc\_state\%SST(isd:ied,jsd:jed)) ; sfc\_state\%SST(:,:) = 0.0}
\DoxyCodeLine{336     \textcolor{keyword}{allocate}(sfc\_state\%SSS(isd:ied,jsd:jed)) ; sfc\_state\%SSS(:,:) = 0.0}
\DoxyCodeLine{337   \textcolor{keywordflow}{else}}
\DoxyCodeLine{338     \textcolor{keyword}{allocate}(sfc\_state\%sfc\_density(isd:ied,jsd:jed)) ; sfc\_state\%sfc\_density(:,:) = 0.0}
\DoxyCodeLine{339 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{340   \textcolor{keywordflow}{if} (use\_temp .and. alloc\_frazil) \textcolor{keywordflow}{then}}
\DoxyCodeLine{341     \textcolor{keyword}{allocate}(sfc\_state\%frazil(isd:ied,jsd:jed)) ; sfc\_state\%frazil(:,:) = 0.0}
\DoxyCodeLine{342 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{343   \textcolor{keyword}{allocate}(sfc\_state\%sea\_lev(isd:ied,jsd:jed)) ; sfc\_state\%sea\_lev(:,:) = 0.0}
\DoxyCodeLine{344   \textcolor{keyword}{allocate}(sfc\_state\%Hml(isd:ied,jsd:jed)) ; sfc\_state\%Hml(:,:) = 0.0}
\DoxyCodeLine{345   \textcolor{keyword}{allocate}(sfc\_state\%u(isdb:iedb,jsd:jed)) ; sfc\_state\%u(:,:) = 0.0}
\DoxyCodeLine{346   \textcolor{keyword}{allocate}(sfc\_state\%v(isd:ied,jsdb:jedb)) ; sfc\_state\%v(:,:) = 0.0}
\DoxyCodeLine{347 }
\DoxyCodeLine{348   \textcolor{keywordflow}{if} (use\_melt\_potential) \textcolor{keywordflow}{then}}
\DoxyCodeLine{349     \textcolor{keyword}{allocate}(sfc\_state\%melt\_potential(isd:ied,jsd:jed)) ; sfc\_state\%melt\_potential(:,:) = 0.0}
\DoxyCodeLine{350 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{351 }
\DoxyCodeLine{352   \textcolor{keywordflow}{if} (alloc\_integ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{353     \textcolor{comment}{! Allocate structures for the vertically integrated ocean\_mass, ocean\_heat, and ocean\_salt.}}
\DoxyCodeLine{354     \textcolor{keyword}{allocate}(sfc\_state\%ocean\_mass(isd:ied,jsd:jed)) ; sfc\_state\%ocean\_mass(:,:) = 0.0}
\DoxyCodeLine{355     \textcolor{keywordflow}{if} (use\_temp) \textcolor{keywordflow}{then}}
\DoxyCodeLine{356       \textcolor{keyword}{allocate}(sfc\_state\%ocean\_heat(isd:ied,jsd:jed)) ; sfc\_state\%ocean\_heat(:,:) = 0.0}
\DoxyCodeLine{357       \textcolor{keyword}{allocate}(sfc\_state\%ocean\_salt(isd:ied,jsd:jed)) ; sfc\_state\%ocean\_salt(:,:) = 0.0}
\DoxyCodeLine{358       \textcolor{keyword}{allocate}(sfc\_state\%TempxPmE(isd:ied,jsd:jed))   ; sfc\_state\%TempxPmE(:,:) = 0.0}
\DoxyCodeLine{359       \textcolor{keyword}{allocate}(sfc\_state\%salt\_deficit(isd:ied,jsd:jed))  ; sfc\_state\%salt\_deficit(:,:) = 0.0}
\DoxyCodeLine{360       \textcolor{keyword}{allocate}(sfc\_state\%internal\_heat(isd:ied,jsd:jed)) ; sfc\_state\%internal\_heat(:,:) = 0.0}
\DoxyCodeLine{361 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{362 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{363 }
\DoxyCodeLine{364   \textcolor{keywordflow}{if} (alloc\_iceshelves) \textcolor{keywordflow}{then}}
\DoxyCodeLine{365     \textcolor{keyword}{allocate}(sfc\_state\%taux\_shelf(isdb:iedb,jsd:jed)) ; sfc\_state\%taux\_shelf(:,:) = 0.0}
\DoxyCodeLine{366     \textcolor{keyword}{allocate}(sfc\_state\%tauy\_shelf(isd:ied,jsdb:jedb)) ; sfc\_state\%tauy\_shelf(:,:) = 0.0}
\DoxyCodeLine{367 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{368 }
\DoxyCodeLine{369   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(gas\_fields\_ocn)) \&}
\DoxyCodeLine{370     \textcolor{keyword}{call }coupler\_type\_spawn(gas\_fields\_ocn, sfc\_state\%tr\_fields, \&}
\DoxyCodeLine{371                             (/is,is,ie,ie/), (/js,js,je,je/), as\_needed=.true.)}
\DoxyCodeLine{372 }
\DoxyCodeLine{373   sfc\_state\%arrays\_allocated = .true.}
\DoxyCodeLine{374 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__variables_a3ca9ae6d8b8322afe3a53b66afae4c1b}\label{namespacemom__variables_a3ca9ae6d8b8322afe3a53b66afae4c1b}} 
\index{mom\_variables@{mom\_variables}!dealloc\_bt\_cont\_type@{dealloc\_bt\_cont\_type}}
\index{dealloc\_bt\_cont\_type@{dealloc\_bt\_cont\_type}!mom\_variables@{mom\_variables}}
\doxysubsubsection{\texorpdfstring{dealloc\_bt\_cont\_type()}{dealloc\_bt\_cont\_type()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+variables\+::dealloc\+\_\+bt\+\_\+cont\+\_\+type (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1bt__cont__type}{bt\+\_\+cont\+\_\+type}}), pointer}]{B\+T\+\_\+cont }\end{DoxyParamCaption})}



Deallocates the arrays contained within a B\+T\+\_\+cont\+\_\+type. 


\begin{DoxyParams}{Parameters}
{\em bt\+\_\+cont} & The B\+T\+\_\+cont\+\_\+type whose elements will be deallocated. \\
\hline
\end{DoxyParams}


Definition at line 512 of file M\+O\+M\+\_\+variables.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{513   \textcolor{keywordtype}{type}(BT\_cont\_type), \textcolor{keywordtype}{pointer} :: BT\_cont\textcolor{comment}{ !< The BT\_cont\_type whose elements will be deallocated.}}
\DoxyCodeLine{514 }
\DoxyCodeLine{515   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(bt\_cont)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{516 }
\DoxyCodeLine{517   \textcolor{keyword}{deallocate}(bt\_cont\%FA\_u\_WW) ; \textcolor{keyword}{deallocate}(bt\_cont\%FA\_u\_W0)}
\DoxyCodeLine{518   \textcolor{keyword}{deallocate}(bt\_cont\%FA\_u\_E0) ; \textcolor{keyword}{deallocate}(bt\_cont\%FA\_u\_EE)}
\DoxyCodeLine{519   \textcolor{keyword}{deallocate}(bt\_cont\%uBT\_WW)  ; \textcolor{keyword}{deallocate}(bt\_cont\%uBT\_EE)}
\DoxyCodeLine{520 }
\DoxyCodeLine{521   \textcolor{keyword}{deallocate}(bt\_cont\%FA\_v\_SS) ; \textcolor{keyword}{deallocate}(bt\_cont\%FA\_v\_S0)}
\DoxyCodeLine{522   \textcolor{keyword}{deallocate}(bt\_cont\%FA\_v\_N0) ; \textcolor{keyword}{deallocate}(bt\_cont\%FA\_v\_NN)}
\DoxyCodeLine{523   \textcolor{keyword}{deallocate}(bt\_cont\%vBT\_SS)  ; \textcolor{keyword}{deallocate}(bt\_cont\%vBT\_NN)}
\DoxyCodeLine{524 }
\DoxyCodeLine{525   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(bt\_cont\%h\_u)) \textcolor{keyword}{deallocate}(bt\_cont\%h\_u)}
\DoxyCodeLine{526   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(bt\_cont\%h\_v)) \textcolor{keyword}{deallocate}(bt\_cont\%h\_v)}
\DoxyCodeLine{527 }
\DoxyCodeLine{528   \textcolor{keyword}{deallocate}(bt\_cont)}
\DoxyCodeLine{529 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__variables_a7e4d7328df7ff02b8e55f9932d1afa7f}\label{namespacemom__variables_a7e4d7328df7ff02b8e55f9932d1afa7f}} 
\index{mom\_variables@{mom\_variables}!deallocate\_surface\_state@{deallocate\_surface\_state}}
\index{deallocate\_surface\_state@{deallocate\_surface\_state}!mom\_variables@{mom\_variables}}
\doxysubsubsection{\texorpdfstring{deallocate\_surface\_state()}{deallocate\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+variables\+::deallocate\+\_\+surface\+\_\+state (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1surface}{surface}}), intent(inout)}]{sfc\+\_\+state }\end{DoxyParamCaption})}



Deallocates the elements of a surface state type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em sfc\+\_\+state} & ocean surface state type to be deallocated here. \\
\hline
\end{DoxyParams}


Definition at line 378 of file M\+O\+M\+\_\+variables.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{379   \textcolor{keywordtype}{type}(surface), \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< ocean surface state type to be deallocated here.}}
\DoxyCodeLine{380 }
\DoxyCodeLine{381   \textcolor{keywordflow}{if} (.not.sfc\_state\%arrays\_allocated) \textcolor{keywordflow}{return}}
\DoxyCodeLine{382 }
\DoxyCodeLine{383   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%melt\_potential)) \textcolor{keyword}{deallocate}(sfc\_state\%melt\_potential)}
\DoxyCodeLine{384   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%SST)) \textcolor{keyword}{deallocate}(sfc\_state\%SST)}
\DoxyCodeLine{385   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%SSS)) \textcolor{keyword}{deallocate}(sfc\_state\%SSS)}
\DoxyCodeLine{386   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%sfc\_density)) \textcolor{keyword}{deallocate}(sfc\_state\%sfc\_density)}
\DoxyCodeLine{387   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%sea\_lev)) \textcolor{keyword}{deallocate}(sfc\_state\%sea\_lev)}
\DoxyCodeLine{388   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%Hml)) \textcolor{keyword}{deallocate}(sfc\_state\%Hml)}
\DoxyCodeLine{389   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%u)) \textcolor{keyword}{deallocate}(sfc\_state\%u)}
\DoxyCodeLine{390   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%v)) \textcolor{keyword}{deallocate}(sfc\_state\%v)}
\DoxyCodeLine{391   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%ocean\_mass)) \textcolor{keyword}{deallocate}(sfc\_state\%ocean\_mass)}
\DoxyCodeLine{392   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%ocean\_heat)) \textcolor{keyword}{deallocate}(sfc\_state\%ocean\_heat)}
\DoxyCodeLine{393   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%ocean\_salt)) \textcolor{keyword}{deallocate}(sfc\_state\%ocean\_salt)}
\DoxyCodeLine{394   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%salt\_deficit)) \textcolor{keyword}{deallocate}(sfc\_state\%salt\_deficit)}
\DoxyCodeLine{395 }
\DoxyCodeLine{396   \textcolor{keyword}{call }coupler\_type\_destructor(sfc\_state\%tr\_fields)}
\DoxyCodeLine{397 }
\DoxyCodeLine{398   sfc\_state\%arrays\_allocated = .false.}
\DoxyCodeLine{399 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__variables_a3a49e8f236529824956f8c5c3e147893}\label{namespacemom__variables_a3a49e8f236529824956f8c5c3e147893}} 
\index{mom\_variables@{mom\_variables}!mom\_thermovar\_chksum@{mom\_thermovar\_chksum}}
\index{mom\_thermovar\_chksum@{mom\_thermovar\_chksum}!mom\_variables@{mom\_variables}}
\doxysubsubsection{\texorpdfstring{mom\_thermovar\_chksum()}{mom\_thermovar\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+variables\+::mom\+\_\+thermovar\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G }\end{DoxyParamCaption})}



Diagnostic checksums on various elements of a \mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}} type for debugging. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mesg} & A message that appears in the checksum lines \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure pointing to various thermodynamic variables \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\end{DoxyParams}


Definition at line 533 of file M\+O\+M\+\_\+variables.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{534   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{ !< A message that appears in the checksum lines}}
\DoxyCodeLine{535   \textcolor{keywordtype}{type}(thermo\_var\_ptrs), \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various thermodynamic variables}}
\DoxyCodeLine{536   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{537 }
\DoxyCodeLine{538   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{539   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{540   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{541   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%T)) \&}
\DoxyCodeLine{542     \textcolor{keyword}{call }hchksum(tv\%T, mesg//\textcolor{stringliteral}{" tv\%T"}, g\%HI)}
\DoxyCodeLine{543   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%S)) \&}
\DoxyCodeLine{544     \textcolor{keyword}{call }hchksum(tv\%S, mesg//\textcolor{stringliteral}{" tv\%S"}, g\%HI)}
\DoxyCodeLine{545   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%frazil)) \&}
\DoxyCodeLine{546     \textcolor{keyword}{call }hchksum(tv\%frazil, mesg//\textcolor{stringliteral}{" tv\%frazil"}, g\%HI, scale=g\%US\%Q\_to\_J\_kg*g\%US\%RZ\_to\_kg\_m2)}
\DoxyCodeLine{547   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%salt\_deficit)) \&}
\DoxyCodeLine{548     \textcolor{keyword}{call }hchksum(tv\%salt\_deficit, mesg//\textcolor{stringliteral}{" tv\%salt\_deficit"}, g\%HI, scale=g\%US\%RZ\_to\_kg\_m2)}
\DoxyCodeLine{549   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%TempxPmE)) \&}
\DoxyCodeLine{550     \textcolor{keyword}{call }hchksum(tv\%TempxPmE, mesg//\textcolor{stringliteral}{" tv\%TempxPmE"}, g\%HI, scale=g\%US\%RZ\_to\_kg\_m2)}

\end{DoxyCode}
