\hypertarget{namespacemom__forcing__type}{}\doxysection{mom\+\_\+forcing\+\_\+type Module Reference}
\label{namespacemom__forcing__type}\index{mom\_forcing\_type@{mom\_forcing\_type}}


\doxysubsection{Detailed Description}
This module implements boundary forcing for M\+O\+M6. 

\hypertarget{namespacemom__forcing__type_section_fluxes}{}\doxysubsection{Boundary fluxes}\label{namespacemom__forcing__type_section_fluxes}
The ocean is a forced-\/dissipative system. Forcing occurs at the boundaries, and this module mediates the various forcing terms from momentum, heat, salt, and mass. Boundary fluxes from other tracers are treated by coupling to biogeochemical models. We here present elements of how M\+O\+M6 assumes boundary fluxes are passed into the ocean.

Note that all fluxes are positive into the ocean. For surface boundary fluxes, that means fluxes are positive downward. For example, a positive shortwave flux warms the ocean.\hypertarget{namespacemom__forcing__type_subsection_momentum_fluxes}{}\doxysubsubsection{Surface boundary momentum fluxes}\label{namespacemom__forcing__type_subsection_momentum_fluxes}
The ocean surface exchanges momentum with the overlying atmosphere, sea ice, and land ice. The momentum is exchanged as a horizontal stress (Newtons per squared meter\+: N/m2) imposed on the upper ocean grid cell.\hypertarget{namespacemom__forcing__type_subsection_mass_fluxes}{}\doxysubsubsection{Surface boundary mass fluxes}\label{namespacemom__forcing__type_subsection_mass_fluxes}
The ocean gains or loses mass through evaporation, precipitation, sea ice melt/form, and and river runoff. Positive mass fluxes add mass to the liquid ocean. The boundary mass flux units are (kilogram per square meter per sec\+: kg/(m2/sec)).


\begin{DoxyItemize}
\item Evaporation field can in fact represent a mass loss (evaporation) or mass gain (condensation in foggy areas).
\item sea ice formation leads to mass moving from the liquid ocean to the ice model, and melt adds liquid to the ocean.
\item Precipitation can be liquid or frozen (snow). Furthermore, in some versions of the G\+F\+DL coupler, precipitation can be negative. The reason is that the ice model combines precipitation with ice melt and ice formation. This limitation of the ice model diagnostics should be overcome future versions.
\item River runoff can be liquid or frozen. Frozen runoff is often associated with calving land-\/ice and/or ice bergs.
\end{DoxyItemize}\hypertarget{namespacemom__forcing__type_subsection_salt_fluxes}{}\doxysubsubsection{Surface boundary salt fluxes}\label{namespacemom__forcing__type_subsection_salt_fluxes}
Over most of the ocean, there is no exchange of salt with the atmosphere. However, the liquid ocean exchanges salt with sea ice. When ice forms, it extracts salt from ice pockets and discharges the salt into the liquid ocean. The salt concentration of sea ice is therefore much lower (around 5ppt) than liquid seawater (around 30-\/35ppt in high latitudes).

For ocean-\/ice models run with a prescribed atmosphere, such as in the C\+O\+R\+E/\+O\+M\+M\+IP simulations, it is necessary to employ a surface restoring term to the k=1 salinity equation, thus imposing a salt flux onto the ocean even outside of sea ice regimes. This salt flux is non-\/physical, and represents a limitation of the ocean-\/ice models run without an interactive atmosphere. Sometimes this salt flux is converted to an implied fresh water flux. However, doing so generally leads to changes in the sea level, unless a global normalization is provided to zero-\/out the net water flux. As a complement, for models with a restoring salt flux, one may choose to zero-\/out the net salt entering the ocean. There are pros/cons of each approach.\hypertarget{namespacemom__forcing__type_subsection_heat_fluxes}{}\doxysubsubsection{Surface boundary heat fluxes}\label{namespacemom__forcing__type_subsection_heat_fluxes}
There are many terms that contribute to boundary-\/related heating of the k=1 surface model grid cell. We here outline details of this heat, with each term having units W/m2.

The net flux of heat crossing ocean surface is stored in the diagnostic array \char`\"{}hfds\char`\"{}. This array is computed as \[ \mbox{hfds = shortwave + longwave + latent + sensible + mass transfer + frazil + restore + flux adjustments} \]


\begin{DoxyItemize}
\item shortwave (SW) = shortwave radiation (always warms ocean)
\item longwave (LW) = longwave radiation (generally cools ocean)
\item latent (L\+AT) = turbulent latent heat loss due to evaporation (liquid to vapor) or melt (snow to liquid); generally cools the ocean
\item sensible (S\+E\+NS) = turbulent heat transfer due to differences in air-\/sea or ice-\/sea temperature
\item mass transfer (M\+A\+SS) = heat transfer due to heat content of mass (e.\+g., E-\/\+P+R) transferred across ocean surface; computed relative to 0 Celsius
\item frazil (F\+R\+AZ) = heat transferred to form frazil sea ice (positive heating of liquid ocean)
\item restore (R\+ES) = heat from surface damping sometimes imposed in non-\/coupled model simulations .
\item restore (flux adjustments) = heat from surface flux adjustment.
\end{DoxyItemize}\hypertarget{namespacemom__forcing__type_subsubsection_SW}{}\doxyparagraph{Treatment of shortwave}\label{namespacemom__forcing__type_subsubsection_SW}
The shortwave field itself is split into two pieces\+:


\begin{DoxyItemize}
\item shortwave = penetrative SW + non-\/penetrative SW
\item non-\/penetrative = non-\/downwelling shortwave; portion of SW totally absorbed in the k=1 cell. The non-\/penetrative SW is combined with L\+W+\+L\+A\+T+\+S\+E\+N\+S+seaice\+\_\+melt\+\_\+heat in net\+\_\+heat inside routine extract\+Fluxes1d. Notably, for many cases, non-\/penetrative SW = 0.
\item penetrative = that portion of shortwave penetrating below a tiny surface layer. This is the downwelling shortwave. Penetrative SW participates in the penetrative SW heating of k=1,nz cells, with the amount of penetration dependent on optical properties.
\end{DoxyItemize}\hypertarget{namespacemom__forcing__type_subsubsection_bdy_heating}{}\doxyparagraph{Convergence of heat into the k=1 cell}\label{namespacemom__forcing__type_subsubsection_bdy_heating}
The convergence of boundary-\/related heat into surface grid cell is given by the difference in the net heat entering the top of the k=1 cell and the penetrative SW leaving the bottom of the cell. \begin{eqnarray*} Q(k=1) &=& \mbox{hfds} - \mbox{pen}\_\mbox{SW(leaving bottom of k=1)} \\ &=& \mbox{nonpen}\_\mbox{SW} + (\mbox{pen}\_\mbox{SW(enter k=1)}-\mbox{pen}\_\mbox{SW(leave k=1)}) + \mbox{LW+LAT+SENS+MASS+FRAZ+RES} \\ &=& \mbox{nonpen}\_\mbox{SW}+ \mbox{LW+LAT+SENS+MASS+FRAZ+RES} + [\mbox{pen}\_\mbox{SW(enter k=1)} - \mbox{pen}\_\mbox{SW(leave k=1)}] \end{eqnarray*} The convergence of the penetrative shortwave flux is given by $ \mbox{pen}\_\mbox{SW (enter k)}-\mbox{pen}\_\mbox{SW (leave k)}$. This term appears for all cells k=1,nz. It is diagnosed as \char`\"{}rsdoabsorb\char`\"{} inside module M\+O\+M6/src/parameterizations/vertical/\+M\+O\+M\+\_\+diabatic\+\_\+aux.\+F90 \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\hyperlink{interfacemom__forcing__type_1_1allocate__forcing__type}{allocate\+\_\+forcing\+\_\+type}}
\begin{DoxyCompactList}\small\item\em Allocate the fields of a (flux) forcing type, based on either a set of input flags for each group of fields, or a pre-\/allocated reference forcing. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__forcing__type_1_1allocate__mech__forcing}{allocate\+\_\+mech\+\_\+forcing}}
\begin{DoxyCompactList}\small\item\em Allocate the fields of a mechanical forcing type, based on either a set of input flags for each group of fields, or a pre-\/allocated reference forcing. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}
\begin{DoxyCompactList}\small\item\em Structure that contains pointers to the boundary forcing used to drive the liquid ocean simulated by M\+OM. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__forcing__type_1_1forcing__diags}{forcing\+\_\+diags}}
\begin{DoxyCompactList}\small\item\em Structure that defines the id handles for the forcing type. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}
\begin{DoxyCompactList}\small\item\em Structure that contains pointers to the mechanical forcing at the surface used to drive the liquid ocean simulated by M\+OM. Data in this type is allocated in the module \mbox{\hyperlink{MOM__surface__forcing_8F90_source}{M\+O\+M\+\_\+surface\+\_\+forcing.\+F90}}, of which there are three versions\+: solo, coupled, and ice-\/shelf. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a6bf986155aba959222a117ca40ba7e0d}{extractfluxes1d}} (G, GV, US, fluxes, optics, nsw, j, dt, Flux\+Rescale\+Depth, use\+River\+Heat\+Content, use\+Calving\+Heat\+Content, h, T, net\+Mass\+In\+Out, net\+Mass\+Out, net\+\_\+heat, net\+\_\+salt, pen\+\_\+\+S\+W\+\_\+bnd, tv, aggregate\+\_\+\+FW, nonpen\+SW, netmass\+In\+Out\+\_\+rate, net\+\_\+\+Heat\+\_\+\+Rate, net\+\_\+salt\+\_\+rate, pen\+\_\+sw\+\_\+bnd\+\_\+\+Rate, skip\+\_\+diags)
\begin{DoxyCompactList}\small\item\em This subroutine extracts fluxes from the surface fluxes type. It works on a j-\/row for optimization purposes. The 2d (i,j) wrapper is the next subroutine below. This routine multiplies fluxes by dt, so that the result is an accumulation of fluxes over a time step. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_abb28aefef337fc656fd719eaff7a3b60}{extractfluxes2d}} (G, GV, US, fluxes, optics, nsw, dt, Flux\+Rescale\+Depth, use\+River\+Heat\+Content, use\+Calving\+Heat\+Content, h, T, net\+Mass\+In\+Out, net\+Mass\+Out, net\+\_\+heat, Net\+\_\+salt, Pen\+\_\+\+S\+W\+\_\+bnd, tv, aggregate\+\_\+\+FW)
\begin{DoxyCompactList}\small\item\em 2d wrapper for 1d extract fluxes from surface fluxes type. This subroutine extracts fluxes from the surface fluxes type. It multiplies the fluxes by dt, so that the result is an accumulation of the fluxes over a time step. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a406a512f0d5b45c873fa91110ca7c387}{calculatebuoyancyflux1d}} (G, GV, US, fluxes, optics, nsw, h, Temp, Salt, tv, j, buoyancy\+Flux, net\+Heat\+Minus\+SW, net\+Salt, skip\+\_\+diags)
\begin{DoxyCompactList}\small\item\em This routine calculates surface buoyancy flux by adding up the heat, FW \& salt fluxes. These are actual fluxes, with units of stuff per time. Setting dt=1 in the call to extract\+Fluxes routine allows us to get \char`\"{}stuf per time\char`\"{} rather than the time integrated fluxes needed in other routines that call extract\+Fluxes. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_ae84373c4a259bd04330ec673af0fa536}{calculatebuoyancyflux2d}} (G, GV, US, fluxes, optics, h, Temp, Salt, tv, buoyancy\+Flux, net\+Heat\+Minus\+SW, net\+Salt, skip\+\_\+diags)
\begin{DoxyCompactList}\small\item\em Calculates surface buoyancy flux by adding up the heat, FW and salt fluxes, for 2d arrays. This is a wrapper for calculate\+Buoyancy\+Flux1d. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a1c4ecd1a779a55e9304b0997088a4815}{mom\+\_\+forcing\+\_\+chksum}} (mesg, fluxes, G, US, haloshift)
\begin{DoxyCompactList}\small\item\em Write out chksums for thermodynamic fluxes. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_afe942ca75b30c226fdfcdedcecad920f}{mom\+\_\+mech\+\_\+forcing\+\_\+chksum}} (mesg, forces, G, US, haloshift)
\begin{DoxyCompactList}\small\item\em Write out chksums for the driving mechanical forces. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a2e3834f8d25c92142d450de74fa68f91}{mech\+\_\+forcing\+\_\+singlepointprint}} (forces, G, i, j, mesg)
\begin{DoxyCompactList}\small\item\em Write out values of the mechanical forcing arrays at the i,j location. This is a debugging tool. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a1048a8e80ebd47f83b91772c02aedba2}{forcing\+\_\+singlepointprint}} (fluxes, G, i, j, mesg)
\begin{DoxyCompactList}\small\item\em Write out values of the fluxes arrays at the i,j location. This is a debugging tool. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_ad4a8e0b876c8082f77352a25a56b86e9}{register\+\_\+forcing\+\_\+type\+\_\+diags}} (Time, diag, US, use\+\_\+temperature, handles, use\+\_\+berg\+\_\+fluxes)
\begin{DoxyCompactList}\small\item\em Register members of the forcing type for diagnostics. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_aab6d8e5da1aafc8a73875e2de61822f9}{forcing\+\_\+accumulate}} (flux\+\_\+tmp, forces, fluxes, G, wt2)
\begin{DoxyCompactList}\small\item\em Accumulate the forcing over time steps, taking input from a mechanical forcing type and a temporary forcing-\/flux type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a839c0241813c94b40b6861e2ad8bdc91}{fluxes\+\_\+accumulate}} (flux\+\_\+tmp, fluxes, G, wt2, forces)
\begin{DoxyCompactList}\small\item\em Accumulate the thermodynamic fluxes over time steps. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a44ade8a584921047fcf960f4cdb9914c}{copy\+\_\+common\+\_\+forcing\+\_\+fields}} (forces, fluxes, G, skip\+\_\+pres)
\begin{DoxyCompactList}\small\item\em This subroutine copies the computational domains of common forcing fields from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type to a (thermodynamic) forcing type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a1e4c747c49b67bb20b322c7b807de036}{set\+\_\+derived\+\_\+forcing\+\_\+fields}} (forces, fluxes, G, US, Rho0)
\begin{DoxyCompactList}\small\item\em This subroutine calculates certain derived forcing fields based on information from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type and stores them in a (thermodynamic) forcing type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a9ee72ee836f7326d0957a4094d8f0231}{set\+\_\+net\+\_\+mass\+\_\+forcing}} (fluxes, forces, G, US)
\begin{DoxyCompactList}\small\item\em This subroutine determines the net mass source to the ocean from a (thermodynamic) forcing type and stores it in a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a67f6972e0e0dd6c0b6b4bbea9ff6b5ef}{get\+\_\+net\+\_\+mass\+\_\+forcing}} (fluxes, G, US, net\+\_\+mass\+\_\+src)
\begin{DoxyCompactList}\small\item\em This subroutine calculates determines the net mass source to the ocean from a (thermodynamic) forcing type and stores it in a provided array. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_aa8ee4e3dace6d294ceb8bfe445dead1b}{copy\+\_\+back\+\_\+forcing\+\_\+fields}} (fluxes, forces, G)
\begin{DoxyCompactList}\small\item\em This subroutine copies the computational domains of common forcing fields from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type to a (thermodynamic) forcing type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a014d07725581af8ede287ea2a2322259}{mech\+\_\+forcing\+\_\+diags}} (forces\+\_\+in, dt, G, time\+\_\+end, diag, handles)
\begin{DoxyCompactList}\small\item\em Offer mechanical forcing fields for diagnostics for those fields registered as part of register\+\_\+forcing\+\_\+type\+\_\+diags. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a18fc44b1946351373f626fcc5aabc340}{forcing\+\_\+diagnostics}} (fluxes\+\_\+in, sfc\+\_\+state, G\+\_\+in, US, time\+\_\+end, diag, handles)
\begin{DoxyCompactList}\small\item\em Offer buoyancy forcing fields for diagnostics for those fields registered as part of register\+\_\+forcing\+\_\+type\+\_\+diags. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a392847be3b991a4fdda885dd759d2b78}{allocate\+\_\+forcing\+\_\+by\+\_\+group}} (G, fluxes, water, heat, ustar, press, shelf, iceberg, salt, fix\+\_\+accum\+\_\+bug)
\begin{DoxyCompactList}\small\item\em Conditionally allocate fields within the forcing type. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a9217574bff645ceeff9e15dc133a6031}{allocate\+\_\+forcing\+\_\+by\+\_\+ref}} (fluxes\+\_\+ref, G, fluxes)
\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_abd84b619cbabd15a33640be270be71a8}{allocate\+\_\+mech\+\_\+forcing\+\_\+by\+\_\+group}} (G, forces, stress, ustar, shelf, press, iceberg)
\begin{DoxyCompactList}\small\item\em Conditionally allocate fields within the mechanical forcing type using control flags. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a8b0e58eae39f6285c6e929922b5874a9}{allocate\+\_\+mech\+\_\+forcing\+\_\+from\+\_\+ref}} (forces\+\_\+ref, G, forces)
\begin{DoxyCompactList}\small\item\em Conditionally allocate fields within the mechanical forcing type based on a reference forcing. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a237dc2330bf133bf3365a924d26b0b37}{get\+\_\+forcing\+\_\+groups}} (fluxes, water, heat, ustar, press, shelf, iceberg, salt, heat\+\_\+added, buoy)
\begin{DoxyCompactList}\small\item\em Return flags indicating which groups of forcings are allocated. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_a2db9d1c071a26c092f662bd30afb2039}{get\+\_\+mech\+\_\+forcing\+\_\+groups}} (forces, stress, ustar, shelf, press, iceberg)
\begin{DoxyCompactList}\small\item\em Return flags indicating which groups of mechanical forcings are allocated. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__forcing__type_aa9a495456715378fe3dd5fb2bd21eec8}{myalloc}} (array, is, ie, js, je, flag)
\begin{DoxyCompactList}\small\item\em Allocates and zeroes-\/out array. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a432b1cbc47ab082b64bf7007a8674973}{deallocate\+\_\+forcing\+\_\+type}} (fluxes)
\begin{DoxyCompactList}\small\item\em Deallocate the forcing type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_aaadc0cd523729cb059cb62a2a224970b}{deallocate\+\_\+mech\+\_\+forcing}} (forces)
\begin{DoxyCompactList}\small\item\em Deallocate the mechanical forcing type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a904033b8a97fed683d795460b555ce9b}{rotate\+\_\+forcing}} (fluxes\+\_\+in, fluxes, turns)
\item 
subroutine, public \mbox{\hyperlink{namespacemom__forcing__type_a7b1d8f7fa2ffad01d699febbf042ac74}{rotate\+\_\+mech\+\_\+forcing}} (forces\+\_\+in, turns, forces)
\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__forcing__type_a392847be3b991a4fdda885dd759d2b78}\label{namespacemom__forcing__type_a392847be3b991a4fdda885dd759d2b78}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!allocate\_forcing\_by\_group@{allocate\_forcing\_by\_group}}
\index{allocate\_forcing\_by\_group@{allocate\_forcing\_by\_group}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{allocate\_forcing\_by\_group()}{allocate\_forcing\_by\_group()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::allocate\+\_\+forcing\+\_\+by\+\_\+group (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{logical, intent(in), optional}]{water,  }\item[{logical, intent(in), optional}]{heat,  }\item[{logical, intent(in), optional}]{ustar,  }\item[{logical, intent(in), optional}]{press,  }\item[{logical, intent(in), optional}]{shelf,  }\item[{logical, intent(in), optional}]{iceberg,  }\item[{logical, intent(in), optional}]{salt,  }\item[{logical, intent(in), optional}]{fix\+\_\+accum\+\_\+bug }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Conditionally allocate fields within the forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em water} & If present and true, allocate water fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em heat} & If present and true, allocate heat fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em ustar} & If present and true, allocate ustar and related fields \\
\hline
\mbox{\texttt{ in}}  & {\em press} & If present and true, allocate p\+\_\+surf and related fields \\
\hline
\mbox{\texttt{ in}}  & {\em shelf} & If present and true, allocate fluxes for ice-\/shelf \\
\hline
\mbox{\texttt{ in}}  & {\em iceberg} & If present and true, allocate fluxes for icebergs \\
\hline
\mbox{\texttt{ in}}  & {\em salt} & If present and true, allocate salt fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em fix\+\_\+accum\+\_\+bug} & If present and true, avoid using a bug in accumulation of ustar\+\_\+gustless \\
\hline
\end{DoxyParams}


Definition at line 2867 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2867   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{       !< Ocean grid structure}}
\DoxyCodeLine{2868   \textcolor{keywordtype}{type}(forcing),      \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{  !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2869   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: water\textcolor{comment}{   !< If present and true, allocate water fluxes}}
\DoxyCodeLine{2870   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: heat\textcolor{comment}{    !< If present and true, allocate heat fluxes}}
\DoxyCodeLine{2871   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: ustar\textcolor{comment}{   !< If present and true, allocate ustar and related fields}}
\DoxyCodeLine{2872   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: press\textcolor{comment}{   !< If present and true, allocate p\_surf and related fields}}
\DoxyCodeLine{2873   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: shelf\textcolor{comment}{   !< If present and true, allocate fluxes for ice-\/shelf}}
\DoxyCodeLine{2874   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: iceberg\textcolor{comment}{ !< If present and true, allocate fluxes for icebergs}}
\DoxyCodeLine{2875   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: salt\textcolor{comment}{    !< If present and true, allocate salt fluxes}}
\DoxyCodeLine{2876   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: fix\_accum\_bug\textcolor{comment}{ !< If present and true, avoid using a bug in}}
\DoxyCodeLine{2877 \textcolor{comment}{                                               !! accumulation of ustar\_gustless}}
\DoxyCodeLine{2878 }
\DoxyCodeLine{2879   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2880   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{2881   \textcolor{keywordtype}{logical} :: heat\_water}
\DoxyCodeLine{2882 }
\DoxyCodeLine{2883   isd  = g\%isd   ; ied  = g\%ied    ; jsd  = g\%jsd   ; jed  = g\%jed}
\DoxyCodeLine{2884   isdb = g\%IsdB  ; iedb = g\%IedB   ; jsdb = g\%JsdB  ; jedb = g\%JedB}
\DoxyCodeLine{2885 }
\DoxyCodeLine{2886   \textcolor{keyword}{call }myalloc(fluxes\%ustar,isd,ied,jsd,jed, ustar)}
\DoxyCodeLine{2887   \textcolor{keyword}{call }myalloc(fluxes\%ustar\_gustless,isd,ied,jsd,jed, ustar)}
\DoxyCodeLine{2888 }
\DoxyCodeLine{2889   \textcolor{keyword}{call }myalloc(fluxes\%evap,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2890   \textcolor{keyword}{call }myalloc(fluxes\%lprec,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2891   \textcolor{keyword}{call }myalloc(fluxes\%fprec,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2892   \textcolor{keyword}{call }myalloc(fluxes\%vprec,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2893   \textcolor{keyword}{call }myalloc(fluxes\%lrunoff,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2894   \textcolor{keyword}{call }myalloc(fluxes\%frunoff,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2895   \textcolor{keyword}{call }myalloc(fluxes\%seaice\_melt,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2896   \textcolor{keyword}{call }myalloc(fluxes\%netMassOut,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2897   \textcolor{keyword}{call }myalloc(fluxes\%netMassIn,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2898   \textcolor{keyword}{call }myalloc(fluxes\%netSalt,isd,ied,jsd,jed, water)}
\DoxyCodeLine{2899   \textcolor{keyword}{call }myalloc(fluxes\%seaice\_melt\_heat,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2900   \textcolor{keyword}{call }myalloc(fluxes\%sw,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2901   \textcolor{keyword}{call }myalloc(fluxes\%lw,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2902   \textcolor{keyword}{call }myalloc(fluxes\%latent,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2903   \textcolor{keyword}{call }myalloc(fluxes\%sens,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2904   \textcolor{keyword}{call }myalloc(fluxes\%latent\_evap\_diag,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2905   \textcolor{keyword}{call }myalloc(fluxes\%latent\_fprec\_diag,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2906   \textcolor{keyword}{call }myalloc(fluxes\%latent\_frunoff\_diag,isd,ied,jsd,jed, heat)}
\DoxyCodeLine{2907 }
\DoxyCodeLine{2908   \textcolor{keyword}{call }myalloc(fluxes\%salt\_flux,isd,ied,jsd,jed, salt)}
\DoxyCodeLine{2909 }
\DoxyCodeLine{2910   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(heat) .and. \textcolor{keyword}{present}(water)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (heat .and. water) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2911     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_cond,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2912     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_icemelt,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2913     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_lprec,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2914     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_fprec,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2915     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_vprec,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2916     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_lrunoff,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2917     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_frunoff,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2918     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_massout,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2919     \textcolor{keyword}{call }myalloc(fluxes\%heat\_content\_massin,isd,ied,jsd,jed, .true.)}
\DoxyCodeLine{2920 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2921 }
\DoxyCodeLine{2922   \textcolor{keyword}{call }myalloc(fluxes\%p\_surf,isd,ied,jsd,jed, press)}
\DoxyCodeLine{2923 }
\DoxyCodeLine{2924   \textcolor{keyword}{call }myalloc(fluxes\%frac\_shelf\_h,isd,ied,jsd,jed, shelf)}
\DoxyCodeLine{2925   \textcolor{keyword}{call }myalloc(fluxes\%ustar\_shelf,isd,ied,jsd,jed, shelf)}
\DoxyCodeLine{2926   \textcolor{keyword}{call }myalloc(fluxes\%iceshelf\_melt,isd,ied,jsd,jed, shelf)}
\DoxyCodeLine{2927 }
\DoxyCodeLine{2928   \textcolor{comment}{!These fields should only on allocated when iceberg area is being passed through the coupler.}}
\DoxyCodeLine{2929   \textcolor{keyword}{call }myalloc(fluxes\%ustar\_berg,isd,ied,jsd,jed, iceberg)}
\DoxyCodeLine{2930   \textcolor{keyword}{call }myalloc(fluxes\%area\_berg,isd,ied,jsd,jed, iceberg)}
\DoxyCodeLine{2931   \textcolor{keyword}{call }myalloc(fluxes\%mass\_berg,isd,ied,jsd,jed, iceberg)}
\DoxyCodeLine{2932 }
\DoxyCodeLine{2933   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(fix\_accum\_bug)) fluxes\%gustless\_accum\_bug = .not.fix\_accum\_bug}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a9217574bff645ceeff9e15dc133a6031}\label{namespacemom__forcing__type_a9217574bff645ceeff9e15dc133a6031}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!allocate\_forcing\_by\_ref@{allocate\_forcing\_by\_ref}}
\index{allocate\_forcing\_by\_ref@{allocate\_forcing\_by\_ref}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{allocate\_forcing\_by\_ref()}{allocate\_forcing\_by\_ref()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::allocate\+\_\+forcing\+\_\+by\+\_\+ref (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes\+\_\+ref,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(out)}]{fluxes }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes\+\_\+ref} & Reference fluxes\\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid metric of target fluxes\\
\hline
\mbox{\texttt{ out}}  & {\em fluxes} & Target fluxes \\
\hline
\end{DoxyParams}


Definition at line 2938 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2938   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(in)} :: fluxes\_ref\textcolor{comment}{  !< Reference fluxes}}
\DoxyCodeLine{2939   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{        !< Grid metric of target fluxes}}
\DoxyCodeLine{2940   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(out)} :: fluxes\textcolor{comment}{     !< Target fluxes}}
\DoxyCodeLine{2941 }
\DoxyCodeLine{2942   \textcolor{keywordtype}{logical} :: do\_ustar, do\_water, do\_heat, do\_salt, do\_press, do\_shelf, \&}
\DoxyCodeLine{2943       do\_iceberg, do\_heat\_added, do\_buoy}
\DoxyCodeLine{2944 }
\DoxyCodeLine{2945   \textcolor{keyword}{call }get\_forcing\_groups(fluxes\_ref, do\_water, do\_heat, do\_ustar, do\_press, \&}
\DoxyCodeLine{2946       do\_shelf, do\_iceberg, do\_salt, do\_heat\_added, do\_buoy)}
\DoxyCodeLine{2947 }
\DoxyCodeLine{2948   \textcolor{keyword}{call }allocate\_forcing\_type(g, fluxes, do\_water, do\_heat, do\_ustar, \&}
\DoxyCodeLine{2949       do\_press, do\_shelf, do\_iceberg, do\_salt)}
\DoxyCodeLine{2950 }
\DoxyCodeLine{2951   \textcolor{comment}{! The following fluxes would typically be allocated by the driver}}
\DoxyCodeLine{2952   \textcolor{keyword}{call }myalloc(fluxes\%sw\_vis\_dir, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2953       \textcolor{keyword}{associated}(fluxes\_ref\%sw\_vis\_dir))}
\DoxyCodeLine{2954   \textcolor{keyword}{call }myalloc(fluxes\%sw\_vis\_dif, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2955       \textcolor{keyword}{associated}(fluxes\_ref\%sw\_vis\_dif))}
\DoxyCodeLine{2956   \textcolor{keyword}{call }myalloc(fluxes\%sw\_nir\_dir, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2957       \textcolor{keyword}{associated}(fluxes\_ref\%sw\_nir\_dir))}
\DoxyCodeLine{2958   \textcolor{keyword}{call }myalloc(fluxes\%sw\_nir\_dif, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2959       \textcolor{keyword}{associated}(fluxes\_ref\%sw\_nir\_dif))}
\DoxyCodeLine{2960 }
\DoxyCodeLine{2961   \textcolor{keyword}{call }myalloc(fluxes\%salt\_flux\_in, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2962       \textcolor{keyword}{associated}(fluxes\_ref\%salt\_flux\_in))}
\DoxyCodeLine{2963   \textcolor{keyword}{call }myalloc(fluxes\%salt\_flux\_added, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2964       \textcolor{keyword}{associated}(fluxes\_ref\%salt\_flux\_added))}
\DoxyCodeLine{2965 }
\DoxyCodeLine{2966   \textcolor{keyword}{call }myalloc(fluxes\%p\_surf\_full, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2967       \textcolor{keyword}{associated}(fluxes\_ref\%p\_surf\_full))}
\DoxyCodeLine{2968 }
\DoxyCodeLine{2969   \textcolor{keyword}{call }myalloc(fluxes\%heat\_added, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2970       \textcolor{keyword}{associated}(fluxes\_ref\%heat\_added))}
\DoxyCodeLine{2971   \textcolor{keyword}{call }myalloc(fluxes\%buoy, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2972       \textcolor{keyword}{associated}(fluxes\_ref\%buoy))}
\DoxyCodeLine{2973 }
\DoxyCodeLine{2974   \textcolor{keyword}{call }myalloc(fluxes\%TKE\_tidal, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2975       \textcolor{keyword}{associated}(fluxes\_ref\%TKE\_tidal))}
\DoxyCodeLine{2976   \textcolor{keyword}{call }myalloc(fluxes\%ustar\_tidal, g\%isd, g\%ied, g\%jsd, g\%jed, \&}
\DoxyCodeLine{2977       \textcolor{keyword}{associated}(fluxes\_ref\%ustar\_tidal))}
\DoxyCodeLine{2978 }
\DoxyCodeLine{2979   \textcolor{comment}{! This flag would normally be set by a control flag in allocate\_forcing\_type.}}
\DoxyCodeLine{2980   \textcolor{comment}{! Here we copy the flag from the reference forcing.}}
\DoxyCodeLine{2981   fluxes\%gustless\_accum\_bug = fluxes\_ref\%gustless\_accum\_bug}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_abd84b619cbabd15a33640be270be71a8}\label{namespacemom__forcing__type_abd84b619cbabd15a33640be270be71a8}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!allocate\_mech\_forcing\_by\_group@{allocate\_mech\_forcing\_by\_group}}
\index{allocate\_mech\_forcing\_by\_group@{allocate\_mech\_forcing\_by\_group}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{allocate\_mech\_forcing\_by\_group()}{allocate\_mech\_forcing\_by\_group()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::allocate\+\_\+mech\+\_\+forcing\+\_\+by\+\_\+group (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(inout)}]{forces,  }\item[{logical, intent(in), optional}]{stress,  }\item[{logical, intent(in), optional}]{ustar,  }\item[{logical, intent(in), optional}]{shelf,  }\item[{logical, intent(in), optional}]{press,  }\item[{logical, intent(in), optional}]{iceberg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Conditionally allocate fields within the mechanical forcing type using control flags. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em forces} & Forcing fields structure \\
\hline
\mbox{\texttt{ in}}  & {\em stress} & If present and true, allocate taux, tauy \\
\hline
\mbox{\texttt{ in}}  & {\em ustar} & If present and true, allocate ustar and related fields \\
\hline
\mbox{\texttt{ in}}  & {\em shelf} & If present and true, allocate forces for ice-\/shelf \\
\hline
\mbox{\texttt{ in}}  & {\em press} & If present and true, allocate p\+\_\+surf and related fields \\
\hline
\mbox{\texttt{ in}}  & {\em iceberg} & If present and true, allocate forces for icebergs \\
\hline
\end{DoxyParams}


Definition at line 2989 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2989   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{       !< Ocean grid structure}}
\DoxyCodeLine{2990   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{  !< Forcing fields structure}}
\DoxyCodeLine{2991 }
\DoxyCodeLine{2992   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: stress\textcolor{comment}{  !< If present and true, allocate taux, tauy}}
\DoxyCodeLine{2993   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: ustar\textcolor{comment}{   !< If present and true, allocate ustar and related fields}}
\DoxyCodeLine{2994   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: shelf\textcolor{comment}{   !< If present and true, allocate forces for ice-\/shelf}}
\DoxyCodeLine{2995   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: press\textcolor{comment}{   !< If present and true, allocate p\_surf and related fields}}
\DoxyCodeLine{2996   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},     \textcolor{keywordtype}{intent(in)} :: iceberg\textcolor{comment}{ !< If present and true, allocate forces for icebergs}}
\DoxyCodeLine{2997 }
\DoxyCodeLine{2998   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{2999   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{3000   \textcolor{keywordtype}{logical} :: heat\_water}
\DoxyCodeLine{3001 }
\DoxyCodeLine{3002   isd  = g\%isd   ; ied  = g\%ied    ; jsd  = g\%jsd   ; jed  = g\%jed}
\DoxyCodeLine{3003   isdb = g\%IsdB  ; iedb = g\%IedB   ; jsdb = g\%JsdB  ; jedb = g\%JedB}
\DoxyCodeLine{3004 }
\DoxyCodeLine{3005   \textcolor{keyword}{call }myalloc(forces\%taux,isdb,iedb,jsd,jed, stress)}
\DoxyCodeLine{3006   \textcolor{keyword}{call }myalloc(forces\%tauy,isd,ied,jsdb,jedb, stress)}
\DoxyCodeLine{3007 }
\DoxyCodeLine{3008   \textcolor{keyword}{call }myalloc(forces\%ustar,isd,ied,jsd,jed, ustar)}
\DoxyCodeLine{3009 }
\DoxyCodeLine{3010   \textcolor{keyword}{call }myalloc(forces\%p\_surf,isd,ied,jsd,jed, press)}
\DoxyCodeLine{3011   \textcolor{keyword}{call }myalloc(forces\%p\_surf\_full,isd,ied,jsd,jed, press)}
\DoxyCodeLine{3012   \textcolor{keyword}{call }myalloc(forces\%net\_mass\_src,isd,ied,jsd,jed, press)}
\DoxyCodeLine{3013 }
\DoxyCodeLine{3014   \textcolor{keyword}{call }myalloc(forces\%rigidity\_ice\_u,isdb,iedb,jsd,jed, shelf)}
\DoxyCodeLine{3015   \textcolor{keyword}{call }myalloc(forces\%rigidity\_ice\_v,isd,ied,jsdb,jedb, shelf)}
\DoxyCodeLine{3016   \textcolor{keyword}{call }myalloc(forces\%frac\_shelf\_u,isdb,iedb,jsd,jed, shelf)}
\DoxyCodeLine{3017   \textcolor{keyword}{call }myalloc(forces\%frac\_shelf\_v,isd,ied,jsdb,jedb, shelf)}
\DoxyCodeLine{3018 }
\DoxyCodeLine{3019   \textcolor{comment}{!These fields should only on allocated when iceberg area is being passed through the coupler.}}
\DoxyCodeLine{3020   \textcolor{keyword}{call }myalloc(forces\%area\_berg,isd,ied,jsd,jed, iceberg)}
\DoxyCodeLine{3021   \textcolor{keyword}{call }myalloc(forces\%mass\_berg,isd,ied,jsd,jed, iceberg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a8b0e58eae39f6285c6e929922b5874a9}\label{namespacemom__forcing__type_a8b0e58eae39f6285c6e929922b5874a9}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!allocate\_mech\_forcing\_from\_ref@{allocate\_mech\_forcing\_from\_ref}}
\index{allocate\_mech\_forcing\_from\_ref@{allocate\_mech\_forcing\_from\_ref}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{allocate\_mech\_forcing\_from\_ref()}{allocate\_mech\_forcing\_from\_ref()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::allocate\+\_\+mech\+\_\+forcing\+\_\+from\+\_\+ref (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces\+\_\+ref,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(out)}]{forces }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Conditionally allocate fields within the mechanical forcing type based on a reference forcing. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces\+\_\+ref} & Reference forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid metric of target forcing \\
\hline
\mbox{\texttt{ out}}  & {\em forces} & Mechanical forcing fields \\
\hline
\end{DoxyParams}


Definition at line 3028 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3028   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(in)} :: forces\_ref\textcolor{comment}{  !< Reference forcing fields}}
\DoxyCodeLine{3029   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{      !< Grid metric of target forcing}}
\DoxyCodeLine{3030   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(out)} :: forces\textcolor{comment}{   !< Mechanical forcing fields}}
\DoxyCodeLine{3031 }
\DoxyCodeLine{3032   \textcolor{keywordtype}{logical} :: do\_stress, do\_ustar, do\_shelf, do\_press, do\_iceberg}
\DoxyCodeLine{3033 }
\DoxyCodeLine{3034   \textcolor{comment}{! Identify the active fields in the reference forcing}}
\DoxyCodeLine{3035   \textcolor{keyword}{call }get\_mech\_forcing\_groups(forces\_ref, do\_stress, do\_ustar, do\_shelf, \&}
\DoxyCodeLine{3036                               do\_press, do\_iceberg)}
\DoxyCodeLine{3037 }
\DoxyCodeLine{3038   \textcolor{keyword}{call }allocate\_mech\_forcing(g, forces, do\_stress, do\_ustar, do\_shelf, \&}
\DoxyCodeLine{3039                              do\_press, do\_iceberg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a406a512f0d5b45c873fa91110ca7c387}\label{namespacemom__forcing__type_a406a512f0d5b45c873fa91110ca7c387}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!calculatebuoyancyflux1d@{calculatebuoyancyflux1d}}
\index{calculatebuoyancyflux1d@{calculatebuoyancyflux1d}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{calculatebuoyancyflux1d()}{calculatebuoyancyflux1d()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::calculatebuoyancyflux1d (\begin{DoxyParamCaption}\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(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(optics\+\_\+type), pointer}]{optics,  }\item[{integer, intent(in)}]{nsw,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{Temp,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{Salt,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{integer, intent(in)}]{j,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%ke+1), intent(inout)}]{buoyancy\+Flux,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(inout)}]{net\+Heat\+Minus\+SW,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(inout)}]{net\+Salt,  }\item[{logical, intent(in), optional}]{skip\+\_\+diags }\end{DoxyParamCaption})}



This routine calculates surface buoyancy flux by adding up the heat, FW \& salt fluxes. These are actual fluxes, with units of stuff per time. Setting dt=1 in the call to extract\+Fluxes routine allows us to get \char`\"{}stuf per time\char`\"{} rather than the time integrated fluxes needed in other routines that call extract\+Fluxes. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & ocean grid \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & surface fluxes \\
\hline
 & {\em optics} & penetrating SW optics \\
\hline
\mbox{\texttt{ in}}  & {\em nsw} & The number of frequency bands of penetrating shortwave radiation \\
\hline
\mbox{\texttt{ in}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em temp} & prognostic temp \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em salt} & salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em tv} & thermodynamics type \\
\hline
\mbox{\texttt{ in}}  & {\em j} & j-\/row to work on \\
\hline
\mbox{\texttt{ in,out}}  & {\em buoyancyflux} & buoyancy fluxes \mbox{[}L2 T-\/3 $\sim$$>$ m2 s-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em netheatminussw} & surf Heat flux \mbox{[}degC H s-\/1 $\sim$$>$ degC m s-\/1 or degC kg m-\/2 s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em netsalt} & surf salt flux \mbox{[}ppt H s-\/1 $\sim$$>$ ppt m s-\/1 or ppt kg m-\/2 s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em skip\+\_\+diags} & If present and true, skip calculating diagnostics inside extract\+Fluxes1d() \\
\hline
\end{DoxyParams}


Definition at line 889 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{889   \textcolor{keywordtype}{type}(ocean\_grid\_type),                    \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{              !< ocean grid}}
\DoxyCodeLine{890   \textcolor{keywordtype}{type}(verticalGrid\_type),                  \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{             !< ocean vertical grid structure}}
\DoxyCodeLine{891   \textcolor{keywordtype}{type}(unit\_scale\_type),                    \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{             !< A dimensional unit scaling type}}
\DoxyCodeLine{892   \textcolor{keywordtype}{type}(forcing),                            \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{         !< surface fluxes}}
\DoxyCodeLine{893   \textcolor{keywordtype}{type}(optics\_type),                        \textcolor{keywordtype}{pointer}       :: optics\textcolor{comment}{         !< penetrating SW optics}}
\DoxyCodeLine{894   \textcolor{keywordtype}{integer},                                  \textcolor{keywordtype}{intent(in)}    :: nsw\textcolor{comment}{            !< The number of frequency bands of}}
\DoxyCodeLine{895 \textcolor{comment}{                                                                            !! penetrating shortwave radiation}}
\DoxyCodeLine{896 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{              !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{897 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}    :: Temp\textcolor{comment}{           !< prognostic temp [degC]}}
\DoxyCodeLine{898 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)}    :: Salt\textcolor{comment}{           !< salinity [ppt]}}
\DoxyCodeLine{899   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                    \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{             !< thermodynamics type}}
\DoxyCodeLine{900   \textcolor{keywordtype}{integer},                                  \textcolor{keywordtype}{intent(in)}    :: j\textcolor{comment}{              !< j-\/row to work on}}
\DoxyCodeLine{901 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G)+1)},       \textcolor{keywordtype}{intent(inout)} :: buoyancyFlux\textcolor{comment}{   !< buoyancy fluxes [L2 T-\/3 \string~> m2 s-\/3]}}
\DoxyCodeLine{902 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))},                 \textcolor{keywordtype}{intent(inout)} :: netHeatMinusSW\textcolor{comment}{ !< surf Heat flux}}
\DoxyCodeLine{903 \textcolor{comment}{                                                                      !! [degC H s-\/1 \string~> degC m s-\/1 or degC kg m-\/2 s-\/1]}}
\DoxyCodeLine{904 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))},                 \textcolor{keywordtype}{intent(inout)} :: netSalt\textcolor{comment}{        !< surf salt flux}}
\DoxyCodeLine{905 \textcolor{comment}{                                                                      !! [ppt H s-\/1 \string~> ppt m s-\/1 or ppt kg m-\/2 s-\/1]}}
\DoxyCodeLine{906   \textcolor{keywordtype}{logical},                        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: skip\_diags\textcolor{comment}{     !< If present and true, skip calculating}}
\DoxyCodeLine{907 \textcolor{comment}{                                                                            !! diagnostics inside extractFluxes1d()}}
\DoxyCodeLine{908   \textcolor{comment}{! local variables}}
\DoxyCodeLine{909   \textcolor{keywordtype}{integer}                               :: k}
\DoxyCodeLine{910 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{parameter}                       :: dt = 1.    \textcolor{comment}{! to return a rate from extractFluxes1d}}
\DoxyCodeLine{911 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: netH       \textcolor{comment}{! net FW flux [H s-\/1 \string~> m s-\/1 or kg m-\/2 s-\/1]}}
\DoxyCodeLine{912 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: netEvap    \textcolor{comment}{! net FW flux leaving ocean via evaporation}}
\DoxyCodeLine{913                                                       \textcolor{comment}{! [H s-\/1 \string~> m s-\/1 or kg m-\/2 s-\/1]}}
\DoxyCodeLine{914 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: netHeat    \textcolor{comment}{! net temp flux [degC H s-\/1 \string~> degC m s-\/2 or degC kg m-\/2 s-\/1]}}
\DoxyCodeLine{915 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(max(nsw,1), SZI\_(G))}  :: penSWbnd   \textcolor{comment}{! penetrating SW radiation by band}}
\DoxyCodeLine{916                                                       \textcolor{comment}{! [degC H \string~> degC m or degC kg m-\/2]}}
\DoxyCodeLine{917 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: pressure   \textcolor{comment}{! pressure at the surface [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{918 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: dRhodT     \textcolor{comment}{! density partial derivative wrt temp [R degC-\/1 \string~> kg m-\/3 degC-\/1]}}
\DoxyCodeLine{919 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}              :: dRhodS     \textcolor{comment}{! density partial derivative wrt saln [R ppt-\/1 \string~> kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{920 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G)+1)}    :: netPen     \textcolor{comment}{! The net penetrating shortwave radiation at each level}}
\DoxyCodeLine{921                                                       \textcolor{comment}{! [degC H \string~> degC m or degC kg m-\/2]}}
\DoxyCodeLine{922 }
\DoxyCodeLine{923   \textcolor{keywordtype}{logical} :: useRiverHeatContent}
\DoxyCodeLine{924   \textcolor{keywordtype}{logical} :: useCalvingHeatContent}
\DoxyCodeLine{925 \textcolor{keywordtype}{  real}    :: depthBeforeScalingFluxes  \textcolor{comment}{! A depth scale [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{926 \textcolor{keywordtype}{  real}    :: GoRho \textcolor{comment}{! The gravitational acceleration divided by mean density times some}}
\DoxyCodeLine{927                    \textcolor{comment}{! unit conversion factors [L2 H-\/1 s R-\/1 T-\/3 \string~> m4 kg-\/1 s-\/2 or m7 kg-\/2 s-\/2]}}
\DoxyCodeLine{928 \textcolor{keywordtype}{  real}    :: H\_limit\_fluxes            \textcolor{comment}{! Another depth scale [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{929   \textcolor{keywordtype}{integer} :: i}
\DoxyCodeLine{930 }
\DoxyCodeLine{931   \textcolor{comment}{!  smg: what do we do when have heat fluxes from calving and river?}}
\DoxyCodeLine{932   useriverheatcontent   = .false.}
\DoxyCodeLine{933   usecalvingheatcontent = .false.}
\DoxyCodeLine{934 }
\DoxyCodeLine{935   depthbeforescalingfluxes = max( gv\%Angstrom\_H, 1.e-\/30*gv\%m\_to\_H )}
\DoxyCodeLine{936   pressure(:) = 0.}
\DoxyCodeLine{937   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%p\_surf)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec ; pressure(i) = tv\%p\_surf(i,j) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{938   gorho       = (gv\%g\_Earth * gv\%H\_to\_Z*us\%T\_to\_s) / gv\%Rho0}
\DoxyCodeLine{939 }
\DoxyCodeLine{940   h\_limit\_fluxes = depthbeforescalingfluxes}
\DoxyCodeLine{941 }
\DoxyCodeLine{942   \textcolor{comment}{! The surface forcing is contained in the fluxes type.}}
\DoxyCodeLine{943   \textcolor{comment}{! We aggregate the thermodynamic forcing for a time step into the following:}}
\DoxyCodeLine{944   \textcolor{comment}{! netH       = water added/removed via surface fluxes [H s-\/1 \string~> m s-\/1 or kg m-\/2 s-\/1]}}
\DoxyCodeLine{945   \textcolor{comment}{! netHeat    = heat via surface fluxes [degC H s-\/1 \string~> degC m s-\/1 or degC kg m-\/2 s-\/1]}}
\DoxyCodeLine{946   \textcolor{comment}{! netSalt    = salt via surface fluxes [ppt H s-\/1 \string~> ppt m s-\/1 or gSalt m-\/2 s-\/1]}}
\DoxyCodeLine{947   \textcolor{comment}{! Note that unlike other calls to extractFLuxes1d() that return the time-\/integrated flux}}
\DoxyCodeLine{948   \textcolor{comment}{! this call returns the rate because dt=1}}
\DoxyCodeLine{949   \textcolor{keyword}{call }extractfluxes1d(g, gv, us, fluxes, optics, nsw, j, dt*us\%s\_to\_T,               \&}
\DoxyCodeLine{950                 depthbeforescalingfluxes, useriverheatcontent, usecalvingheatcontent, \&}
\DoxyCodeLine{951                 h(:,j,:), temp(:,j,:), neth, netevap, netheatminussw,                 \&}
\DoxyCodeLine{952                 netsalt, penswbnd, tv, .false., skip\_diags=skip\_diags)}
\DoxyCodeLine{953 }
\DoxyCodeLine{954   \textcolor{comment}{! Sum over bands and attenuate as a function of depth}}
\DoxyCodeLine{955   \textcolor{comment}{! netPen is the netSW as a function of depth}}
\DoxyCodeLine{956   \textcolor{keyword}{call }sumswoverbands(g, gv, us, h(:,j,:), optics\_nbands(optics), optics, j, dt*us\%s\_to\_T, \&}
\DoxyCodeLine{957                       h\_limit\_fluxes, .true., penswbnd, netpen)}
\DoxyCodeLine{958 }
\DoxyCodeLine{959   \textcolor{comment}{! Density derivatives}}
\DoxyCodeLine{960   \textcolor{keyword}{call }calculate\_density\_derivs(temp(:,j,1), salt(:,j,1), pressure, drhodt, drhods, \&}
\DoxyCodeLine{961                                 tv\%eqn\_of\_state, eos\_domain(g\%HI))}
\DoxyCodeLine{962 }
\DoxyCodeLine{963   \textcolor{comment}{! Adjust netSalt to reflect dilution effect of FW flux}}
\DoxyCodeLine{964   netsalt(g\%isc:g\%iec) = netsalt(g\%isc:g\%iec) -\/ salt(g\%isc:g\%iec,j,1) * neth(g\%isc:g\%iec) \textcolor{comment}{! ppt H/s}}
\DoxyCodeLine{965 }
\DoxyCodeLine{966   \textcolor{comment}{! Add in the SW heating for purposes of calculating the net}}
\DoxyCodeLine{967   \textcolor{comment}{! surface buoyancy flux affecting the top layer.}}
\DoxyCodeLine{968   \textcolor{comment}{!netHeat(:) = netHeatMinusSW(:) + sum( penSWbnd, dim=1 )}}
\DoxyCodeLine{969   netheat(g\%isc:g\%iec) = netheatminussw(g\%isc:g\%iec) + netpen(g\%isc:g\%iec,1) \textcolor{comment}{! K H/s}}
\DoxyCodeLine{970 }
\DoxyCodeLine{971   \textcolor{comment}{! Convert to a buoyancy flux, excluding penetrating SW heating}}
\DoxyCodeLine{972   buoyancyflux(g\%isc:g\%iec,1) = -\/ gorho * ( drhods(g\%isc:g\%iec) * netsalt(g\%isc:g\%iec) + \&}
\DoxyCodeLine{973                                              drhodt(g\%isc:g\%iec) * netheat(g\%isc:g\%iec) ) \textcolor{comment}{! [L2 T-\/3 \string~> m2 s-\/3]}}
\DoxyCodeLine{974   \textcolor{comment}{! We also have a penetrative buoyancy flux associated with penetrative SW}}
\DoxyCodeLine{975   \textcolor{keywordflow}{do} k=2, g\%ke+1}
\DoxyCodeLine{976     buoyancyflux(g\%isc:g\%iec,k) = -\/ gorho * ( drhodt(g\%isc:g\%iec) * netpen(g\%isc:g\%iec,k) ) \textcolor{comment}{! [L2 T-\/3 \string~> m2 s-\/3]}}
\DoxyCodeLine{977 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{978 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_ae84373c4a259bd04330ec673af0fa536}\label{namespacemom__forcing__type_ae84373c4a259bd04330ec673af0fa536}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!calculatebuoyancyflux2d@{calculatebuoyancyflux2d}}
\index{calculatebuoyancyflux2d@{calculatebuoyancyflux2d}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{calculatebuoyancyflux2d()}{calculatebuoyancyflux2d()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::calculatebuoyancyflux2d (\begin{DoxyParamCaption}\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(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(optics\+\_\+type), pointer}]{optics,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{Temp,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{Salt,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke+1), intent(inout)}]{buoyancy\+Flux,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(inout), optional}]{net\+Heat\+Minus\+SW,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(inout), optional}]{net\+Salt,  }\item[{logical, intent(in), optional}]{skip\+\_\+diags }\end{DoxyParamCaption})}



Calculates surface buoyancy flux by adding up the heat, FW and salt fluxes, for 2d arrays. This is a wrapper for calculate\+Buoyancy\+Flux1d. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & ocean grid \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & surface fluxes \\
\hline
 & {\em optics} & SW ocean optics \\
\hline
\mbox{\texttt{ in}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em temp} & temperature \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em salt} & salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em tv} & thermodynamics type \\
\hline
\mbox{\texttt{ in,out}}  & {\em buoyancyflux} & buoyancy fluxes \mbox{[}L2 T-\/3 $\sim$$>$ m2 s-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em netheatminussw} & surf temp flux \mbox{[}degC H $\sim$$>$ degC m or degC kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em netsalt} & surf salt flux \mbox{[}ppt H $\sim$$>$ ppt m or ppt kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em skip\+\_\+diags} & If present and true, skip calculating diagnostics inside extract\+Fluxes1d() \\
\hline
\end{DoxyParams}


Definition at line 986 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{986   \textcolor{keywordtype}{type}(ocean\_grid\_type),                      \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{      !< ocean grid}}
\DoxyCodeLine{987   \textcolor{keywordtype}{type}(verticalGrid\_type),                    \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{     !< ocean vertical grid structure}}
\DoxyCodeLine{988   \textcolor{keywordtype}{type}(unit\_scale\_type),                      \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{     !< A dimensional unit scaling type}}
\DoxyCodeLine{989   \textcolor{keywordtype}{type}(forcing),                              \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< surface fluxes}}
\DoxyCodeLine{990   \textcolor{keywordtype}{type}(optics\_type),                          \textcolor{keywordtype}{pointer}       :: optics\textcolor{comment}{ !< SW ocean optics}}
\DoxyCodeLine{991 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},   \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{      !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{992 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},   \textcolor{keywordtype}{intent(in)}    :: Temp\textcolor{comment}{   !< temperature [degC]}}
\DoxyCodeLine{993 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},   \textcolor{keywordtype}{intent(in)}    :: Salt\textcolor{comment}{   !< salinity [ppt]}}
\DoxyCodeLine{994   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),                      \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{     !< thermodynamics type}}
\DoxyCodeLine{995 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G)+1)}, \textcolor{keywordtype}{intent(inout)} :: buoyancyFlux\textcolor{comment}{   !< buoyancy fluxes [L2 T-\/3 \string~> m2 s-\/3]}}
\DoxyCodeLine{996 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: netHeatMinusSW\textcolor{comment}{ !< surf temp flux}}
\DoxyCodeLine{997 \textcolor{comment}{                                                                              !! [degC H \string~> degC m or degC kg m-\/2]}}
\DoxyCodeLine{998 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: netSalt\textcolor{comment}{        !< surf salt flux}}
\DoxyCodeLine{999 \textcolor{comment}{                                                                              !! [ppt H \string~> ppt m or ppt kg m-\/2]}}
\DoxyCodeLine{1000   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},                          \textcolor{keywordtype}{intent(in)}    :: skip\_diags\textcolor{comment}{     !< If present and true, skip calculating}}
\DoxyCodeLine{1001 \textcolor{comment}{                                                                              !! diagnostics inside extractFluxes1d()}}
\DoxyCodeLine{1002   \textcolor{comment}{! local variables}}
\DoxyCodeLine{1003 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension( SZI\_(G) )} :: netT \textcolor{comment}{! net temperature flux [degC H s-\/1 \string~> degC m s-\/2 or degC kg m-\/2 s-\/1]}}
\DoxyCodeLine{1004 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension( SZI\_(G) )} :: netS \textcolor{comment}{! net saln flux !! [ppt H s-\/1 \string~> ppt m s-\/1 or ppt kg m-\/2 s-\/1]}}
\DoxyCodeLine{1005   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{1006 }
\DoxyCodeLine{1007   nett(g\%isc:g\%iec) = 0. ; nets(g\%isc:g\%iec) = 0.}
\DoxyCodeLine{1008 }
\DoxyCodeLine{1009   \textcolor{comment}{!\$OMP parallel do default(shared) firstprivate(netT,netS)}}
\DoxyCodeLine{1010   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec}
\DoxyCodeLine{1011     \textcolor{keyword}{call }calculatebuoyancyflux1d(g, gv, us, fluxes, optics, optics\_nbands(optics), h, temp, salt, \&}
\DoxyCodeLine{1012                                  tv, j, buoyancyflux(:,j,:), nett, nets, skip\_diags=skip\_diags)}
\DoxyCodeLine{1013     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(netheatminussw)) netheatminussw(g\%isc:g\%iec,j) = nett(g\%isc:g\%iec)}
\DoxyCodeLine{1014     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(netsalt)) netsalt(g\%isc:g\%iec,j) = nets(g\%isc:g\%iec)}
\DoxyCodeLine{1015 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{1016 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_aa8ee4e3dace6d294ceb8bfe445dead1b}\label{namespacemom__forcing__type_aa8ee4e3dace6d294ceb8bfe445dead1b}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!copy\_back\_forcing\_fields@{copy\_back\_forcing\_fields}}
\index{copy\_back\_forcing\_fields@{copy\_back\_forcing\_fields}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{copy\_back\_forcing\_fields()}{copy\_back\_forcing\_fields()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::copy\+\_\+back\+\_\+forcing\+\_\+fields (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(inout)}]{forces,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G }\end{DoxyParamCaption})}



This subroutine copies the computational domains of common forcing fields from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type to a (thermodynamic) forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\end{DoxyParams}


Definition at line 2199 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2199   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)}    :: fluxes\textcolor{comment}{   !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2200   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{   !< A structure with the driving mechanical forces}}
\DoxyCodeLine{2201   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{        !< grid type}}
\DoxyCodeLine{2202 }
\DoxyCodeLine{2203   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{2204   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2205 }
\DoxyCodeLine{2206   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%ustar) .and. \textcolor{keyword}{associated}(fluxes\%ustar)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2207     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2208       forces\%ustar(i,j) = fluxes\%ustar(i,j)}
\DoxyCodeLine{2209 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2210 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2211 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a44ade8a584921047fcf960f4cdb9914c}\label{namespacemom__forcing__type_a44ade8a584921047fcf960f4cdb9914c}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!copy\_common\_forcing\_fields@{copy\_common\_forcing\_fields}}
\index{copy\_common\_forcing\_fields@{copy\_common\_forcing\_fields}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{copy\_common\_forcing\_fields()}{copy\_common\_forcing\_fields()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::copy\+\_\+common\+\_\+forcing\+\_\+fields (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{logical, intent(in), optional}]{skip\+\_\+pres }\end{DoxyParamCaption})}



This subroutine copies the computational domains of common forcing fields from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type to a (thermodynamic) forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\mbox{\texttt{ in}}  & {\em skip\+\_\+pres} & If present and true, do not copy pressure fields. \\
\hline
\end{DoxyParams}


Definition at line 2061 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2061   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(in)}    :: forces\textcolor{comment}{   !< A structure with the driving mechanical forces}}
\DoxyCodeLine{2062   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{   !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2063   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{        !< grid type}}
\DoxyCodeLine{2064   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: skip\_pres\textcolor{comment}{ !< If present and true, do not copy pressure fields.}}
\DoxyCodeLine{2065 }
\DoxyCodeLine{2066   \textcolor{keywordtype}{logical} :: do\_pres}
\DoxyCodeLine{2067   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{2068   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2069 }
\DoxyCodeLine{2070   do\_pres = .true. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(skip\_pres)) do\_pres = .not.skip\_pres}
\DoxyCodeLine{2071 }
\DoxyCodeLine{2072   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%ustar) .and. \textcolor{keyword}{associated}(fluxes\%ustar)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2073     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2074       fluxes\%ustar(i,j) = forces\%ustar(i,j)}
\DoxyCodeLine{2075 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2076 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2077 }
\DoxyCodeLine{2078   \textcolor{keywordflow}{if} (do\_pres) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2079     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf) .and. \textcolor{keyword}{associated}(fluxes\%p\_surf)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2080       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2081         fluxes\%p\_surf(i,j) = forces\%p\_surf(i,j)}
\DoxyCodeLine{2082 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2083 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2084 }
\DoxyCodeLine{2085     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf\_full) .and. \textcolor{keyword}{associated}(fluxes\%p\_surf\_full)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2086       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2087         fluxes\%p\_surf\_full(i,j) = forces\%p\_surf\_full(i,j)}
\DoxyCodeLine{2088 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2089 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2090 }
\DoxyCodeLine{2091     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf\_SSH, forces\%p\_surf\_full)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2092       fluxes\%p\_surf\_SSH => fluxes\%p\_surf\_full}
\DoxyCodeLine{2093     \textcolor{keywordflow}{elseif} (\textcolor{keyword}{associated}(forces\%p\_surf\_SSH, forces\%p\_surf)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2094       fluxes\%p\_surf\_SSH => fluxes\%p\_surf}
\DoxyCodeLine{2095 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2096 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2097 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a432b1cbc47ab082b64bf7007a8674973}\label{namespacemom__forcing__type_a432b1cbc47ab082b64bf7007a8674973}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!deallocate\_forcing\_type@{deallocate\_forcing\_type}}
\index{deallocate\_forcing\_type@{deallocate\_forcing\_type}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{deallocate\_forcing\_type()}{deallocate\_forcing\_type()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::deallocate\+\_\+forcing\+\_\+type (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes }\end{DoxyParamCaption})}



Deallocate the forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fluxes} & Forcing fields structure \\
\hline
\end{DoxyParams}


Definition at line 3115 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3115   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< Forcing fields structure}}
\DoxyCodeLine{3116 }
\DoxyCodeLine{3117   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar))                \textcolor{keyword}{deallocate}(fluxes\%ustar)}
\DoxyCodeLine{3118   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_gustless))       \textcolor{keyword}{deallocate}(fluxes\%ustar\_gustless)}
\DoxyCodeLine{3119   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%buoy))                 \textcolor{keyword}{deallocate}(fluxes\%buoy)}
\DoxyCodeLine{3120   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw))                   \textcolor{keyword}{deallocate}(fluxes\%sw)}
\DoxyCodeLine{3121   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat))     \textcolor{keyword}{deallocate}(fluxes\%seaice\_melt\_heat)}
\DoxyCodeLine{3122   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_vis\_dir))           \textcolor{keyword}{deallocate}(fluxes\%sw\_vis\_dir)}
\DoxyCodeLine{3123   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_vis\_dif))           \textcolor{keyword}{deallocate}(fluxes\%sw\_vis\_dif)}
\DoxyCodeLine{3124   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_nir\_dir))           \textcolor{keyword}{deallocate}(fluxes\%sw\_nir\_dir)}
\DoxyCodeLine{3125   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_nir\_dif))           \textcolor{keyword}{deallocate}(fluxes\%sw\_nir\_dif)}
\DoxyCodeLine{3126   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lw))                   \textcolor{keyword}{deallocate}(fluxes\%lw)}
\DoxyCodeLine{3127   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent))               \textcolor{keyword}{deallocate}(fluxes\%latent)}
\DoxyCodeLine{3128   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_evap\_diag))     \textcolor{keyword}{deallocate}(fluxes\%latent\_evap\_diag)}
\DoxyCodeLine{3129   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_fprec\_diag))    \textcolor{keyword}{deallocate}(fluxes\%latent\_fprec\_diag)}
\DoxyCodeLine{3130   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_frunoff\_diag))  \textcolor{keyword}{deallocate}(fluxes\%latent\_frunoff\_diag)}
\DoxyCodeLine{3131   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sens))                 \textcolor{keyword}{deallocate}(fluxes\%sens)}
\DoxyCodeLine{3132   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_added))           \textcolor{keyword}{deallocate}(fluxes\%heat\_added)}
\DoxyCodeLine{3133   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_lrunoff)}
\DoxyCodeLine{3134   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_frunoff)}
\DoxyCodeLine{3135   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_icemelt)}
\DoxyCodeLine{3136   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec))   \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_lprec)}
\DoxyCodeLine{3137   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec))   \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_fprec)}
\DoxyCodeLine{3138   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond))    \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_cond)}
\DoxyCodeLine{3139   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_massout)}
\DoxyCodeLine{3140   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massin))  \textcolor{keyword}{deallocate}(fluxes\%heat\_content\_massin)}
\DoxyCodeLine{3141   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap))                 \textcolor{keyword}{deallocate}(fluxes\%evap)}
\DoxyCodeLine{3142   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec))                \textcolor{keyword}{deallocate}(fluxes\%lprec)}
\DoxyCodeLine{3143   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec))                \textcolor{keyword}{deallocate}(fluxes\%fprec)}
\DoxyCodeLine{3144   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec))                \textcolor{keyword}{deallocate}(fluxes\%vprec)}
\DoxyCodeLine{3145   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff))              \textcolor{keyword}{deallocate}(fluxes\%lrunoff)}
\DoxyCodeLine{3146   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff))              \textcolor{keyword}{deallocate}(fluxes\%frunoff)}
\DoxyCodeLine{3147   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt))          \textcolor{keyword}{deallocate}(fluxes\%seaice\_melt)}
\DoxyCodeLine{3148   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%salt\_flux))            \textcolor{keyword}{deallocate}(fluxes\%salt\_flux)}
\DoxyCodeLine{3149   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%p\_surf\_full))          \textcolor{keyword}{deallocate}(fluxes\%p\_surf\_full)}
\DoxyCodeLine{3150   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%p\_surf))               \textcolor{keyword}{deallocate}(fluxes\%p\_surf)}
\DoxyCodeLine{3151   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%TKE\_tidal))            \textcolor{keyword}{deallocate}(fluxes\%TKE\_tidal)}
\DoxyCodeLine{3152   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_tidal))          \textcolor{keyword}{deallocate}(fluxes\%ustar\_tidal)}
\DoxyCodeLine{3153   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_shelf))          \textcolor{keyword}{deallocate}(fluxes\%ustar\_shelf)}
\DoxyCodeLine{3154   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%iceshelf\_melt))        \textcolor{keyword}{deallocate}(fluxes\%iceshelf\_melt)}
\DoxyCodeLine{3155   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frac\_shelf\_h))         \textcolor{keyword}{deallocate}(fluxes\%frac\_shelf\_h)}
\DoxyCodeLine{3156   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_berg))           \textcolor{keyword}{deallocate}(fluxes\%ustar\_berg)}
\DoxyCodeLine{3157   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%area\_berg))            \textcolor{keyword}{deallocate}(fluxes\%area\_berg)}
\DoxyCodeLine{3158   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%mass\_berg))            \textcolor{keyword}{deallocate}(fluxes\%mass\_berg)}
\DoxyCodeLine{3159 }
\DoxyCodeLine{3160   \textcolor{keyword}{call }coupler\_type\_destructor(fluxes\%tr\_fluxes)}
\DoxyCodeLine{3161 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_aaadc0cd523729cb059cb62a2a224970b}\label{namespacemom__forcing__type_aaadc0cd523729cb059cb62a2a224970b}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!deallocate\_mech\_forcing@{deallocate\_mech\_forcing}}
\index{deallocate\_mech\_forcing@{deallocate\_mech\_forcing}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{deallocate\_mech\_forcing()}{deallocate\_mech\_forcing()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::deallocate\+\_\+mech\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(inout)}]{forces }\end{DoxyParamCaption})}



Deallocate the mechanical forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em forces} & Forcing fields structure \\
\hline
\end{DoxyParams}


Definition at line 3167 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3167   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{  !< Forcing fields structure}}
\DoxyCodeLine{3168 }
\DoxyCodeLine{3169   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%taux))  \textcolor{keyword}{deallocate}(forces\%taux)}
\DoxyCodeLine{3170   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%tauy))  \textcolor{keyword}{deallocate}(forces\%tauy)}
\DoxyCodeLine{3171   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%ustar)) \textcolor{keyword}{deallocate}(forces\%ustar)}
\DoxyCodeLine{3172   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf))         \textcolor{keyword}{deallocate}(forces\%p\_surf)}
\DoxyCodeLine{3173   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf\_full))    \textcolor{keyword}{deallocate}(forces\%p\_surf\_full)}
\DoxyCodeLine{3174   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%net\_mass\_src))   \textcolor{keyword}{deallocate}(forces\%net\_mass\_src)}
\DoxyCodeLine{3175   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%rigidity\_ice\_u)) \textcolor{keyword}{deallocate}(forces\%rigidity\_ice\_u)}
\DoxyCodeLine{3176   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%rigidity\_ice\_v)) \textcolor{keyword}{deallocate}(forces\%rigidity\_ice\_v)}
\DoxyCodeLine{3177   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%frac\_shelf\_u))   \textcolor{keyword}{deallocate}(forces\%frac\_shelf\_u)}
\DoxyCodeLine{3178   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%frac\_shelf\_v))   \textcolor{keyword}{deallocate}(forces\%frac\_shelf\_v)}
\DoxyCodeLine{3179   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%area\_berg))      \textcolor{keyword}{deallocate}(forces\%area\_berg)}
\DoxyCodeLine{3180   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%mass\_berg))      \textcolor{keyword}{deallocate}(forces\%mass\_berg)}
\DoxyCodeLine{3181 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a6bf986155aba959222a117ca40ba7e0d}\label{namespacemom__forcing__type_a6bf986155aba959222a117ca40ba7e0d}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!extractfluxes1d@{extractfluxes1d}}
\index{extractfluxes1d@{extractfluxes1d}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{extractfluxes1d()}{extractfluxes1d()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::extractfluxes1d (\begin{DoxyParamCaption}\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(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(optics\+\_\+type), pointer}]{optics,  }\item[{integer, intent(in)}]{nsw,  }\item[{integer, intent(in)}]{j,  }\item[{real, intent(in)}]{dt,  }\item[{real, intent(in)}]{Flux\+Rescale\+Depth,  }\item[{logical, intent(in)}]{use\+River\+Heat\+Content,  }\item[{logical, intent(in)}]{use\+Calving\+Heat\+Content,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%ke), intent(in)}]{h,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%ke), intent(in)}]{T,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out)}]{net\+Mass\+In\+Out,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out)}]{net\+Mass\+Out,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out)}]{net\+\_\+heat,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out)}]{net\+\_\+salt,  }\item[{real, dimension(max(1,nsw),g\%isd\+:g\%ied), intent(out)}]{pen\+\_\+\+S\+W\+\_\+bnd,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{logical, intent(in)}]{aggregate\+\_\+\+FW,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out), optional}]{nonpen\+SW,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out), optional}]{netmass\+In\+Out\+\_\+rate,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out), optional}]{net\+\_\+\+Heat\+\_\+\+Rate,  }\item[{real, dimension( g \%isd\+: g \%ied), intent(out), optional}]{net\+\_\+salt\+\_\+rate,  }\item[{real, dimension(max(1,nsw),g\%isd\+:g\%ied), intent(out), optional}]{pen\+\_\+sw\+\_\+bnd\+\_\+\+Rate,  }\item[{logical, intent(in), optional}]{skip\+\_\+diags }\end{DoxyParamCaption})}



This subroutine extracts fluxes from the surface fluxes type. It works on a j-\/row for optimization purposes. The 2d (i,j) wrapper is the next subroutine below. This routine multiplies fluxes by dt, so that the result is an accumulation of fluxes over a time step. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & structure containing pointers to possible forcing fields. N\+U\+LL unused fields. \\
\hline
 & {\em optics} & pointer to optics \\
\hline
\mbox{\texttt{ in}}  & {\em nsw} & number of bands of penetrating SW \\
\hline
\mbox{\texttt{ in}}  & {\em j} & j-\/index to work on \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The time step for these fluxes \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em fluxrescaledepth} & min ocean depth before fluxes are scaled away \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em useriverheatcontent} & logical for river heat content \\
\hline
\mbox{\texttt{ in}}  & {\em usecalvingheatcontent} & logical for calving heat content \\
\hline
\mbox{\texttt{ in}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em t} & layer temperatures \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em netmassinout} & net mass flux (non-\/\+Bouss) or volume flux (if Bouss) of water in/out of ocean over a time step \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em netmassout} & net mass flux (non-\/\+Bouss) or volume flux (if Bouss) of water leaving ocean surface over a time step \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. net\+Mass\+Out $<$ 0 means mass leaves ocean. \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+heat} & net heat at the surface accumulated over a time step for coupler + restoring. Exclude two terms from net\+\_\+heat\+: (1) downwelling (penetrative) SW, (2) evaporation heat content, (since do not yet know evap temperature). \mbox{[}degC H $\sim$$>$ degC m or degC kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+salt} & surface salt flux into the ocean accumulated over a time step \mbox{[}ppt H $\sim$$>$ ppt m or ppt kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em pen\+\_\+sw\+\_\+bnd} & penetrating SW flux, split into bands. \mbox{[}degC H $\sim$$>$ degC m or degC kg m-\/2\mbox{]} and array size nsw x G isd\+: G ied, where nsw=number of SW bands in pen\+\_\+\+S\+W\+\_\+bnd. This heat flux is not part of net\+\_\+heat. \\
\hline
\mbox{\texttt{ in,out}}  & {\em tv} & structure containing pointers to available thermodynamic fields. Used to keep track of the heat flux associated with net mass fluxes into the ocean. \\
\hline
\mbox{\texttt{ in}}  & {\em aggregate\+\_\+fw} & For determining how to aggregate forcing. \\
\hline
\mbox{\texttt{ out}}  & {\em nonpensw} & Non-\/penetrating SW used in net\+\_\+heat \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+heat\+\_\+rate} & Rate of net surface heating \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+salt\+\_\+rate} & Surface salt flux into the ocean \\
\hline
\mbox{\texttt{ out}}  & {\em netmassinout\+\_\+rate} & Rate of net mass flux into the ocean \\
\hline
\mbox{\texttt{ out}}  & {\em pen\+\_\+sw\+\_\+bnd\+\_\+rate} & Rate of penetrative shortwave heating \\
\hline
\mbox{\texttt{ in}}  & {\em skip\+\_\+diags} & If present and true, skip calculating diagnostics \\
\hline
\end{DoxyParams}


Definition at line 365 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{365 }
\DoxyCodeLine{366   \textcolor{keywordtype}{type}(ocean\_grid\_type),    \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{              !< ocean grid structure}}
\DoxyCodeLine{367   \textcolor{keywordtype}{type}(verticalGrid\_type),  \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{             !< ocean vertical grid structure}}
\DoxyCodeLine{368   \textcolor{keywordtype}{type}(unit\_scale\_type),    \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{             !< A dimensional unit scaling type}}
\DoxyCodeLine{369   \textcolor{keywordtype}{type}(forcing),            \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{         !< structure containing pointers to possible}}
\DoxyCodeLine{370 \textcolor{comment}{                                                            !! forcing fields. NULL unused fields.}}
\DoxyCodeLine{371   \textcolor{keywordtype}{type}(optics\_type),        \textcolor{keywordtype}{pointer}       :: optics\textcolor{comment}{         !< pointer to optics}}
\DoxyCodeLine{372   \textcolor{keywordtype}{integer},                  \textcolor{keywordtype}{intent(in)}    :: nsw\textcolor{comment}{            !< number of bands of penetrating SW}}
\DoxyCodeLine{373   \textcolor{keywordtype}{integer},                  \textcolor{keywordtype}{intent(in)}    :: j\textcolor{comment}{              !< j-\/index to work on}}
\DoxyCodeLine{374 \textcolor{keywordtype}{  real},                     \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{             !< The time step for these fluxes [T \string~> s]}}
\DoxyCodeLine{375 \textcolor{keywordtype}{  real},                     \textcolor{keywordtype}{intent(in)}    :: FluxRescaleDepth\textcolor{comment}{ !< min ocean depth before fluxes}}
\DoxyCodeLine{376 \textcolor{comment}{                                                            !! are scaled away [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{377   \textcolor{keywordtype}{logical},                  \textcolor{keywordtype}{intent(in)}    :: useRiverHeatContent\textcolor{comment}{   !< logical for river heat content}}
\DoxyCodeLine{378   \textcolor{keywordtype}{logical},                  \textcolor{keywordtype}{intent(in)}    :: useCalvingHeatContent\textcolor{comment}{ !< logical for calving heat content}}
\DoxyCodeLine{379 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{380                             \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{              !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{381 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{382                             \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{              !< layer temperatures [degC]}}
\DoxyCodeLine{383 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \textcolor{keywordtype}{intent(out)}   :: netMassInOut\textcolor{comment}{   !< net mass flux (non-\/Bouss) or volume flux}}
\DoxyCodeLine{384 \textcolor{comment}{                                                            !! (if Bouss) of water in/out of ocean over}}
\DoxyCodeLine{385 \textcolor{comment}{                                                            !! a time step [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{386 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \textcolor{keywordtype}{intent(out)}   :: netMassOut\textcolor{comment}{     !< net mass flux (non-\/Bouss) or volume flux}}
\DoxyCodeLine{387 \textcolor{comment}{                                                            !! (if Bouss) of water leaving ocean surface}}
\DoxyCodeLine{388 \textcolor{comment}{                                                            !! over a time step [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{389 \textcolor{comment}{                                                            !! netMassOut < 0 means mass leaves ocean.}}
\DoxyCodeLine{390 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \textcolor{keywordtype}{intent(out)}   :: net\_heat\textcolor{comment}{       !< net heat at the surface accumulated over a}}
\DoxyCodeLine{391 \textcolor{comment}{                                                            !! time step for coupler + restoring.}}
\DoxyCodeLine{392 \textcolor{comment}{                                                            !! Exclude two terms from net\_heat:}}
\DoxyCodeLine{393 \textcolor{comment}{                                                            !! (1) downwelling (penetrative) SW,}}
\DoxyCodeLine{394 \textcolor{comment}{                                                            !! (2) evaporation heat content,}}
\DoxyCodeLine{395 \textcolor{comment}{                                                            !! (since do not yet know evap temperature).}}
\DoxyCodeLine{396 \textcolor{comment}{                                                            !! [degC H \string~> degC m or degC kg m-\/2].}}
\DoxyCodeLine{397 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \textcolor{keywordtype}{intent(out)}   :: net\_salt\textcolor{comment}{       !< surface salt flux into the ocean}}
\DoxyCodeLine{398 \textcolor{comment}{                                                            !! accumulated over a time step}}
\DoxyCodeLine{399 \textcolor{comment}{                                                            !! [ppt H \string~> ppt m or ppt kg m-\/2].}}
\DoxyCodeLine{400 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(max(1,nsw),G\%isd:G\%ied)}, \textcolor{keywordtype}{intent(out)} :: pen\_SW\_bnd\textcolor{comment}{ !< penetrating SW flux, split into bands.}}
\DoxyCodeLine{401 \textcolor{comment}{                                                            !! [degC H \string~> degC m or degC kg m-\/2]}}
\DoxyCodeLine{402 \textcolor{comment}{                                                            !! and array size nsw x SZI\_(G), where}}
\DoxyCodeLine{403 \textcolor{comment}{                                                            !! nsw=number of SW bands in pen\_SW\_bnd.}}
\DoxyCodeLine{404 \textcolor{comment}{                                                            !! This heat flux is not part of net\_heat.}}
\DoxyCodeLine{405   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),    \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{             !< structure containing pointers to available}}
\DoxyCodeLine{406 \textcolor{comment}{                                                            !! thermodynamic fields. Used to keep}}
\DoxyCodeLine{407 \textcolor{comment}{                                                            !! track of the heat flux associated with net}}
\DoxyCodeLine{408 \textcolor{comment}{                                                            !! mass fluxes into the ocean.}}
\DoxyCodeLine{409   \textcolor{keywordtype}{logical},                  \textcolor{keywordtype}{intent(in)}    :: aggregate\_FW\textcolor{comment}{   !< For determining how to aggregate forcing.}}
\DoxyCodeLine{410 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \&}
\DoxyCodeLine{411                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: nonpenSW\textcolor{comment}{       !< Non-\/penetrating SW used in net\_heat}}
\DoxyCodeLine{412 \textcolor{comment}{                                                            !! [degC H \string~> degC m or degC kg m-\/2].}}
\DoxyCodeLine{413 \textcolor{comment}{                                                            !! Summed over SW bands when diagnosing nonpenSW.}}
\DoxyCodeLine{414 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \&}
\DoxyCodeLine{415                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: net\_Heat\_rate\textcolor{comment}{  !< Rate of net surface heating}}
\DoxyCodeLine{416 \textcolor{comment}{                                                            !! [degC H T-\/1 \string~> degC m s-\/1 or degC kg m-\/2 s-\/1].}}
\DoxyCodeLine{417 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \&}
\DoxyCodeLine{418                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: net\_salt\_rate\textcolor{comment}{  !< Surface salt flux into the ocean}}
\DoxyCodeLine{419 \textcolor{comment}{                                                            !! [ppt H T-\/1 \string~> ppt m s-\/1 or ppt kg m-\/2 s-\/1].}}
\DoxyCodeLine{420 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}, \&}
\DoxyCodeLine{421                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: netmassInOut\_rate\textcolor{comment}{ !< Rate of net mass flux into the ocean}}
\DoxyCodeLine{422 \textcolor{comment}{                                                            !! [H T-\/1 \string~> m s-\/1 or kg m-\/2 s-\/1].}}
\DoxyCodeLine{423 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(max(1,nsw),G\%isd:G\%ied)}, \&}
\DoxyCodeLine{424                   \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)}   :: pen\_sw\_bnd\_rate\textcolor{comment}{ !< Rate of penetrative shortwave heating}}
\DoxyCodeLine{425 \textcolor{comment}{                                                             !! [degC H T-\/1 \string~> degC m s-\/1 or degC kg m-\/2 s-\/1].}}
\DoxyCodeLine{426   \textcolor{keywordtype}{logical},        \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: skip\_diags\textcolor{comment}{      !< If present and true, skip calculating diagnostics}}
\DoxyCodeLine{427 }
\DoxyCodeLine{428   \textcolor{comment}{! local}}
\DoxyCodeLine{429 \textcolor{keywordtype}{  real} :: htot(SZI\_(G))       \textcolor{comment}{! total ocean depth [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{430 \textcolor{keywordtype}{  real} :: Pen\_sw\_tot(SZI\_(G)) \textcolor{comment}{! sum across all bands of Pen\_SW [degC H \string~> degC m or degC kg m-\/2].}}
\DoxyCodeLine{431 \textcolor{keywordtype}{  real} :: pen\_sw\_tot\_rate(SZI\_(G)) \textcolor{comment}{! Summed rate of shortwave heating across bands}}
\DoxyCodeLine{432                               \textcolor{comment}{! [degC H T-\/1 \string~> degC m s-\/1 or degC kg m-\/2 s-\/1]}}
\DoxyCodeLine{433 \textcolor{keywordtype}{  real} :: Ih\_limit            \textcolor{comment}{! inverse depth at which surface fluxes start to be limited}}
\DoxyCodeLine{434                               \textcolor{comment}{! or 0 for no limiting [H-\/1 \string~> m-\/1 or m2 kg-\/1]}}
\DoxyCodeLine{435 \textcolor{keywordtype}{  real} :: scale               \textcolor{comment}{! scale scales away fluxes if depth < FluxRescaleDepth}}
\DoxyCodeLine{436 \textcolor{keywordtype}{  real} :: I\_Cp                \textcolor{comment}{! 1.0 / C\_p [degC Q-\/1 \string~> kg degC J-\/1]}}
\DoxyCodeLine{437 \textcolor{keywordtype}{  real} :: I\_Cp\_Hconvert       \textcolor{comment}{! Unit conversion factors divided by the heat capacity}}
\DoxyCodeLine{438                               \textcolor{comment}{! [degC H R-\/1 Z-\/1 Q-\/1 \string~> degC m3 J-\/1 or kg degC J-\/1]}}
\DoxyCodeLine{439   \textcolor{keywordtype}{logical} :: calculate\_diags  \textcolor{comment}{! Indicate to calculate/update diagnostic arrays}}
\DoxyCodeLine{440   \textcolor{keywordtype}{character(len=200)} :: mesg}
\DoxyCodeLine{441   \textcolor{keywordtype}{integer}            :: is, ie, nz, i, k, n}
\DoxyCodeLine{442 }
\DoxyCodeLine{443   \textcolor{keywordtype}{logical} :: do\_NHR, do\_NSR, do\_NMIOR, do\_PSWBR}
\DoxyCodeLine{444 }
\DoxyCodeLine{445   \textcolor{comment}{!BGR-\/Jul 5,2017\{}}
\DoxyCodeLine{446   \textcolor{comment}{! Initializes/sets logicals if 'rates' are requested}}
\DoxyCodeLine{447   \textcolor{comment}{! These factors are required for legacy reasons}}
\DoxyCodeLine{448   \textcolor{comment}{!  and therefore computed only when optional outputs are requested}}
\DoxyCodeLine{449   do\_nhr = .false.}
\DoxyCodeLine{450   do\_nsr = .false.}
\DoxyCodeLine{451   do\_nmior = .false.}
\DoxyCodeLine{452   do\_pswbr = .false.}
\DoxyCodeLine{453   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(net\_heat\_rate)) do\_nhr = .true.}
\DoxyCodeLine{454   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(net\_salt\_rate)) do\_nsr = .true.}
\DoxyCodeLine{455   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(netmassinout\_rate)) do\_nmior = .true.}
\DoxyCodeLine{456   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(pen\_sw\_bnd\_rate)) do\_pswbr = .true.}
\DoxyCodeLine{457   \textcolor{comment}{!\}BGR}}
\DoxyCodeLine{458 }
\DoxyCodeLine{459   ih\_limit  = 0.0 ; \textcolor{keywordflow}{if} (fluxrescaledepth > 0.0) ih\_limit  = 1.0 / fluxrescaledepth}
\DoxyCodeLine{460   i\_cp      = 1.0 / fluxes\%C\_p}
\DoxyCodeLine{461   i\_cp\_hconvert = 1.0 / (gv\%H\_to\_RZ * fluxes\%C\_p)}
\DoxyCodeLine{462 }
\DoxyCodeLine{463   is = g\%isc ; ie = g\%iec ; nz = g\%ke}
\DoxyCodeLine{464 }
\DoxyCodeLine{465   calculate\_diags = .true.}
\DoxyCodeLine{466   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(skip\_diags)) calculate\_diags = .not. skip\_diags}
\DoxyCodeLine{467 }
\DoxyCodeLine{468   \textcolor{comment}{! error checking}}
\DoxyCodeLine{469 }
\DoxyCodeLine{470   \textcolor{keywordflow}{if} (nsw > 0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (nsw /= optics\_nbands(optics)) \textcolor{keyword}{call }mom\_error(warning, \&}
\DoxyCodeLine{471     \textcolor{stringliteral}{"mismatch in the number of bands of shortwave radiation in MOM\_forcing\_type extract\_fluxes."})}
\DoxyCodeLine{472 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{473 }
\DoxyCodeLine{474   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%sw)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{475     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: fluxes\%sw is not associated."})}
\DoxyCodeLine{476 }
\DoxyCodeLine{477   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%lw)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{478     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: fluxes\%lw is not associated."})}
\DoxyCodeLine{479 }
\DoxyCodeLine{480   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%latent)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{481     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: fluxes\%latent is not associated."})}
\DoxyCodeLine{482 }
\DoxyCodeLine{483   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{484     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: fluxes\%sens is not associated."})}
\DoxyCodeLine{485 }
\DoxyCodeLine{486   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{487     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: No evaporation defined."})}
\DoxyCodeLine{488 }
\DoxyCodeLine{489   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(fluxes\%vprec)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{490     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: fluxes\%vprec not defined."})}
\DoxyCodeLine{491 }
\DoxyCodeLine{492   \textcolor{keywordflow}{if} ((.not.\textcolor{keyword}{associated}(fluxes\%lprec)) .or. \&}
\DoxyCodeLine{493       (.not.\textcolor{keyword}{associated}(fluxes\%fprec))) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{494     \textcolor{stringliteral}{"MOM\_forcing\_type extractFluxes1d: No precipitation defined."})}
\DoxyCodeLine{495 }
\DoxyCodeLine{496   \textcolor{keywordflow}{do} i=is,ie ; htot(i) = h(i,1) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{497   \textcolor{keywordflow}{do} k=2,nz ; \textcolor{keywordflow}{do} i=is,ie ; htot(i) = htot(i) + h(i,k) ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{498 }
\DoxyCodeLine{499   \textcolor{keywordflow}{if} (nsw >= 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{500     \textcolor{keyword}{call }extract\_optics\_slice(optics, j, g, gv, pensw\_top=pen\_sw\_bnd)}
\DoxyCodeLine{501     \textcolor{keywordflow}{if} (do\_pswbr) \textcolor{keyword}{call }extract\_optics\_slice(optics, j, g, gv, pensw\_top=pen\_sw\_bnd\_rate)}
\DoxyCodeLine{502 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{503 }
\DoxyCodeLine{504   \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{505 }
\DoxyCodeLine{506     scale = 1.0 ; \textcolor{keywordflow}{if} ((ih\_limit > 0.0) .and. (htot(i)*ih\_limit < 1.0)) scale = htot(i)*ih\_limit}
\DoxyCodeLine{507 }
\DoxyCodeLine{508     \textcolor{comment}{! Convert the penetrating shortwave forcing to (K * H) and reduce fluxes for shallow depths.}}
\DoxyCodeLine{509     \textcolor{comment}{! (H=m for Bouss, H=kg/m2 for non-\/Bouss)}}
\DoxyCodeLine{510     pen\_sw\_tot(i) = 0.0}
\DoxyCodeLine{511     \textcolor{keywordflow}{if} (nsw >= 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{512       \textcolor{keywordflow}{do} n=1,nsw}
\DoxyCodeLine{513         pen\_sw\_bnd(n,i) = i\_cp\_hconvert*scale*dt * max(0.0, pen\_sw\_bnd(n,i))}
\DoxyCodeLine{514         pen\_sw\_tot(i)   = pen\_sw\_tot(i) + pen\_sw\_bnd(n,i)}
\DoxyCodeLine{515 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{516     \textcolor{keywordflow}{else}}
\DoxyCodeLine{517       pen\_sw\_bnd(1,i) = 0.0}
\DoxyCodeLine{518 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{519 }
\DoxyCodeLine{520     \textcolor{keywordflow}{if} (do\_pswbr) \textcolor{keywordflow}{then}  \textcolor{comment}{! Repeat the above code w/ dt=1s for legacy reasons}}
\DoxyCodeLine{521       pen\_sw\_tot\_rate(i) = 0.0}
\DoxyCodeLine{522       \textcolor{keywordflow}{if} (nsw >= 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{523         \textcolor{keywordflow}{do} n=1,nsw}
\DoxyCodeLine{524           pen\_sw\_bnd\_rate(n,i) = i\_cp\_hconvert*scale * max(0.0, pen\_sw\_bnd\_rate(n,i))}
\DoxyCodeLine{525           pen\_sw\_tot\_rate(i) = pen\_sw\_tot\_rate(i) + pen\_sw\_bnd\_rate(n,i)}
\DoxyCodeLine{526 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{527       \textcolor{keywordflow}{else}}
\DoxyCodeLine{528         pen\_sw\_bnd\_rate(1,i) = 0.0}
\DoxyCodeLine{529 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{530 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{531 }
\DoxyCodeLine{532     \textcolor{comment}{! net volume/mass of liquid and solid passing through surface boundary fluxes}}
\DoxyCodeLine{533     netmassinout(i) = dt * (scale * \&}
\DoxyCodeLine{534                                    (((((( fluxes\%lprec(i,j)        \&}
\DoxyCodeLine{535                                         + fluxes\%fprec(i,j)      )  \&}
\DoxyCodeLine{536                                         + fluxes\%evap(i,j)       )  \&}
\DoxyCodeLine{537                                         + fluxes\%lrunoff(i,j)    )  \&}
\DoxyCodeLine{538                                         + fluxes\%vprec(i,j)      )  \&}
\DoxyCodeLine{539                                         + fluxes\%seaice\_melt(i,j))  \&}
\DoxyCodeLine{540                                         + fluxes\%frunoff(i,j)    ))}
\DoxyCodeLine{541 }
\DoxyCodeLine{542     \textcolor{keywordflow}{if} (do\_nmior) \textcolor{keywordflow}{then}  \textcolor{comment}{! Repeat the above code without multiplying by a timestep for legacy reasons}}
\DoxyCodeLine{543       netmassinout\_rate(i) = (scale * \&}
\DoxyCodeLine{544                                    (((((( fluxes\%lprec(i,j)      \&}
\DoxyCodeLine{545                                         + fluxes\%fprec(i,j)      )  \&}
\DoxyCodeLine{546                                         + fluxes\%evap(i,j)       )  \&}
\DoxyCodeLine{547                                         + fluxes\%lrunoff(i,j)    )  \&}
\DoxyCodeLine{548                                         + fluxes\%vprec(i,j)      )  \&}
\DoxyCodeLine{549                                         + fluxes\%seaice\_melt(i,j))  \&}
\DoxyCodeLine{550                                         + fluxes\%frunoff(i,j)   ))}
\DoxyCodeLine{551 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{552 }
\DoxyCodeLine{553     \textcolor{comment}{! smg:}}
\DoxyCodeLine{554     \textcolor{comment}{! for non-\/Bouss, we add/remove salt mass to total ocean mass. to conserve}}
\DoxyCodeLine{555     \textcolor{comment}{! total salt mass ocean+ice, the sea ice model must lose mass when salt mass}}
\DoxyCodeLine{556     \textcolor{comment}{! is added to the ocean, which may still need to be coded.  Not that the units}}
\DoxyCodeLine{557     \textcolor{comment}{! of netMassInOut are still kg\_m2, so no conversion to H should occur yet.}}
\DoxyCodeLine{558     \textcolor{keywordflow}{if} (.not.gv\%Boussinesq .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{559       netmassinout(i) = netmassinout(i) + dt * (scale * fluxes\%salt\_flux(i,j))}
\DoxyCodeLine{560       \textcolor{keywordflow}{if} (do\_nmior) netmassinout\_rate(i) = netmassinout\_rate(i) + \&}
\DoxyCodeLine{561                                                (scale * fluxes\%salt\_flux(i,j))}
\DoxyCodeLine{562 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{563 }
\DoxyCodeLine{564     \textcolor{comment}{! net volume/mass of water leaving the ocean.}}
\DoxyCodeLine{565     \textcolor{comment}{! check that fluxes are < 0, which means mass is indeed leaving.}}
\DoxyCodeLine{566     netmassout(i) = 0.0}
\DoxyCodeLine{567 }
\DoxyCodeLine{568     \textcolor{comment}{! evap > 0 means condensating water is added into ocean.}}
\DoxyCodeLine{569     \textcolor{comment}{! evap < 0 means evaporation of water from the ocean, in}}
\DoxyCodeLine{570     \textcolor{comment}{! which case heat\_content\_evap is computed in MOM\_diabatic\_driver.F90}}
\DoxyCodeLine{571     \textcolor{keywordflow}{if} (fluxes\%evap(i,j) < 0.0) netmassout(i) = netmassout(i) + fluxes\%evap(i,j)}
\DoxyCodeLine{572   \textcolor{comment}{!   if (associated(fluxes\%heat\_content\_cond)) fluxes\%heat\_content\_cond(i,j) = 0.0 !??? -\/-\/AJA}}
\DoxyCodeLine{573 }
\DoxyCodeLine{574     \textcolor{comment}{! lprec < 0 means sea ice formation taking water from the ocean.}}
\DoxyCodeLine{575     \textcolor{comment}{! smg: we should split the ice melt/formation from the lprec}}
\DoxyCodeLine{576     \textcolor{keywordflow}{if} (fluxes\%lprec(i,j) < 0.0) netmassout(i) = netmassout(i) + fluxes\%lprec(i,j)}
\DoxyCodeLine{577 }
\DoxyCodeLine{578     \textcolor{comment}{! seaice\_melt < 0 means sea ice formation taking water from the ocean.}}
\DoxyCodeLine{579     \textcolor{keywordflow}{if} (fluxes\%seaice\_melt(i,j) < 0.0) netmassout(i) = netmassout(i) + fluxes\%seaice\_melt(i,j)}
\DoxyCodeLine{580 }
\DoxyCodeLine{581     \textcolor{comment}{! vprec < 0 means virtual evaporation arising from surface salinity restoring,}}
\DoxyCodeLine{582     \textcolor{comment}{! in which case heat\_content\_vprec is computed in MOM\_diabatic\_driver.F90.}}
\DoxyCodeLine{583     \textcolor{keywordflow}{if} (fluxes\%vprec(i,j) < 0.0) netmassout(i) = netmassout(i) + fluxes\%vprec(i,j)}
\DoxyCodeLine{584 }
\DoxyCodeLine{585     netmassout(i) = dt * scale * netmassout(i)}
\DoxyCodeLine{586 }
\DoxyCodeLine{587     \textcolor{comment}{! convert to H units (Bouss=meter or non-\/Bouss=kg/m\string^2)}}
\DoxyCodeLine{588     netmassinout(i) = gv\%RZ\_to\_H * netmassinout(i)}
\DoxyCodeLine{589     \textcolor{keywordflow}{if} (do\_nmior) netmassinout\_rate(i) = gv\%RZ\_to\_H * netmassinout\_rate(i)}
\DoxyCodeLine{590     netmassout(i)   = gv\%RZ\_to\_H * netmassout(i)}
\DoxyCodeLine{591 }
\DoxyCodeLine{592     \textcolor{comment}{! surface heat fluxes from radiation and turbulent fluxes (K * H)}}
\DoxyCodeLine{593     \textcolor{comment}{! (H=m for Bouss, H=kg/m2 for non-\/Bouss)}}
\DoxyCodeLine{594 }
\DoxyCodeLine{595     \textcolor{comment}{! CIME provides heat flux from snow\&ice melt (seaice\_melt\_heat), so this is added below}}
\DoxyCodeLine{596     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{597       net\_heat(i) = scale * dt * i\_cp\_hconvert * \&}
\DoxyCodeLine{598                     ( fluxes\%sw(i,j) + (((fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)) + \&}
\DoxyCodeLine{599                       fluxes\%seaice\_melt\_heat(i,j)) )}
\DoxyCodeLine{600       \textcolor{comment}{!Repeats above code w/ dt=1. for legacy reason}}
\DoxyCodeLine{601       \textcolor{keywordflow}{if} (do\_nhr)  net\_heat\_rate(i) = scale * i\_cp\_hconvert * \&}
\DoxyCodeLine{602            ( fluxes\%sw(i,j) + (((fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)) + \&}
\DoxyCodeLine{603              fluxes\%seaice\_melt\_heat(i,j)))}
\DoxyCodeLine{604     \textcolor{keywordflow}{else}}
\DoxyCodeLine{605       net\_heat(i) = scale * dt * i\_cp\_hconvert * \&}
\DoxyCodeLine{606                     ( fluxes\%sw(i,j) + ((fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)) )}
\DoxyCodeLine{607       \textcolor{comment}{!Repeats above code w/ dt=1. for legacy reason}}
\DoxyCodeLine{608       \textcolor{keywordflow}{if} (do\_nhr)  net\_heat\_rate(i) = scale * i\_cp\_hconvert * \&}
\DoxyCodeLine{609            ( fluxes\%sw(i,j) + ((fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)) )}
\DoxyCodeLine{610 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{611 }
\DoxyCodeLine{612     \textcolor{comment}{! Add heat flux from surface damping (restoring) (K * H) or flux adjustments.}}
\DoxyCodeLine{613     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_added)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{614       net\_heat(i) = net\_heat(i) + (scale * (dt * i\_cp\_hconvert)) * fluxes\%heat\_added(i,j)}
\DoxyCodeLine{615       \textcolor{keywordflow}{if} (do\_nhr) net\_heat\_rate(i) = net\_heat\_rate(i) + (scale * i\_cp\_hconvert) * fluxes\%heat\_added(i,j)}
\DoxyCodeLine{616 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{617 }
\DoxyCodeLine{618     \textcolor{comment}{! Add explicit heat flux for runoff (which is part of the ice-\/ocean boundary}}
\DoxyCodeLine{619     \textcolor{comment}{! flux type). Runoff is otherwise added with a temperature of SST.}}
\DoxyCodeLine{620     \textcolor{keywordflow}{if} (useriverheatcontent) \textcolor{keywordflow}{then}}
\DoxyCodeLine{621       \textcolor{comment}{! remove lrunoff*SST here, to counteract its addition elsewhere}}
\DoxyCodeLine{622       net\_heat(i) = (net\_heat(i) + (scale*(dt * i\_cp\_hconvert)) * fluxes\%heat\_content\_lrunoff(i,j)) -\/ \&}
\DoxyCodeLine{623                      (gv\%RZ\_to\_H * (scale * dt)) * fluxes\%lrunoff(i,j) * t(i,1)}
\DoxyCodeLine{624       \textcolor{comment}{!BGR-\/Jul 5, 2017\{}}
\DoxyCodeLine{625       \textcolor{comment}{!Intentionally neglect the following contribution to rate for legacy reasons.}}
\DoxyCodeLine{626       \textcolor{comment}{!if (do\_NHR) net\_heat\_rate(i) = (net\_heat\_rate(i) + (scale*I\_Cp\_Hconvert) * fluxes\%heat\_content\_lrunoff(i,j)) -\/ \&}}
\DoxyCodeLine{627       \textcolor{comment}{!               (GV\%RZ\_to\_H * (scale)) * fluxes\%lrunoff(i,j) * T(i,1)}}
\DoxyCodeLine{628       \textcolor{comment}{!\}BGR}}
\DoxyCodeLine{629       \textcolor{keywordflow}{if} (calculate\_diags .and. \textcolor{keyword}{associated}(tv\%TempxPmE)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{630         tv\%TempxPmE(i,j) = tv\%TempxPmE(i,j) + (scale * dt) * \&}
\DoxyCodeLine{631             (i\_cp*fluxes\%heat\_content\_lrunoff(i,j) -\/ fluxes\%lrunoff(i,j)*t(i,1))}
\DoxyCodeLine{632 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{633 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{634 }
\DoxyCodeLine{635     \textcolor{comment}{! Add explicit heat flux for calving (which is part of the ice-\/ocean boundary}}
\DoxyCodeLine{636     \textcolor{comment}{! flux type). Calving is otherwise added with a temperature of SST.}}
\DoxyCodeLine{637     \textcolor{keywordflow}{if} (usecalvingheatcontent) \textcolor{keywordflow}{then}}
\DoxyCodeLine{638       \textcolor{comment}{! remove frunoff*SST here, to counteract its addition elsewhere}}
\DoxyCodeLine{639       net\_heat(i) = net\_heat(i) + (scale*(dt * i\_cp\_hconvert)) * fluxes\%heat\_content\_frunoff(i,j) -\/ \&}
\DoxyCodeLine{640                     (gv\%RZ\_to\_H * (scale * dt)) * fluxes\%frunoff(i,j) * t(i,1)}
\DoxyCodeLine{641       \textcolor{comment}{!BGR-\/Jul 5, 2017\{}}
\DoxyCodeLine{642       \textcolor{comment}{!Intentionally neglect the following contribution to rate for legacy reasons.}}
\DoxyCodeLine{643 \textcolor{comment}{!      if (do\_NHR) net\_heat\_rate(i) = net\_heat\_rate(i) + (scale*I\_Cp\_Hconvert) * fluxes\%heat\_content\_frunoff(i,j) -\/ \&}}
\DoxyCodeLine{644 \textcolor{comment}{!                    (GV\%RZ\_to\_H * scale) * fluxes\%frunoff(i,j) * T(i,1)}}
\DoxyCodeLine{645       \textcolor{comment}{!\}BGR}}
\DoxyCodeLine{646       \textcolor{keywordflow}{if} (calculate\_diags .and. \textcolor{keyword}{associated}(tv\%TempxPmE)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{647         tv\%TempxPmE(i,j) = tv\%TempxPmE(i,j) + (scale * dt) * \&}
\DoxyCodeLine{648             (i\_cp*fluxes\%heat\_content\_frunoff(i,j) -\/ fluxes\%frunoff(i,j)*t(i,1))}
\DoxyCodeLine{649 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{650 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{651 }
\DoxyCodeLine{652 \textcolor{comment}{! smg: new code}}
\DoxyCodeLine{653     \textcolor{comment}{! add heat from all terms that may add mass to the ocean (K * H).}}
\DoxyCodeLine{654     \textcolor{comment}{! if evap, lprec, or vprec < 0, then compute their heat content}}
\DoxyCodeLine{655     \textcolor{comment}{! inside MOM\_diabatic\_driver.F90 and fill in fluxes\%heat\_content\_massout.}}
\DoxyCodeLine{656     \textcolor{comment}{! we do so since we do not here know the temperature}}
\DoxyCodeLine{657     \textcolor{comment}{! of water leaving the ocean, as it could be leaving from more than}}
\DoxyCodeLine{658     \textcolor{comment}{! one layer of the upper ocean in the case of very thin layers.}}
\DoxyCodeLine{659     \textcolor{comment}{! When evap, lprec, or vprec > 0, then we know their heat content here}}
\DoxyCodeLine{660     \textcolor{comment}{! via settings from inside of the appropriate config\_src driver files.}}
\DoxyCodeLine{661 \textcolor{comment}{!    if (associated(fluxes\%heat\_content\_lprec)) then}}
\DoxyCodeLine{662 \textcolor{comment}{!      net\_heat(i) = net\_heat(i) + scale * dt * I\_Cp\_Hconvert * \&}}
\DoxyCodeLine{663 \textcolor{comment}{!     (fluxes\%heat\_content\_lprec(i,j)    + (fluxes\%heat\_content\_fprec(i,j)   + \&}}
\DoxyCodeLine{664 \textcolor{comment}{!     (fluxes\%heat\_content\_lrunoff(i,j)  + (fluxes\%heat\_content\_frunoff(i,j) + \&}}
\DoxyCodeLine{665 \textcolor{comment}{!     (fluxes\%heat\_content\_cond(i,j)     +  fluxes\%heat\_content\_vprec(i,j))))))}}
\DoxyCodeLine{666 \textcolor{comment}{!    endif}}
\DoxyCodeLine{667 }
\DoxyCodeLine{668     \textcolor{keywordflow}{if} (fluxes\%num\_msg < fluxes\%max\_msg) \textcolor{keywordflow}{then}}
\DoxyCodeLine{669       \textcolor{keywordflow}{if} (pen\_sw\_tot(i) > 1.000001 * i\_cp\_hconvert*scale*dt*fluxes\%sw(i,j)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{670         fluxes\%num\_msg = fluxes\%num\_msg + 1}
\DoxyCodeLine{671         \textcolor{keyword}{write}(mesg,\textcolor{stringliteral}{'("Penetrating shortwave of ",1pe17.10, \&}}
\DoxyCodeLine{672 \textcolor{stringliteral}{}\textcolor{stringliteral}{                    \&" exceeds total shortwave of ",1pe17.10,\&}}
\DoxyCodeLine{673 \textcolor{stringliteral}{}\textcolor{stringliteral}{                    \&" at ",1pg11.4,"E, "1pg11.4,"N.")'}) \&}
\DoxyCodeLine{674                pen\_sw\_tot(i), i\_cp\_hconvert*scale*dt * fluxes\%sw(i,j), \&}
\DoxyCodeLine{675                g\%geoLonT(i,j), g\%geoLatT(i,j)}
\DoxyCodeLine{676         \textcolor{keyword}{call }mom\_error(warning,mesg)}
\DoxyCodeLine{677 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{678 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{679 }
\DoxyCodeLine{680     \textcolor{comment}{! remove penetrative portion of the SW that is NOT absorbed within a}}
\DoxyCodeLine{681     \textcolor{comment}{! tiny layer at the top of the ocean.}}
\DoxyCodeLine{682     net\_heat(i) = net\_heat(i) -\/ pen\_sw\_tot(i)}
\DoxyCodeLine{683     \textcolor{comment}{!Repeat above code for 'rate' term}}
\DoxyCodeLine{684     \textcolor{keywordflow}{if} (do\_nhr) net\_heat\_rate(i) = net\_heat\_rate(i) -\/ pen\_sw\_tot\_rate(i)}
\DoxyCodeLine{685 }
\DoxyCodeLine{686     \textcolor{comment}{! diagnose non-\/downwelling SW}}
\DoxyCodeLine{687     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(nonpensw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{688       nonpensw(i) = scale * dt * i\_cp\_hconvert * fluxes\%sw(i,j) -\/ pen\_sw\_tot(i)}
\DoxyCodeLine{689 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{690 }
\DoxyCodeLine{691     \textcolor{comment}{! Salt fluxes}}
\DoxyCodeLine{692     net\_salt(i) = 0.0}
\DoxyCodeLine{693     \textcolor{keywordflow}{if} (do\_nsr) net\_salt\_rate(i) = 0.0}
\DoxyCodeLine{694     \textcolor{comment}{! Convert salt\_flux from kg (salt)/(m\string^2 * s) to}}
\DoxyCodeLine{695     \textcolor{comment}{! Boussinesq: (ppt * m)}}
\DoxyCodeLine{696     \textcolor{comment}{! non-\/Bouss:  (g/m\string^2)}}
\DoxyCodeLine{697     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%salt\_flux)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{698       net\_salt(i) = (scale * dt * (1000.0 * fluxes\%salt\_flux(i,j))) * gv\%RZ\_to\_H}
\DoxyCodeLine{699       \textcolor{comment}{!Repeat above code for 'rate' term}}
\DoxyCodeLine{700       \textcolor{keywordflow}{if} (do\_nsr) net\_salt\_rate(i) = (scale * 1. * (1000.0 * fluxes\%salt\_flux(i,j))) * gv\%RZ\_to\_H}
\DoxyCodeLine{701 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{702 }
\DoxyCodeLine{703     \textcolor{comment}{! Diagnostics follow...}}
\DoxyCodeLine{704     \textcolor{keywordflow}{if} (calculate\_diags) \textcolor{keywordflow}{then}}
\DoxyCodeLine{705 }
\DoxyCodeLine{706       \textcolor{comment}{! Store Net\_salt for unknown reason?}}
\DoxyCodeLine{707       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%salt\_flux)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{708         \textcolor{comment}{! This seems like a bad idea to me. -\/RWH}}
\DoxyCodeLine{709         \textcolor{keywordflow}{if} (calculate\_diags) fluxes\%netSalt(i,j) = us\%kg\_m2s\_to\_RZ\_T*net\_salt(i)}
\DoxyCodeLine{710 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{711 }
\DoxyCodeLine{712       \textcolor{comment}{! Initialize heat\_content\_massin that is diagnosed in mixedlayer\_convection or}}
\DoxyCodeLine{713       \textcolor{comment}{! applyBoundaryFluxes such that the meaning is as the sum of all incoming components.}}
\DoxyCodeLine{714       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massin))  \textcolor{keywordflow}{then}}
\DoxyCodeLine{715         \textcolor{keywordflow}{if} (aggregate\_fw) \textcolor{keywordflow}{then}}
\DoxyCodeLine{716           \textcolor{keywordflow}{if} (netmassinout(i) > 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! net is "in"}}
\DoxyCodeLine{717             fluxes\%heat\_content\_massin(i,j) = -\/fluxes\%C\_p * netmassout(i) * t(i,1) * gv\%H\_to\_RZ / dt}
\DoxyCodeLine{718           \textcolor{keywordflow}{else} \textcolor{comment}{! net is "out"}}
\DoxyCodeLine{719             fluxes\%heat\_content\_massin(i,j) = fluxes\%C\_p * ( netmassinout(i) -\/ netmassout(i) ) * \&}
\DoxyCodeLine{720                                                t(i,1) * gv\%H\_to\_RZ / dt}
\DoxyCodeLine{721 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{722         \textcolor{keywordflow}{else}}
\DoxyCodeLine{723           fluxes\%heat\_content\_massin(i,j) = 0.}
\DoxyCodeLine{724 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{725 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{726 }
\DoxyCodeLine{727       \textcolor{comment}{! Initialize heat\_content\_massout that is diagnosed in mixedlayer\_convection or}}
\DoxyCodeLine{728       \textcolor{comment}{! applyBoundaryFluxes such that the meaning is as the sum of all outgoing components.}}
\DoxyCodeLine{729       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{730         \textcolor{keywordflow}{if} (aggregate\_fw) \textcolor{keywordflow}{then}}
\DoxyCodeLine{731           \textcolor{keywordflow}{if} (netmassinout(i) > 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! net is "in"}}
\DoxyCodeLine{732             fluxes\%heat\_content\_massout(i,j) = fluxes\%C\_p * netmassout(i) * t(i,1) * gv\%H\_to\_RZ / dt}
\DoxyCodeLine{733           \textcolor{keywordflow}{else} \textcolor{comment}{! net is "out"}}
\DoxyCodeLine{734             fluxes\%heat\_content\_massout(i,j) = -\/fluxes\%C\_p * ( netmassinout(i) -\/ netmassout(i) ) * \&}
\DoxyCodeLine{735                                                 t(i,1) * gv\%H\_to\_RZ / dt}
\DoxyCodeLine{736 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{737         \textcolor{keywordflow}{else}}
\DoxyCodeLine{738           fluxes\%heat\_content\_massout(i,j) = 0.0}
\DoxyCodeLine{739 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{740 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{741 }
\DoxyCodeLine{742       \textcolor{comment}{! smg: we should remove sea ice melt from lprec!!!}}
\DoxyCodeLine{743       \textcolor{comment}{! fluxes\%lprec > 0 means ocean gains mass via liquid precipitation and/or sea ice melt.}}
\DoxyCodeLine{744       \textcolor{comment}{! When atmosphere does not provide heat of this precipitation, the ocean assumes}}
\DoxyCodeLine{745       \textcolor{comment}{! it enters the ocean at the SST.}}
\DoxyCodeLine{746       \textcolor{comment}{! fluxes\%lprec < 0 means ocean loses mass via sea ice formation. As we do not yet know}}
\DoxyCodeLine{747       \textcolor{comment}{! the layer at which this mass is removed, we cannot compute it heat content. We must}}
\DoxyCodeLine{748       \textcolor{comment}{! wait until MOM\_diabatic\_driver.F90.}}
\DoxyCodeLine{749       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{750         \textcolor{keywordflow}{if} (fluxes\%lprec(i,j) > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{751           fluxes\%heat\_content\_lprec(i,j) = fluxes\%C\_p*fluxes\%lprec(i,j)*t(i,1)}
\DoxyCodeLine{752         \textcolor{keywordflow}{else}}
\DoxyCodeLine{753           fluxes\%heat\_content\_lprec(i,j) = 0.0}
\DoxyCodeLine{754 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{755 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{756 }
\DoxyCodeLine{757       \textcolor{comment}{! fprec SHOULD enter ocean at 0degC if atmos model does not provide fprec heat content.}}
\DoxyCodeLine{758       \textcolor{comment}{! However, we need to adjust netHeat above to reflect the difference between 0decC and SST}}
\DoxyCodeLine{759       \textcolor{comment}{! and until we do so fprec is treated like lprec and enters at SST. -\/AJA}}
\DoxyCodeLine{760       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{761         \textcolor{keywordflow}{if} (fluxes\%fprec(i,j) > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{762           fluxes\%heat\_content\_fprec(i,j) = fluxes\%C\_p*fluxes\%fprec(i,j)*t(i,1)}
\DoxyCodeLine{763         \textcolor{keywordflow}{else}}
\DoxyCodeLine{764           fluxes\%heat\_content\_fprec(i,j) = 0.0}
\DoxyCodeLine{765 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{766 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{767 }
\DoxyCodeLine{768       \textcolor{comment}{! Following lprec and fprec, water flux due to sea ice melt (seaice\_melt) enters at SST -\/ GMM}}
\DoxyCodeLine{769       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{770         \textcolor{keywordflow}{if} (fluxes\%seaice\_melt(i,j) > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{771           fluxes\%heat\_content\_icemelt(i,j) = fluxes\%C\_p*fluxes\%seaice\_melt(i,j)*t(i,1)}
\DoxyCodeLine{772         \textcolor{keywordflow}{else}}
\DoxyCodeLine{773           fluxes\%heat\_content\_icemelt(i,j) = 0.0}
\DoxyCodeLine{774 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{775 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{776 }
\DoxyCodeLine{777       \textcolor{comment}{! virtual precip associated with salinity restoring}}
\DoxyCodeLine{778       \textcolor{comment}{! vprec > 0 means add water to ocean, assumed to be at SST}}
\DoxyCodeLine{779       \textcolor{comment}{! vprec < 0 means remove water from ocean; set heat\_content\_vprec in MOM\_diabatic\_driver.F90}}
\DoxyCodeLine{780       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{781         \textcolor{keywordflow}{if} (fluxes\%vprec(i,j) > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{782           fluxes\%heat\_content\_vprec(i,j) = fluxes\%C\_p*fluxes\%vprec(i,j)*t(i,1)}
\DoxyCodeLine{783         \textcolor{keywordflow}{else}}
\DoxyCodeLine{784           fluxes\%heat\_content\_vprec(i,j) = 0.0}
\DoxyCodeLine{785 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{786 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{787 }
\DoxyCodeLine{788       \textcolor{comment}{! fluxes\%evap < 0 means ocean loses mass due to evaporation.}}
\DoxyCodeLine{789       \textcolor{comment}{! Evaporation leaves ocean surface at a temperature that has yet to be determined,}}
\DoxyCodeLine{790       \textcolor{comment}{! since we do not know the precise layer that the water evaporates.  We therefore}}
\DoxyCodeLine{791       \textcolor{comment}{! compute fluxes\%heat\_content\_massout at the relevant point inside MOM\_diabatic\_driver.F90.}}
\DoxyCodeLine{792       \textcolor{comment}{! fluxes\%evap > 0 means ocean gains moisture via condensation.}}
\DoxyCodeLine{793       \textcolor{comment}{! Condensation is assumed to drop into the ocean at the SST, just like lprec.}}
\DoxyCodeLine{794       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{795         \textcolor{keywordflow}{if} (fluxes\%evap(i,j) > 0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{796           fluxes\%heat\_content\_cond(i,j) = fluxes\%C\_p*fluxes\%evap(i,j)*t(i,1)}
\DoxyCodeLine{797         \textcolor{keywordflow}{else}}
\DoxyCodeLine{798           fluxes\%heat\_content\_cond(i,j) = 0.0}
\DoxyCodeLine{799 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{800 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{801 }
\DoxyCodeLine{802       \textcolor{comment}{! Liquid runoff enters ocean at SST if land model does not provide runoff heat content.}}
\DoxyCodeLine{803       \textcolor{keywordflow}{if} (.not. useriverheatcontent) \textcolor{keywordflow}{then}}
\DoxyCodeLine{804         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{805           fluxes\%heat\_content\_lrunoff(i,j) = fluxes\%C\_p*fluxes\%lrunoff(i,j)*t(i,1)}
\DoxyCodeLine{806 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{807 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{808 }
\DoxyCodeLine{809       \textcolor{comment}{! Icebergs enter ocean at SST if land model does not provide calving heat content.}}
\DoxyCodeLine{810       \textcolor{keywordflow}{if} (.not. usecalvingheatcontent) \textcolor{keywordflow}{then}}
\DoxyCodeLine{811         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{812           fluxes\%heat\_content\_frunoff(i,j) = fluxes\%C\_p*fluxes\%frunoff(i,j)*t(i,1)}
\DoxyCodeLine{813 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{814 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{815 }
\DoxyCodeLine{816 \textcolor{keywordflow}{    endif} \textcolor{comment}{! calculate\_diags}}
\DoxyCodeLine{817 }
\DoxyCodeLine{818 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! i-\/loop}}
\DoxyCodeLine{819 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_abb28aefef337fc656fd719eaff7a3b60}\label{namespacemom__forcing__type_abb28aefef337fc656fd719eaff7a3b60}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!extractfluxes2d@{extractfluxes2d}}
\index{extractfluxes2d@{extractfluxes2d}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{extractfluxes2d()}{extractfluxes2d()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::extractfluxes2d (\begin{DoxyParamCaption}\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(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(optics\+\_\+type), pointer}]{optics,  }\item[{integer, intent(in)}]{nsw,  }\item[{real, intent(in)}]{dt,  }\item[{real, intent(in)}]{Flux\+Rescale\+Depth,  }\item[{logical, intent(in)}]{use\+River\+Heat\+Content,  }\item[{logical, intent(in)}]{use\+Calving\+Heat\+Content,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{T,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{net\+Mass\+In\+Out,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{net\+Mass\+Out,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{net\+\_\+heat,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{Net\+\_\+salt,  }\item[{real, dimension(max(1,nsw),g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{Pen\+\_\+\+S\+W\+\_\+bnd,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(inout)}]{tv,  }\item[{logical, intent(in)}]{aggregate\+\_\+\+FW }\end{DoxyParamCaption})}



2d wrapper for 1d extract fluxes from surface fluxes type. This subroutine extracts fluxes from the surface fluxes type. It multiplies the fluxes by dt, so that the result is an accumulation of the fluxes over a time step. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & structure containing pointers to forcing. \\
\hline
 & {\em optics} & pointer to optics \\
\hline
\mbox{\texttt{ in}}  & {\em nsw} & number of bands of penetrating SW \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The time step for these fluxes \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em fluxrescaledepth} & min ocean depth before fluxes are scaled away \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em useriverheatcontent} & logical for river heat content \\
\hline
\mbox{\texttt{ in}}  & {\em usecalvingheatcontent} & logical for calving heat content \\
\hline
\mbox{\texttt{ in}}  & {\em h} & layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em t} & layer temperatures \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em netmassinout} & net mass flux (non-\/\+Bouss) or volume flux (if Bouss) of water in/out of ocean over a time step \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em netmassout} & net mass flux (non-\/\+Bouss) or volume flux (if Bouss) of water leaving ocean surface over a time step \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+heat} & net heat at the surface accumulated over a time step associated with coupler + restore. Exclude two terms from net\+\_\+heat\+: (1) downwelling (penetrative) SW, (2) evaporation heat content, (since do not yet know temperature of evap). \mbox{[}degC H $\sim$$>$ degC m or degC kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+salt} & surface salt flux into the ocean accumulated over a time step \mbox{[}ppt H $\sim$$>$ ppt m or ppt kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em pen\+\_\+sw\+\_\+bnd} & penetrating SW flux, by frequency band \mbox{[}degC H $\sim$$>$ degC m or degC kg m-\/2\mbox{]} with array size nsw x G isd\+: G ied, where nsw=number of SW bands in pen\+\_\+\+S\+W\+\_\+bnd. This heat flux is not in net\+\_\+heat. \\
\hline
\mbox{\texttt{ in,out}}  & {\em tv} & structure containing pointers to available thermodynamic fields. Here it is used to keep track of the heat flux associated with net mass fluxes into the ocean. \\
\hline
\mbox{\texttt{ in}}  & {\em aggregate\+\_\+fw} & For determining how to aggregate the forcing. \\
\hline
\end{DoxyParams}


Definition at line 830 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{830 }
\DoxyCodeLine{831   \textcolor{keywordtype}{type}(ocean\_grid\_type),            \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{              !< ocean grid structure}}
\DoxyCodeLine{832   \textcolor{keywordtype}{type}(verticalGrid\_type),          \textcolor{keywordtype}{intent(in)}    :: GV\textcolor{comment}{             !< ocean vertical grid structure}}
\DoxyCodeLine{833   \textcolor{keywordtype}{type}(unit\_scale\_type),            \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{             !< A dimensional unit scaling type}}
\DoxyCodeLine{834   \textcolor{keywordtype}{type}(forcing),                    \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{         !< structure containing pointers to forcing.}}
\DoxyCodeLine{835   \textcolor{keywordtype}{type}(optics\_type),                \textcolor{keywordtype}{pointer}       :: optics\textcolor{comment}{         !< pointer to optics}}
\DoxyCodeLine{836   \textcolor{keywordtype}{integer},                          \textcolor{keywordtype}{intent(in)}    :: nsw\textcolor{comment}{            !< number of bands of penetrating SW}}
\DoxyCodeLine{837 \textcolor{keywordtype}{  real},                             \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{             !< The time step for these fluxes [T \string~> s]}}
\DoxyCodeLine{838 \textcolor{keywordtype}{  real},                             \textcolor{keywordtype}{intent(in)}    :: FluxRescaleDepth\textcolor{comment}{ !< min ocean depth before fluxes}}
\DoxyCodeLine{839 \textcolor{comment}{                                                                    !! are scaled away [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{840   \textcolor{keywordtype}{logical},                          \textcolor{keywordtype}{intent(in)}    :: useRiverHeatContent\textcolor{comment}{   !< logical for river heat content}}
\DoxyCodeLine{841   \textcolor{keywordtype}{logical},                          \textcolor{keywordtype}{intent(in)}    :: useCalvingHeatContent\textcolor{comment}{ !< logical for calving heat content}}
\DoxyCodeLine{842 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{843                                     \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{              !< layer thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{844 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{845                                     \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{              !< layer temperatures [degC]}}
\DoxyCodeLine{846 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)}   :: netMassInOut\textcolor{comment}{   !< net mass flux (non-\/Bouss) or volume flux}}
\DoxyCodeLine{847 \textcolor{comment}{                                                                    !! (if Bouss) of water in/out of ocean over}}
\DoxyCodeLine{848 \textcolor{comment}{                                                                    !! a time step [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{849 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)}   :: netMassOut\textcolor{comment}{     !< net mass flux (non-\/Bouss) or volume flux}}
\DoxyCodeLine{850 \textcolor{comment}{                                                                    !! (if Bouss) of water leaving ocean surface}}
\DoxyCodeLine{851 \textcolor{comment}{                                                                    !! over a time step [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{852 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)}   :: net\_heat\textcolor{comment}{       !< net heat at the surface accumulated over a}}
\DoxyCodeLine{853 \textcolor{comment}{                                                                    !! time step associated with coupler + restore.}}
\DoxyCodeLine{854 \textcolor{comment}{                                                                    !! Exclude two terms from net\_heat:}}
\DoxyCodeLine{855 \textcolor{comment}{                                                                    !! (1) downwelling (penetrative) SW,}}
\DoxyCodeLine{856 \textcolor{comment}{                                                                    !! (2) evaporation heat content,}}
\DoxyCodeLine{857 \textcolor{comment}{                                                                    !! (since do not yet know temperature of evap).}}
\DoxyCodeLine{858 \textcolor{comment}{                                                                    !! [degC H \string~> degC m or degC kg m-\/2]}}
\DoxyCodeLine{859 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)}   :: net\_salt\textcolor{comment}{       !< surface salt flux into the ocean accumulated}}
\DoxyCodeLine{860 \textcolor{comment}{                                                                    !! over a time step [ppt H \string~> ppt m or ppt kg m-\/2]}}
\DoxyCodeLine{861 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(max(1,nsw),G\%isd:G\%ied,G\%jsd:G\%jed)}, \textcolor{keywordtype}{intent(out)} :: pen\_SW\_bnd\textcolor{comment}{ !< penetrating SW flux, by frequency}}
\DoxyCodeLine{862 \textcolor{comment}{                                                                    !! band [degC H \string~> degC m or degC kg m-\/2] with array}}
\DoxyCodeLine{863 \textcolor{comment}{                                                                    !! size nsw x SZI\_(G), where nsw=number of SW bands}}
\DoxyCodeLine{864 \textcolor{comment}{                                                                    !! in pen\_SW\_bnd. This heat flux is not in net\_heat.}}
\DoxyCodeLine{865   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),            \textcolor{keywordtype}{intent(inout)} :: tv\textcolor{comment}{             !< structure containing pointers to available}}
\DoxyCodeLine{866 \textcolor{comment}{                                                                    !! thermodynamic fields. Here it is used to keep}}
\DoxyCodeLine{867 \textcolor{comment}{                                                                    !! track of the heat flux associated with net}}
\DoxyCodeLine{868 \textcolor{comment}{                                                                    !! mass fluxes into the ocean.}}
\DoxyCodeLine{869   \textcolor{keywordtype}{logical},                          \textcolor{keywordtype}{intent(in)}    :: aggregate\_FW\textcolor{comment}{   !< For determining how to aggregate the forcing.}}
\DoxyCodeLine{870 }
\DoxyCodeLine{871   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{872   \textcolor{comment}{!\$OMP parallel do default(shared)}}
\DoxyCodeLine{873   \textcolor{keywordflow}{do} j=g\%jsc, g\%jec}
\DoxyCodeLine{874     \textcolor{keyword}{call }extractfluxes1d(g, gv, us, fluxes, optics, nsw, j, dt, \&}
\DoxyCodeLine{875             fluxrescaledepth, useriverheatcontent, usecalvingheatcontent,\&}
\DoxyCodeLine{876             h(:,j,:), t(:,j,:), netmassinout(:,j), netmassout(:,j),              \&}
\DoxyCodeLine{877             net\_heat(:,j), net\_salt(:,j), pen\_sw\_bnd(:,:,j), tv, aggregate\_fw)}
\DoxyCodeLine{878 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{879 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a839c0241813c94b40b6861e2ad8bdc91}\label{namespacemom__forcing__type_a839c0241813c94b40b6861e2ad8bdc91}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!fluxes\_accumulate@{fluxes\_accumulate}}
\index{fluxes\_accumulate@{fluxes\_accumulate}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{fluxes\_accumulate()}{fluxes\_accumulate()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::fluxes\+\_\+accumulate (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{flux\+\_\+tmp,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{real, intent(out)}]{wt2,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in), optional}]{forces }\end{DoxyParamCaption})}



Accumulate the thermodynamic fluxes over time steps. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em flux\+\_\+tmp} & A temporary structure with current thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing time-\/averaged thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em wt2} & The relative weight of the new fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\end{DoxyParams}


Definition at line 1914 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1914   \textcolor{keywordtype}{type}(forcing),             \textcolor{keywordtype}{intent(in)}    :: flux\_tmp\textcolor{comment}{ !< A temporary structure with current}}
\DoxyCodeLine{1915 \textcolor{comment}{                                                     !! thermodynamic forcing fields}}
\DoxyCodeLine{1916   \textcolor{keywordtype}{type}(forcing),             \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing time-\/averaged}}
\DoxyCodeLine{1917 \textcolor{comment}{                                                     !! thermodynamic forcing fields}}
\DoxyCodeLine{1918   \textcolor{keywordtype}{type}(ocean\_grid\_type),     \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{      !< The ocean's grid structure}}
\DoxyCodeLine{1919 \textcolor{keywordtype}{  real},                      \textcolor{keywordtype}{intent(out)}   :: wt2\textcolor{comment}{    !< The relative weight of the new fluxes}}
\DoxyCodeLine{1920   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}}
\DoxyCodeLine{1921 }
\DoxyCodeLine{1922   \textcolor{comment}{! This subroutine copies mechancal forcing from flux\_tmp to fluxes and}}
\DoxyCodeLine{1923   \textcolor{comment}{! stores the time-\/weighted averages of the various buoyancy fluxes in fluxes,}}
\DoxyCodeLine{1924   \textcolor{comment}{! and increments the amount of time over which the buoyancy forcing in fluxes should be}}
\DoxyCodeLine{1925   \textcolor{comment}{! applied based on the time interval stored in flux\_tmp.}}
\DoxyCodeLine{1926 }
\DoxyCodeLine{1927 \textcolor{keywordtype}{  real} :: wt1}
\DoxyCodeLine{1928   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq, i0, j0}
\DoxyCodeLine{1929   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, IsdB, IedB, JsdB, JedB, isr, ier, jsr, jer}
\DoxyCodeLine{1930   is   = g\%isc   ; ie   = g\%iec    ; js   = g\%jsc   ; je   = g\%jec}
\DoxyCodeLine{1931   isq  = g\%IscB  ; ieq  = g\%IecB   ; jsq  = g\%JscB  ; jeq  = g\%JecB}
\DoxyCodeLine{1932   isd  = g\%isd   ; ied  = g\%ied    ; jsd  = g\%jsd   ; jed  = g\%jed}
\DoxyCodeLine{1933   isdb = g\%IsdB  ; iedb = g\%IedB   ; jsdb = g\%JsdB  ; jedb = g\%JedB}
\DoxyCodeLine{1934 }
\DoxyCodeLine{1935 }
\DoxyCodeLine{1936   \textcolor{keywordflow}{if} (fluxes\%dt\_buoy\_accum < 0) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"fluxes\_accumulate: "}//\&}
\DoxyCodeLine{1937      \textcolor{stringliteral}{"fluxes must be initialzed before it can be augmented."})}
\DoxyCodeLine{1938 }
\DoxyCodeLine{1939   \textcolor{comment}{! wt1 is the relative weight of the previous fluxes.}}
\DoxyCodeLine{1940   wt1 = fluxes\%dt\_buoy\_accum / (fluxes\%dt\_buoy\_accum + flux\_tmp\%dt\_buoy\_accum)}
\DoxyCodeLine{1941   wt2 = 1.0 -\/ wt1 \textcolor{comment}{! = flux\_tmp\%dt\_buoy\_accum / (fluxes\%dt\_buoy\_accum + flux\_tmp\%dt\_buoy\_accum)}}
\DoxyCodeLine{1942   fluxes\%dt\_buoy\_accum = fluxes\%dt\_buoy\_accum + flux\_tmp\%dt\_buoy\_accum}
\DoxyCodeLine{1943 }
\DoxyCodeLine{1944   \textcolor{comment}{! Copy over the pressure fields and accumulate averages of ustar, either from the forcing}}
\DoxyCodeLine{1945   \textcolor{comment}{! type or from the temporary fluxes type.}}
\DoxyCodeLine{1946   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(forces)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1947     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1948       fluxes\%p\_surf(i,j) = forces\%p\_surf(i,j)}
\DoxyCodeLine{1949       fluxes\%p\_surf\_full(i,j) = forces\%p\_surf\_full(i,j)}
\DoxyCodeLine{1950 }
\DoxyCodeLine{1951       fluxes\%ustar(i,j) = wt1*fluxes\%ustar(i,j) + wt2*forces\%ustar(i,j)}
\DoxyCodeLine{1952 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1953   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1954     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1955       fluxes\%p\_surf(i,j) = flux\_tmp\%p\_surf(i,j)}
\DoxyCodeLine{1956       fluxes\%p\_surf\_full(i,j) = flux\_tmp\%p\_surf\_full(i,j)}
\DoxyCodeLine{1957 }
\DoxyCodeLine{1958       fluxes\%ustar(i,j) = wt1*fluxes\%ustar(i,j) + wt2*flux\_tmp\%ustar(i,j)}
\DoxyCodeLine{1959 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1960 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1961 }
\DoxyCodeLine{1962   \textcolor{comment}{! Average the water, heat, and salt fluxes, and ustar.}}
\DoxyCodeLine{1963   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1964     \textcolor{keywordflow}{if} (fluxes\%gustless\_accum\_bug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1965       fluxes\%ustar\_gustless(i,j) = flux\_tmp\%ustar\_gustless(i,j)}
\DoxyCodeLine{1966     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1967       fluxes\%ustar\_gustless(i,j) = wt1*fluxes\%ustar\_gustless(i,j) + wt2*flux\_tmp\%ustar\_gustless(i,j)}
\DoxyCodeLine{1968 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1969 }
\DoxyCodeLine{1970     fluxes\%evap(i,j) = wt1*fluxes\%evap(i,j) + wt2*flux\_tmp\%evap(i,j)}
\DoxyCodeLine{1971     fluxes\%lprec(i,j) = wt1*fluxes\%lprec(i,j) + wt2*flux\_tmp\%lprec(i,j)}
\DoxyCodeLine{1972     fluxes\%fprec(i,j) = wt1*fluxes\%fprec(i,j) + wt2*flux\_tmp\%fprec(i,j)}
\DoxyCodeLine{1973     fluxes\%vprec(i,j) = wt1*fluxes\%vprec(i,j) + wt2*flux\_tmp\%vprec(i,j)}
\DoxyCodeLine{1974     fluxes\%lrunoff(i,j) = wt1*fluxes\%lrunoff(i,j) + wt2*flux\_tmp\%lrunoff(i,j)}
\DoxyCodeLine{1975     fluxes\%frunoff(i,j) = wt1*fluxes\%frunoff(i,j) + wt2*flux\_tmp\%frunoff(i,j)}
\DoxyCodeLine{1976     fluxes\%seaice\_melt(i,j) = wt1*fluxes\%seaice\_melt(i,j) + wt2*flux\_tmp\%seaice\_melt(i,j)}
\DoxyCodeLine{1977     fluxes\%sw(i,j) = wt1*fluxes\%sw(i,j) + wt2*flux\_tmp\%sw(i,j)}
\DoxyCodeLine{1978     fluxes\%sw\_vis\_dir(i,j) = wt1*fluxes\%sw\_vis\_dir(i,j) + wt2*flux\_tmp\%sw\_vis\_dir(i,j)}
\DoxyCodeLine{1979     fluxes\%sw\_vis\_dif(i,j) = wt1*fluxes\%sw\_vis\_dif(i,j) + wt2*flux\_tmp\%sw\_vis\_dif(i,j)}
\DoxyCodeLine{1980     fluxes\%sw\_nir\_dir(i,j) = wt1*fluxes\%sw\_nir\_dir(i,j) + wt2*flux\_tmp\%sw\_nir\_dir(i,j)}
\DoxyCodeLine{1981     fluxes\%sw\_nir\_dif(i,j) = wt1*fluxes\%sw\_nir\_dif(i,j) + wt2*flux\_tmp\%sw\_nir\_dif(i,j)}
\DoxyCodeLine{1982     fluxes\%lw(i,j) = wt1*fluxes\%lw(i,j) + wt2*flux\_tmp\%lw(i,j)}
\DoxyCodeLine{1983     fluxes\%latent(i,j) = wt1*fluxes\%latent(i,j) + wt2*flux\_tmp\%latent(i,j)}
\DoxyCodeLine{1984     fluxes\%sens(i,j) = wt1*fluxes\%sens(i,j) + wt2*flux\_tmp\%sens(i,j)}
\DoxyCodeLine{1985 }
\DoxyCodeLine{1986     fluxes\%salt\_flux(i,j) = wt1*fluxes\%salt\_flux(i,j) + wt2*flux\_tmp\%salt\_flux(i,j)}
\DoxyCodeLine{1987 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1988   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_added) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_added)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1989     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1990       fluxes\%heat\_added(i,j) = wt1*fluxes\%heat\_added(i,j) + wt2*flux\_tmp\%heat\_added(i,j)}
\DoxyCodeLine{1991 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1992 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1993   \textcolor{comment}{! These might always be associated, in which case they can be combined?}}
\DoxyCodeLine{1994   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_cond)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1995     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1996       fluxes\%heat\_content\_cond(i,j) = wt1*fluxes\%heat\_content\_cond(i,j) + wt2*flux\_tmp\%heat\_content\_cond(i,j)}
\DoxyCodeLine{1997 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1998 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1999   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2000     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2001       fluxes\%heat\_content\_lprec(i,j) = wt1*fluxes\%heat\_content\_lprec(i,j) + wt2*flux\_tmp\%heat\_content\_lprec(i,j)}
\DoxyCodeLine{2002 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2003 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2004   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_fprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2005     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2006       fluxes\%heat\_content\_fprec(i,j) = wt1*fluxes\%heat\_content\_fprec(i,j) + wt2*flux\_tmp\%heat\_content\_fprec(i,j)}
\DoxyCodeLine{2007 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2008 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2009   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_icemelt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2010     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2011       fluxes\%heat\_content\_icemelt(i,j) = wt1*fluxes\%heat\_content\_icemelt(i,j) + wt2*flux\_tmp\%heat\_content\_icemelt(i,j)}
\DoxyCodeLine{2012 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2013 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2014   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2015     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2016       fluxes\%heat\_content\_vprec(i,j) = wt1*fluxes\%heat\_content\_vprec(i,j) + wt2*flux\_tmp\%heat\_content\_vprec(i,j)}
\DoxyCodeLine{2017 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2018 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2019   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_lrunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2020     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2021       fluxes\%heat\_content\_lrunoff(i,j) = wt1*fluxes\%heat\_content\_lrunoff(i,j) + wt2*flux\_tmp\%heat\_content\_lrunoff(i,j)}
\DoxyCodeLine{2022 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2023 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2024   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_frunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2025     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2026       fluxes\%heat\_content\_frunoff(i,j) = wt1*fluxes\%heat\_content\_frunoff(i,j) + wt2*flux\_tmp\%heat\_content\_frunoff(i,j)}
\DoxyCodeLine{2027 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2028 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2029   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt) .and. \textcolor{keyword}{associated}(flux\_tmp\%heat\_content\_icemelt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2030     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2031       fluxes\%heat\_content\_icemelt(i,j) = wt1*fluxes\%heat\_content\_icemelt(i,j) + wt2*flux\_tmp\%heat\_content\_icemelt(i,j)}
\DoxyCodeLine{2032 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2033 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2034 }
\DoxyCodeLine{2035   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_shelf) .and. \textcolor{keyword}{associated}(flux\_tmp\%ustar\_shelf)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2036     \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsd,jed}
\DoxyCodeLine{2037       fluxes\%ustar\_shelf(i,j)  = flux\_tmp\%ustar\_shelf(i,j)}
\DoxyCodeLine{2038 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2039 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2040   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%iceshelf\_melt) .and. \textcolor{keyword}{associated}(flux\_tmp\%iceshelf\_melt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2041     \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsd,jed}
\DoxyCodeLine{2042       fluxes\%iceshelf\_melt(i,j)  = flux\_tmp\%iceshelf\_melt(i,j)}
\DoxyCodeLine{2043 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2044 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2045   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frac\_shelf\_h) .and. \textcolor{keyword}{associated}(flux\_tmp\%frac\_shelf\_h)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2046     \textcolor{keywordflow}{do} i=isd,ied ; \textcolor{keywordflow}{do} j=jsd,jed}
\DoxyCodeLine{2047       fluxes\%frac\_shelf\_h(i,j)  = flux\_tmp\%frac\_shelf\_h(i,j)}
\DoxyCodeLine{2048 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2049 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2050 }
\DoxyCodeLine{2051   \textcolor{keywordflow}{if} (coupler\_type\_initialized(fluxes\%tr\_fluxes) .and. \&}
\DoxyCodeLine{2052       coupler\_type\_initialized(flux\_tmp\%tr\_fluxes)) \&}
\DoxyCodeLine{2053     \textcolor{keyword}{call }coupler\_type\_increment\_data(flux\_tmp\%tr\_fluxes, fluxes\%tr\_fluxes, \&}
\DoxyCodeLine{2054                               scale\_factor=wt2, scale\_prev=wt1)}
\DoxyCodeLine{2055 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_aab6d8e5da1aafc8a73875e2de61822f9}\label{namespacemom__forcing__type_aab6d8e5da1aafc8a73875e2de61822f9}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!forcing\_accumulate@{forcing\_accumulate}}
\index{forcing\_accumulate@{forcing\_accumulate}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{forcing\_accumulate()}{forcing\_accumulate()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::forcing\+\_\+accumulate (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{flux\+\_\+tmp,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{real, intent(out)}]{wt2 }\end{DoxyParamCaption})}



Accumulate the forcing over time steps, taking input from a mechanical forcing type and a temporary forcing-\/flux type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em flux\+\_\+tmp} & A temporary structure with current thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing time-\/averaged thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em wt2} & The relative weight of the new fluxes \\
\hline
\end{DoxyParams}


Definition at line 1895 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1895   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(in)}    :: flux\_tmp\textcolor{comment}{ !< A temporary structure with current}}
\DoxyCodeLine{1896 \textcolor{comment}{                                                 !!thermodynamic forcing fields}}
\DoxyCodeLine{1897   \textcolor{keywordtype}{type}(mech\_forcing),    \textcolor{keywordtype}{intent(in)}    :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}}
\DoxyCodeLine{1898   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< A structure containing time-\/averaged}}
\DoxyCodeLine{1899 \textcolor{comment}{                                                 !! thermodynamic forcing fields}}
\DoxyCodeLine{1900   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{      !< The ocean's grid structure}}
\DoxyCodeLine{1901 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{intent(out)}   :: wt2\textcolor{comment}{    !< The relative weight of the new fluxes}}
\DoxyCodeLine{1902 }
\DoxyCodeLine{1903   \textcolor{comment}{! This subroutine copies mechancal forcing from flux\_tmp to fluxes and}}
\DoxyCodeLine{1904   \textcolor{comment}{! stores the time-\/weighted averages of the various buoyancy fluxes in fluxes,}}
\DoxyCodeLine{1905   \textcolor{comment}{! and increments the amount of time over which the buoyancy forcing should be}}
\DoxyCodeLine{1906   \textcolor{comment}{! applied, all via a call to fluxes accumulate.}}
\DoxyCodeLine{1907 }
\DoxyCodeLine{1908   \textcolor{keyword}{call }fluxes\_accumulate(flux\_tmp, fluxes, g, wt2, forces)}
\DoxyCodeLine{1909 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a18fc44b1946351373f626fcc5aabc340}\label{namespacemom__forcing__type_a18fc44b1946351373f626fcc5aabc340}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!forcing\_diagnostics@{forcing\_diagnostics}}
\index{forcing\_diagnostics@{forcing\_diagnostics}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{forcing\_diagnostics()}{forcing\_diagnostics()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::forcing\+\_\+diagnostics (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in), target}]{fluxes\+\_\+in,  }\item[{type(surface), intent(in)}]{sfc\+\_\+state,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in), target}]{G\+\_\+in,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(time\+\_\+type), intent(in)}]{time\+\_\+end,  }\item[{type(diag\+\_\+ctrl), intent(inout)}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing__diags}{forcing\+\_\+diags}}), intent(inout)}]{handles }\end{DoxyParamCaption})}



Offer buoyancy forcing fields for diagnostics for those fields registered as part of register\+\_\+forcing\+\_\+type\+\_\+diags. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes\+\_\+in} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean. \\
\hline
\mbox{\texttt{ in}}  & {\em g\+\_\+in} & Input grid type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+end} & The end time of the diagnostic interval. \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & diagnostic regulator \\
\hline
\mbox{\texttt{ in,out}}  & {\em handles} & diagnostic ids \\
\hline
\end{DoxyParams}


Definition at line 2274 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2274   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)}    :: fluxes\_in\textcolor{comment}{ !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2275   \textcolor{keywordtype}{type}(surface),         \textcolor{keywordtype}{intent(in)}    :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}}
\DoxyCodeLine{2276 \textcolor{comment}{                                                    !! describe the surface state of the ocean.}}
\DoxyCodeLine{2277   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: G\_in\textcolor{comment}{ !< Input grid type}}
\DoxyCodeLine{2278   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{        !< A dimensional unit scaling type}}
\DoxyCodeLine{2279   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: time\_end\textcolor{comment}{  !< The end time of the diagnostic interval.}}
\DoxyCodeLine{2280   \textcolor{keywordtype}{type}(diag\_ctrl),       \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{      !< diagnostic regulator}}
\DoxyCodeLine{2281   \textcolor{keywordtype}{type}(forcing\_diags),   \textcolor{keywordtype}{intent(inout)} :: handles\textcolor{comment}{   !< diagnostic ids}}
\DoxyCodeLine{2282 }
\DoxyCodeLine{2283   \textcolor{comment}{! local}}
\DoxyCodeLine{2284   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{pointer} :: G   \textcolor{comment}{! Grid metric on model index map}}
\DoxyCodeLine{2285   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{pointer} :: fluxes      \textcolor{comment}{! Fluxes on the model index map}}
\DoxyCodeLine{2286 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(diag\%G),SZJ\_(diag\%G))} :: res}
\DoxyCodeLine{2287 \textcolor{keywordtype}{  real} :: total\_transport \textcolor{comment}{! for diagnosing integrated boundary transport}}
\DoxyCodeLine{2288 \textcolor{keywordtype}{  real} :: ave\_flux        \textcolor{comment}{! for diagnosing averaged   boundary flux}}
\DoxyCodeLine{2289 \textcolor{keywordtype}{  real} :: RZ\_T\_conversion \textcolor{comment}{! A combination of scaling factors for mass fluxes [kg T m-\/2 s-\/1 R-\/1 Z-\/1 \string~> 1]}}
\DoxyCodeLine{2290 \textcolor{keywordtype}{  real} :: I\_dt            \textcolor{comment}{! inverse time step [T-\/1 \string~> s-\/1]}}
\DoxyCodeLine{2291 \textcolor{keywordtype}{  real} :: ppt2mks         \textcolor{comment}{! conversion between ppt and mks}}
\DoxyCodeLine{2292   \textcolor{keywordtype}{integer} :: turns        \textcolor{comment}{! Number of index quarter turns}}
\DoxyCodeLine{2293   \textcolor{keywordtype}{integer} :: i,j,is,ie,js,je}
\DoxyCodeLine{2294 }
\DoxyCodeLine{2295   \textcolor{keyword}{call }cpu\_clock\_begin(handles\%id\_clock\_forcing)}
\DoxyCodeLine{2296 }
\DoxyCodeLine{2297   \textcolor{comment}{! NOTE: post\_data expects data to be on the rotated index map, so any}}
\DoxyCodeLine{2298   \textcolor{comment}{!   rotations must be applied before saving the output.}}
\DoxyCodeLine{2299   turns = diag\%G\%HI\%turns}
\DoxyCodeLine{2300   \textcolor{keywordflow}{if} (turns /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2301     g => diag\%G}
\DoxyCodeLine{2302     \textcolor{keyword}{allocate}(fluxes)}
\DoxyCodeLine{2303     \textcolor{keyword}{call }allocate\_forcing\_type(fluxes\_in, g, fluxes)}
\DoxyCodeLine{2304     \textcolor{keyword}{call }rotate\_forcing(fluxes\_in, fluxes, turns)}
\DoxyCodeLine{2305   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2306     g => g\_in}
\DoxyCodeLine{2307     fluxes => fluxes\_in}
\DoxyCodeLine{2308 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2309 }
\DoxyCodeLine{2310   rz\_t\_conversion = us\%RZ\_T\_to\_kg\_m2s}
\DoxyCodeLine{2311   i\_dt    = 1.0 / fluxes\%dt\_buoy\_accum}
\DoxyCodeLine{2312   ppt2mks = 1e-\/3}
\DoxyCodeLine{2313   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2314 }
\DoxyCodeLine{2315   \textcolor{keyword}{call }enable\_averages(fluxes\%dt\_buoy\_accum, time\_end, diag)}
\DoxyCodeLine{2316   \textcolor{comment}{! if (query\_averaging\_enabled(diag)) then}}
\DoxyCodeLine{2317 }
\DoxyCodeLine{2318     \textcolor{comment}{! post the diagnostics for surface mass fluxes ==================================}}
\DoxyCodeLine{2319 }
\DoxyCodeLine{2320     \textcolor{keywordflow}{if} (handles\%id\_prcme > 0 .or. handles\%id\_total\_prcme > 0 .or. handles\%id\_prcme\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2321       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2322         res(i,j) = 0.0}
\DoxyCodeLine{2323         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec))       res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%lprec(i,j)}
\DoxyCodeLine{2324         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec))       res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%fprec(i,j)}
\DoxyCodeLine{2325         \textcolor{comment}{! fluxes\%cond is not needed because it is derived from \%evap > 0}}
\DoxyCodeLine{2326         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap))        res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%evap(i,j)}
\DoxyCodeLine{2327         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff))     res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%lrunoff(i,j)}
\DoxyCodeLine{2328         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff))     res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%frunoff(i,j)}
\DoxyCodeLine{2329         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec))       res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%vprec(i,j)}
\DoxyCodeLine{2330         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%seaice\_melt(i,j)}
\DoxyCodeLine{2331 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2332       \textcolor{keywordflow}{if} (handles\%id\_prcme > 0) \textcolor{keyword}{call }post\_data(handles\%id\_prcme, res, diag)}
\DoxyCodeLine{2333       \textcolor{keywordflow}{if} (handles\%id\_total\_prcme > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2334         total\_transport = global\_area\_integral(res, g)}
\DoxyCodeLine{2335         \textcolor{keyword}{call }post\_data(handles\%id\_total\_prcme, total\_transport, diag)}
\DoxyCodeLine{2336 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2337       \textcolor{keywordflow}{if} (handles\%id\_prcme\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2338         ave\_flux = global\_area\_mean(res, g)}
\DoxyCodeLine{2339         \textcolor{keyword}{call }post\_data(handles\%id\_prcme\_ga, ave\_flux, diag)}
\DoxyCodeLine{2340 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2341 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2342 }
\DoxyCodeLine{2343     \textcolor{keywordflow}{if} (handles\%id\_net\_massout > 0 .or. handles\%id\_total\_net\_massout > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2344       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2345         res(i,j) = 0.0}
\DoxyCodeLine{2346         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2347           \textcolor{keywordflow}{if} (fluxes\%lprec(i,j) < 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%lprec(i,j)}
\DoxyCodeLine{2348 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2349         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2350           \textcolor{keywordflow}{if} (fluxes\%vprec(i,j) < 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%vprec(i,j)}
\DoxyCodeLine{2351 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2352         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2353           \textcolor{keywordflow}{if} (fluxes\%evap(i,j) < 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%evap(i,j)}
\DoxyCodeLine{2354 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2355         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2356           \textcolor{keywordflow}{if} (fluxes\%seaice\_melt(i,j) < 0.0) \&}
\DoxyCodeLine{2357             res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%seaice\_melt(i,j)}
\DoxyCodeLine{2358 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2359 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2360       \textcolor{keywordflow}{if} (handles\%id\_net\_massout > 0) \textcolor{keyword}{call }post\_data(handles\%id\_net\_massout, res, diag)}
\DoxyCodeLine{2361       \textcolor{keywordflow}{if} (handles\%id\_total\_net\_massout > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2362         total\_transport = global\_area\_integral(res, g)}
\DoxyCodeLine{2363         \textcolor{keyword}{call }post\_data(handles\%id\_total\_net\_massout, total\_transport, diag)}
\DoxyCodeLine{2364 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2365 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2366 }
\DoxyCodeLine{2367     \textcolor{keywordflow}{if} (handles\%id\_massout\_flux > 0 .and. \textcolor{keyword}{associated}(fluxes\%netMassOut)) \&}
\DoxyCodeLine{2368       \textcolor{keyword}{call }post\_data(handles\%id\_massout\_flux,fluxes\%netMassOut,diag)}
\DoxyCodeLine{2369 }
\DoxyCodeLine{2370     \textcolor{keywordflow}{if} (handles\%id\_net\_massin > 0 .or. handles\%id\_total\_net\_massin > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2371       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2372         res(i,j) = 0.0}
\DoxyCodeLine{2373 }
\DoxyCodeLine{2374         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec)) \&}
\DoxyCodeLine{2375           res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%fprec(i,j)}
\DoxyCodeLine{2376         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff)) \&}
\DoxyCodeLine{2377           res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%lrunoff(i,j)}
\DoxyCodeLine{2378         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff)) \&}
\DoxyCodeLine{2379           res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%frunoff(i,j)}
\DoxyCodeLine{2380 }
\DoxyCodeLine{2381         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2382           \textcolor{keywordflow}{if} (fluxes\%lprec(i,j) > 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%lprec(i,j)}
\DoxyCodeLine{2383 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2384         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2385           \textcolor{keywordflow}{if} (fluxes\%vprec(i,j) > 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%vprec(i,j)}
\DoxyCodeLine{2386 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2387         \textcolor{comment}{! fluxes\%cond is not needed because it is derived from \%evap > 0}}
\DoxyCodeLine{2388         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2389           \textcolor{keywordflow}{if} (fluxes\%evap(i,j) > 0.0) res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%evap(i,j)}
\DoxyCodeLine{2390 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2391         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2392           \textcolor{keywordflow}{if} (fluxes\%seaice\_melt(i,j) > 0.0) \&}
\DoxyCodeLine{2393             res(i,j) = res(i,j) + rz\_t\_conversion*fluxes\%seaice\_melt(i,j)}
\DoxyCodeLine{2394 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{2395 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2396       \textcolor{keywordflow}{if} (handles\%id\_net\_massin > 0) \textcolor{keyword}{call }post\_data(handles\%id\_net\_massin, res, diag)}
\DoxyCodeLine{2397       \textcolor{keywordflow}{if} (handles\%id\_total\_net\_massin > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2398         total\_transport = global\_area\_integral(res, g)}
\DoxyCodeLine{2399         \textcolor{keyword}{call }post\_data(handles\%id\_total\_net\_massin, total\_transport, diag)}
\DoxyCodeLine{2400 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2401 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2402 }
\DoxyCodeLine{2403     \textcolor{keywordflow}{if} (handles\%id\_massin\_flux > 0 .and. \textcolor{keyword}{associated}(fluxes\%netMassIn)) \&}
\DoxyCodeLine{2404       \textcolor{keyword}{call }post\_data(handles\%id\_massin\_flux,fluxes\%netMassIn,diag)}
\DoxyCodeLine{2405 }
\DoxyCodeLine{2406     \textcolor{keywordflow}{if} ((handles\%id\_evap > 0) .and. \textcolor{keyword}{associated}(fluxes\%evap)) \&}
\DoxyCodeLine{2407       \textcolor{keyword}{call }post\_data(handles\%id\_evap, fluxes\%evap, diag)}
\DoxyCodeLine{2408     \textcolor{keywordflow}{if} ((handles\%id\_total\_evap > 0) .and. \textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2409       total\_transport = global\_area\_integral(fluxes\%evap, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2410       \textcolor{keyword}{call }post\_data(handles\%id\_total\_evap, total\_transport, diag)}
\DoxyCodeLine{2411 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2412     \textcolor{keywordflow}{if} ((handles\%id\_evap\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2413       ave\_flux = global\_area\_mean(fluxes\%evap, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2414       \textcolor{keyword}{call }post\_data(handles\%id\_evap\_ga, ave\_flux, diag)}
\DoxyCodeLine{2415 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2416 }
\DoxyCodeLine{2417     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec) .and. \textcolor{keyword}{associated}(fluxes\%fprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2418       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2419         res(i,j) = rz\_t\_conversion* (fluxes\%lprec(i,j) + fluxes\%fprec(i,j))}
\DoxyCodeLine{2420 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2421       \textcolor{keywordflow}{if} (handles\%id\_precip > 0) \textcolor{keyword}{call }post\_data(handles\%id\_precip, res, diag)}
\DoxyCodeLine{2422       \textcolor{keywordflow}{if} (handles\%id\_total\_precip > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2423         total\_transport = global\_area\_integral(res, g)}
\DoxyCodeLine{2424         \textcolor{keyword}{call }post\_data(handles\%id\_total\_precip, total\_transport, diag)}
\DoxyCodeLine{2425 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2426       \textcolor{keywordflow}{if} (handles\%id\_precip\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2427         ave\_flux = global\_area\_mean(res, g)}
\DoxyCodeLine{2428         \textcolor{keyword}{call }post\_data(handles\%id\_precip\_ga, ave\_flux, diag)}
\DoxyCodeLine{2429 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2430 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2431 }
\DoxyCodeLine{2432     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2433       \textcolor{keywordflow}{if} (handles\%id\_lprec > 0) \textcolor{keyword}{call }post\_data(handles\%id\_lprec, fluxes\%lprec, diag)}
\DoxyCodeLine{2434       \textcolor{keywordflow}{if} (handles\%id\_total\_lprec > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2435         total\_transport = global\_area\_integral(fluxes\%lprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2436         \textcolor{keyword}{call }post\_data(handles\%id\_total\_lprec, total\_transport, diag)}
\DoxyCodeLine{2437 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2438       \textcolor{keywordflow}{if} (handles\%id\_lprec\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2439         ave\_flux = global\_area\_mean(fluxes\%lprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2440         \textcolor{keyword}{call }post\_data(handles\%id\_lprec\_ga, ave\_flux, diag)}
\DoxyCodeLine{2441 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2442 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2443 }
\DoxyCodeLine{2444     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2445       \textcolor{keywordflow}{if} (handles\%id\_fprec > 0) \textcolor{keyword}{call }post\_data(handles\%id\_fprec, fluxes\%fprec, diag)}
\DoxyCodeLine{2446       \textcolor{keywordflow}{if} (handles\%id\_total\_fprec > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2447         total\_transport = global\_area\_integral(fluxes\%fprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2448         \textcolor{keyword}{call }post\_data(handles\%id\_total\_fprec, total\_transport, diag)}
\DoxyCodeLine{2449 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2450       \textcolor{keywordflow}{if} (handles\%id\_fprec\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2451         ave\_flux = global\_area\_mean(fluxes\%fprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2452         \textcolor{keyword}{call }post\_data(handles\%id\_fprec\_ga, ave\_flux, diag)}
\DoxyCodeLine{2453 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2454 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2455 }
\DoxyCodeLine{2456     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2457       \textcolor{keywordflow}{if} (handles\%id\_vprec > 0) \textcolor{keyword}{call }post\_data(handles\%id\_vprec, fluxes\%vprec, diag)}
\DoxyCodeLine{2458       \textcolor{keywordflow}{if} (handles\%id\_total\_vprec > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2459         total\_transport = global\_area\_integral(fluxes\%vprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2460         \textcolor{keyword}{call }post\_data(handles\%id\_total\_vprec, total\_transport, diag)}
\DoxyCodeLine{2461 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2462       \textcolor{keywordflow}{if} (handles\%id\_vprec\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2463         ave\_flux = global\_area\_mean(fluxes\%vprec, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2464         \textcolor{keyword}{call }post\_data(handles\%id\_vprec\_ga, ave\_flux, diag)}
\DoxyCodeLine{2465 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2466 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2467 }
\DoxyCodeLine{2468     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2469     \textcolor{keywordflow}{if} (handles\%id\_lrunoff > 0) \textcolor{keyword}{call }post\_data(handles\%id\_lrunoff, fluxes\%lrunoff, diag)}
\DoxyCodeLine{2470       \textcolor{keywordflow}{if} (handles\%id\_total\_lrunoff > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2471         total\_transport = global\_area\_integral(fluxes\%lrunoff, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2472         \textcolor{keyword}{call }post\_data(handles\%id\_total\_lrunoff, total\_transport, diag)}
\DoxyCodeLine{2473 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2474 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2475 }
\DoxyCodeLine{2476     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2477       \textcolor{keywordflow}{if} (handles\%id\_frunoff > 0) \textcolor{keyword}{call }post\_data(handles\%id\_frunoff, fluxes\%frunoff, diag)}
\DoxyCodeLine{2478       \textcolor{keywordflow}{if} (handles\%id\_total\_frunoff > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2479         total\_transport = global\_area\_integral(fluxes\%frunoff, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2480         \textcolor{keyword}{call }post\_data(handles\%id\_total\_frunoff, total\_transport, diag)}
\DoxyCodeLine{2481 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2482 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2483 }
\DoxyCodeLine{2484     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2485       \textcolor{keywordflow}{if} (handles\%id\_seaice\_melt > 0) \textcolor{keyword}{call }post\_data(handles\%id\_seaice\_melt, fluxes\%seaice\_melt, diag)}
\DoxyCodeLine{2486       \textcolor{keywordflow}{if} (handles\%id\_total\_seaice\_melt > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2487         total\_transport = global\_area\_integral(fluxes\%seaice\_melt, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2488         \textcolor{keyword}{call }post\_data(handles\%id\_total\_seaice\_melt, total\_transport, diag)}
\DoxyCodeLine{2489 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2490 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2491 }
\DoxyCodeLine{2492     \textcolor{comment}{! post diagnostics for boundary heat fluxes ====================================}}
\DoxyCodeLine{2493 }
\DoxyCodeLine{2494     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_lrunoff > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff))  \&}
\DoxyCodeLine{2495       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_lrunoff, fluxes\%heat\_content\_lrunoff, diag)}
\DoxyCodeLine{2496     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_lrunoff > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2497       total\_transport = global\_area\_integral(fluxes\%heat\_content\_lrunoff, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2498       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_lrunoff, total\_transport, diag)}
\DoxyCodeLine{2499 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2500 }
\DoxyCodeLine{2501     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_frunoff > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff))  \&}
\DoxyCodeLine{2502       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_frunoff, fluxes\%heat\_content\_frunoff, diag)}
\DoxyCodeLine{2503     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_frunoff > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2504       total\_transport = global\_area\_integral(fluxes\%heat\_content\_frunoff, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2505       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_frunoff, total\_transport, diag)}
\DoxyCodeLine{2506 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2507 }
\DoxyCodeLine{2508     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_lprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec))      \&}
\DoxyCodeLine{2509       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_lprec, fluxes\%heat\_content\_lprec, diag)}
\DoxyCodeLine{2510     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_lprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2511       total\_transport = global\_area\_integral(fluxes\%heat\_content\_lprec, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2512       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_lprec, total\_transport, diag)}
\DoxyCodeLine{2513 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2514 }
\DoxyCodeLine{2515     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_fprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec))      \&}
\DoxyCodeLine{2516       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_fprec, fluxes\%heat\_content\_fprec, diag)}
\DoxyCodeLine{2517     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_fprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2518       total\_transport = global\_area\_integral(fluxes\%heat\_content\_fprec, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2519       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_fprec, total\_transport, diag)}
\DoxyCodeLine{2520 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2521 }
\DoxyCodeLine{2522     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_icemelt > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt))      \&}
\DoxyCodeLine{2523       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_icemelt, fluxes\%heat\_content\_icemelt, diag)}
\DoxyCodeLine{2524     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_icemelt > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2525       total\_transport = global\_area\_integral(fluxes\%heat\_content\_icemelt, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2526       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_icemelt, total\_transport, diag)}
\DoxyCodeLine{2527 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2528 }
\DoxyCodeLine{2529     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_vprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec))      \&}
\DoxyCodeLine{2530       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_vprec, fluxes\%heat\_content\_vprec, diag)}
\DoxyCodeLine{2531     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_vprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2532       total\_transport = global\_area\_integral(fluxes\%heat\_content\_vprec, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2533       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_vprec, total\_transport, diag)}
\DoxyCodeLine{2534 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2535 }
\DoxyCodeLine{2536     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_cond > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_cond))        \&}
\DoxyCodeLine{2537       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_cond, fluxes\%heat\_content\_cond, diag)}
\DoxyCodeLine{2538     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_cond > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_cond)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2539       total\_transport = global\_area\_integral(fluxes\%heat\_content\_cond, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2540       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_cond, total\_transport, diag)}
\DoxyCodeLine{2541 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2542 }
\DoxyCodeLine{2543     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_massout > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_massout))  \&}
\DoxyCodeLine{2544       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_massout, fluxes\%heat\_content\_massout, diag)}
\DoxyCodeLine{2545     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_massout > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2546       total\_transport = global\_area\_integral(fluxes\%heat\_content\_massout, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2547       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_massout, total\_transport, diag)}
\DoxyCodeLine{2548 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2549 }
\DoxyCodeLine{2550     \textcolor{keywordflow}{if} ((handles\%id\_heat\_content\_massin > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_massin))  \&}
\DoxyCodeLine{2551       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_massin, fluxes\%heat\_content\_massin, diag)}
\DoxyCodeLine{2552     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_content\_massin > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_content\_massin)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2553       total\_transport = global\_area\_integral(fluxes\%heat\_content\_massin, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2554       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_massin, total\_transport, diag)}
\DoxyCodeLine{2555 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2556 }
\DoxyCodeLine{2557     \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_coupler > 0 .or. handles\%id\_total\_net\_heat\_coupler > 0 .or. \&}
\DoxyCodeLine{2558         handles\%id\_net\_heat\_coupler\_ga > 0. ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2559       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2560       res(i,j) = 0.0}
\DoxyCodeLine{2561       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%LW))               res(i,j) = res(i,j) + fluxes\%lw(i,j)}
\DoxyCodeLine{2562       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent))           res(i,j) = res(i,j) + fluxes\%latent(i,j)}
\DoxyCodeLine{2563       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sens))             res(i,j) = res(i,j) + fluxes\%sens(i,j)}
\DoxyCodeLine{2564       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%SW))               res(i,j) = res(i,j) + fluxes\%sw(i,j)}
\DoxyCodeLine{2565       \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) res(i,j) = res(i,j) + fluxes\%seaice\_melt\_heat(i,j)}
\DoxyCodeLine{2566 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2567       \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_coupler > 0) \textcolor{keyword}{call }post\_data(handles\%id\_net\_heat\_coupler, res, diag)}
\DoxyCodeLine{2568       \textcolor{keywordflow}{if} (handles\%id\_total\_net\_heat\_coupler > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2569         total\_transport = global\_area\_integral(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2570         \textcolor{keyword}{call }post\_data(handles\%id\_total\_net\_heat\_coupler, total\_transport, diag)}
\DoxyCodeLine{2571 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2572       \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_coupler\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2573         ave\_flux = global\_area\_mean(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2574         \textcolor{keyword}{call }post\_data(handles\%id\_net\_heat\_coupler\_ga, ave\_flux, diag)}
\DoxyCodeLine{2575 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2576 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2577 }
\DoxyCodeLine{2578     \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_surface > 0 .or. handles\%id\_total\_net\_heat\_surface > 0 .or. \&}
\DoxyCodeLine{2579         handles\%id\_net\_heat\_surface\_ga > 0. ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2580       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2581         res(i,j) = 0.0}
\DoxyCodeLine{2582         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%LW))               res(i,j) = res(i,j) + fluxes\%lw(i,j)}
\DoxyCodeLine{2583         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent))           res(i,j) = res(i,j) + fluxes\%latent(i,j)}
\DoxyCodeLine{2584         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sens))             res(i,j) = res(i,j) + fluxes\%sens(i,j)}
\DoxyCodeLine{2585         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%SW))               res(i,j) = res(i,j) + fluxes\%sw(i,j)}
\DoxyCodeLine{2586         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) res(i,j) = res(i,j) + fluxes\%seaice\_melt\_heat(i,j)}
\DoxyCodeLine{2587         \textcolor{keywordflow}{if} (\textcolor{keyword}{allocated}(sfc\_state\%frazil))         res(i,j) = res(i,j) + sfc\_state\%frazil(i,j) * i\_dt}
\DoxyCodeLine{2588         \textcolor{comment}{!if (associated(sfc\_state\%TempXpme)) then}}
\DoxyCodeLine{2589         \textcolor{comment}{!  res(i,j) = res(i,j) + sfc\_state\%TempXpme(i,j) * fluxes\%C\_p * I\_dt}}
\DoxyCodeLine{2590         \textcolor{comment}{!else}}
\DoxyCodeLine{2591           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) \&}
\DoxyCodeLine{2592             res(i,j) = res(i,j) + fluxes\%heat\_content\_lrunoff(i,j)}
\DoxyCodeLine{2593           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) \&}
\DoxyCodeLine{2594             res(i,j) = res(i,j) + fluxes\%heat\_content\_frunoff(i,j)}
\DoxyCodeLine{2595           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec)) \&}
\DoxyCodeLine{2596             res(i,j) = res(i,j) + fluxes\%heat\_content\_lprec(i,j)}
\DoxyCodeLine{2597           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec)) \&}
\DoxyCodeLine{2598             res(i,j) = res(i,j) + fluxes\%heat\_content\_fprec(i,j)}
\DoxyCodeLine{2599           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) \&}
\DoxyCodeLine{2600             res(i,j) = res(i,j) + fluxes\%heat\_content\_icemelt(i,j)}
\DoxyCodeLine{2601           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec)) \&}
\DoxyCodeLine{2602             res(i,j) = res(i,j) + fluxes\%heat\_content\_vprec(i,j)}
\DoxyCodeLine{2603           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond)) \&}
\DoxyCodeLine{2604             res(i,j) = res(i,j) + fluxes\%heat\_content\_cond(i,j)}
\DoxyCodeLine{2605           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) \&}
\DoxyCodeLine{2606             res(i,j) = res(i,j) + fluxes\%heat\_content\_massout(i,j)}
\DoxyCodeLine{2607         \textcolor{comment}{!endif}}
\DoxyCodeLine{2608         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_added)) res(i,j) = res(i,j) + fluxes\%heat\_added(i,j)}
\DoxyCodeLine{2609 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2610       \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_surface > 0) \textcolor{keyword}{call }post\_data(handles\%id\_net\_heat\_surface, res, diag)}
\DoxyCodeLine{2611 }
\DoxyCodeLine{2612       \textcolor{keywordflow}{if} (handles\%id\_total\_net\_heat\_surface > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2613         total\_transport = global\_area\_integral(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2614         \textcolor{keyword}{call }post\_data(handles\%id\_total\_net\_heat\_surface, total\_transport, diag)}
\DoxyCodeLine{2615 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2616       \textcolor{keywordflow}{if} (handles\%id\_net\_heat\_surface\_ga > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2617         ave\_flux = global\_area\_mean(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2618         \textcolor{keyword}{call }post\_data(handles\%id\_net\_heat\_surface\_ga, ave\_flux, diag)}
\DoxyCodeLine{2619 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2620 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2621 }
\DoxyCodeLine{2622     \textcolor{keywordflow}{if} (handles\%id\_heat\_content\_surfwater > 0 .or. handles\%id\_total\_heat\_content\_surfwater > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2623       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2624         res(i,j) = 0.0}
\DoxyCodeLine{2625       \textcolor{comment}{! if (associated(sfc\_state\%TempXpme)) then}}
\DoxyCodeLine{2626       \textcolor{comment}{!   res(i,j) = res(i,j) + sfc\_state\%TempXpme(i,j) * fluxes\%C\_p * I\_dt}}
\DoxyCodeLine{2627       \textcolor{comment}{! else}}
\DoxyCodeLine{2628           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) res(i,j) = res(i,j) + fluxes\%heat\_content\_lrunoff(i,j)}
\DoxyCodeLine{2629           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) res(i,j) = res(i,j) + fluxes\%heat\_content\_frunoff(i,j)}
\DoxyCodeLine{2630           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec))   res(i,j) = res(i,j) + fluxes\%heat\_content\_lprec(i,j)}
\DoxyCodeLine{2631           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) res(i,j) = res(i,j) + fluxes\%heat\_content\_icemelt(i,j)}
\DoxyCodeLine{2632           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec))   res(i,j) = res(i,j) + fluxes\%heat\_content\_fprec(i,j)}
\DoxyCodeLine{2633           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_vprec))   res(i,j) = res(i,j) + fluxes\%heat\_content\_vprec(i,j)}
\DoxyCodeLine{2634           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond))    res(i,j) = res(i,j) + fluxes\%heat\_content\_cond(i,j)}
\DoxyCodeLine{2635           \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) res(i,j) = res(i,j) + fluxes\%heat\_content\_massout(i,j)}
\DoxyCodeLine{2636       \textcolor{comment}{! endif}}
\DoxyCodeLine{2637 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2638       \textcolor{keywordflow}{if} (handles\%id\_heat\_content\_surfwater > 0) \textcolor{keyword}{call }post\_data(handles\%id\_heat\_content\_surfwater, res, diag)}
\DoxyCodeLine{2639       \textcolor{keywordflow}{if} (handles\%id\_total\_heat\_content\_surfwater > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2640         total\_transport = global\_area\_integral(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2641         \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_content\_surfwater, total\_transport, diag)}
\DoxyCodeLine{2642 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2643 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2644 }
\DoxyCodeLine{2645     \textcolor{comment}{! for OMIP, hfrunoffds = heat content of liquid plus frozen runoff}}
\DoxyCodeLine{2646     \textcolor{keywordflow}{if} (handles\%id\_hfrunoffds > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2647       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2648         res(i,j) = 0.0}
\DoxyCodeLine{2649         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) res(i,j) = res(i,j) + fluxes\%heat\_content\_lrunoff(i,j)}
\DoxyCodeLine{2650         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) res(i,j) = res(i,j) + fluxes\%heat\_content\_frunoff(i,j)}
\DoxyCodeLine{2651 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2652       \textcolor{keyword}{call }post\_data(handles\%id\_hfrunoffds, res, diag)}
\DoxyCodeLine{2653 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2654 }
\DoxyCodeLine{2655     \textcolor{comment}{! for OMIP, hfrainds = heat content of lprec + fprec + cond}}
\DoxyCodeLine{2656     \textcolor{keywordflow}{if} (handles\%id\_hfrainds > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2657       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2658         res(i,j) = 0.0}
\DoxyCodeLine{2659         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec)) res(i,j) = res(i,j) + fluxes\%heat\_content\_lprec(i,j)}
\DoxyCodeLine{2660         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec)) res(i,j) = res(i,j) + fluxes\%heat\_content\_fprec(i,j)}
\DoxyCodeLine{2661         \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond)) res(i,j) = res(i,j) + fluxes\%heat\_content\_cond(i,j)}
\DoxyCodeLine{2662 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2663       \textcolor{keyword}{call }post\_data(handles\%id\_hfrainds, res, diag)}
\DoxyCodeLine{2664 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2665 }
\DoxyCodeLine{2666     \textcolor{keywordflow}{if} ((handles\%id\_LwLatSens > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw) .and. \&}
\DoxyCodeLine{2667          \textcolor{keyword}{associated}(fluxes\%latent) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2668       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2669         res(i,j) = (fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)}
\DoxyCodeLine{2670 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2671       \textcolor{keyword}{call }post\_data(handles\%id\_LwLatSens, res, diag)}
\DoxyCodeLine{2672 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2673 }
\DoxyCodeLine{2674     \textcolor{keywordflow}{if} ((handles\%id\_total\_LwLatSens > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw) .and. \&}
\DoxyCodeLine{2675          \textcolor{keyword}{associated}(fluxes\%latent) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2676       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2677         res(i,j) = (fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j)}
\DoxyCodeLine{2678 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2679       total\_transport = global\_area\_integral(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2680       \textcolor{keyword}{call }post\_data(handles\%id\_total\_LwLatSens, total\_transport, diag)}
\DoxyCodeLine{2681 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2682 }
\DoxyCodeLine{2683     \textcolor{keywordflow}{if} ((handles\%id\_LwLatSens\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw) .and. \&}
\DoxyCodeLine{2684          \textcolor{keyword}{associated}(fluxes\%latent) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2685       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2686         res(i,j) = ((fluxes\%lw(i,j) + fluxes\%latent(i,j)) + fluxes\%sens(i,j))}
\DoxyCodeLine{2687 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2688       ave\_flux = global\_area\_mean(res, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2689       \textcolor{keyword}{call }post\_data(handles\%id\_LwLatSens\_ga, ave\_flux, diag)}
\DoxyCodeLine{2690 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2691 }
\DoxyCodeLine{2692     \textcolor{keywordflow}{if} ((handles\%id\_sw > 0) .and. \textcolor{keyword}{associated}(fluxes\%sw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2693       \textcolor{keyword}{call }post\_data(handles\%id\_sw, fluxes\%sw, diag)}
\DoxyCodeLine{2694 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2695     \textcolor{keywordflow}{if} ((handles\%id\_sw\_vis > 0) .and. \textcolor{keyword}{associated}(fluxes\%sw\_vis\_dir) .and. \&}
\DoxyCodeLine{2696         \textcolor{keyword}{associated}(fluxes\%sw\_vis\_dif)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2697       \textcolor{keyword}{call }post\_data(handles\%id\_sw\_vis, fluxes\%sw\_vis\_dir+fluxes\%sw\_vis\_dif, diag)}
\DoxyCodeLine{2698 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2699     \textcolor{keywordflow}{if} ((handles\%id\_sw\_nir > 0) .and. \textcolor{keyword}{associated}(fluxes\%sw\_nir\_dir) .and. \&}
\DoxyCodeLine{2700         \textcolor{keyword}{associated}(fluxes\%sw\_nir\_dif)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2701       \textcolor{keyword}{call }post\_data(handles\%id\_sw\_nir, fluxes\%sw\_nir\_dir+fluxes\%sw\_nir\_dif, diag)}
\DoxyCodeLine{2702 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2703     \textcolor{keywordflow}{if} ((handles\%id\_total\_sw > 0) .and. \textcolor{keyword}{associated}(fluxes\%sw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2704       total\_transport = global\_area\_integral(fluxes\%sw, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2705       \textcolor{keyword}{call }post\_data(handles\%id\_total\_sw, total\_transport, diag)}
\DoxyCodeLine{2706 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2707     \textcolor{keywordflow}{if} ((handles\%id\_sw\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%sw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2708       ave\_flux = global\_area\_mean(fluxes\%sw, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2709       \textcolor{keyword}{call }post\_data(handles\%id\_sw\_ga, ave\_flux, diag)}
\DoxyCodeLine{2710 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2711 }
\DoxyCodeLine{2712     \textcolor{keywordflow}{if} ((handles\%id\_lw > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2713       \textcolor{keyword}{call }post\_data(handles\%id\_lw, fluxes\%lw, diag)}
\DoxyCodeLine{2714 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2715     \textcolor{keywordflow}{if} ((handles\%id\_total\_lw > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2716       total\_transport = global\_area\_integral(fluxes\%lw, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2717       \textcolor{keyword}{call }post\_data(handles\%id\_total\_lw, total\_transport, diag)}
\DoxyCodeLine{2718 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2719     \textcolor{keywordflow}{if} ((handles\%id\_lw\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%lw)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2720       ave\_flux = global\_area\_mean(fluxes\%lw, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2721       \textcolor{keyword}{call }post\_data(handles\%id\_lw\_ga, ave\_flux, diag)}
\DoxyCodeLine{2722 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2723 }
\DoxyCodeLine{2724     \textcolor{keywordflow}{if} ((handles\%id\_lat > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2725       \textcolor{keyword}{call }post\_data(handles\%id\_lat, fluxes\%latent, diag)}
\DoxyCodeLine{2726 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2727     \textcolor{keywordflow}{if} ((handles\%id\_total\_lat > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2728       total\_transport = global\_area\_integral(fluxes\%latent, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2729       \textcolor{keyword}{call }post\_data(handles\%id\_total\_lat, total\_transport, diag)}
\DoxyCodeLine{2730 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2731     \textcolor{keywordflow}{if} ((handles\%id\_lat\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2732       ave\_flux = global\_area\_mean(fluxes\%latent, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2733       \textcolor{keyword}{call }post\_data(handles\%id\_lat\_ga, ave\_flux, diag)}
\DoxyCodeLine{2734 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2735 }
\DoxyCodeLine{2736     \textcolor{keywordflow}{if} ((handles\%id\_lat\_evap > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent\_evap\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2737       \textcolor{keyword}{call }post\_data(handles\%id\_lat\_evap, fluxes\%latent\_evap\_diag, diag)}
\DoxyCodeLine{2738 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2739     \textcolor{keywordflow}{if} ((handles\%id\_total\_lat\_evap > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent\_evap\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2740       total\_transport = global\_area\_integral(fluxes\%latent\_evap\_diag, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2741       \textcolor{keyword}{call }post\_data(handles\%id\_total\_lat\_evap, total\_transport, diag)}
\DoxyCodeLine{2742 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2743 }
\DoxyCodeLine{2744     \textcolor{keywordflow}{if} ((handles\%id\_lat\_fprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent\_fprec\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2745       \textcolor{keyword}{call }post\_data(handles\%id\_lat\_fprec, fluxes\%latent\_fprec\_diag, diag)}
\DoxyCodeLine{2746 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2747     \textcolor{keywordflow}{if} ((handles\%id\_total\_lat\_fprec > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent\_fprec\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2748       total\_transport = global\_area\_integral(fluxes\%latent\_fprec\_diag, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2749       \textcolor{keyword}{call }post\_data(handles\%id\_total\_lat\_fprec, total\_transport, diag)}
\DoxyCodeLine{2750 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2751 }
\DoxyCodeLine{2752     \textcolor{keywordflow}{if} ((handles\%id\_lat\_frunoff > 0) .and. \textcolor{keyword}{associated}(fluxes\%latent\_frunoff\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2753       \textcolor{keyword}{call }post\_data(handles\%id\_lat\_frunoff, fluxes\%latent\_frunoff\_diag, diag)}
\DoxyCodeLine{2754 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2755     \textcolor{keywordflow}{if} (handles\%id\_total\_lat\_frunoff > 0 .and. \textcolor{keyword}{associated}(fluxes\%latent\_frunoff\_diag)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2756       total\_transport = global\_area\_integral(fluxes\%latent\_frunoff\_diag, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2757       \textcolor{keyword}{call }post\_data(handles\%id\_total\_lat\_frunoff, total\_transport, diag)}
\DoxyCodeLine{2758 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2759 }
\DoxyCodeLine{2760     \textcolor{keywordflow}{if} ((handles\%id\_sens > 0) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2761       \textcolor{keyword}{call }post\_data(handles\%id\_sens, fluxes\%sens, diag)}
\DoxyCodeLine{2762 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2763 }
\DoxyCodeLine{2764     \textcolor{keywordflow}{if} ((handles\%id\_seaice\_melt\_heat > 0) .and. \textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2765       \textcolor{keyword}{call }post\_data(handles\%id\_seaice\_melt\_heat, fluxes\%seaice\_melt\_heat, diag)}
\DoxyCodeLine{2766 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2767 }
\DoxyCodeLine{2768     \textcolor{keywordflow}{if} ((handles\%id\_total\_seaice\_melt\_heat > 0) .and. \textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2769       total\_transport = global\_area\_integral(fluxes\%seaice\_melt\_heat, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2770       \textcolor{keyword}{call }post\_data(handles\%id\_total\_seaice\_melt\_heat, total\_transport, diag)}
\DoxyCodeLine{2771 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2772 }
\DoxyCodeLine{2773     \textcolor{keywordflow}{if} ((handles\%id\_total\_sens > 0) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2774       total\_transport = global\_area\_integral(fluxes\%sens, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2775       \textcolor{keyword}{call }post\_data(handles\%id\_total\_sens, total\_transport, diag)}
\DoxyCodeLine{2776 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2777     \textcolor{keywordflow}{if} ((handles\%id\_sens\_ga > 0) .and. \textcolor{keyword}{associated}(fluxes\%sens)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2778       ave\_flux = global\_area\_mean(fluxes\%sens, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2779       \textcolor{keyword}{call }post\_data(handles\%id\_sens\_ga, ave\_flux, diag)}
\DoxyCodeLine{2780 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2781 }
\DoxyCodeLine{2782     \textcolor{keywordflow}{if} ((handles\%id\_heat\_added > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_added)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2783       \textcolor{keyword}{call }post\_data(handles\%id\_heat\_added, fluxes\%heat\_added, diag)}
\DoxyCodeLine{2784 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2785 }
\DoxyCodeLine{2786     \textcolor{keywordflow}{if} ((handles\%id\_total\_heat\_added > 0) .and. \textcolor{keyword}{associated}(fluxes\%heat\_added)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2787       total\_transport = global\_area\_integral(fluxes\%heat\_added, g, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{2788       \textcolor{keyword}{call }post\_data(handles\%id\_total\_heat\_added, total\_transport, diag)}
\DoxyCodeLine{2789 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2790 }
\DoxyCodeLine{2791 }
\DoxyCodeLine{2792     \textcolor{comment}{! post the diagnostics for boundary salt fluxes ==========================}}
\DoxyCodeLine{2793 }
\DoxyCodeLine{2794     \textcolor{keywordflow}{if} ((handles\%id\_saltflux > 0) .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux)) \&}
\DoxyCodeLine{2795       \textcolor{keyword}{call }post\_data(handles\%id\_saltflux, fluxes\%salt\_flux, diag)}
\DoxyCodeLine{2796     \textcolor{keywordflow}{if} ((handles\%id\_total\_saltflux > 0) .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2797       total\_transport = ppt2mks*global\_area\_integral(fluxes\%salt\_flux, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2798       \textcolor{keyword}{call }post\_data(handles\%id\_total\_saltflux, total\_transport, diag)}
\DoxyCodeLine{2799 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2800 }
\DoxyCodeLine{2801     \textcolor{keywordflow}{if} ((handles\%id\_saltFluxAdded > 0) .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux\_added)) \&}
\DoxyCodeLine{2802       \textcolor{keyword}{call }post\_data(handles\%id\_saltFluxAdded, fluxes\%salt\_flux\_added, diag)}
\DoxyCodeLine{2803     \textcolor{keywordflow}{if} ((handles\%id\_total\_saltFluxAdded > 0) .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux\_added)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2804       total\_transport = ppt2mks*global\_area\_integral(fluxes\%salt\_flux\_added, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2805       \textcolor{keyword}{call }post\_data(handles\%id\_total\_saltFluxAdded, total\_transport, diag)}
\DoxyCodeLine{2806 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2807 }
\DoxyCodeLine{2808     \textcolor{keywordflow}{if} (handles\%id\_saltFluxIn > 0 .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux\_in)) \&}
\DoxyCodeLine{2809       \textcolor{keyword}{call }post\_data(handles\%id\_saltFluxIn, fluxes\%salt\_flux\_in, diag)}
\DoxyCodeLine{2810     \textcolor{keywordflow}{if} ((handles\%id\_total\_saltFluxIn > 0) .and. \textcolor{keyword}{associated}(fluxes\%salt\_flux\_in)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2811       total\_transport = ppt2mks*global\_area\_integral(fluxes\%salt\_flux\_in, g, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{2812       \textcolor{keyword}{call }post\_data(handles\%id\_total\_saltFluxIn, total\_transport, diag)}
\DoxyCodeLine{2813 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{2814 }
\DoxyCodeLine{2815     \textcolor{keywordflow}{if} (handles\%id\_saltFluxGlobalAdj > 0)                                            \&}
\DoxyCodeLine{2816       \textcolor{keyword}{call }post\_data(handles\%id\_saltFluxGlobalAdj, fluxes\%saltFluxGlobalAdj, diag)}
\DoxyCodeLine{2817     \textcolor{keywordflow}{if} (handles\%id\_vPrecGlobalAdj > 0)                                               \&}
\DoxyCodeLine{2818       \textcolor{keyword}{call }post\_data(handles\%id\_vPrecGlobalAdj, fluxes\%vPrecGlobalAdj, diag)}
\DoxyCodeLine{2819     \textcolor{keywordflow}{if} (handles\%id\_netFWGlobalAdj > 0)                                               \&}
\DoxyCodeLine{2820       \textcolor{keyword}{call }post\_data(handles\%id\_netFWGlobalAdj, fluxes\%netFWGlobalAdj, diag)}
\DoxyCodeLine{2821     \textcolor{keywordflow}{if} (handles\%id\_saltFluxGlobalScl > 0)                                            \&}
\DoxyCodeLine{2822       \textcolor{keyword}{call }post\_data(handles\%id\_saltFluxGlobalScl, fluxes\%saltFluxGlobalScl, diag)}
\DoxyCodeLine{2823     \textcolor{keywordflow}{if} (handles\%id\_vPrecGlobalScl > 0)                                               \&}
\DoxyCodeLine{2824       \textcolor{keyword}{call }post\_data(handles\%id\_vPrecGlobalScl, fluxes\%vPrecGlobalScl, diag)}
\DoxyCodeLine{2825     \textcolor{keywordflow}{if} (handles\%id\_netFWGlobalScl > 0)                                               \&}
\DoxyCodeLine{2826       \textcolor{keyword}{call }post\_data(handles\%id\_netFWGlobalScl, fluxes\%netFWGlobalScl, diag)}
\DoxyCodeLine{2827 }
\DoxyCodeLine{2828 }
\DoxyCodeLine{2829     \textcolor{comment}{! remaining boundary terms ==================================================}}
\DoxyCodeLine{2830 }
\DoxyCodeLine{2831     \textcolor{keywordflow}{if} ((handles\%id\_psurf > 0) .and. \textcolor{keyword}{associated}(fluxes\%p\_surf))                      \&}
\DoxyCodeLine{2832       \textcolor{keyword}{call }post\_data(handles\%id\_psurf, fluxes\%p\_surf, diag)}
\DoxyCodeLine{2833 }
\DoxyCodeLine{2834     \textcolor{keywordflow}{if} ((handles\%id\_TKE\_tidal > 0) .and. \textcolor{keyword}{associated}(fluxes\%TKE\_tidal))               \&}
\DoxyCodeLine{2835       \textcolor{keyword}{call }post\_data(handles\%id\_TKE\_tidal, fluxes\%TKE\_tidal, diag)}
\DoxyCodeLine{2836 }
\DoxyCodeLine{2837     \textcolor{keywordflow}{if} ((handles\%id\_buoy > 0) .and. \textcolor{keyword}{associated}(fluxes\%buoy))                         \&}
\DoxyCodeLine{2838       \textcolor{keyword}{call }post\_data(handles\%id\_buoy, fluxes\%buoy, diag)}
\DoxyCodeLine{2839 }
\DoxyCodeLine{2840     \textcolor{keywordflow}{if} ((handles\%id\_ustar > 0) .and. \textcolor{keyword}{associated}(fluxes\%ustar)) \&}
\DoxyCodeLine{2841       \textcolor{keyword}{call }post\_data(handles\%id\_ustar, fluxes\%ustar, diag)}
\DoxyCodeLine{2842 }
\DoxyCodeLine{2843     \textcolor{keywordflow}{if} ((handles\%id\_ustar\_berg > 0) .and. \textcolor{keyword}{associated}(fluxes\%ustar\_berg)) \&}
\DoxyCodeLine{2844       \textcolor{keyword}{call }post\_data(handles\%id\_ustar\_berg, fluxes\%ustar\_berg, diag)}
\DoxyCodeLine{2845 }
\DoxyCodeLine{2846     \textcolor{keywordflow}{if} ((handles\%id\_frac\_ice\_cover > 0) .and. \textcolor{keyword}{associated}(fluxes\%frac\_shelf\_h)) \&}
\DoxyCodeLine{2847       \textcolor{keyword}{call }post\_data(handles\%id\_frac\_ice\_cover, fluxes\%frac\_shelf\_h, diag)}
\DoxyCodeLine{2848 }
\DoxyCodeLine{2849     \textcolor{keywordflow}{if} ((handles\%id\_ustar\_ice\_cover > 0) .and. \textcolor{keyword}{associated}(fluxes\%ustar\_shelf)) \&}
\DoxyCodeLine{2850       \textcolor{keyword}{call }post\_data(handles\%id\_ustar\_ice\_cover, fluxes\%ustar\_shelf, diag)}
\DoxyCodeLine{2851 }
\DoxyCodeLine{2852   \textcolor{comment}{! endif  ! query\_averaging\_enabled}}
\DoxyCodeLine{2853   \textcolor{keyword}{call }disable\_averaging(diag)}
\DoxyCodeLine{2854 }
\DoxyCodeLine{2855   \textcolor{keywordflow}{if} (turns /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2856     \textcolor{keyword}{call }deallocate\_forcing\_type(fluxes)}
\DoxyCodeLine{2857     \textcolor{keyword}{deallocate}(fluxes)}
\DoxyCodeLine{2858 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2859 }
\DoxyCodeLine{2860   \textcolor{keyword}{call }cpu\_clock\_end(handles\%id\_clock\_forcing)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a1048a8e80ebd47f83b91772c02aedba2}\label{namespacemom__forcing__type_a1048a8e80ebd47f83b91772c02aedba2}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!forcing\_singlepointprint@{forcing\_singlepointprint}}
\index{forcing\_singlepointprint@{forcing\_singlepointprint}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{forcing\_singlepointprint()}{forcing\_singlepointprint()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::forcing\+\_\+singlepointprint (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{integer, intent(in)}]{i,  }\item[{integer, intent(in)}]{j,  }\item[{character(len=$\ast$), intent(in)}]{mesg }\end{DoxyParamCaption})}



Write out values of the fluxes arrays at the i,j location. This is a debugging tool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid type \\
\hline
\mbox{\texttt{ in}}  & {\em mesg} & Message \\
\hline
\mbox{\texttt{ in}}  & {\em i} & i-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em j} & j-\/index \\
\hline
\end{DoxyParams}


Definition at line 1173 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1173   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{ !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{1174   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{      !< Grid type}}
\DoxyCodeLine{1175   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{   !< Message}}
\DoxyCodeLine{1176   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)} :: i\textcolor{comment}{      !< i-\/index}}
\DoxyCodeLine{1177   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)} :: j\textcolor{comment}{      !< j-\/index}}
\DoxyCodeLine{1178 }
\DoxyCodeLine{1179   \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(2a)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: Called from '},mesg}
\DoxyCodeLine{1180   \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a,2es15.3)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: lon,lat = '},g\%geoLonT(i,j),g\%geoLatT(i,j)}
\DoxyCodeLine{1181   \textcolor{keyword}{call }locmsg(fluxes\%ustar,\textcolor{stringliteral}{'ustar'})}
\DoxyCodeLine{1182   \textcolor{keyword}{call }locmsg(fluxes\%buoy,\textcolor{stringliteral}{'buoy'})}
\DoxyCodeLine{1183   \textcolor{keyword}{call }locmsg(fluxes\%sw,\textcolor{stringliteral}{'sw'})}
\DoxyCodeLine{1184   \textcolor{keyword}{call }locmsg(fluxes\%sw\_vis\_dir,\textcolor{stringliteral}{'sw\_vis\_dir'})}
\DoxyCodeLine{1185   \textcolor{keyword}{call }locmsg(fluxes\%sw\_vis\_dif,\textcolor{stringliteral}{'sw\_vis\_dif'})}
\DoxyCodeLine{1186   \textcolor{keyword}{call }locmsg(fluxes\%sw\_nir\_dir,\textcolor{stringliteral}{'sw\_nir\_dir'})}
\DoxyCodeLine{1187   \textcolor{keyword}{call }locmsg(fluxes\%sw\_nir\_dif,\textcolor{stringliteral}{'sw\_nir\_dif'})}
\DoxyCodeLine{1188   \textcolor{keyword}{call }locmsg(fluxes\%lw,\textcolor{stringliteral}{'lw'})}
\DoxyCodeLine{1189   \textcolor{keyword}{call }locmsg(fluxes\%latent,\textcolor{stringliteral}{'latent'})}
\DoxyCodeLine{1190   \textcolor{keyword}{call }locmsg(fluxes\%latent\_evap\_diag,\textcolor{stringliteral}{'latent\_evap\_diag'})}
\DoxyCodeLine{1191   \textcolor{keyword}{call }locmsg(fluxes\%latent\_fprec\_diag,\textcolor{stringliteral}{'latent\_fprec\_diag'})}
\DoxyCodeLine{1192   \textcolor{keyword}{call }locmsg(fluxes\%latent\_frunoff\_diag,\textcolor{stringliteral}{'latent\_frunoff\_diag'})}
\DoxyCodeLine{1193   \textcolor{keyword}{call }locmsg(fluxes\%sens,\textcolor{stringliteral}{'sens'})}
\DoxyCodeLine{1194   \textcolor{keyword}{call }locmsg(fluxes\%evap,\textcolor{stringliteral}{'evap'})}
\DoxyCodeLine{1195   \textcolor{keyword}{call }locmsg(fluxes\%lprec,\textcolor{stringliteral}{'lprec'})}
\DoxyCodeLine{1196   \textcolor{keyword}{call }locmsg(fluxes\%fprec,\textcolor{stringliteral}{'fprec'})}
\DoxyCodeLine{1197   \textcolor{keyword}{call }locmsg(fluxes\%vprec,\textcolor{stringliteral}{'vprec'})}
\DoxyCodeLine{1198   \textcolor{keyword}{call }locmsg(fluxes\%seaice\_melt,\textcolor{stringliteral}{'seaice\_melt'})}
\DoxyCodeLine{1199   \textcolor{keyword}{call }locmsg(fluxes\%seaice\_melt\_heat,\textcolor{stringliteral}{'seaice\_melt\_heat'})}
\DoxyCodeLine{1200   \textcolor{keyword}{call }locmsg(fluxes\%p\_surf,\textcolor{stringliteral}{'p\_surf'})}
\DoxyCodeLine{1201   \textcolor{keyword}{call }locmsg(fluxes\%salt\_flux,\textcolor{stringliteral}{'salt\_flux'})}
\DoxyCodeLine{1202   \textcolor{keyword}{call }locmsg(fluxes\%TKE\_tidal,\textcolor{stringliteral}{'TKE\_tidal'})}
\DoxyCodeLine{1203   \textcolor{keyword}{call }locmsg(fluxes\%ustar\_tidal,\textcolor{stringliteral}{'ustar\_tidal'})}
\DoxyCodeLine{1204   \textcolor{keyword}{call }locmsg(fluxes\%lrunoff,\textcolor{stringliteral}{'lrunoff'})}
\DoxyCodeLine{1205   \textcolor{keyword}{call }locmsg(fluxes\%frunoff,\textcolor{stringliteral}{'frunoff'})}
\DoxyCodeLine{1206   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_lrunoff,\textcolor{stringliteral}{'heat\_content\_lrunoff'})}
\DoxyCodeLine{1207   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_frunoff,\textcolor{stringliteral}{'heat\_content\_frunoff'})}
\DoxyCodeLine{1208   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_lprec,\textcolor{stringliteral}{'heat\_content\_lprec'})}
\DoxyCodeLine{1209   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_fprec,\textcolor{stringliteral}{'heat\_content\_fprec'})}
\DoxyCodeLine{1210   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_icemelt,\textcolor{stringliteral}{'heat\_content\_icemelt'})}
\DoxyCodeLine{1211   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_vprec,\textcolor{stringliteral}{'heat\_content\_vprec'})}
\DoxyCodeLine{1212   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_cond,\textcolor{stringliteral}{'heat\_content\_cond'})}
\DoxyCodeLine{1213   \textcolor{keyword}{call }locmsg(fluxes\%heat\_content\_cond,\textcolor{stringliteral}{'heat\_content\_massout'})}
\DoxyCodeLine{1214 }
\DoxyCodeLine{1215   \textcolor{keyword}{contains}\textcolor{comment}{}}
\DoxyCodeLine{1216 \textcolor{comment}{  !> Format and write a message depending on associated state of array}}
\DoxyCodeLine{1217   \textcolor{keyword}{subroutine }locmsg(array,aname)}
\DoxyCodeLine{1218 \textcolor{keywordtype}{    real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: array\textcolor{comment}{ !< Array to write element from}}
\DoxyCodeLine{1219     \textcolor{keywordtype}{character(len=*)}              :: aname\textcolor{comment}{ !< Name of array}}
\DoxyCodeLine{1220 }
\DoxyCodeLine{1221     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(array)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1222       \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(3a,es15.3)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: '},trim(aname),\textcolor{stringliteral}{' = '},array(i,j)}
\DoxyCodeLine{1223     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1224       \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(4a)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: '},trim(aname),\textcolor{stringliteral}{' is not associated.'}}
\DoxyCodeLine{1225 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1226   \textcolor{keyword}{end subroutine }locmsg}
\DoxyCodeLine{1227 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a237dc2330bf133bf3365a924d26b0b37}\label{namespacemom__forcing__type_a237dc2330bf133bf3365a924d26b0b37}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!get\_forcing\_groups@{get\_forcing\_groups}}
\index{get\_forcing\_groups@{get\_forcing\_groups}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{get\_forcing\_groups()}{get\_forcing\_groups()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::get\+\_\+forcing\+\_\+groups (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{logical, intent(out)}]{water,  }\item[{logical, intent(out)}]{heat,  }\item[{logical, intent(out)}]{ustar,  }\item[{logical, intent(out)}]{press,  }\item[{logical, intent(out)}]{shelf,  }\item[{logical, intent(out)}]{iceberg,  }\item[{logical, intent(out)}]{salt,  }\item[{logical, intent(out)}]{heat\+\_\+added,  }\item[{logical, intent(out)}]{buoy }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Return flags indicating which groups of forcings are allocated. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes} & Reference flux fields \\
\hline
\mbox{\texttt{ out}}  & {\em water} & True if fluxes contains water-\/based fluxes \\
\hline
\mbox{\texttt{ out}}  & {\em heat} & True if fluxes contains heat-\/based fluxes \\
\hline
\mbox{\texttt{ out}}  & {\em ustar} & True if fluxes contains ustar fluxes \\
\hline
\mbox{\texttt{ out}}  & {\em press} & True if fluxes contains surface pressure \\
\hline
\mbox{\texttt{ out}}  & {\em shelf} & True if fluxes contains ice shelf fields \\
\hline
\mbox{\texttt{ out}}  & {\em iceberg} & True if fluxes contains iceberg fluxes \\
\hline
\mbox{\texttt{ out}}  & {\em salt} & True if fluxes contains salt flux \\
\hline
\mbox{\texttt{ out}}  & {\em heat\+\_\+added} & True if fluxes contains explicit heat \\
\hline
\mbox{\texttt{ out}}  & {\em buoy} & True if fluxes contains buoyancy fluxes \\
\hline
\end{DoxyParams}


Definition at line 3046 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3046   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{  !< Reference flux fields}}
\DoxyCodeLine{3047   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: water\textcolor{comment}{   !< True if fluxes contains water-\/based fluxes}}
\DoxyCodeLine{3048   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: heat\textcolor{comment}{    !< True if fluxes contains heat-\/based fluxes}}
\DoxyCodeLine{3049   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: ustar\textcolor{comment}{   !< True if fluxes contains ustar fluxes}}
\DoxyCodeLine{3050   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: press\textcolor{comment}{   !< True if fluxes contains surface pressure}}
\DoxyCodeLine{3051   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: shelf\textcolor{comment}{   !< True if fluxes contains ice shelf fields}}
\DoxyCodeLine{3052   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: iceberg\textcolor{comment}{ !< True if fluxes contains iceberg fluxes}}
\DoxyCodeLine{3053   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: salt\textcolor{comment}{    !< True if fluxes contains salt flux}}
\DoxyCodeLine{3054   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: heat\_added\textcolor{comment}{ !< True if fluxes contains explicit heat}}
\DoxyCodeLine{3055   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: buoy\textcolor{comment}{    !< True if fluxes contains buoyancy fluxes}}
\DoxyCodeLine{3056 }
\DoxyCodeLine{3057   \textcolor{comment}{! NOTE: heat, salt, heat\_added, and buoy would typically depend on each other}}
\DoxyCodeLine{3058   \textcolor{comment}{!   to some degree.  But since this would be enforced at the driver level,}}
\DoxyCodeLine{3059   \textcolor{comment}{!   we handle them here as independent flags.}}
\DoxyCodeLine{3060 }
\DoxyCodeLine{3061   ustar = \textcolor{keyword}{associated}(fluxes\%ustar) \&}
\DoxyCodeLine{3062       .and. \textcolor{keyword}{associated}(fluxes\%ustar\_gustless)}
\DoxyCodeLine{3063   \textcolor{comment}{! TODO: Check for all associated fields, but for now just check one as a marker}}
\DoxyCodeLine{3064   water = \textcolor{keyword}{associated}(fluxes\%evap)}
\DoxyCodeLine{3065   heat = \textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)}
\DoxyCodeLine{3066   salt = \textcolor{keyword}{associated}(fluxes\%salt\_flux)}
\DoxyCodeLine{3067   press = \textcolor{keyword}{associated}(fluxes\%p\_surf)}
\DoxyCodeLine{3068   shelf = \textcolor{keyword}{associated}(fluxes\%frac\_shelf\_h)}
\DoxyCodeLine{3069   iceberg = \textcolor{keyword}{associated}(fluxes\%ustar\_berg)}
\DoxyCodeLine{3070   heat\_added = \textcolor{keyword}{associated}(fluxes\%heat\_added)}
\DoxyCodeLine{3071   buoy = \textcolor{keyword}{associated}(fluxes\%buoy)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a2db9d1c071a26c092f662bd30afb2039}\label{namespacemom__forcing__type_a2db9d1c071a26c092f662bd30afb2039}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!get\_mech\_forcing\_groups@{get\_mech\_forcing\_groups}}
\index{get\_mech\_forcing\_groups@{get\_mech\_forcing\_groups}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{get\_mech\_forcing\_groups()}{get\_mech\_forcing\_groups()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::get\+\_\+mech\+\_\+forcing\+\_\+groups (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{logical, intent(out)}]{stress,  }\item[{logical, intent(out)}]{ustar,  }\item[{logical, intent(out)}]{shelf,  }\item[{logical, intent(out)}]{press,  }\item[{logical, intent(out)}]{iceberg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Return flags indicating which groups of mechanical forcings are allocated. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces} & Reference forcing fields \\
\hline
\mbox{\texttt{ out}}  & {\em stress} & True if forces contains wind stress fields \\
\hline
\mbox{\texttt{ out}}  & {\em ustar} & True if forces contains ustar field \\
\hline
\mbox{\texttt{ out}}  & {\em shelf} & True if forces contains ice shelf fields \\
\hline
\mbox{\texttt{ out}}  & {\em press} & True if forces contains pressure fields \\
\hline
\mbox{\texttt{ out}}  & {\em iceberg} & True if forces contains iceberg fields \\
\hline
\end{DoxyParams}


Definition at line 3077 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3077   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(in)} :: forces\textcolor{comment}{  !< Reference forcing fields}}
\DoxyCodeLine{3078   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: stress\textcolor{comment}{  !< True if forces contains wind stress fields}}
\DoxyCodeLine{3079   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: ustar\textcolor{comment}{   !< True if forces contains ustar field}}
\DoxyCodeLine{3080   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: shelf\textcolor{comment}{   !< True if forces contains ice shelf fields}}
\DoxyCodeLine{3081   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: press\textcolor{comment}{   !< True if forces contains pressure fields}}
\DoxyCodeLine{3082   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{intent(out)} :: iceberg\textcolor{comment}{ !< True if forces contains iceberg fields}}
\DoxyCodeLine{3083 }
\DoxyCodeLine{3084   stress = \textcolor{keyword}{associated}(forces\%taux) \&}
\DoxyCodeLine{3085       .and. \textcolor{keyword}{associated}(forces\%tauy)}
\DoxyCodeLine{3086   ustar = \textcolor{keyword}{associated}(forces\%ustar)}
\DoxyCodeLine{3087   shelf = \textcolor{keyword}{associated}(forces\%rigidity\_ice\_u) \&}
\DoxyCodeLine{3088       .and. \textcolor{keyword}{associated}(forces\%rigidity\_ice\_v) \&}
\DoxyCodeLine{3089       .and. \textcolor{keyword}{associated}(forces\%frac\_shelf\_u) \&}
\DoxyCodeLine{3090       .and. \textcolor{keyword}{associated}(forces\%frac\_shelf\_v)}
\DoxyCodeLine{3091   press = \textcolor{keyword}{associated}(forces\%p\_surf) \&}
\DoxyCodeLine{3092       .and. \textcolor{keyword}{associated}(forces\%p\_surf\_full) \&}
\DoxyCodeLine{3093       .and. \textcolor{keyword}{associated}(forces\%net\_mass\_src)}
\DoxyCodeLine{3094   iceberg = \textcolor{keyword}{associated}(forces\%area\_berg) \&}
\DoxyCodeLine{3095       .and. \textcolor{keyword}{associated}(forces\%mass\_berg)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a67f6972e0e0dd6c0b6b4bbea9ff6b5ef}\label{namespacemom__forcing__type_a67f6972e0e0dd6c0b6b4bbea9ff6b5ef}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!get\_net\_mass\_forcing@{get\_net\_mass\_forcing}}
\index{get\_net\_mass\_forcing@{get\_net\_mass\_forcing}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{get\_net\_mass\_forcing()}{get\_net\_mass\_forcing()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::get\+\_\+net\+\_\+mass\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed), intent(out)}]{net\+\_\+mass\+\_\+src }\end{DoxyParamCaption})}



This subroutine calculates determines the net mass source to the ocean from a (thermodynamic) forcing type and stores it in a provided array. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ out}}  & {\em net\+\_\+mass\+\_\+src} & The net mass flux of water into the ocean \mbox{[}kg m-\/2 s-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 2159 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2159   \textcolor{keywordtype}{type}(forcing),                    \textcolor{keywordtype}{intent(in)}  :: fluxes\textcolor{comment}{ !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2160   \textcolor{keywordtype}{type}(ocean\_grid\_type),            \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{      !< The ocean grid type}}
\DoxyCodeLine{2161   \textcolor{keywordtype}{type}(unit\_scale\_type),            \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{     !< A dimensional unit scaling type}}
\DoxyCodeLine{2162 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))}, \textcolor{keywordtype}{intent(out)} :: net\_mass\_src\textcolor{comment}{ !< The net mass flux of water into the ocean}}
\DoxyCodeLine{2163 \textcolor{comment}{                                                          !! [kg m-\/2 s-\/1].}}
\DoxyCodeLine{2164 }
\DoxyCodeLine{2165 \textcolor{keywordtype}{  real} :: RZ\_T\_conversion \textcolor{comment}{! A combination of scaling factors for mass fluxes [kg T m-\/2 s-\/1 R-\/1 Z-\/1 \string~> 1]}}
\DoxyCodeLine{2166   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{2167   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2168 }
\DoxyCodeLine{2169   rz\_t\_conversion = us\%RZ\_T\_to\_kg\_m2s}
\DoxyCodeLine{2170 }
\DoxyCodeLine{2171   net\_mass\_src(:,:) = 0.0}
\DoxyCodeLine{2172   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2173     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%lprec(i,j)}
\DoxyCodeLine{2174 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2175   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2176     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%fprec(i,j)}
\DoxyCodeLine{2177 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2178   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2179     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%vprec(i,j)}
\DoxyCodeLine{2180 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2181   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2182     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%lrunoff(i,j)}
\DoxyCodeLine{2183 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2184   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2185     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%frunoff(i,j)}
\DoxyCodeLine{2186 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2187   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2188     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%evap(i,j)}
\DoxyCodeLine{2189 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2190   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2191     net\_mass\_src(i,j) = net\_mass\_src(i,j) + rz\_t\_conversion*fluxes\%seaice\_melt(i,j)}
\DoxyCodeLine{2192 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{2193 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a014d07725581af8ede287ea2a2322259}\label{namespacemom__forcing__type_a014d07725581af8ede287ea2a2322259}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!mech\_forcing\_diags@{mech\_forcing\_diags}}
\index{mech\_forcing\_diags@{mech\_forcing\_diags}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{mech\_forcing\_diags()}{mech\_forcing\_diags()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::mech\+\_\+forcing\+\_\+diags (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in), target}]{forces\+\_\+in,  }\item[{real, intent(in)}]{dt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(time\+\_\+type), intent(in)}]{time\+\_\+end,  }\item[{type(diag\+\_\+ctrl), intent(inout)}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing__diags}{forcing\+\_\+diags}}), intent(inout)}]{handles }\end{DoxyParamCaption})}



Offer mechanical forcing fields for diagnostics for those fields registered as part of register\+\_\+forcing\+\_\+type\+\_\+diags. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces\+\_\+in} & mechanical forcing input fields \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & time step for the forcing \mbox{[}s\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+end} & The end time of the diagnostic interval. \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & diagnostic type \\
\hline
\mbox{\texttt{ in,out}}  & {\em handles} & diagnostic id for diag\+\_\+manager \\
\hline
\end{DoxyParams}


Definition at line 2217 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2217   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: forces\_in\textcolor{comment}{ !< mechanical forcing input fields}}
\DoxyCodeLine{2218 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{intent(in)}    :: dt\textcolor{comment}{       !< time step for the forcing [s]}}
\DoxyCodeLine{2219   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{        !< grid type}}
\DoxyCodeLine{2220   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: time\_end\textcolor{comment}{ !< The end time of the diagnostic interval.}}
\DoxyCodeLine{2221   \textcolor{keywordtype}{type}(diag\_ctrl),       \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{     !< diagnostic type}}
\DoxyCodeLine{2222   \textcolor{keywordtype}{type}(forcing\_diags),   \textcolor{keywordtype}{intent(inout)} :: handles\textcolor{comment}{  !< diagnostic id for diag\_manager}}
\DoxyCodeLine{2223 }
\DoxyCodeLine{2224   \textcolor{keywordtype}{integer} :: i,j,is,ie,js,je}
\DoxyCodeLine{2225 }
\DoxyCodeLine{2226   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{pointer} :: forces}
\DoxyCodeLine{2227   \textcolor{keywordtype}{integer} :: turns}
\DoxyCodeLine{2228 }
\DoxyCodeLine{2229   \textcolor{keyword}{call }cpu\_clock\_begin(handles\%id\_clock\_forcing)}
\DoxyCodeLine{2230 }
\DoxyCodeLine{2231   \textcolor{comment}{! NOTE: post\_data expects data to be on the rotated index map, so any}}
\DoxyCodeLine{2232   \textcolor{comment}{!   rotations must be applied before saving the output.}}
\DoxyCodeLine{2233   turns = diag\%G\%HI\%turns}
\DoxyCodeLine{2234   \textcolor{keywordflow}{if} (turns /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2235     \textcolor{keyword}{allocate}(forces)}
\DoxyCodeLine{2236     \textcolor{keyword}{call }allocate\_mech\_forcing(forces\_in, diag\%G, forces)}
\DoxyCodeLine{2237     \textcolor{keyword}{call }rotate\_mech\_forcing(forces\_in, turns, forces)}
\DoxyCodeLine{2238   \textcolor{keywordflow}{else}}
\DoxyCodeLine{2239     forces => forces\_in}
\DoxyCodeLine{2240 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2241 }
\DoxyCodeLine{2242   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2243   \textcolor{keyword}{call }enable\_averaging(dt, time\_end, diag)}
\DoxyCodeLine{2244   \textcolor{comment}{! if (query\_averaging\_enabled(diag)) then}}
\DoxyCodeLine{2245 }
\DoxyCodeLine{2246     \textcolor{keywordflow}{if} ((handles\%id\_taux > 0) .and. \textcolor{keyword}{associated}(forces\%taux)) \&}
\DoxyCodeLine{2247       \textcolor{keyword}{call }post\_data(handles\%id\_taux, forces\%taux, diag)}
\DoxyCodeLine{2248 }
\DoxyCodeLine{2249     \textcolor{keywordflow}{if} ((handles\%id\_tauy > 0) .and. \textcolor{keyword}{associated}(forces\%tauy)) \&}
\DoxyCodeLine{2250       \textcolor{keyword}{call }post\_data(handles\%id\_tauy, forces\%tauy, diag)}
\DoxyCodeLine{2251 }
\DoxyCodeLine{2252     \textcolor{keywordflow}{if} ((handles\%id\_mass\_berg > 0) .and. \textcolor{keyword}{associated}(forces\%mass\_berg)) \&}
\DoxyCodeLine{2253       \textcolor{keyword}{call }post\_data(handles\%id\_mass\_berg, forces\%mass\_berg, diag)}
\DoxyCodeLine{2254 }
\DoxyCodeLine{2255     \textcolor{keywordflow}{if} ((handles\%id\_area\_berg > 0) .and. \textcolor{keyword}{associated}(forces\%area\_berg)) \&}
\DoxyCodeLine{2256       \textcolor{keyword}{call }post\_data(handles\%id\_area\_berg, forces\%area\_berg, diag)}
\DoxyCodeLine{2257 }
\DoxyCodeLine{2258   \textcolor{comment}{! endif}}
\DoxyCodeLine{2259 }
\DoxyCodeLine{2260   \textcolor{keyword}{call }disable\_averaging(diag)}
\DoxyCodeLine{2261 }
\DoxyCodeLine{2262   \textcolor{keywordflow}{if} (turns /= 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2263     \textcolor{keyword}{call }deallocate\_mech\_forcing(forces)}
\DoxyCodeLine{2264     \textcolor{keyword}{deallocate}(forces)}
\DoxyCodeLine{2265 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2266 }
\DoxyCodeLine{2267   \textcolor{keyword}{call }cpu\_clock\_end(handles\%id\_clock\_forcing)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a2e3834f8d25c92142d450de74fa68f91}\label{namespacemom__forcing__type_a2e3834f8d25c92142d450de74fa68f91}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!mech\_forcing\_singlepointprint@{mech\_forcing\_singlepointprint}}
\index{mech\_forcing\_singlepointprint@{mech\_forcing\_singlepointprint}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{mech\_forcing\_singlepointprint()}{mech\_forcing\_singlepointprint()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::mech\+\_\+forcing\+\_\+singlepointprint (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{integer, intent(in)}]{i,  }\item[{integer, intent(in)}]{j,  }\item[{character(len=$\ast$), intent(in)}]{mesg }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Write out values of the mechanical forcing arrays at the i,j location. This is a debugging tool. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in}}  & {\em g} & Grid type \\
\hline
\mbox{\texttt{ in}}  & {\em mesg} & Message \\
\hline
\mbox{\texttt{ in}}  & {\em i} & i-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em j} & j-\/index \\
\hline
\end{DoxyParams}


Definition at line 1145 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1145   \textcolor{keywordtype}{type}(mech\_forcing),    \textcolor{keywordtype}{intent(in)} :: forces\textcolor{comment}{ !< A structure with the driving mechanical forces}}
\DoxyCodeLine{1146   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{      !< Grid type}}
\DoxyCodeLine{1147   \textcolor{keywordtype}{character(len=*)},      \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{   !< Message}}
\DoxyCodeLine{1148   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)} :: i\textcolor{comment}{      !< i-\/index}}
\DoxyCodeLine{1149   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)} :: j\textcolor{comment}{      !< j-\/index}}
\DoxyCodeLine{1150 }
\DoxyCodeLine{1151   \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(2a)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: Called from '},mesg}
\DoxyCodeLine{1152   \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(a,2es15.3)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, forcing\_SinglePointPrint: lon,lat = '},g\%geoLonT(i,j),g\%geoLatT(i,j)}
\DoxyCodeLine{1153   \textcolor{keyword}{call }locmsg(forces\%taux,\textcolor{stringliteral}{'taux'})}
\DoxyCodeLine{1154   \textcolor{keyword}{call }locmsg(forces\%tauy,\textcolor{stringliteral}{'tauy'})}
\DoxyCodeLine{1155 }
\DoxyCodeLine{1156   \textcolor{keyword}{contains}\textcolor{comment}{}}
\DoxyCodeLine{1157 \textcolor{comment}{  !> Format and write a message depending on associated state of array}}
\DoxyCodeLine{1158   \textcolor{keyword}{subroutine }locmsg(array,aname)}
\DoxyCodeLine{1159 \textcolor{keywordtype}{    real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: array\textcolor{comment}{ !< Array to write element from}}
\DoxyCodeLine{1160     \textcolor{keywordtype}{character(len=*)}              :: aname\textcolor{comment}{ !< Name of array}}
\DoxyCodeLine{1161 }
\DoxyCodeLine{1162     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(array)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1163       \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(3a,es15.3)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, mech\_forcing\_SinglePointPrint: '},trim(aname),\textcolor{stringliteral}{' = '},array(i,j)}
\DoxyCodeLine{1164     \textcolor{keywordflow}{else}}
\DoxyCodeLine{1165       \textcolor{keyword}{write}(0,\textcolor{stringliteral}{'(4a)'}) \textcolor{stringliteral}{'MOM\_forcing\_type, mech\_forcing\_SinglePointPrint: '},trim(aname),\textcolor{stringliteral}{' is not associated.'}}
\DoxyCodeLine{1166 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1167   \textcolor{keyword}{end subroutine }locmsg}
\DoxyCodeLine{1168 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a1c4ecd1a779a55e9304b0997088a4815}\label{namespacemom__forcing__type_a1c4ecd1a779a55e9304b0997088a4815}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!mom\_forcing\_chksum@{mom\_forcing\_chksum}}
\index{mom\_forcing\_chksum@{mom\_forcing\_chksum}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{mom\_forcing\_chksum()}{mom\_forcing\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::mom\+\_\+forcing\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in), optional}]{haloshift }\end{DoxyParamCaption})}



Write out chksums for thermodynamic fluxes. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mesg} & message \\
\hline
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em haloshift} & shift in halo \\
\hline
\end{DoxyParams}


Definition at line 1022 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1022   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{      !< message}}
\DoxyCodeLine{1023   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{    !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{1024   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{         !< grid type}}
\DoxyCodeLine{1025   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{        !< A dimensional unit scaling type}}
\DoxyCodeLine{1026   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},       \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< shift in halo}}
\DoxyCodeLine{1027 }
\DoxyCodeLine{1028   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hshift}
\DoxyCodeLine{1029   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{1030 }
\DoxyCodeLine{1031   hshift = 1 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hshift = haloshift}
\DoxyCodeLine{1032 }
\DoxyCodeLine{1033   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{1034   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{1035   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{1036   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar)) \&}
\DoxyCodeLine{1037     \textcolor{keyword}{call }hchksum(fluxes\%ustar, mesg//\textcolor{stringliteral}{" fluxes\%ustar"}, g\%HI, haloshift=hshift, scale=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1038   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%buoy)) \&}
\DoxyCodeLine{1039     \textcolor{keyword}{call }hchksum(fluxes\%buoy, mesg//\textcolor{stringliteral}{" fluxes\%buoy "}, g\%HI, haloshift=hshift, scale=us\%L\_to\_m**2*us\%s\_to\_T**3)}
\DoxyCodeLine{1040   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw)) \&}
\DoxyCodeLine{1041     \textcolor{keyword}{call }hchksum(fluxes\%sw, mesg//\textcolor{stringliteral}{" fluxes\%sw"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1042   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_vis\_dir)) \&}
\DoxyCodeLine{1043     \textcolor{keyword}{call }hchksum(fluxes\%sw\_vis\_dir, mesg//\textcolor{stringliteral}{" fluxes\%sw\_vis\_dir"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1044   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_vis\_dif)) \&}
\DoxyCodeLine{1045     \textcolor{keyword}{call }hchksum(fluxes\%sw\_vis\_dif, mesg//\textcolor{stringliteral}{" fluxes\%sw\_vis\_dif"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1046   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_nir\_dir)) \&}
\DoxyCodeLine{1047     \textcolor{keyword}{call }hchksum(fluxes\%sw\_nir\_dir, mesg//\textcolor{stringliteral}{" fluxes\%sw\_nir\_dir"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1048   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sw\_nir\_dif)) \&}
\DoxyCodeLine{1049     \textcolor{keyword}{call }hchksum(fluxes\%sw\_nir\_dif, mesg//\textcolor{stringliteral}{" fluxes\%sw\_nir\_dif"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1050   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lw)) \&}
\DoxyCodeLine{1051     \textcolor{keyword}{call }hchksum(fluxes\%lw, mesg//\textcolor{stringliteral}{" fluxes\%lw"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1052   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent)) \&}
\DoxyCodeLine{1053     \textcolor{keyword}{call }hchksum(fluxes\%latent, mesg//\textcolor{stringliteral}{" fluxes\%latent"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1054   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_evap\_diag)) \&}
\DoxyCodeLine{1055     \textcolor{keyword}{call }hchksum(fluxes\%latent\_evap\_diag, mesg//\textcolor{stringliteral}{" fluxes\%latent\_evap\_diag"}, g\%HI, \&}
\DoxyCodeLine{1056                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1057   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_fprec\_diag)) \&}
\DoxyCodeLine{1058     \textcolor{keyword}{call }hchksum(fluxes\%latent\_fprec\_diag, mesg//\textcolor{stringliteral}{" fluxes\%latent\_fprec\_diag"}, g\%HI, \&}
\DoxyCodeLine{1059                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1060   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%latent\_frunoff\_diag)) \&}
\DoxyCodeLine{1061     \textcolor{keyword}{call }hchksum(fluxes\%latent\_frunoff\_diag, mesg//\textcolor{stringliteral}{" fluxes\%latent\_frunoff\_diag"}, g\%HI, \&}
\DoxyCodeLine{1062                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1063   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%sens)) \&}
\DoxyCodeLine{1064     \textcolor{keyword}{call }hchksum(fluxes\%sens, mesg//\textcolor{stringliteral}{" fluxes\%sens"}, g\%HI, haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1065   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%evap)) \&}
\DoxyCodeLine{1066     \textcolor{keyword}{call }hchksum(fluxes\%evap, mesg//\textcolor{stringliteral}{" fluxes\%evap"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1067   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lprec)) \&}
\DoxyCodeLine{1068     \textcolor{keyword}{call }hchksum(fluxes\%lprec, mesg//\textcolor{stringliteral}{" fluxes\%lprec"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1069   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%fprec)) \&}
\DoxyCodeLine{1070     \textcolor{keyword}{call }hchksum(fluxes\%fprec, mesg//\textcolor{stringliteral}{" fluxes\%fprec"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1071   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%vprec)) \&}
\DoxyCodeLine{1072     \textcolor{keyword}{call }hchksum(fluxes\%vprec, mesg//\textcolor{stringliteral}{" fluxes\%vprec"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1073   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt)) \&}
\DoxyCodeLine{1074     \textcolor{keyword}{call }hchksum(fluxes\%seaice\_melt, mesg//\textcolor{stringliteral}{" fluxes\%seaice\_melt"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1075   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%seaice\_melt\_heat)) \&}
\DoxyCodeLine{1076     \textcolor{keyword}{call }hchksum(fluxes\%seaice\_melt\_heat, mesg//\textcolor{stringliteral}{" fluxes\%seaice\_melt\_heat"}, g\%HI, \&}
\DoxyCodeLine{1077                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1078   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%p\_surf)) \&}
\DoxyCodeLine{1079     \textcolor{keyword}{call }hchksum(fluxes\%p\_surf, mesg//\textcolor{stringliteral}{" fluxes\%p\_surf"}, g\%HI, haloshift=hshift , scale=us\%RL2\_T2\_to\_Pa)}
\DoxyCodeLine{1080   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%salt\_flux)) \&}
\DoxyCodeLine{1081     \textcolor{keyword}{call }hchksum(fluxes\%salt\_flux, mesg//\textcolor{stringliteral}{" fluxes\%salt\_flux"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1082   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%TKE\_tidal)) \&}
\DoxyCodeLine{1083     \textcolor{keyword}{call }hchksum(fluxes\%TKE\_tidal, mesg//\textcolor{stringliteral}{" fluxes\%TKE\_tidal"}, g\%HI, haloshift=hshift, \&}
\DoxyCodeLine{1084                  scale=us\%RZ3\_T3\_to\_W\_m2)}
\DoxyCodeLine{1085   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%ustar\_tidal)) \&}
\DoxyCodeLine{1086     \textcolor{keyword}{call }hchksum(fluxes\%ustar\_tidal, mesg//\textcolor{stringliteral}{" fluxes\%ustar\_tidal"}, g\%HI, haloshift=hshift, scale=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1087   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%lrunoff)) \&}
\DoxyCodeLine{1088     \textcolor{keyword}{call }hchksum(fluxes\%lrunoff, mesg//\textcolor{stringliteral}{" fluxes\%lrunoff"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1089   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%frunoff)) \&}
\DoxyCodeLine{1090     \textcolor{keyword}{call }hchksum(fluxes\%frunoff, mesg//\textcolor{stringliteral}{" fluxes\%frunoff"}, g\%HI, haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1091   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lrunoff)) \&}
\DoxyCodeLine{1092     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_lrunoff, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_lrunoff"}, g\%HI, \&}
\DoxyCodeLine{1093                  haloshift=hshift, scale=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1094   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_frunoff)) \&}
\DoxyCodeLine{1095     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_frunoff, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_frunoff"}, g\%HI, \&}
\DoxyCodeLine{1096                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1097   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_lprec)) \&}
\DoxyCodeLine{1098     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_lprec, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_lprec"}, g\%HI,  \&}
\DoxyCodeLine{1099                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1100   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_fprec)) \&}
\DoxyCodeLine{1101     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_fprec, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_fprec"}, g\%HI, \&}
\DoxyCodeLine{1102                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1103   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_icemelt)) \&}
\DoxyCodeLine{1104     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_icemelt, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_icemelt"}, g\%HI, \&}
\DoxyCodeLine{1105                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1106   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_cond)) \&}
\DoxyCodeLine{1107     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_cond, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_cond"}, g\%HI, \&}
\DoxyCodeLine{1108                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1109   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\%heat\_content\_massout)) \&}
\DoxyCodeLine{1110     \textcolor{keyword}{call }hchksum(fluxes\%heat\_content\_massout, mesg//\textcolor{stringliteral}{" fluxes\%heat\_content\_massout"}, g\%HI, \&}
\DoxyCodeLine{1111                  haloshift=hshift, scale=us\%QRZ\_T\_to\_W\_m2)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_afe942ca75b30c226fdfcdedcecad920f}\label{namespacemom__forcing__type_afe942ca75b30c226fdfcdedcecad920f}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!mom\_mech\_forcing\_chksum@{mom\_mech\_forcing\_chksum}}
\index{mom\_mech\_forcing\_chksum@{mom\_mech\_forcing\_chksum}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{mom\_mech\_forcing\_chksum()}{mom\_mech\_forcing\_chksum()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::mom\+\_\+mech\+\_\+forcing\+\_\+chksum (\begin{DoxyParamCaption}\item[{character(len=$\ast$), intent(in)}]{mesg,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{integer, intent(in), optional}]{haloshift }\end{DoxyParamCaption})}



Write out chksums for the driving mechanical forces. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em mesg} & message \\
\hline
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em haloshift} & shift in halo \\
\hline
\end{DoxyParams}


Definition at line 1116 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1116   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in)} :: mesg\textcolor{comment}{      !< message}}
\DoxyCodeLine{1117   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(in)} :: forces\textcolor{comment}{    !< A structure with the driving mechanical forces}}
\DoxyCodeLine{1118   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{         !< grid type}}
\DoxyCodeLine{1119   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{        !< A dimensional unit scaling type}}
\DoxyCodeLine{1120   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},       \textcolor{keywordtype}{intent(in)} :: haloshift\textcolor{comment}{ !< shift in halo}}
\DoxyCodeLine{1121 }
\DoxyCodeLine{1122   \textcolor{keywordtype}{integer} :: is, ie, js, je, nz, hshift}
\DoxyCodeLine{1123   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{1124 }
\DoxyCodeLine{1125   hshift=1; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(haloshift)) hshift=haloshift}
\DoxyCodeLine{1126 }
\DoxyCodeLine{1127   \textcolor{comment}{! Note that for the chksum calls to be useful for reproducing across PE}}
\DoxyCodeLine{1128   \textcolor{comment}{! counts, there must be no redundant points, so all variables use is..ie}}
\DoxyCodeLine{1129   \textcolor{comment}{! and js...je as their extent.}}
\DoxyCodeLine{1130   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%taux) .and. \textcolor{keyword}{associated}(forces\%tauy)) \&}
\DoxyCodeLine{1131     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" forces\%tau[xy]"}, forces\%taux, forces\%tauy, g\%HI, \&}
\DoxyCodeLine{1132                   haloshift=hshift, symmetric=.true., scale=us\%RZ\_T\_to\_kg\_m2s*us\%L\_T\_to\_m\_s)}
\DoxyCodeLine{1133   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%p\_surf)) \&}
\DoxyCodeLine{1134     \textcolor{keyword}{call }hchksum(forces\%p\_surf, mesg//\textcolor{stringliteral}{" forces\%p\_surf"}, g\%HI, haloshift=hshift, scale=us\%RL2\_T2\_to\_Pa)}
\DoxyCodeLine{1135   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%ustar)) \&}
\DoxyCodeLine{1136     \textcolor{keyword}{call }hchksum(forces\%ustar, mesg//\textcolor{stringliteral}{" forces\%ustar"}, g\%HI, haloshift=hshift, scale=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1137   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%rigidity\_ice\_u) .and. \textcolor{keyword}{associated}(forces\%rigidity\_ice\_v)) \&}
\DoxyCodeLine{1138     \textcolor{keyword}{call }uvchksum(mesg//\textcolor{stringliteral}{" forces\%rigidity\_ice\_[uv]"}, forces\%rigidity\_ice\_u, forces\%rigidity\_ice\_v, \&}
\DoxyCodeLine{1139                   g\%HI, haloshift=hshift, symmetric=.true., scale=us\%L\_to\_m**3*us\%L\_to\_Z*us\%s\_to\_T)}
\DoxyCodeLine{1140 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_aa9a495456715378fe3dd5fb2bd21eec8}\label{namespacemom__forcing__type_aa9a495456715378fe3dd5fb2bd21eec8}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!myalloc@{myalloc}}
\index{myalloc@{myalloc}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{myalloc()}{myalloc()}}
{\footnotesize\ttfamily subroutine mom\+\_\+forcing\+\_\+type\+::myalloc (\begin{DoxyParamCaption}\item[{real, dimension(\+:,\+:), pointer}]{array,  }\item[{integer, intent(in)}]{is,  }\item[{integer, intent(in)}]{ie,  }\item[{integer, intent(in)}]{js,  }\item[{integer, intent(in)}]{je,  }\item[{logical, intent(in), optional}]{flag }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Allocates and zeroes-\/out array. 


\begin{DoxyParams}[1]{Parameters}
 & {\em array} & Array to be allocated \\
\hline
\mbox{\texttt{ in}}  & {\em is} & Start i-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em ie} & End i-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em js} & Start j-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em je} & End j-\/index \\
\hline
\mbox{\texttt{ in}}  & {\em flag} & Flag to indicate to allocate \\
\hline
\end{DoxyParams}


Definition at line 3101 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3101 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:)}, \textcolor{keywordtype}{pointer} :: array\textcolor{comment}{ !< Array to be allocated}}
\DoxyCodeLine{3102   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: is\textcolor{comment}{ !< Start i-\/index}}
\DoxyCodeLine{3103   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: ie\textcolor{comment}{ !< End i-\/index}}
\DoxyCodeLine{3104   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: js\textcolor{comment}{ !< Start j-\/index}}
\DoxyCodeLine{3105   \textcolor{keywordtype}{integer},           \textcolor{keywordtype}{intent(in)} :: je\textcolor{comment}{ !< End j-\/index}}
\DoxyCodeLine{3106   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: flag\textcolor{comment}{ !< Flag to indicate to allocate}}
\DoxyCodeLine{3107 }
\DoxyCodeLine{3108   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(flag)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (flag) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(array)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3109     \textcolor{keyword}{allocate}(array(is:ie,js:je)) ; array(is:ie,js:je) = 0.0}
\DoxyCodeLine{3110 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif} ;\textcolor{keywordflow}{ endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_ad4a8e0b876c8082f77352a25a56b86e9}\label{namespacemom__forcing__type_ad4a8e0b876c8082f77352a25a56b86e9}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!register\_forcing\_type\_diags@{register\_forcing\_type\_diags}}
\index{register\_forcing\_type\_diags@{register\_forcing\_type\_diags}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{register\_forcing\_type\_diags()}{register\_forcing\_type\_diags()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::register\+\_\+forcing\+\_\+type\+\_\+diags (\begin{DoxyParamCaption}\item[{type(time\+\_\+type), intent(in)}]{Time,  }\item[{type(diag\+\_\+ctrl), intent(inout)}]{diag,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{logical, intent(in)}]{use\+\_\+temperature,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing__diags}{forcing\+\_\+diags}}), intent(inout)}]{handles,  }\item[{logical, intent(in), optional}]{use\+\_\+berg\+\_\+fluxes }\end{DoxyParamCaption})}



Register members of the forcing type for diagnostics. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em time} & time type \\
\hline
\mbox{\texttt{ in,out}}  & {\em diag} & diagnostic control type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+temperature} & True if T/S are in use \\
\hline
\mbox{\texttt{ in,out}}  & {\em handles} & handles for diagnostics \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+berg\+\_\+fluxes} & If true, allow iceberg flux diagnostics \\
\hline
\end{DoxyParams}


Definition at line 1233 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1233   \textcolor{keywordtype}{type}(time\_type),     \textcolor{keywordtype}{intent(in)}    :: Time\textcolor{comment}{            !< time type}}
\DoxyCodeLine{1234   \textcolor{keywordtype}{type}(diag\_ctrl),     \textcolor{keywordtype}{intent(inout)} :: diag\textcolor{comment}{            !< diagnostic control type}}
\DoxyCodeLine{1235   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{              !< A dimensional unit scaling type}}
\DoxyCodeLine{1236   \textcolor{keywordtype}{logical},             \textcolor{keywordtype}{intent(in)}    :: use\_temperature\textcolor{comment}{ !< True if T/S are in use}}
\DoxyCodeLine{1237   \textcolor{keywordtype}{type}(forcing\_diags), \textcolor{keywordtype}{intent(inout)} :: handles\textcolor{comment}{         !< handles for diagnostics}}
\DoxyCodeLine{1238   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional},   \textcolor{keywordtype}{intent(in)}    :: use\_berg\_fluxes\textcolor{comment}{ !< If true, allow iceberg flux diagnostics}}
\DoxyCodeLine{1239 }
\DoxyCodeLine{1240   \textcolor{comment}{! Clock for forcing diagnostics}}
\DoxyCodeLine{1241   handles\%id\_clock\_forcing=cpu\_clock\_id(\textcolor{stringliteral}{'(Ocean forcing diagnostics)'}, grain=clock\_routine)}
\DoxyCodeLine{1242 }
\DoxyCodeLine{1243 }
\DoxyCodeLine{1244   handles\%id\_taux = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'taux'}, diag\%axesCu1, time,  \&}
\DoxyCodeLine{1245         \textcolor{stringliteral}{'Zonal surface stress from ocean interactions with atmos and ice'}, \&}
\DoxyCodeLine{1246         \textcolor{stringliteral}{'Pa'}, conversion=us\%RZ\_T\_to\_kg\_m2s*us\%L\_T\_to\_m\_s, \&}
\DoxyCodeLine{1247         standard\_name=\textcolor{stringliteral}{'surface\_downward\_x\_stress'}, cmor\_field\_name=\textcolor{stringliteral}{'tauuo'},         \&}
\DoxyCodeLine{1248         cmor\_units=\textcolor{stringliteral}{'N m-\/2'}, cmor\_long\_name=\textcolor{stringliteral}{'Surface Downward X Stress'},             \&}
\DoxyCodeLine{1249         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_x\_stress'})}
\DoxyCodeLine{1250 }
\DoxyCodeLine{1251   handles\%id\_tauy = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'tauy'}, diag\%axesCv1, time,  \&}
\DoxyCodeLine{1252         \textcolor{stringliteral}{'Meridional surface stress ocean interactions with atmos and ice'}, \&}
\DoxyCodeLine{1253         \textcolor{stringliteral}{'Pa'},  conversion=us\%RZ\_T\_to\_kg\_m2s*us\%L\_T\_to\_m\_s, \&}
\DoxyCodeLine{1254         standard\_name=\textcolor{stringliteral}{'surface\_downward\_y\_stress'}, cmor\_field\_name=\textcolor{stringliteral}{'tauvo'},        \&}
\DoxyCodeLine{1255         cmor\_units=\textcolor{stringliteral}{'N m-\/2'}, cmor\_long\_name=\textcolor{stringliteral}{'Surface Downward Y Stress'},            \&}
\DoxyCodeLine{1256         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_y\_stress'})}
\DoxyCodeLine{1257 }
\DoxyCodeLine{1258   handles\%id\_ustar = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'ustar'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1259       \textcolor{stringliteral}{'Surface friction velocity = [(gustiness + tau\_magnitude)/rho0]\string^(1/2)'}, \&}
\DoxyCodeLine{1260       \textcolor{stringliteral}{'m s-\/1'}, conversion=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1261 }
\DoxyCodeLine{1262   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(use\_berg\_fluxes)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1263     \textcolor{keywordflow}{if} (use\_berg\_fluxes) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1264       handles\%id\_ustar\_berg = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'ustar\_berg'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1265           \textcolor{stringliteral}{'Friction velocity below iceberg '}, \textcolor{stringliteral}{'m s-\/1'}, conversion=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1266 }
\DoxyCodeLine{1267       handles\%id\_area\_berg = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'area\_berg'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1268           \textcolor{stringliteral}{'Area of grid cell covered by iceberg '}, \textcolor{stringliteral}{'m2 m-\/2'})}
\DoxyCodeLine{1269 }
\DoxyCodeLine{1270       handles\%id\_mass\_berg = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'mass\_berg'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1271           \textcolor{stringliteral}{'Mass of icebergs '}, \textcolor{stringliteral}{'kg m-\/2'}, conversion=us\%RZ\_to\_kg\_m2)}
\DoxyCodeLine{1272 }
\DoxyCodeLine{1273       handles\%id\_ustar\_ice\_cover = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'ustar\_ice\_cover'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1274           \textcolor{stringliteral}{'Friction velocity below iceberg and ice shelf together'}, \textcolor{stringliteral}{'m s-\/1'}, conversion=us\%Z\_to\_m*us\%s\_to\_T)}
\DoxyCodeLine{1275 }
\DoxyCodeLine{1276       handles\%id\_frac\_ice\_cover = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'frac\_ice\_cover'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1277           \textcolor{stringliteral}{'Area of grid cell below iceberg and ice shelf together '}, \textcolor{stringliteral}{'m2 m-\/2'})}
\DoxyCodeLine{1278 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1279 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1280 }
\DoxyCodeLine{1281   handles\%id\_psurf = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'p\_surf'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1282         \textcolor{stringliteral}{'Pressure at ice-\/ocean or atmosphere-\/ocean interface'}, \&}
\DoxyCodeLine{1283         \textcolor{stringliteral}{'Pa'}, conversion=us\%RL2\_T2\_to\_Pa, cmor\_field\_name=\textcolor{stringliteral}{'pso'}, \&}
\DoxyCodeLine{1284         cmor\_long\_name=\textcolor{stringliteral}{'Sea Water Pressure at Sea Water Surface'}, \&}
\DoxyCodeLine{1285         cmor\_standard\_name=\textcolor{stringliteral}{'sea\_water\_pressure\_at\_sea\_water\_surface'})}
\DoxyCodeLine{1286 }
\DoxyCodeLine{1287   handles\%id\_TKE\_tidal = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'TKE\_tidal'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1288         \textcolor{stringliteral}{'Tidal source of BBL mixing'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%RZ3\_T3\_to\_W\_m2)}
\DoxyCodeLine{1289 }
\DoxyCodeLine{1290   \textcolor{keywordflow}{if} (.not. use\_temperature) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1291     handles\%id\_buoy = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'buoy'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1292           \textcolor{stringliteral}{'Buoyancy forcing'}, \textcolor{stringliteral}{'m2 s-\/3'}, conversion=us\%L\_to\_m**2*us\%s\_to\_T**3)}
\DoxyCodeLine{1293     \textcolor{keywordflow}{return}}
\DoxyCodeLine{1294 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1295 }
\DoxyCodeLine{1296 }
\DoxyCodeLine{1297   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1298   \textcolor{comment}{! surface mass flux maps}}
\DoxyCodeLine{1299 }
\DoxyCodeLine{1300   handles\%id\_prcme = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PRCmE'}, diag\%axesT1, time,                  \&}
\DoxyCodeLine{1301         \textcolor{stringliteral}{'Net surface water flux (precip+melt+lrunoff+ice calving-\/evap)'}, \textcolor{stringliteral}{'kg m-\/2 s-\/1'}, \&}
\DoxyCodeLine{1302         standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water'}, cmor\_field\_name=\textcolor{stringliteral}{'wfo'},                            \&}
\DoxyCodeLine{1303         cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water'},cmor\_long\_name=\textcolor{stringliteral}{'Water Flux Into Sea Water'})}
\DoxyCodeLine{1304         \textcolor{comment}{! This diagnostic is rescaled to MKS units when combined.}}
\DoxyCodeLine{1305 }
\DoxyCodeLine{1306   handles\%id\_evap = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'evap'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1307        \textcolor{stringliteral}{'Evaporation/condensation at ocean surface (evaporation is negative)'}, \&}
\DoxyCodeLine{1308        \textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s, \&}
\DoxyCodeLine{1309        standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux'}, cmor\_field\_name=\textcolor{stringliteral}{'evs'}, \&}
\DoxyCodeLine{1310        cmor\_standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux'}, \&}
\DoxyCodeLine{1311        cmor\_long\_name=\textcolor{stringliteral}{'Water Evaporation Flux Where Ice Free Ocean over Sea'})}
\DoxyCodeLine{1312 }
\DoxyCodeLine{1313   \textcolor{comment}{! smg: seaice\_melt field requires updates to the sea ice model}}
\DoxyCodeLine{1314   handles\%id\_seaice\_melt = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'seaice\_melt'},       \&}
\DoxyCodeLine{1315      diag\%axesT1, time, \textcolor{stringliteral}{'water flux to ocean from snow/sea ice melting(> 0) or formation(< 0)'}, \&}
\DoxyCodeLine{1316      \textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s, \&}
\DoxyCodeLine{1317       standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_due\_to\_sea\_ice\_thermodynamics'},     \&}
\DoxyCodeLine{1318       cmor\_field\_name=\textcolor{stringliteral}{'fsitherm'},                                                  \&}
\DoxyCodeLine{1319       cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_due\_to\_sea\_ice\_thermodynamics'},\&}
\DoxyCodeLine{1320       cmor\_long\_name=\textcolor{stringliteral}{'water flux to ocean from sea ice melt(> 0) or form(< 0)'})}
\DoxyCodeLine{1321 }
\DoxyCodeLine{1322   handles\%id\_precip = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'precip'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1323         \textcolor{stringliteral}{'Liquid + frozen precipitation into ocean'}, \textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1324         \textcolor{comment}{! This diagnostic is rescaled to MKS units when combined.}}
\DoxyCodeLine{1325 }
\DoxyCodeLine{1326   handles\%id\_fprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'fprec'}, diag\%axesT1, time,     \&}
\DoxyCodeLine{1327         \textcolor{stringliteral}{'Frozen precipitation into ocean'}, \&}
\DoxyCodeLine{1328         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s,   \&}
\DoxyCodeLine{1329         standard\_name=\textcolor{stringliteral}{'snowfall\_flux'}, cmor\_field\_name=\textcolor{stringliteral}{'prsn'},                          \&}
\DoxyCodeLine{1330         cmor\_standard\_name=\textcolor{stringliteral}{'snowfall\_flux'}, cmor\_long\_name=\textcolor{stringliteral}{'Snowfall Flux where Ice Free Ocean over Sea'})}
\DoxyCodeLine{1331 }
\DoxyCodeLine{1332   handles\%id\_lprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'lprec'}, diag\%axesT1, time,       \&}
\DoxyCodeLine{1333         \textcolor{stringliteral}{'Liquid precipitation into ocean'}, \&}
\DoxyCodeLine{1334         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s,                 \&}
\DoxyCodeLine{1335         standard\_name=\textcolor{stringliteral}{'rainfall\_flux'},                                                    \&}
\DoxyCodeLine{1336         cmor\_field\_name=\textcolor{stringliteral}{'prlq'}, cmor\_standard\_name=\textcolor{stringliteral}{'rainfall\_flux'},                       \&}
\DoxyCodeLine{1337         cmor\_long\_name=\textcolor{stringliteral}{'Rainfall Flux where Ice Free Ocean over Sea'})}
\DoxyCodeLine{1338 }
\DoxyCodeLine{1339   handles\%id\_vprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'vprec'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1340         \textcolor{stringliteral}{'Virtual liquid precip into ocean due to SSS restoring'}, \&}
\DoxyCodeLine{1341         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1342 }
\DoxyCodeLine{1343   handles\%id\_frunoff = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'frunoff'}, diag\%axesT1, time,    \&}
\DoxyCodeLine{1344         \textcolor{stringliteral}{'Frozen runoff (calving) and iceberg melt into ocean'}, \&}
\DoxyCodeLine{1345         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s, \&}
\DoxyCodeLine{1346         standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_icebergs'},                           \&}
\DoxyCodeLine{1347         cmor\_field\_name=\textcolor{stringliteral}{'ficeberg'},                                                        \&}
\DoxyCodeLine{1348         cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_icebergs'},                      \&}
\DoxyCodeLine{1349         cmor\_long\_name=\textcolor{stringliteral}{'Water Flux into Seawater from Icebergs'})}
\DoxyCodeLine{1350 }
\DoxyCodeLine{1351   handles\%id\_lrunoff = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'lrunoff'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1352         \textcolor{stringliteral}{'Liquid runoff (rivers) into ocean'}, \&}
\DoxyCodeLine{1353         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s, \&}
\DoxyCodeLine{1354         standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_rivers'}, cmor\_field\_name=\textcolor{stringliteral}{'friver'},      \&}
\DoxyCodeLine{1355         cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_rivers'},                           \&}
\DoxyCodeLine{1356         cmor\_long\_name=\textcolor{stringliteral}{'Water Flux into Sea Water From Rivers'})}
\DoxyCodeLine{1357 }
\DoxyCodeLine{1358   handles\%id\_net\_massout = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'net\_massout'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1359         \textcolor{stringliteral}{'Net mass leaving the ocean due to evaporation, seaice formation'}, \textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1360         \textcolor{comment}{! This diagnostic is rescaled to MKS units when combined.}}
\DoxyCodeLine{1361 }
\DoxyCodeLine{1362   handles\%id\_net\_massin  = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'net\_massin'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1363         \textcolor{stringliteral}{'Net mass entering ocean due to precip, runoff, ice melt'}, \textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1364         \textcolor{comment}{! This diagnostic is rescaled to MKS units when combined.}}
\DoxyCodeLine{1365 }
\DoxyCodeLine{1366   handles\%id\_massout\_flux = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'massout\_flux'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1367         \textcolor{stringliteral}{'Net mass flux of freshwater out of the ocean (used in the boundary flux calculation)'}, \&}
\DoxyCodeLine{1368          \textcolor{stringliteral}{'kg m-\/2'}, conversion=diag\%GV\%H\_to\_kg\_m2)}
\DoxyCodeLine{1369         \textcolor{comment}{! This diagnostic is calculated in MKS units.}}
\DoxyCodeLine{1370 }
\DoxyCodeLine{1371   handles\%id\_massin\_flux  = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'massin\_flux'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1372         \textcolor{stringliteral}{'Net mass flux of freshwater into the ocean (used in boundary flux calculation)'}, \textcolor{stringliteral}{'kg m-\/2'})}
\DoxyCodeLine{1373         \textcolor{comment}{! This diagnostic is calculated in MKS units.}}
\DoxyCodeLine{1374 }
\DoxyCodeLine{1375   \textcolor{comment}{!=========================================================================}}
\DoxyCodeLine{1376   \textcolor{comment}{! area integrated surface mass transport, all are rescaled to MKS units before area integration.}}
\DoxyCodeLine{1377 }
\DoxyCodeLine{1378   handles\%id\_total\_prcme = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_PRCmE'}, time, diag,         \&}
\DoxyCodeLine{1379       long\_name=\textcolor{stringliteral}{'Area integrated net surface water flux (precip+melt+liq runoff+ice calving-\/evap)'},\&}
\DoxyCodeLine{1380       units=\textcolor{stringliteral}{'kg s-\/1'}, standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_area\_integrated'},                   \&}
\DoxyCodeLine{1381       cmor\_field\_name=\textcolor{stringliteral}{'total\_wfo'},                                                                 \&}
\DoxyCodeLine{1382       cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_area\_integrated'},                              \&}
\DoxyCodeLine{1383       cmor\_long\_name=\textcolor{stringliteral}{'Water Transport Into Sea Water Area Integrated'})}
\DoxyCodeLine{1384 }
\DoxyCodeLine{1385   handles\%id\_total\_evap = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_evap'}, time, diag,\&}
\DoxyCodeLine{1386       long\_name=\textcolor{stringliteral}{'Area integrated evap/condense at ocean surface'},                       \&}
\DoxyCodeLine{1387       units=\textcolor{stringliteral}{'kg s-\/1'}, standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux\_area\_integrated'},           \&}
\DoxyCodeLine{1388       cmor\_field\_name=\textcolor{stringliteral}{'total\_evs'},                                                      \&}
\DoxyCodeLine{1389       cmor\_standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux\_area\_integrated'},                      \&}
\DoxyCodeLine{1390       cmor\_long\_name=\textcolor{stringliteral}{'Evaporation Where Ice Free Ocean over Sea Area Integrated'})}
\DoxyCodeLine{1391 }
\DoxyCodeLine{1392   \textcolor{comment}{! seaice\_melt field requires updates to the sea ice model}}
\DoxyCodeLine{1393   handles\%id\_total\_seaice\_melt = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_icemelt'}, time, diag, \&}
\DoxyCodeLine{1394       long\_name=\textcolor{stringliteral}{'Area integrated sea ice melt (>0) or form (<0)'}, units=\textcolor{stringliteral}{'kg s-\/1'},                      \&}
\DoxyCodeLine{1395       standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_due\_to\_sea\_ice\_thermodynamics\_area\_integrated'},         \&}
\DoxyCodeLine{1396       cmor\_field\_name=\textcolor{stringliteral}{'total\_fsitherm'},                                                                \&}
\DoxyCodeLine{1397       cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_due\_to\_sea\_ice\_thermodynamics\_area\_integrated'},    \&}
\DoxyCodeLine{1398       cmor\_long\_name=\textcolor{stringliteral}{'Water Melt/Form from Sea Ice Area Integrated'})}
\DoxyCodeLine{1399 }
\DoxyCodeLine{1400   handles\%id\_total\_precip = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_precip'}, time, diag, \&}
\DoxyCodeLine{1401       long\_name=\textcolor{stringliteral}{'Area integrated liquid+frozen precip into ocean'}, units=\textcolor{stringliteral}{'kg s-\/1'})}
\DoxyCodeLine{1402 }
\DoxyCodeLine{1403   handles\%id\_total\_fprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_fprec'}, time, diag,\&}
\DoxyCodeLine{1404       long\_name=\textcolor{stringliteral}{'Area integrated frozen precip into ocean'}, units=\textcolor{stringliteral}{'kg s-\/1'},               \&}
\DoxyCodeLine{1405       standard\_name=\textcolor{stringliteral}{'snowfall\_flux\_area\_integrated'},                                      \&}
\DoxyCodeLine{1406       cmor\_field\_name=\textcolor{stringliteral}{'total\_prsn'},                                                       \&}
\DoxyCodeLine{1407       cmor\_standard\_name=\textcolor{stringliteral}{'snowfall\_flux\_area\_integrated'},                                 \&}
\DoxyCodeLine{1408       cmor\_long\_name=\textcolor{stringliteral}{'Snowfall Flux where Ice Free Ocean over Sea Area Integrated'})}
\DoxyCodeLine{1409 }
\DoxyCodeLine{1410   handles\%id\_total\_lprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_lprec'}, time, diag,\&}
\DoxyCodeLine{1411       long\_name=\textcolor{stringliteral}{'Area integrated liquid precip into ocean'}, units=\textcolor{stringliteral}{'kg s-\/1'},               \&}
\DoxyCodeLine{1412       standard\_name=\textcolor{stringliteral}{'rainfall\_flux\_area\_integrated'},                                      \&}
\DoxyCodeLine{1413       cmor\_field\_name=\textcolor{stringliteral}{'total\_pr'},                                                         \&}
\DoxyCodeLine{1414       cmor\_standard\_name=\textcolor{stringliteral}{'rainfall\_flux\_area\_integrated'},                                 \&}
\DoxyCodeLine{1415       cmor\_long\_name=\textcolor{stringliteral}{'Rainfall Flux where Ice Free Ocean over Sea Area Integrated'})}
\DoxyCodeLine{1416 }
\DoxyCodeLine{1417   handles\%id\_total\_vprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_vprec'}, time, diag, \&}
\DoxyCodeLine{1418       long\_name=\textcolor{stringliteral}{'Area integrated virtual liquid precip due to SSS restoring'}, units=\textcolor{stringliteral}{'kg s-\/1'})}
\DoxyCodeLine{1419 }
\DoxyCodeLine{1420   handles\%id\_total\_frunoff = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_frunoff'}, time, diag,    \&}
\DoxyCodeLine{1421       long\_name=\textcolor{stringliteral}{'Area integrated frozen runoff (calving) \& iceberg melt into ocean'}, units=\textcolor{stringliteral}{'kg s-\/1'},\&}
\DoxyCodeLine{1422       cmor\_field\_name=\textcolor{stringliteral}{'total\_ficeberg'},                                                           \&}
\DoxyCodeLine{1423       cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_icebergs\_area\_integrated'},               \&}
\DoxyCodeLine{1424       cmor\_long\_name=\textcolor{stringliteral}{'Water Flux into Seawater from Icebergs Area Integrated'})}
\DoxyCodeLine{1425 }
\DoxyCodeLine{1426   handles\%id\_total\_lrunoff = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_lrunoff'}, time, diag,\&}
\DoxyCodeLine{1427       long\_name=\textcolor{stringliteral}{'Area integrated liquid runoff into ocean'}, units=\textcolor{stringliteral}{'kg s-\/1'},                   \&}
\DoxyCodeLine{1428       cmor\_field\_name=\textcolor{stringliteral}{'total\_friver'},                                                         \&}
\DoxyCodeLine{1429       cmor\_standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_from\_rivers\_area\_integrated'},             \&}
\DoxyCodeLine{1430       cmor\_long\_name=\textcolor{stringliteral}{'Water Flux into Sea Water From Rivers Area Integrated'})}
\DoxyCodeLine{1431 }
\DoxyCodeLine{1432   handles\%id\_total\_net\_massout = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_net\_massout'}, time, diag, \&}
\DoxyCodeLine{1433       long\_name=\textcolor{stringliteral}{'Area integrated mass leaving ocean due to evap and seaice form'}, units=\textcolor{stringliteral}{'kg s-\/1'})}
\DoxyCodeLine{1434 }
\DoxyCodeLine{1435   handles\%id\_total\_net\_massin = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_net\_massin'}, time, diag, \&}
\DoxyCodeLine{1436       long\_name=\textcolor{stringliteral}{'Area integrated mass entering ocean due to predip, runoff, ice melt'}, units=\textcolor{stringliteral}{'kg s-\/1'})}
\DoxyCodeLine{1437 }
\DoxyCodeLine{1438   \textcolor{comment}{!=========================================================================}}
\DoxyCodeLine{1439   \textcolor{comment}{! area averaged surface mass transport}}
\DoxyCodeLine{1440 }
\DoxyCodeLine{1441   handles\%id\_prcme\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'PRCmE\_ga'}, time, diag,             \&}
\DoxyCodeLine{1442       long\_name=\textcolor{stringliteral}{'Area averaged net surface water flux (precip+melt+liq runoff+ice calving-\/evap)'},\&}
\DoxyCodeLine{1443       units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, standard\_name=\textcolor{stringliteral}{'water\_flux\_into\_sea\_water\_area\_averaged'},               \&}
\DoxyCodeLine{1444       cmor\_field\_name=\textcolor{stringliteral}{'ave\_wfo'},                                                                 \&}
\DoxyCodeLine{1445       cmor\_standard\_name=\textcolor{stringliteral}{'rainfall\_flux\_area\_averaged'},                                          \&}
\DoxyCodeLine{1446       cmor\_long\_name=\textcolor{stringliteral}{'Water Transport Into Sea Water Area Averaged'})}
\DoxyCodeLine{1447 }
\DoxyCodeLine{1448   handles\%id\_evap\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'evap\_ga'}, time, diag,\&}
\DoxyCodeLine{1449       long\_name=\textcolor{stringliteral}{'Area averaged evap/condense at ocean surface'},                   \&}
\DoxyCodeLine{1450       units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux\_area\_averaged'},   \&}
\DoxyCodeLine{1451       cmor\_field\_name=\textcolor{stringliteral}{'ave\_evs'},                                                  \&}
\DoxyCodeLine{1452       cmor\_standard\_name=\textcolor{stringliteral}{'water\_evaporation\_flux\_area\_averaged'},                  \&}
\DoxyCodeLine{1453       cmor\_long\_name=\textcolor{stringliteral}{'Evaporation Where Ice Free Ocean over Sea Area Averaged'})}
\DoxyCodeLine{1454 }
\DoxyCodeLine{1455  handles\%id\_lprec\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'lprec\_ga'}, time, diag,\&}
\DoxyCodeLine{1456       long\_name=\textcolor{stringliteral}{'Area integrated liquid precip into ocean'}, units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'},    \&}
\DoxyCodeLine{1457       standard\_name=\textcolor{stringliteral}{'rainfall\_flux\_area\_averaged'},                                 \&}
\DoxyCodeLine{1458       cmor\_field\_name=\textcolor{stringliteral}{'ave\_pr'},                                                    \&}
\DoxyCodeLine{1459       cmor\_standard\_name=\textcolor{stringliteral}{'rainfall\_flux\_area\_averaged'},                            \&}
\DoxyCodeLine{1460       cmor\_long\_name=\textcolor{stringliteral}{'Rainfall Flux where Ice Free Ocean over Sea Area Averaged'})}
\DoxyCodeLine{1461 }
\DoxyCodeLine{1462  handles\%id\_fprec\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'fprec\_ga'}, time, diag,\&}
\DoxyCodeLine{1463       long\_name=\textcolor{stringliteral}{'Area integrated frozen precip into ocean'}, units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'},    \&}
\DoxyCodeLine{1464       standard\_name=\textcolor{stringliteral}{'snowfall\_flux\_area\_averaged'},                                 \&}
\DoxyCodeLine{1465       cmor\_field\_name=\textcolor{stringliteral}{'ave\_prsn'},                                                  \&}
\DoxyCodeLine{1466       cmor\_standard\_name=\textcolor{stringliteral}{'snowfall\_flux\_area\_averaged'},                            \&}
\DoxyCodeLine{1467       cmor\_long\_name=\textcolor{stringliteral}{'Snowfall Flux where Ice Free Ocean over Sea Area Averaged'})}
\DoxyCodeLine{1468 }
\DoxyCodeLine{1469   handles\%id\_precip\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'precip\_ga'}, time, diag, \&}
\DoxyCodeLine{1470       long\_name=\textcolor{stringliteral}{'Area averaged liquid+frozen precip into ocean'}, units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1471 }
\DoxyCodeLine{1472   handles\%id\_vprec\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'vrec\_ga'}, time, diag, \&}
\DoxyCodeLine{1473       long\_name=\textcolor{stringliteral}{'Area averaged virtual liquid precip due to SSS restoring'}, units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1474 }
\DoxyCodeLine{1475   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1476   \textcolor{comment}{! surface heat flux maps}}
\DoxyCodeLine{1477 }
\DoxyCodeLine{1478   handles\%id\_heat\_content\_frunoff = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_frunoff'}, \&}
\DoxyCodeLine{1479         diag\%axesT1, time, \textcolor{stringliteral}{'Heat content (relative to 0C) of solid runoff into ocean'},         \&}
\DoxyCodeLine{1480         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1481         standard\_name=\textcolor{stringliteral}{'temperature\_flux\_due\_to\_solid\_runoff\_expressed\_as\_heat\_flux\_into\_sea\_water'})}
\DoxyCodeLine{1482 }
\DoxyCodeLine{1483   handles\%id\_heat\_content\_lrunoff = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_lrunoff'}, \&}
\DoxyCodeLine{1484         diag\%axesT1, time, \textcolor{stringliteral}{'Heat content (relative to 0C) of liquid runoff into ocean'},        \&}
\DoxyCodeLine{1485         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1486         standard\_name=\textcolor{stringliteral}{'temperature\_flux\_due\_to\_runoff\_expressed\_as\_heat\_flux\_into\_sea\_water'})}
\DoxyCodeLine{1487 }
\DoxyCodeLine{1488   handles\%id\_hfrunoffds = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hfrunoffds'},                            \&}
\DoxyCodeLine{1489         diag\%axesT1, time, \textcolor{stringliteral}{'Heat content (relative to 0C) of liquid+solid runoff into ocean'}, \&}
\DoxyCodeLine{1490         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1491         standard\_name=\textcolor{stringliteral}{'temperature\_flux\_due\_to\_runoff\_expressed\_as\_heat\_flux\_into\_sea\_water'})}
\DoxyCodeLine{1492 }
\DoxyCodeLine{1493   handles\%id\_heat\_content\_lprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_lprec'},             \&}
\DoxyCodeLine{1494         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of liquid precip entering ocean'},           \&}
\DoxyCodeLine{1495         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1496 }
\DoxyCodeLine{1497   handles\%id\_heat\_content\_fprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_fprec'},\&}
\DoxyCodeLine{1498         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of frozen prec entering ocean'},\&}
\DoxyCodeLine{1499         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1500 }
\DoxyCodeLine{1501   handles\%id\_heat\_content\_icemelt = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_icemelt'},\&}
\DoxyCodeLine{1502         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of water flux due to sea ice melting/freezing'},\&}
\DoxyCodeLine{1503         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1504 }
\DoxyCodeLine{1505   handles\%id\_heat\_content\_vprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_vprec'},   \&}
\DoxyCodeLine{1506         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of virtual precip entering ocean'},\&}
\DoxyCodeLine{1507         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1508 }
\DoxyCodeLine{1509   handles\%id\_heat\_content\_cond = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_cond'},   \&}
\DoxyCodeLine{1510         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of water condensing into ocean'},\&}
\DoxyCodeLine{1511         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1512 }
\DoxyCodeLine{1513   handles\%id\_hfrainds = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'hfrainds'},                                 \&}
\DoxyCodeLine{1514         diag\%axesT1,time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of liquid+frozen precip entering ocean'},    \&}
\DoxyCodeLine{1515         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1516         standard\_name=\textcolor{stringliteral}{'temperature\_flux\_due\_to\_rainfall\_expressed\_as\_heat\_flux\_into\_sea\_water'},\&}
\DoxyCodeLine{1517         cmor\_long\_name=\textcolor{stringliteral}{'Heat Content (relative to 0degC) of Liquid + Frozen Precipitation'})}
\DoxyCodeLine{1518 }
\DoxyCodeLine{1519   handles\%id\_heat\_content\_surfwater = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_surfwater'},\&}
\DoxyCodeLine{1520          diag\%axesT1, time,                                                                       \&}
\DoxyCodeLine{1521         \textcolor{stringliteral}{'Heat content (relative to 0degC) of net water crossing ocean surface (frozen+liquid)'},   \&}
\DoxyCodeLine{1522         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1523 }
\DoxyCodeLine{1524   handles\%id\_heat\_content\_massout = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_massout'},                      \&}
\DoxyCodeLine{1525          diag\%axesT1, time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of net mass leaving ocean ocean via evap and ice form'},\&}
\DoxyCodeLine{1526         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2,                                                      \&}
\DoxyCodeLine{1527         cmor\_field\_name=\textcolor{stringliteral}{'hfevapds'},                                                                                 \&}
\DoxyCodeLine{1528         cmor\_standard\_name=\textcolor{stringliteral}{'temperature\_flux\_due\_to\_evaporation\_expressed\_as\_heat\_flux\_out\_of\_sea\_water'},           \&}
\DoxyCodeLine{1529         cmor\_long\_name=\textcolor{stringliteral}{'Heat Content (relative to 0degC) of Water Leaving Ocean via Evaporation and Ice Formation'})}
\DoxyCodeLine{1530 }
\DoxyCodeLine{1531   handles\%id\_heat\_content\_massin = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_content\_massin'},   \&}
\DoxyCodeLine{1532          diag\%axesT1, time,\textcolor{stringliteral}{'Heat content (relative to 0degC) of net mass entering ocean ocean'},\&}
\DoxyCodeLine{1533         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1534 }
\DoxyCodeLine{1535   handles\%id\_net\_heat\_coupler = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'net\_heat\_coupler'},          \&}
\DoxyCodeLine{1536         diag\%axesT1,time,\textcolor{stringliteral}{'Surface ocean heat flux from SW+LW+latent+sensible+seaice\_melt\_heat (via the coupler)'},\&}
\DoxyCodeLine{1537         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1538 }
\DoxyCodeLine{1539   handles\%id\_net\_heat\_surface = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'net\_heat\_surface'},diag\%axesT1, time,  \&}
\DoxyCodeLine{1540         \textcolor{stringliteral}{'Surface ocean heat flux from SW+LW+lat+sens+mass transfer+frazil+restore+seaice\_melt\_heat or '}// \&}
\DoxyCodeLine{1541         \textcolor{stringliteral}{'flux adjustments'}, \&}
\DoxyCodeLine{1542         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1543         standard\_name=\textcolor{stringliteral}{'surface\_downward\_heat\_flux\_in\_sea\_water'}, cmor\_field\_name=\textcolor{stringliteral}{'hfds'},            \&}
\DoxyCodeLine{1544         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_heat\_flux\_in\_sea\_water'},           \&}
\DoxyCodeLine{1545         cmor\_long\_name=\textcolor{stringliteral}{'Surface ocean heat flux from SW+LW+latent+sensible+masstransfer+frazil+seaice\_melt\_heat'})}
\DoxyCodeLine{1546 }
\DoxyCodeLine{1547   handles\%id\_sw = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'SW'}, diag\%axesT1, time,  \&}
\DoxyCodeLine{1548         \textcolor{stringliteral}{'Shortwave radiation flux into ocean'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2,                        \&}
\DoxyCodeLine{1549         standard\_name=\textcolor{stringliteral}{'net\_downward\_shortwave\_flux\_at\_sea\_water\_surface'},      \&}
\DoxyCodeLine{1550         cmor\_field\_name=\textcolor{stringliteral}{'rsntds'},                                              \&}
\DoxyCodeLine{1551         cmor\_standard\_name=\textcolor{stringliteral}{'net\_downward\_shortwave\_flux\_at\_sea\_water\_surface'}, \&}
\DoxyCodeLine{1552         cmor\_long\_name=\textcolor{stringliteral}{'Net Downward Shortwave Radiation at Sea Water Surface'})}
\DoxyCodeLine{1553   handles\%id\_sw\_vis = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'sw\_vis'}, diag\%axesT1, time,     \&}
\DoxyCodeLine{1554         \textcolor{stringliteral}{'Shortwave radiation direct and diffuse flux into the ocean in the visible band'}, \&}
\DoxyCodeLine{1555         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1556   handles\%id\_sw\_nir = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'sw\_nir'}, diag\%axesT1, time,     \&}
\DoxyCodeLine{1557         \textcolor{stringliteral}{'Shortwave radiation direct and diffuse flux into the ocean in the near-\/infrared band'}, \&}
\DoxyCodeLine{1558         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1559 }
\DoxyCodeLine{1560   handles\%id\_LwLatSens = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'LwLatSens'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1561         \textcolor{stringliteral}{'Combined longwave, latent, and sensible heating at ocean surface'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1562 }
\DoxyCodeLine{1563   handles\%id\_lw = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'LW'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1564         \textcolor{stringliteral}{'Longwave radiation flux into ocean'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1565         standard\_name=\textcolor{stringliteral}{'surface\_net\_downward\_longwave\_flux'},                   \&}
\DoxyCodeLine{1566         cmor\_field\_name=\textcolor{stringliteral}{'rlntds'},                                             \&}
\DoxyCodeLine{1567         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_net\_downward\_longwave\_flux'},              \&}
\DoxyCodeLine{1568         cmor\_long\_name=\textcolor{stringliteral}{'Surface Net Downward Longwave Radiation'})}
\DoxyCodeLine{1569 }
\DoxyCodeLine{1570   handles\%id\_lat = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'latent'}, diag\%axesT1, time,                    \&}
\DoxyCodeLine{1571         \textcolor{stringliteral}{'Latent heat flux into ocean due to fusion and evaporation (negative means ocean heat loss)'}, \&}
\DoxyCodeLine{1572         \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, cmor\_field\_name=\textcolor{stringliteral}{'hflso'},                                \&}
\DoxyCodeLine{1573         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_latent\_heat\_flux'},                                       \&}
\DoxyCodeLine{1574         cmor\_long\_name=\textcolor{stringliteral}{'Surface Downward Latent Heat Flux due to Evap + Melt Snow/Ice'})}
\DoxyCodeLine{1575 }
\DoxyCodeLine{1576   handles\%id\_lat\_evap = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'latent\_evap'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1577         \textcolor{stringliteral}{'Latent heat flux into ocean due to evaporation/condensation'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1578 }
\DoxyCodeLine{1579   handles\%id\_lat\_fprec = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'latent\_fprec\_diag'}, diag\%axesT1, time,\&}
\DoxyCodeLine{1580         \textcolor{stringliteral}{'Latent heat flux into ocean due to melting of frozen precipitation'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1581         cmor\_field\_name=\textcolor{stringliteral}{'hfsnthermds'},                                                             \&}
\DoxyCodeLine{1582         cmor\_standard\_name=\textcolor{stringliteral}{'heat\_flux\_into\_sea\_water\_due\_to\_snow\_thermodynamics'},                  \&}
\DoxyCodeLine{1583         cmor\_long\_name=\textcolor{stringliteral}{'Latent Heat to Melt Frozen Precipitation'})}
\DoxyCodeLine{1584 }
\DoxyCodeLine{1585   handles\%id\_lat\_frunoff = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'latent\_frunoff'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1586         \textcolor{stringliteral}{'Latent heat flux into ocean due to melting of icebergs'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1587         cmor\_field\_name=\textcolor{stringliteral}{'hfibthermds'},                                                             \&}
\DoxyCodeLine{1588         cmor\_standard\_name=\textcolor{stringliteral}{'heat\_flux\_into\_sea\_water\_due\_to\_iceberg\_thermodynamics'},               \&}
\DoxyCodeLine{1589         cmor\_long\_name=\textcolor{stringliteral}{'Latent Heat to Melt Frozen Runoff/Iceberg'})}
\DoxyCodeLine{1590 }
\DoxyCodeLine{1591   handles\%id\_sens = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'sensible'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1592         \textcolor{stringliteral}{'Sensible heat flux into ocean'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2,        \&}
\DoxyCodeLine{1593         standard\_name=\textcolor{stringliteral}{'surface\_downward\_sensible\_heat\_flux'},                         \&}
\DoxyCodeLine{1594         cmor\_field\_name=\textcolor{stringliteral}{'hfsso'},                                                     \&}
\DoxyCodeLine{1595         cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_sensible\_heat\_flux'},                    \&}
\DoxyCodeLine{1596         cmor\_long\_name=\textcolor{stringliteral}{'Surface Downward Sensible Heat Flux'})}
\DoxyCodeLine{1597 }
\DoxyCodeLine{1598   handles\%id\_seaice\_melt\_heat = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'seaice\_melt\_heat'}, diag\%axesT1, time,\&}
\DoxyCodeLine{1599         \textcolor{stringliteral}{'Heat flux into ocean due to snow and sea ice melt/freeze'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2, \&}
\DoxyCodeLine{1600         standard\_name=\textcolor{stringliteral}{'snow\_ice\_melt\_heat\_flux'},                         \&}
\DoxyCodeLine{1601   \textcolor{comment}{!GMM TODO cmor\_field\_name='hfsso',                                                     \&}}
\DoxyCodeLine{1602         cmor\_standard\_name=\textcolor{stringliteral}{'snow\_ice\_melt\_heat\_flux'},                    \&}
\DoxyCodeLine{1603         cmor\_long\_name=\textcolor{stringliteral}{'Heat flux into ocean from snow and sea ice melt'})}
\DoxyCodeLine{1604 }
\DoxyCodeLine{1605   handles\%id\_heat\_added = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'heat\_added'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1606         \textcolor{stringliteral}{'Flux Adjustment or restoring surface heat flux into ocean'}, \textcolor{stringliteral}{'W m-\/2'}, conversion=us\%QRZ\_T\_to\_W\_m2)}
\DoxyCodeLine{1607 }
\DoxyCodeLine{1608 }
\DoxyCodeLine{1609   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1610   \textcolor{comment}{! area integrated surface heat fluxes}}
\DoxyCodeLine{1611 }
\DoxyCodeLine{1612   handles\%id\_total\_heat\_content\_frunoff = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                     \&}
\DoxyCodeLine{1613       \textcolor{stringliteral}{'total\_heat\_content\_frunoff'}, time, diag,                                                    \&}
\DoxyCodeLine{1614       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of solid runoff'},                   \&}
\DoxyCodeLine{1615       units=\textcolor{stringliteral}{'W'}, cmor\_field\_name=\textcolor{stringliteral}{'total\_hfsolidrunoffds'},                                          \&}
\DoxyCodeLine{1616       cmor\_standard\_name=                                                                          \&}
\DoxyCodeLine{1617       \textcolor{stringliteral}{'temperature\_flux\_due\_to\_solid\_runoff\_expressed\_as\_heat\_flux\_into\_sea\_water\_area\_integrated'},\&}
\DoxyCodeLine{1618       cmor\_long\_name=                                                                              \&}
\DoxyCodeLine{1619       \textcolor{stringliteral}{'Temperature Flux due to Solid Runoff Expressed as Heat Flux into Sea Water Area Integrated'})}
\DoxyCodeLine{1620 }
\DoxyCodeLine{1621   handles\%id\_total\_heat\_content\_lrunoff = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},               \&}
\DoxyCodeLine{1622       \textcolor{stringliteral}{'total\_heat\_content\_lrunoff'}, time, diag,                                              \&}
\DoxyCodeLine{1623       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of liquid runoff'},            \&}
\DoxyCodeLine{1624       units=\textcolor{stringliteral}{'W'}, cmor\_field\_name=\textcolor{stringliteral}{'total\_hfrunoffds'},                                         \&}
\DoxyCodeLine{1625       cmor\_standard\_name=                                                                    \&}
\DoxyCodeLine{1626       \textcolor{stringliteral}{'temperature\_flux\_due\_to\_runoff\_expressed\_as\_heat\_flux\_into\_sea\_water\_area\_integrated'},\&}
\DoxyCodeLine{1627       cmor\_long\_name=                                                                        \&}
\DoxyCodeLine{1628       \textcolor{stringliteral}{'Temperature Flux due to Runoff Expressed as Heat Flux into Sea Water Area Integrated'})}
\DoxyCodeLine{1629 }
\DoxyCodeLine{1630   handles\%id\_total\_heat\_content\_lprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                   \&}
\DoxyCodeLine{1631       \textcolor{stringliteral}{'total\_heat\_content\_lprec'}, time, diag,                                                  \&}
\DoxyCodeLine{1632       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of liquid precip'},              \&}
\DoxyCodeLine{1633       units=\textcolor{stringliteral}{'W'}, cmor\_field\_name=\textcolor{stringliteral}{'total\_hfrainds'},                                             \&}
\DoxyCodeLine{1634       cmor\_standard\_name=                                                                      \&}
\DoxyCodeLine{1635       \textcolor{stringliteral}{'temperature\_flux\_due\_to\_rainfall\_expressed\_as\_heat\_flux\_into\_sea\_water\_area\_integrated'},\&}
\DoxyCodeLine{1636       cmor\_long\_name=                                                                          \&}
\DoxyCodeLine{1637       \textcolor{stringliteral}{'Temperature Flux due to Rainfall Expressed as Heat Flux into Sea Water Area Integrated'})}
\DoxyCodeLine{1638 }
\DoxyCodeLine{1639   handles\%id\_total\_heat\_content\_fprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},     \&}
\DoxyCodeLine{1640       \textcolor{stringliteral}{'total\_heat\_content\_fprec'}, time, diag,                                    \&}
\DoxyCodeLine{1641       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of frozen precip'},\&}
\DoxyCodeLine{1642       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1643 }
\DoxyCodeLine{1644   handles\%id\_total\_heat\_content\_icemelt = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},     \&}
\DoxyCodeLine{1645       \textcolor{stringliteral}{'total\_heat\_content\_icemelt'}, time, diag,long\_name=                          \&}
\DoxyCodeLine{1646       \textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of water flux due sea ice melting/freezing'}, \&}
\DoxyCodeLine{1647       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1648 }
\DoxyCodeLine{1649   handles\%id\_total\_heat\_content\_vprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},      \&}
\DoxyCodeLine{1650       \textcolor{stringliteral}{'total\_heat\_content\_vprec'}, time, diag,                                     \&}
\DoxyCodeLine{1651       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of virtual precip'},\&}
\DoxyCodeLine{1652       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1653 }
\DoxyCodeLine{1654   handles\%id\_total\_heat\_content\_cond = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},   \&}
\DoxyCodeLine{1655       \textcolor{stringliteral}{'total\_heat\_content\_cond'}, time, diag,                                  \&}
\DoxyCodeLine{1656       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of condensate'},\&}
\DoxyCodeLine{1657       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1658 }
\DoxyCodeLine{1659   handles\%id\_total\_heat\_content\_surfwater = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},          \&}
\DoxyCodeLine{1660       \textcolor{stringliteral}{'total\_heat\_content\_surfwater'}, time, diag,                                         \&}
\DoxyCodeLine{1661       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of water crossing surface'},\&}
\DoxyCodeLine{1662       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1663 }
\DoxyCodeLine{1664   handles\%id\_total\_heat\_content\_massout = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                      \&}
\DoxyCodeLine{1665       \textcolor{stringliteral}{'total\_heat\_content\_massout'}, time, diag,                                                     \&}
\DoxyCodeLine{1666       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of water leaving ocean'},             \&}
\DoxyCodeLine{1667       units=\textcolor{stringliteral}{'W'},                                                                                    \&}
\DoxyCodeLine{1668       cmor\_field\_name=\textcolor{stringliteral}{'total\_hfevapds'},                                                             \&}
\DoxyCodeLine{1669       cmor\_standard\_name=                                                                           \&}
\DoxyCodeLine{1670       \textcolor{stringliteral}{'temperature\_flux\_due\_to\_evaporation\_expressed\_as\_heat\_flux\_out\_of\_sea\_water\_area\_integrated'},\&}
\DoxyCodeLine{1671       cmor\_long\_name=\textcolor{stringliteral}{'Heat Flux Out of Sea Water due to Evaporating Water Area Integrated'})}
\DoxyCodeLine{1672 }
\DoxyCodeLine{1673   handles\%id\_total\_heat\_content\_massin = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},           \&}
\DoxyCodeLine{1674       \textcolor{stringliteral}{'total\_heat\_content\_massin'}, time, diag,                                          \&}
\DoxyCodeLine{1675       long\_name=\textcolor{stringliteral}{'Area integrated heat content (relative to 0C) of water entering ocean'},\&}
\DoxyCodeLine{1676       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1677 }
\DoxyCodeLine{1678   handles\%id\_total\_net\_heat\_coupler = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                       \&}
\DoxyCodeLine{1679       \textcolor{stringliteral}{'total\_net\_heat\_coupler'}, time, diag,                                                      \&}
\DoxyCodeLine{1680       long\_name=\textcolor{stringliteral}{'Area integrated surface heat flux from SW+LW+latent+sensible+seaice\_melt\_heat (via the coupler)'},\&}
\DoxyCodeLine{1681       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1682 }
\DoxyCodeLine{1683   handles\%id\_total\_net\_heat\_surface = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                      \&}
\DoxyCodeLine{1684       \textcolor{stringliteral}{'total\_net\_heat\_surface'}, time, diag,                                                     \&}
\DoxyCodeLine{1685       long\_name=\textcolor{stringliteral}{'Area integrated surface heat flux from SW+LW+lat+sens+mass+frazil+restore or flux adjustments'}, \&}
\DoxyCodeLine{1686       units=\textcolor{stringliteral}{'W'},                                                                                \&}
\DoxyCodeLine{1687       cmor\_field\_name=\textcolor{stringliteral}{'total\_hfds'},                                                             \&}
\DoxyCodeLine{1688       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_heat\_flux\_in\_sea\_water\_area\_integrated'},             \&}
\DoxyCodeLine{1689       cmor\_long\_name=                                                                           \&}
\DoxyCodeLine{1690       \textcolor{stringliteral}{'Surface Ocean Heat Flux from SW+LW+latent+sensible+mass transfer+frazil Area Integrated'})}
\DoxyCodeLine{1691 }
\DoxyCodeLine{1692   handles\%id\_total\_sw = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                                \&}
\DoxyCodeLine{1693       \textcolor{stringliteral}{'total\_sw'}, time, diag,                                                               \&}
\DoxyCodeLine{1694       long\_name=\textcolor{stringliteral}{'Area integrated net downward shortwave at sea water surface'},              \&}
\DoxyCodeLine{1695       units=\textcolor{stringliteral}{'W'},                                                                            \&}
\DoxyCodeLine{1696       cmor\_field\_name=\textcolor{stringliteral}{'total\_rsntds'},                                                       \&}
\DoxyCodeLine{1697       cmor\_standard\_name=\textcolor{stringliteral}{'net\_downward\_shortwave\_flux\_at\_sea\_water\_surface\_area\_integrated'},\&}
\DoxyCodeLine{1698       cmor\_long\_name=                                                                       \&}
\DoxyCodeLine{1699       \textcolor{stringliteral}{'Net Downward Shortwave Radiation at Sea Water Surface Area Integrated'})}
\DoxyCodeLine{1700 }
\DoxyCodeLine{1701   handles\%id\_total\_LwLatSens = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},\&}
\DoxyCodeLine{1702       \textcolor{stringliteral}{'total\_LwLatSens'}, time, diag,                               \&}
\DoxyCodeLine{1703       long\_name=\textcolor{stringliteral}{'Area integrated longwave+latent+sensible heating'},\&}
\DoxyCodeLine{1704       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1705 }
\DoxyCodeLine{1706   handles\%id\_total\_lw = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                  \&}
\DoxyCodeLine{1707       \textcolor{stringliteral}{'total\_lw'}, time, diag,                                                 \&}
\DoxyCodeLine{1708       long\_name=\textcolor{stringliteral}{'Area integrated net downward longwave at sea water surface'}, \&}
\DoxyCodeLine{1709       units=\textcolor{stringliteral}{'W'},                                                              \&}
\DoxyCodeLine{1710       cmor\_field\_name=\textcolor{stringliteral}{'total\_rlntds'},                                         \&}
\DoxyCodeLine{1711       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_net\_downward\_longwave\_flux\_area\_integrated'},\&}
\DoxyCodeLine{1712       cmor\_long\_name=                                                         \&}
\DoxyCodeLine{1713       \textcolor{stringliteral}{'Surface Net Downward Longwave Radiation Area Integrated'})}
\DoxyCodeLine{1714 }
\DoxyCodeLine{1715   handles\%id\_total\_lat = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                \&}
\DoxyCodeLine{1716       \textcolor{stringliteral}{'total\_lat'}, time, diag,                                               \&}
\DoxyCodeLine{1717       long\_name=\textcolor{stringliteral}{'Area integrated surface downward latent heat flux'},         \&}
\DoxyCodeLine{1718       units=\textcolor{stringliteral}{'W'},                                                             \&}
\DoxyCodeLine{1719       cmor\_field\_name=\textcolor{stringliteral}{'total\_hflso'},                                         \&}
\DoxyCodeLine{1720       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_latent\_heat\_flux\_area\_integrated'},\&}
\DoxyCodeLine{1721       cmor\_long\_name=                                                        \&}
\DoxyCodeLine{1722       \textcolor{stringliteral}{'Surface Downward Latent Heat Flux Area Integrated'})}
\DoxyCodeLine{1723 }
\DoxyCodeLine{1724   handles\%id\_total\_lat\_evap = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},      \&}
\DoxyCodeLine{1725       \textcolor{stringliteral}{'total\_lat\_evap'}, time, diag,                                     \&}
\DoxyCodeLine{1726       long\_name=\textcolor{stringliteral}{'Area integrated latent heat flux due to evap/condense'},\&}
\DoxyCodeLine{1727       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1728 }
\DoxyCodeLine{1729   handles\%id\_total\_lat\_fprec = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                            \&}
\DoxyCodeLine{1730       \textcolor{stringliteral}{'total\_lat\_fprec'}, time, diag,                                                           \&}
\DoxyCodeLine{1731       long\_name=\textcolor{stringliteral}{'Area integrated latent heat flux due to melting frozen precip'},               \&}
\DoxyCodeLine{1732       units=\textcolor{stringliteral}{'W'},                                                                               \&}
\DoxyCodeLine{1733       cmor\_field\_name=\textcolor{stringliteral}{'total\_hfsnthermds'},                                                     \&}
\DoxyCodeLine{1734       cmor\_standard\_name=\textcolor{stringliteral}{'heat\_flux\_into\_sea\_water\_due\_to\_snow\_thermodynamics\_area\_integrated'},\&}
\DoxyCodeLine{1735       cmor\_long\_name=                                                                          \&}
\DoxyCodeLine{1736       \textcolor{stringliteral}{'Latent Heat to Melt Frozen Precipitation Area Integrated'})}
\DoxyCodeLine{1737 }
\DoxyCodeLine{1738   handles\%id\_total\_lat\_frunoff = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                             \&}
\DoxyCodeLine{1739       \textcolor{stringliteral}{'total\_lat\_frunoff'}, time, diag,                                                            \&}
\DoxyCodeLine{1740       long\_name=\textcolor{stringliteral}{'Area integrated latent heat flux due to melting icebergs'},                       \&}
\DoxyCodeLine{1741       units=\textcolor{stringliteral}{'W'},                                                                                  \&}
\DoxyCodeLine{1742       cmor\_field\_name=\textcolor{stringliteral}{'total\_hfibthermds'},                                                        \&}
\DoxyCodeLine{1743       cmor\_standard\_name=\textcolor{stringliteral}{'heat\_flux\_into\_sea\_water\_due\_to\_iceberg\_thermodynamics\_area\_integrated'},\&}
\DoxyCodeLine{1744       cmor\_long\_name=                                                                             \&}
\DoxyCodeLine{1745       \textcolor{stringliteral}{'Heat Flux into Sea Water due to Iceberg Thermodynamics Area Integrated'})}
\DoxyCodeLine{1746 }
\DoxyCodeLine{1747   handles\%id\_total\_sens = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                 \&}
\DoxyCodeLine{1748       \textcolor{stringliteral}{'total\_sens'}, time, diag,                                                \&}
\DoxyCodeLine{1749       long\_name=\textcolor{stringliteral}{'Area integrated downward sensible heat flux'},                 \&}
\DoxyCodeLine{1750       units=\textcolor{stringliteral}{'W'},                                                               \&}
\DoxyCodeLine{1751       cmor\_field\_name=\textcolor{stringliteral}{'total\_hfsso'},                                           \&}
\DoxyCodeLine{1752       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_sensible\_heat\_flux\_area\_integrated'},\&}
\DoxyCodeLine{1753       cmor\_long\_name=                                                          \&}
\DoxyCodeLine{1754       \textcolor{stringliteral}{'Surface Downward Sensible Heat Flux Area Integrated'})}
\DoxyCodeLine{1755 }
\DoxyCodeLine{1756   handles\%id\_total\_heat\_added = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},\&}
\DoxyCodeLine{1757       \textcolor{stringliteral}{'total\_heat\_adjustment'}, time, diag,                               \&}
\DoxyCodeLine{1758       long\_name=\textcolor{stringliteral}{'Area integrated surface heat flux from restoring and/or flux adjustment'},   \&}
\DoxyCodeLine{1759       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1760 }
\DoxyCodeLine{1761   handles\%id\_total\_seaice\_melt\_heat = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},\&}
\DoxyCodeLine{1762       \textcolor{stringliteral}{'total\_seaice\_melt\_heat'}, time, diag,                               \&}
\DoxyCodeLine{1763       long\_name=\textcolor{stringliteral}{'Area integrated surface heat flux from snow and sea ice melt'},   \&}
\DoxyCodeLine{1764       units=\textcolor{stringliteral}{'W'})}
\DoxyCodeLine{1765 }
\DoxyCodeLine{1766   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1767   \textcolor{comment}{! area averaged surface heat fluxes}}
\DoxyCodeLine{1768 }
\DoxyCodeLine{1769   handles\%id\_net\_heat\_coupler\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                       \&}
\DoxyCodeLine{1770       \textcolor{stringliteral}{'net\_heat\_coupler\_ga'}, time, diag,                                                      \&}
\DoxyCodeLine{1771       long\_name=\textcolor{stringliteral}{'Area averaged surface heat flux from SW+LW+latent+sensible+seaice\_melt\_heat (via the coupler)'},\&}
\DoxyCodeLine{1772       units=\textcolor{stringliteral}{'W m-\/2'})}
\DoxyCodeLine{1773 }
\DoxyCodeLine{1774   handles\%id\_net\_heat\_surface\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                       \&}
\DoxyCodeLine{1775       \textcolor{stringliteral}{'net\_heat\_surface\_ga'}, time, diag, long\_name=                                                     \&}
\DoxyCodeLine{1776       \textcolor{stringliteral}{'Area averaged surface heat flux from SW+LW+lat+sens+mass+frazil+restore+seaice\_melt\_heat or flux adjustments'}, \&}
\DoxyCodeLine{1777       units=\textcolor{stringliteral}{'W m-\/2'},                                                                          \&}
\DoxyCodeLine{1778       cmor\_field\_name=\textcolor{stringliteral}{'ave\_hfds'},                                                             \&}
\DoxyCodeLine{1779       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_heat\_flux\_in\_sea\_water\_area\_averaged'},             \&}
\DoxyCodeLine{1780       cmor\_long\_name=                                                                         \&}
\DoxyCodeLine{1781       \textcolor{stringliteral}{'Surface Ocean Heat Flux from SW+LW+latent+sensible+mass transfer+frazil Area Averaged'})}
\DoxyCodeLine{1782 }
\DoxyCodeLine{1783   handles\%id\_sw\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                                 \&}
\DoxyCodeLine{1784       \textcolor{stringliteral}{'sw\_ga'}, time, diag,                                                                \&}
\DoxyCodeLine{1785       long\_name=\textcolor{stringliteral}{'Area averaged net downward shortwave at sea water surface'},              \&}
\DoxyCodeLine{1786       units=\textcolor{stringliteral}{'W m-\/2'},                                                                      \&}
\DoxyCodeLine{1787       cmor\_field\_name=\textcolor{stringliteral}{'ave\_rsntds'},                                                       \&}
\DoxyCodeLine{1788       cmor\_standard\_name=\textcolor{stringliteral}{'net\_downward\_shortwave\_flux\_at\_sea\_water\_surface\_area\_averaged'},\&}
\DoxyCodeLine{1789       cmor\_long\_name=                                                                     \&}
\DoxyCodeLine{1790       \textcolor{stringliteral}{'Net Downward Shortwave Radiation at Sea Water Surface Area Averaged'})}
\DoxyCodeLine{1791 }
\DoxyCodeLine{1792   handles\%id\_LwLatSens\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},\&}
\DoxyCodeLine{1793       \textcolor{stringliteral}{'LwLatSens\_ga'}, time, diag,                               \&}
\DoxyCodeLine{1794       long\_name=\textcolor{stringliteral}{'Area averaged longwave+latent+sensible heating'},\&}
\DoxyCodeLine{1795       units=\textcolor{stringliteral}{'W m-\/2'})}
\DoxyCodeLine{1796 }
\DoxyCodeLine{1797   handles\%id\_lw\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                   \&}
\DoxyCodeLine{1798       \textcolor{stringliteral}{'lw\_ga'}, time, diag,                                                  \&}
\DoxyCodeLine{1799       long\_name=\textcolor{stringliteral}{'Area averaged net downward longwave at sea water surface'}, \&}
\DoxyCodeLine{1800       units=\textcolor{stringliteral}{'W m-\/2'},                                                        \&}
\DoxyCodeLine{1801       cmor\_field\_name=\textcolor{stringliteral}{'ave\_rlntds'},                                         \&}
\DoxyCodeLine{1802       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_net\_downward\_longwave\_flux\_area\_averaged'},\&}
\DoxyCodeLine{1803       cmor\_long\_name=                                                       \&}
\DoxyCodeLine{1804       \textcolor{stringliteral}{'Surface Net Downward Longwave Radiation Area Averaged'})}
\DoxyCodeLine{1805 }
\DoxyCodeLine{1806   handles\%id\_lat\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                 \&}
\DoxyCodeLine{1807       \textcolor{stringliteral}{'lat\_ga'}, time, diag,                                                \&}
\DoxyCodeLine{1808       long\_name=\textcolor{stringliteral}{'Area averaged surface downward latent heat flux'},         \&}
\DoxyCodeLine{1809       units=\textcolor{stringliteral}{'W m-\/2'},                                                       \&}
\DoxyCodeLine{1810       cmor\_field\_name=\textcolor{stringliteral}{'ave\_hflso'},                                         \&}
\DoxyCodeLine{1811       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_latent\_heat\_flux\_area\_averaged'},\&}
\DoxyCodeLine{1812       cmor\_long\_name=                                                      \&}
\DoxyCodeLine{1813       \textcolor{stringliteral}{'Surface Downward Latent Heat Flux Area Averaged'})}
\DoxyCodeLine{1814 }
\DoxyCodeLine{1815   handles\%id\_sens\_ga = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},                  \&}
\DoxyCodeLine{1816       \textcolor{stringliteral}{'sens\_ga'}, time, diag,                                                 \&}
\DoxyCodeLine{1817       long\_name=\textcolor{stringliteral}{'Area averaged downward sensible heat flux'},                 \&}
\DoxyCodeLine{1818       units=\textcolor{stringliteral}{'W m-\/2'},                                                         \&}
\DoxyCodeLine{1819       cmor\_field\_name=\textcolor{stringliteral}{'ave\_hfsso'},                                           \&}
\DoxyCodeLine{1820       cmor\_standard\_name=\textcolor{stringliteral}{'surface\_downward\_sensible\_heat\_flux\_area\_averaged'},\&}
\DoxyCodeLine{1821       cmor\_long\_name=                                                        \&}
\DoxyCodeLine{1822       \textcolor{stringliteral}{'Surface Downward Sensible Heat Flux Area Averaged'})}
\DoxyCodeLine{1823 }
\DoxyCodeLine{1824 }
\DoxyCodeLine{1825   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1826   \textcolor{comment}{! maps of surface salt fluxes, virtual precip fluxes, and adjustments}}
\DoxyCodeLine{1827 }
\DoxyCodeLine{1828   handles\%id\_saltflux = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'salt\_flux'}, diag\%axesT1, time,\&}
\DoxyCodeLine{1829         \textcolor{stringliteral}{'Net salt flux into ocean at surface (restoring + sea-\/ice)'},                      \&}
\DoxyCodeLine{1830         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s, \&}
\DoxyCodeLine{1831         cmor\_field\_name=\textcolor{stringliteral}{'sfdsi'}, cmor\_standard\_name=\textcolor{stringliteral}{'downward\_sea\_ice\_basal\_salt\_flux'}, \&}
\DoxyCodeLine{1832         cmor\_long\_name=\textcolor{stringliteral}{'Downward Sea Ice Basal Salt Flux'})}
\DoxyCodeLine{1833 }
\DoxyCodeLine{1834   handles\%id\_saltFluxIn = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'salt\_flux\_in'}, diag\%axesT1, time, \&}
\DoxyCodeLine{1835         \textcolor{stringliteral}{'Salt flux into ocean at surface from coupler'}, \&}
\DoxyCodeLine{1836         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1837 }
\DoxyCodeLine{1838   handles\%id\_saltFluxAdded = register\_diag\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'salt\_flux\_added'}, \&}
\DoxyCodeLine{1839         diag\%axesT1,time,\textcolor{stringliteral}{'Salt flux into ocean at surface due to restoring or flux adjustment'}, \&}
\DoxyCodeLine{1840         units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}, conversion=us\%RZ\_T\_to\_kg\_m2s)}
\DoxyCodeLine{1841 }
\DoxyCodeLine{1842   handles\%id\_saltFluxGlobalAdj = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},              \&}
\DoxyCodeLine{1843         \textcolor{stringliteral}{'salt\_flux\_global\_restoring\_adjustment'}, time, diag,                       \&}
\DoxyCodeLine{1844         \textcolor{stringliteral}{'Adjustment needed to balance net global salt flux into ocean at surface'}, \&}
\DoxyCodeLine{1845          units=\textcolor{stringliteral}{'kg m-\/2 s-\/1'}) \textcolor{comment}{!, conversion=US\%RZ\_T\_to\_kg\_m2s)}}
\DoxyCodeLine{1846 }
\DoxyCodeLine{1847   handles\%id\_vPrecGlobalAdj = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},  \&}
\DoxyCodeLine{1848         \textcolor{stringliteral}{'vprec\_global\_adjustment'}, time, diag,                      \&}
\DoxyCodeLine{1849         \textcolor{stringliteral}{'Adjustment needed to adjust net vprec into ocean to zero'}, \&}
\DoxyCodeLine{1850         \textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1851 }
\DoxyCodeLine{1852   handles\%id\_netFWGlobalAdj = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},       \&}
\DoxyCodeLine{1853         \textcolor{stringliteral}{'net\_fresh\_water\_global\_adjustment'}, time, diag,                 \&}
\DoxyCodeLine{1854         \textcolor{stringliteral}{'Adjustment needed to adjust net fresh water into ocean to zero'},\&}
\DoxyCodeLine{1855         \textcolor{stringliteral}{'kg m-\/2 s-\/1'})}
\DoxyCodeLine{1856 }
\DoxyCodeLine{1857   handles\%id\_saltFluxGlobalScl = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},            \&}
\DoxyCodeLine{1858         \textcolor{stringliteral}{'salt\_flux\_global\_restoring\_scaling'}, time, diag,                        \&}
\DoxyCodeLine{1859         \textcolor{stringliteral}{'Scaling applied to balance net global salt flux into ocean at surface'}, \&}
\DoxyCodeLine{1860         \textcolor{stringliteral}{'nondim'})}
\DoxyCodeLine{1861 }
\DoxyCodeLine{1862   handles\%id\_vPrecGlobalScl = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},\&}
\DoxyCodeLine{1863         \textcolor{stringliteral}{'vprec\_global\_scaling'}, time, diag,                       \&}
\DoxyCodeLine{1864         \textcolor{stringliteral}{'Scaling applied to adjust net vprec into ocean to zero'}, \&}
\DoxyCodeLine{1865         \textcolor{stringliteral}{'nondim'})}
\DoxyCodeLine{1866 }
\DoxyCodeLine{1867   handles\%id\_netFWGlobalScl = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},      \&}
\DoxyCodeLine{1868         \textcolor{stringliteral}{'net\_fresh\_water\_global\_scaling'}, time, diag,                   \&}
\DoxyCodeLine{1869         \textcolor{stringliteral}{'Scaling applied to adjust net fresh water into ocean to zero'}, \&}
\DoxyCodeLine{1870         \textcolor{stringliteral}{'nondim'})}
\DoxyCodeLine{1871 }
\DoxyCodeLine{1872   \textcolor{comment}{!===============================================================}}
\DoxyCodeLine{1873   \textcolor{comment}{! area integrals of surface salt fluxes}}
\DoxyCodeLine{1874 }
\DoxyCodeLine{1875   handles\%id\_total\_saltflux = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'},          \&}
\DoxyCodeLine{1876       \textcolor{stringliteral}{'total\_salt\_flux'}, time, diag,                                        \&}
\DoxyCodeLine{1877       long\_name=\textcolor{stringliteral}{'Area integrated surface salt flux'}, units=\textcolor{stringliteral}{'kg'},            \&}
\DoxyCodeLine{1878       cmor\_field\_name=\textcolor{stringliteral}{'total\_sfdsi'},                                        \&}
\DoxyCodeLine{1879       cmor\_units=\textcolor{stringliteral}{'kg s-\/1'},                                                  \&}
\DoxyCodeLine{1880       cmor\_standard\_name=\textcolor{stringliteral}{'downward\_sea\_ice\_basal\_salt\_flux\_area\_integrated'},\&}
\DoxyCodeLine{1881       cmor\_long\_name=\textcolor{stringliteral}{'Downward Sea Ice Basal Salt Flux Area Integrated'})}
\DoxyCodeLine{1882 }
\DoxyCodeLine{1883   handles\%id\_total\_saltFluxIn = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_salt\_Flux\_In'}, \&}
\DoxyCodeLine{1884       time, diag, long\_name=\textcolor{stringliteral}{'Area integrated surface salt flux at surface from coupler'}, units=\textcolor{stringliteral}{'kg'})}
\DoxyCodeLine{1885 }
\DoxyCodeLine{1886   handles\%id\_total\_saltFluxAdded = register\_scalar\_field(\textcolor{stringliteral}{'ocean\_model'}, \textcolor{stringliteral}{'total\_salt\_Flux\_Added'}, \&}
\DoxyCodeLine{1887       time, diag, long\_name=\textcolor{stringliteral}{'Area integrated surface salt flux due to restoring or flux adjustment'}, units=\textcolor{stringliteral}{'kg'})}
\DoxyCodeLine{1888 }
\DoxyCodeLine{1889 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a904033b8a97fed683d795460b555ce9b}\label{namespacemom__forcing__type_a904033b8a97fed683d795460b555ce9b}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!rotate\_forcing@{rotate\_forcing}}
\index{rotate\_forcing@{rotate\_forcing}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{rotate\_forcing()}{rotate\_forcing()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::rotate\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes\+\_\+in,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{integer, intent(in)}]{turns }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes\+\_\+in} & Input forcing struct\\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & Rotated forcing struct\\
\hline
\mbox{\texttt{ in}}  & {\em turns} & Number of quarter turns \\
\hline
\end{DoxyParams}


Definition at line 3187 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3187   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(in)}  :: fluxes\_in\textcolor{comment}{     !< Input forcing struct}}
\DoxyCodeLine{3188   \textcolor{keywordtype}{type}(forcing), \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{      !< Rotated forcing struct}}
\DoxyCodeLine{3189   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: turns\textcolor{comment}{                !< Number of quarter turns}}
\DoxyCodeLine{3190 }
\DoxyCodeLine{3191   \textcolor{keywordtype}{logical} :: do\_ustar, do\_water, do\_heat, do\_salt, do\_press, do\_shelf, \&}
\DoxyCodeLine{3192       do\_iceberg, do\_heat\_added, do\_buoy}
\DoxyCodeLine{3193 }
\DoxyCodeLine{3194   \textcolor{keyword}{call }get\_forcing\_groups(fluxes\_in, do\_water, do\_heat, do\_ustar, do\_press, \&}
\DoxyCodeLine{3195       do\_shelf, do\_iceberg, do\_salt, do\_heat\_added, do\_buoy)}
\DoxyCodeLine{3196 }
\DoxyCodeLine{3197   \textcolor{keywordflow}{if} (do\_ustar) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3198     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%ustar, turns, fluxes\%ustar)}
\DoxyCodeLine{3199     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%ustar\_gustless, turns, fluxes\%ustar\_gustless)}
\DoxyCodeLine{3200 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3201 }
\DoxyCodeLine{3202   \textcolor{keywordflow}{if} (do\_water) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3203     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%evap, turns, fluxes\%evap)}
\DoxyCodeLine{3204     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%lprec, turns, fluxes\%lprec)}
\DoxyCodeLine{3205     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%fprec, turns, fluxes\%fprec)}
\DoxyCodeLine{3206     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%vprec, turns, fluxes\%vprec)}
\DoxyCodeLine{3207     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%lrunoff, turns, fluxes\%lrunoff)}
\DoxyCodeLine{3208     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%frunoff, turns, fluxes\%frunoff)}
\DoxyCodeLine{3209     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%seaice\_melt, turns, fluxes\%seaice\_melt)}
\DoxyCodeLine{3210     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%netMassOut, turns, fluxes\%netMassOut)}
\DoxyCodeLine{3211     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%netMassIn, turns, fluxes\%netMassIn)}
\DoxyCodeLine{3212     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%netSalt, turns, fluxes\%netSalt)}
\DoxyCodeLine{3213 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3214 }
\DoxyCodeLine{3215   \textcolor{keywordflow}{if} (do\_heat) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3216     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%seaice\_melt\_heat, turns, fluxes\%seaice\_melt\_heat)}
\DoxyCodeLine{3217     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sw, turns, fluxes\%sw)}
\DoxyCodeLine{3218     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%lw, turns, fluxes\%lw)}
\DoxyCodeLine{3219     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%latent, turns, fluxes\%latent)}
\DoxyCodeLine{3220     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sens, turns, fluxes\%sens)}
\DoxyCodeLine{3221     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%latent\_evap\_diag, turns, fluxes\%latent\_evap\_diag)}
\DoxyCodeLine{3222     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%latent\_fprec\_diag, turns, fluxes\%latent\_fprec\_diag)}
\DoxyCodeLine{3223     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%latent\_frunoff\_diag, turns, fluxes\%latent\_frunoff\_diag)}
\DoxyCodeLine{3224 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3225 }
\DoxyCodeLine{3226   \textcolor{keywordflow}{if} (do\_salt) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3227     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%salt\_flux, turns, fluxes\%salt\_flux)}
\DoxyCodeLine{3228 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3229 }
\DoxyCodeLine{3230   \textcolor{keywordflow}{if} (do\_heat .and. do\_water) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3231     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_cond, turns, fluxes\%heat\_content\_cond)}
\DoxyCodeLine{3232     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_icemelt, turns, fluxes\%heat\_content\_icemelt)}
\DoxyCodeLine{3233     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_lprec, turns, fluxes\%heat\_content\_lprec)}
\DoxyCodeLine{3234     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_fprec, turns, fluxes\%heat\_content\_fprec)}
\DoxyCodeLine{3235     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_vprec, turns, fluxes\%heat\_content\_vprec)}
\DoxyCodeLine{3236     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_lrunoff, turns, fluxes\%heat\_content\_lrunoff)}
\DoxyCodeLine{3237     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_frunoff, turns, fluxes\%heat\_content\_frunoff)}
\DoxyCodeLine{3238     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_massout, turns, fluxes\%heat\_content\_massout)}
\DoxyCodeLine{3239     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_content\_massin, turns, fluxes\%heat\_content\_massin)}
\DoxyCodeLine{3240 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3241 }
\DoxyCodeLine{3242   \textcolor{keywordflow}{if} (do\_press) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3243     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%p\_surf, turns, fluxes\%p\_surf)}
\DoxyCodeLine{3244 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3245 }
\DoxyCodeLine{3246   \textcolor{keywordflow}{if} (do\_shelf) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3247     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%frac\_shelf\_h, turns, fluxes\%frac\_shelf\_h)}
\DoxyCodeLine{3248     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%ustar\_shelf, turns, fluxes\%ustar\_shelf)}
\DoxyCodeLine{3249     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%iceshelf\_melt, turns, fluxes\%iceshelf\_melt)}
\DoxyCodeLine{3250 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3251 }
\DoxyCodeLine{3252   \textcolor{keywordflow}{if} (do\_iceberg) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3253     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%ustar\_berg, turns, fluxes\%ustar\_berg)}
\DoxyCodeLine{3254     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%area\_berg, turns, fluxes\%area\_berg)}
\DoxyCodeLine{3255     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%iceshelf\_melt, turns, fluxes\%iceshelf\_melt)}
\DoxyCodeLine{3256 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3257 }
\DoxyCodeLine{3258   \textcolor{keywordflow}{if} (do\_heat\_added) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3259     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%heat\_added, turns, fluxes\%heat\_added)}
\DoxyCodeLine{3260 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3261 }
\DoxyCodeLine{3262   \textcolor{comment}{! The following fields are handled by drivers rather than control flags.}}
\DoxyCodeLine{3263   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%sw\_vis\_dir)) \&}
\DoxyCodeLine{3264     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sw\_vis\_dir, turns, fluxes\%sw\_vis\_dir)}
\DoxyCodeLine{3265   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%sw\_vis\_dif)) \&}
\DoxyCodeLine{3266     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sw\_vis\_dif, turns, fluxes\%sw\_vis\_dif)}
\DoxyCodeLine{3267   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%sw\_nir\_dir)) \&}
\DoxyCodeLine{3268     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sw\_nir\_dir, turns, fluxes\%sw\_nir\_dir)}
\DoxyCodeLine{3269   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%sw\_nir\_dif)) \&}
\DoxyCodeLine{3270     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%sw\_nir\_dif, turns, fluxes\%sw\_nir\_dif)}
\DoxyCodeLine{3271 }
\DoxyCodeLine{3272   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%salt\_flux\_in)) \&}
\DoxyCodeLine{3273     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%salt\_flux\_in, turns, fluxes\%salt\_flux\_in)}
\DoxyCodeLine{3274   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%salt\_flux\_added)) \&}
\DoxyCodeLine{3275     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%salt\_flux\_added, turns, fluxes\%salt\_flux\_added)}
\DoxyCodeLine{3276 }
\DoxyCodeLine{3277   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%p\_surf\_full)) \&}
\DoxyCodeLine{3278     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%p\_surf\_full, turns, fluxes\%p\_surf\_full)}
\DoxyCodeLine{3279 }
\DoxyCodeLine{3280   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%buoy)) \&}
\DoxyCodeLine{3281     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%buoy, turns, fluxes\%buoy)}
\DoxyCodeLine{3282 }
\DoxyCodeLine{3283   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%TKE\_tidal)) \&}
\DoxyCodeLine{3284     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%TKE\_tidal, turns, fluxes\%TKE\_tidal)}
\DoxyCodeLine{3285   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(fluxes\_in\%ustar\_tidal)) \&}
\DoxyCodeLine{3286     \textcolor{keyword}{call }rotate\_array(fluxes\_in\%ustar\_tidal, turns, fluxes\%ustar\_tidal)}
\DoxyCodeLine{3287 }
\DoxyCodeLine{3288   \textcolor{comment}{! TODO: tracer flux rotation}}
\DoxyCodeLine{3289   \textcolor{keywordflow}{if} (coupler\_type\_initialized(fluxes\%tr\_fluxes)) \&}
\DoxyCodeLine{3290     \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"Rotation of tracer BC fluxes not yet implemented."})}
\DoxyCodeLine{3291 }
\DoxyCodeLine{3292   \textcolor{comment}{! Scalars and flags}}
\DoxyCodeLine{3293   fluxes\%accumulate\_p\_surf = fluxes\_in\%accumulate\_p\_surf}
\DoxyCodeLine{3294 }
\DoxyCodeLine{3295   fluxes\%vPrecGlobalAdj = fluxes\_in\%vPrecGlobalAdj}
\DoxyCodeLine{3296   fluxes\%saltFluxGlobalAdj = fluxes\_in\%saltFluxGlobalAdj}
\DoxyCodeLine{3297   fluxes\%netFWGlobalAdj = fluxes\_in\%netFWGlobalAdj}
\DoxyCodeLine{3298   fluxes\%vPrecGlobalScl = fluxes\_in\%vPrecGlobalScl}
\DoxyCodeLine{3299   fluxes\%saltFluxGlobalScl = fluxes\_in\%saltFluxGlobalScl}
\DoxyCodeLine{3300   fluxes\%netFWGlobalScl = fluxes\_in\%netFWGlobalScl}
\DoxyCodeLine{3301 }
\DoxyCodeLine{3302   fluxes\%fluxes\_used = fluxes\_in\%fluxes\_used}
\DoxyCodeLine{3303   fluxes\%dt\_buoy\_accum = fluxes\_in\%dt\_buoy\_accum}
\DoxyCodeLine{3304   fluxes\%C\_p = fluxes\_in\%C\_p}
\DoxyCodeLine{3305   \textcolor{comment}{! NOTE: gustless\_accum\_bug is set during allocation}}
\DoxyCodeLine{3306 }
\DoxyCodeLine{3307   fluxes\%num\_msg = fluxes\_in\%num\_msg}
\DoxyCodeLine{3308   fluxes\%max\_msg = fluxes\_in\%max\_msg}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a7b1d8f7fa2ffad01d699febbf042ac74}\label{namespacemom__forcing__type_a7b1d8f7fa2ffad01d699febbf042ac74}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!rotate\_mech\_forcing@{rotate\_mech\_forcing}}
\index{rotate\_mech\_forcing@{rotate\_mech\_forcing}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{rotate\_mech\_forcing()}{rotate\_mech\_forcing()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::rotate\+\_\+mech\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces\+\_\+in,  }\item[{integer, intent(in)}]{turns,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(inout)}]{forces }\end{DoxyParamCaption})}


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces\+\_\+in} & Forcing on the input domain\\
\hline
\mbox{\texttt{ in}}  & {\em turns} & Number of quarter-\/turns\\
\hline
\mbox{\texttt{ in,out}}  & {\em forces} & Forcing on the rotated domain \\
\hline
\end{DoxyParams}


Definition at line 3313 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{3313   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(in)}  :: forces\_in\textcolor{comment}{  !< Forcing on the input domain}}
\DoxyCodeLine{3314   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)} :: turns\textcolor{comment}{                  !< Number of quarter-\/turns}}
\DoxyCodeLine{3315   \textcolor{keywordtype}{type}(mech\_forcing), \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{   !< Forcing on the rotated domain}}
\DoxyCodeLine{3316 }
\DoxyCodeLine{3317   \textcolor{keywordtype}{logical} :: do\_stress, do\_ustar, do\_shelf, do\_press, do\_iceberg}
\DoxyCodeLine{3318 }
\DoxyCodeLine{3319   \textcolor{keyword}{call }get\_mech\_forcing\_groups(forces\_in, do\_stress, do\_ustar, do\_shelf, \&}
\DoxyCodeLine{3320                               do\_press, do\_iceberg)}
\DoxyCodeLine{3321 }
\DoxyCodeLine{3322   \textcolor{keywordflow}{if} (do\_stress) \&}
\DoxyCodeLine{3323     \textcolor{keyword}{call }rotate\_vector(forces\_in\%taux, forces\_in\%tauy, turns, \&}
\DoxyCodeLine{3324         forces\%taux, forces\%tauy)}
\DoxyCodeLine{3325 }
\DoxyCodeLine{3326   \textcolor{keywordflow}{if} (do\_ustar) \&}
\DoxyCodeLine{3327     \textcolor{keyword}{call }rotate\_array(forces\_in\%ustar, turns, forces\%ustar)}
\DoxyCodeLine{3328 }
\DoxyCodeLine{3329   \textcolor{keywordflow}{if} (do\_shelf) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3330     \textcolor{keyword}{call }rotate\_array\_pair( \&}
\DoxyCodeLine{3331       forces\_in\%rigidity\_ice\_u, forces\_in\%rigidity\_ice\_v, turns, \&}
\DoxyCodeLine{3332       forces\%rigidity\_ice\_u, forces\%rigidity\_ice\_v \&}
\DoxyCodeLine{3333     )}
\DoxyCodeLine{3334     \textcolor{keyword}{call }rotate\_array\_pair( \&}
\DoxyCodeLine{3335       forces\_in\%frac\_shelf\_u, forces\_in\%frac\_shelf\_v, turns, \&}
\DoxyCodeLine{3336       forces\%frac\_shelf\_u, forces\%frac\_shelf\_v \&}
\DoxyCodeLine{3337     )}
\DoxyCodeLine{3338 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3339 }
\DoxyCodeLine{3340   \textcolor{keywordflow}{if} (do\_press) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3341     \textcolor{comment}{! NOTE: p\_surf\_SSH either points to p\_surf or p\_surf\_full}}
\DoxyCodeLine{3342     \textcolor{keyword}{call }rotate\_array(forces\_in\%p\_surf, turns, forces\%p\_surf)}
\DoxyCodeLine{3343     \textcolor{keyword}{call }rotate\_array(forces\_in\%p\_surf\_full, turns, forces\%p\_surf\_full)}
\DoxyCodeLine{3344     \textcolor{keyword}{call }rotate\_array(forces\_in\%net\_mass\_src, turns, forces\%net\_mass\_src)}
\DoxyCodeLine{3345 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3346 }
\DoxyCodeLine{3347   \textcolor{keywordflow}{if} (do\_iceberg) \textcolor{keywordflow}{then}}
\DoxyCodeLine{3348     \textcolor{keyword}{call }rotate\_array(forces\_in\%area\_berg, turns, forces\%area\_berg)}
\DoxyCodeLine{3349     \textcolor{keyword}{call }rotate\_array(forces\_in\%mass\_berg, turns, forces\%mass\_berg)}
\DoxyCodeLine{3350 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{3351 }
\DoxyCodeLine{3352   \textcolor{comment}{! Copy fields}}
\DoxyCodeLine{3353   forces\%dt\_force\_accum = forces\_in\%dt\_force\_accum}
\DoxyCodeLine{3354   forces\%net\_mass\_src\_set = forces\_in\%net\_mass\_src\_set}
\DoxyCodeLine{3355   forces\%accumulate\_p\_surf = forces\_in\%accumulate\_p\_surf}
\DoxyCodeLine{3356   forces\%accumulate\_rigidity = forces\_in\%accumulate\_rigidity}
\DoxyCodeLine{3357   forces\%initialized = forces\_in\%initialized}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a1e4c747c49b67bb20b322c7b807de036}\label{namespacemom__forcing__type_a1e4c747c49b67bb20b322c7b807de036}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!set\_derived\_forcing\_fields@{set\_derived\_forcing\_fields}}
\index{set\_derived\_forcing\_fields@{set\_derived\_forcing\_fields}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{set\_derived\_forcing\_fields()}{set\_derived\_forcing\_fields()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::set\+\_\+derived\+\_\+forcing\+\_\+fields (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(in)}]{forces,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(inout)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, intent(in)}]{Rho0 }\end{DoxyParamCaption})}



This subroutine calculates certain derived forcing fields based on information from a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type and stores them in a (thermodynamic) forcing type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in}}  & {\em g} & grid type \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em rho0} & A reference density of seawater \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}, as used to calculate ustar. \\
\hline
\end{DoxyParams}


Definition at line 2103 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2103   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(in)}    :: forces\textcolor{comment}{   !< A structure with the driving mechanical forces}}
\DoxyCodeLine{2104   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{   !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2105   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{        !< grid type}}
\DoxyCodeLine{2106   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{       !< A dimensional unit scaling type}}
\DoxyCodeLine{2107 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)}    :: Rho0\textcolor{comment}{     !< A reference density of seawater [R \string~> kg m-\/3],}}
\DoxyCodeLine{2108 \textcolor{comment}{                                                     !! as used to calculate ustar.}}
\DoxyCodeLine{2109 }
\DoxyCodeLine{2110 \textcolor{keywordtype}{  real} :: taux2, tauy2 \textcolor{comment}{! Squared wind stress components [R2 L2 Z2 T-\/4 \string~> Pa2].}}
\DoxyCodeLine{2111 \textcolor{keywordtype}{  real} :: Irho0        \textcolor{comment}{! Inverse of the mean density rescaled to [Z L-\/1 R-\/1 \string~> m3 kg-\/1]}}
\DoxyCodeLine{2112   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je}
\DoxyCodeLine{2113   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{2114 }
\DoxyCodeLine{2115   irho0 = us\%L\_to\_Z / rho0}
\DoxyCodeLine{2116 }
\DoxyCodeLine{2117   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%taux) .and. \textcolor{keyword}{associated}(forces\%tauy) .and. \&}
\DoxyCodeLine{2118       \textcolor{keyword}{associated}(fluxes\%ustar\_gustless)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2119     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{2120       taux2 = 0.0}
\DoxyCodeLine{2121       \textcolor{keywordflow}{if} ((g\%mask2dCu(i-\/1,j) + g\%mask2dCu(i,j)) > 0) \&}
\DoxyCodeLine{2122         taux2 = (g\%mask2dCu(i-\/1,j) * forces\%taux(i-\/1,j)**2 + \&}
\DoxyCodeLine{2123                  g\%mask2dCu(i,j) * forces\%taux(i,j)**2) / \&}
\DoxyCodeLine{2124                 (g\%mask2dCu(i-\/1,j) + g\%mask2dCu(i,j))}
\DoxyCodeLine{2125       tauy2 = 0.0}
\DoxyCodeLine{2126       \textcolor{keywordflow}{if} ((g\%mask2dCv(i,j-\/1) + g\%mask2dCv(i,j)) > 0) \&}
\DoxyCodeLine{2127         tauy2 = (g\%mask2dCv(i,j-\/1) * forces\%tauy(i,j-\/1)**2 + \&}
\DoxyCodeLine{2128                  g\%mask2dCv(i,j) * forces\%tauy(i,j)**2) / \&}
\DoxyCodeLine{2129                 (g\%mask2dCv(i,j-\/1) + g\%mask2dCv(i,j))}
\DoxyCodeLine{2130 }
\DoxyCodeLine{2131       \textcolor{keywordflow}{if} (fluxes\%gustless\_accum\_bug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{2132         \textcolor{comment}{! This change is just for computational efficiency, but it is wrapped with another change.}}
\DoxyCodeLine{2133         fluxes\%ustar\_gustless(i,j) = sqrt(us\%L\_to\_Z * sqrt(taux2 + tauy2) / rho0)}
\DoxyCodeLine{2134       \textcolor{keywordflow}{else}}
\DoxyCodeLine{2135         fluxes\%ustar\_gustless(i,j) = sqrt(sqrt(taux2 + tauy2) * irho0)}
\DoxyCodeLine{2136 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{2137 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{2138 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{2139 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__forcing__type_a9ee72ee836f7326d0957a4094d8f0231}\label{namespacemom__forcing__type_a9ee72ee836f7326d0957a4094d8f0231}} 
\index{mom\_forcing\_type@{mom\_forcing\_type}!set\_net\_mass\_forcing@{set\_net\_mass\_forcing}}
\index{set\_net\_mass\_forcing@{set\_net\_mass\_forcing}!mom\_forcing\_type@{mom\_forcing\_type}}
\doxysubsubsection{\texorpdfstring{set\_net\_mass\_forcing()}{set\_net\_mass\_forcing()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+forcing\+\_\+type\+::set\+\_\+net\+\_\+mass\+\_\+forcing (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{type(\mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}}), intent(inout)}]{forces,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US }\end{DoxyParamCaption})}



This subroutine determines the net mass source to the ocean from a (thermodynamic) forcing type and stores it in a \mbox{\hyperlink{structmom__forcing__type_1_1mech__forcing}{mech\+\_\+forcing}} type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing thermodynamic forcing fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em forces} & A structure with the driving mechanical forces \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean grid type \\
\hline
\end{DoxyParams}


Definition at line 2146 of file M\+O\+M\+\_\+forcing\+\_\+type.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{2146   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)}    :: fluxes\textcolor{comment}{   !< A structure containing thermodynamic forcing fields}}
\DoxyCodeLine{2147   \textcolor{keywordtype}{type}(mech\_forcing),      \textcolor{keywordtype}{intent(inout)} :: forces\textcolor{comment}{   !< A structure with the driving mechanical forces}}
\DoxyCodeLine{2148   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}    :: US\textcolor{comment}{       !< A dimensional unit scaling type}}
\DoxyCodeLine{2149   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{        !< The ocean grid type}}
\DoxyCodeLine{2150 }
\DoxyCodeLine{2151   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(forces\%net\_mass\_src)) \&}
\DoxyCodeLine{2152     \textcolor{keyword}{call }get\_net\_mass\_forcing(fluxes, g, us, forces\%net\_mass\_src)}
\DoxyCodeLine{2153 }

\end{DoxyCode}
