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


\subsection{Detailed Description}
Provides transparent structures with groups of M\+O\+M6 variables and supporting routines. \subsection*{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}
\subsection*{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}


\subsection{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}}
\subsubsection{\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{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em alloc\+\_\+faces} & If present and true, allocate memory for effective face thicknesses. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
477   \textcolor{keywordtype}{type}(BT\_cont\_type),    \textcolor{keywordtype}{pointer}    :: BT\_cont\textcolor{comment}{ !< The BT\_cont\_type whose elements will be allocated}
478   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}
479   \textcolor{keywordtype}{logical},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: alloc\_faces\textcolor{comment}{ !< If present and true, allocate}
480 \textcolor{comment}{                                            !! memory for effective face thicknesses.}
481 
482   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB
483   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
484   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
485 
486   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(bt\_cont)) \textcolor{keyword}{call }mom\_error(fatal, &
487     \textcolor{stringliteral}{"alloc\_BT\_cont\_type called with an associated BT\_cont\_type pointer."})
488 
489   \textcolor{keyword}{allocate}(bt\_cont)
490   \textcolor{keyword}{allocate}(bt\_cont%FA\_u\_WW(isdb:iedb,jsd:jed)) ; bt\_cont%FA\_u\_WW(:,:) = 0.0
491   \textcolor{keyword}{allocate}(bt\_cont%FA\_u\_W0(isdb:iedb,jsd:jed)) ; bt\_cont%FA\_u\_W0(:,:) = 0.0
492   \textcolor{keyword}{allocate}(bt\_cont%FA\_u\_E0(isdb:iedb,jsd:jed)) ; bt\_cont%FA\_u\_E0(:,:) = 0.0
493   \textcolor{keyword}{allocate}(bt\_cont%FA\_u\_EE(isdb:iedb,jsd:jed)) ; bt\_cont%FA\_u\_EE(:,:) = 0.0
494   \textcolor{keyword}{allocate}(bt\_cont%uBT\_WW(isdb:iedb,jsd:jed))  ; bt\_cont%uBT\_WW(:,:) = 0.0
495   \textcolor{keyword}{allocate}(bt\_cont%uBT\_EE(isdb:iedb,jsd:jed))  ; bt\_cont%uBT\_EE(:,:) = 0.0
496 
497   \textcolor{keyword}{allocate}(bt\_cont%FA\_v\_SS(isd:ied,jsdb:jedb)) ; bt\_cont%FA\_v\_SS(:,:) = 0.0
498   \textcolor{keyword}{allocate}(bt\_cont%FA\_v\_S0(isd:ied,jsdb:jedb)) ; bt\_cont%FA\_v\_S0(:,:) = 0.0
499   \textcolor{keyword}{allocate}(bt\_cont%FA\_v\_N0(isd:ied,jsdb:jedb)) ; bt\_cont%FA\_v\_N0(:,:) = 0.0
500   \textcolor{keyword}{allocate}(bt\_cont%FA\_v\_NN(isd:ied,jsdb:jedb)) ; bt\_cont%FA\_v\_NN(:,:) = 0.0
501   \textcolor{keyword}{allocate}(bt\_cont%vBT\_SS(isd:ied,jsdb:jedb))  ; bt\_cont%vBT\_SS(:,:) = 0.0
502   \textcolor{keyword}{allocate}(bt\_cont%vBT\_NN(isd:ied,jsdb:jedb))  ; bt\_cont%vBT\_NN(:,:) = 0.0
503 
504   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(alloc\_faces)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (alloc\_faces) \textcolor{keywordflow}{then}
505     \textcolor{keyword}{allocate}(bt\_cont%h\_u(isdb:iedb,jsd:jed,1:g%ke)) ; bt\_cont%h\_u(:,:,:) = 0.0
506     \textcolor{keyword}{allocate}(bt\_cont%h\_v(isd:ied,jsdb:jedb,1:g%ke)) ; bt\_cont%h\_v(:,:,:) = 0.0
507 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}
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}}
\subsubsection{\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{\tt in}  & {\em g} & ocean grid structure\\
\hline
\mbox{\tt in,out}  & {\em sfc\+\_\+state} & ocean surface state type to be allocated.\\
\hline
\mbox{\tt in}  & {\em use\+\_\+temperature} & If true, allocate the space for thermodynamic variables.\\
\hline
\mbox{\tt in}  & {\em do\+\_\+integrals} & If true, allocate the space for vertically integrated fields.\\
\hline
\mbox{\tt in}  & {\em gas\+\_\+fields\+\_\+ocn} & If present, this type describes the ocean\\
\hline
\mbox{\tt in}  & {\em use\+\_\+meltpot} & If true, allocate the space for melt potential\\
\hline
\mbox{\tt in}  & {\em use\+\_\+iceshelves} & If true, allocate the space for the stresses under ice shelves.\\
\hline
\mbox{\tt 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 300 of file M\+O\+M\+\_\+variables.\+F90.


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


\begin{DoxyCode}
513   \textcolor{keywordtype}{type}(BT\_cont\_type), \textcolor{keywordtype}{pointer} :: BT\_cont\textcolor{comment}{ !< The BT\_cont\_type whose elements will be deallocated.}
514 
515   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(bt\_cont)) \textcolor{keywordflow}{return}
516 
517   \textcolor{keyword}{deallocate}(bt\_cont%FA\_u\_WW) ; \textcolor{keyword}{deallocate}(bt\_cont%FA\_u\_W0)
518   \textcolor{keyword}{deallocate}(bt\_cont%FA\_u\_E0) ; \textcolor{keyword}{deallocate}(bt\_cont%FA\_u\_EE)
519   \textcolor{keyword}{deallocate}(bt\_cont%uBT\_WW)  ; \textcolor{keyword}{deallocate}(bt\_cont%uBT\_EE)
520 
521   \textcolor{keyword}{deallocate}(bt\_cont%FA\_v\_SS) ; \textcolor{keyword}{deallocate}(bt\_cont%FA\_v\_S0)
522   \textcolor{keyword}{deallocate}(bt\_cont%FA\_v\_N0) ; \textcolor{keyword}{deallocate}(bt\_cont%FA\_v\_NN)
523   \textcolor{keyword}{deallocate}(bt\_cont%vBT\_SS)  ; \textcolor{keyword}{deallocate}(bt\_cont%vBT\_NN)
524 
525   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(bt\_cont%h\_u)) \textcolor{keyword}{deallocate}(bt\_cont%h\_u)
526   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(bt\_cont%h\_v)) \textcolor{keyword}{deallocate}(bt\_cont%h\_v)
527 
528   \textcolor{keyword}{deallocate}(bt\_cont)
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}}
\subsubsection{\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{\tt in,out}  & {\em sfc\+\_\+state} & ocean surface state type to be deallocated here. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
379   \textcolor{keywordtype}{type}(surface), \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< ocean surface state type to be deallocated here.}
380 
381   \textcolor{keywordflow}{if} (.not.sfc\_state%arrays\_allocated) \textcolor{keywordflow}{return}
382 
383   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%melt\_potential)) \textcolor{keyword}{deallocate}(sfc\_state%melt\_potential)
384   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%SST)) \textcolor{keyword}{deallocate}(sfc\_state%SST)
385   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%SSS)) \textcolor{keyword}{deallocate}(sfc\_state%SSS)
386   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%sfc\_density)) \textcolor{keyword}{deallocate}(sfc\_state%sfc\_density)
387   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%sea\_lev)) \textcolor{keyword}{deallocate}(sfc\_state%sea\_lev)
388   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%Hml)) \textcolor{keyword}{deallocate}(sfc\_state%Hml)
389   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%u)) \textcolor{keyword}{deallocate}(sfc\_state%u)
390   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%v)) \textcolor{keyword}{deallocate}(sfc\_state%v)
391   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%ocean\_mass)) \textcolor{keyword}{deallocate}(sfc\_state%ocean\_mass)
392   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%ocean\_heat)) \textcolor{keyword}{deallocate}(sfc\_state%ocean\_heat)
393   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%ocean\_salt)) \textcolor{keyword}{deallocate}(sfc\_state%ocean\_salt)
394   \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state%salt\_deficit)) \textcolor{keyword}{deallocate}(sfc\_state%salt\_deficit)
395 
396   \textcolor{keyword}{call }coupler\_type\_destructor(sfc\_state%tr\_fields)
397 
398   sfc\_state%arrays\_allocated = .false.
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}}
\subsubsection{\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{\tt in}  & {\em mesg} & A message that appears in the checksum lines\\
\hline
\mbox{\tt in}  & {\em tv} & A structure pointing to various thermodynamic variables\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\end{DoxyParams}


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


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