\hypertarget{namespacemom__offline__aux}{}\doxysection{mom\+\_\+offline\+\_\+aux Module Reference}
\label{namespacemom__offline__aux}\index{mom\_offline\_aux@{mom\_offline\_aux}}


\doxysubsection{Detailed Description}
Contains routines related to offline transport of tracers. These routines are likely to be called from the M\+O\+M\+\_\+offline\+\_\+main module. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a2a72a34fb47df31ad8a10ee51b4beca3}{update\+\_\+h\+\_\+horizontal\+\_\+flux}} (G, GV, uhtr, vhtr, h\+\_\+pre, h\+\_\+new)
\begin{DoxyCompactList}\small\item\em This updates thickness based on the convergence of horizontal mass fluxes N\+O\+TE\+: Only used in non-\/\+A\+LE mode. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a1dd22761e228785bf84f2d6db11ba8cc}{update\+\_\+h\+\_\+vertical\+\_\+flux}} (G, GV, ea, eb, h\+\_\+pre, h\+\_\+new)
\begin{DoxyCompactList}\small\item\em Updates layer thicknesses due to vertical mass transports N\+O\+TE\+: Only used in non-\/\+A\+LE configuration. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a970148366cfc57cb311ab0c3fdbf0f6b}{limit\+\_\+mass\+\_\+flux\+\_\+3d}} (G, GV, uh, vh, ea, eb, h\+\_\+pre)
\begin{DoxyCompactList}\small\item\em This routine limits the mass fluxes so that the a layer cannot be completely depleted. N\+O\+TE\+: Only used in non-\/\+A\+LE mode. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_ab0ae4b0baa6a99a7c424f88cb308bff2}{distribute\+\_\+residual\+\_\+uh\+\_\+barotropic}} (G, GV, hvol, uh)
\begin{DoxyCompactList}\small\item\em In the case where offline advection has failed to converge, redistribute the u-\/flux into remainder of the water column as a barotropic equivalent. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_ad23ced9ed480b299332ca600e97d82bc}{distribute\+\_\+residual\+\_\+vh\+\_\+barotropic}} (G, GV, hvol, vh)
\begin{DoxyCompactList}\small\item\em Redistribute the v-\/flux as a barotropic equivalent. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a926820f5e1a788c56f1f5f485f667a1f}{distribute\+\_\+residual\+\_\+uh\+\_\+upwards}} (G, GV, hvol, uh)
\begin{DoxyCompactList}\small\item\em In the case where offline advection has failed to converge, redistribute the u-\/flux into layers above. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_ae89d0bdb8c648bc137a188c4f7fa956d}{distribute\+\_\+residual\+\_\+vh\+\_\+upwards}} (G, GV, hvol, vh)
\begin{DoxyCompactList}\small\item\em In the case where offline advection has failed to converge, redistribute the u-\/flux into layers above. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_ac03963f0ae27e12160f78c6a420bc7a8}{offline\+\_\+add\+\_\+diurnal\+\_\+sw}} (fluxes, G, Time\+\_\+start, Time\+\_\+end)
\begin{DoxyCompactList}\small\item\em add\+\_\+diurnal\+\_\+\+SW adjusts the shortwave fluxes in an forcying\+\_\+type variable to add a synthetic diurnal cycle. Adapted from S\+I\+S2 \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a088f31cd992ae91a4610aafe43b04c08}{update\+\_\+offline\+\_\+from\+\_\+files}} (G, GV, nk\+\_\+input, mean\+\_\+file, sum\+\_\+file, snap\+\_\+file, surf\+\_\+file, h\+\_\+end, uhtr, vhtr, temp\+\_\+mean, salt\+\_\+mean, mld, Kd, fluxes, ridx\+\_\+sum, ridx\+\_\+snap, read\+\_\+mld, read\+\_\+sw, read\+\_\+ts\+\_\+uvh, do\+\_\+ale\+\_\+in)
\begin{DoxyCompactList}\small\item\em Controls the reading in 3d mass fluxes, diffusive fluxes, and other fields stored in a previous integration of the online model. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__offline__aux_a6fc82d358eae9030a030182290a30858}{update\+\_\+offline\+\_\+from\+\_\+arrays}} (G, GV, nk\+\_\+input, ridx\+\_\+sum, mean\+\_\+file, sum\+\_\+file, snap\+\_\+file, uhtr, vhtr, hend, uhtr\+\_\+all, vhtr\+\_\+all, hend\+\_\+all, temp, salt, temp\+\_\+all, salt\+\_\+all)
\begin{DoxyCompactList}\small\item\em Fields for offline transport are copied from the stored arrays read during initialization. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__offline__aux_a4704d9514fdbf239f228f261938a9a09}\label{namespacemom__offline__aux_a4704d9514fdbf239f228f261938a9a09}} 
integer function, public \mbox{\hyperlink{namespacemom__offline__aux_a4704d9514fdbf239f228f261938a9a09}{next\+\_\+modulo\+\_\+time}} (inidx, numtime)
\begin{DoxyCompactList}\small\item\em Calculates the next timelevel to read from the input fields. This allows the \textquotesingle{}looping\textquotesingle{} of the fields. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__offline__aux_ab0ae4b0baa6a99a7c424f88cb308bff2}\label{namespacemom__offline__aux_ab0ae4b0baa6a99a7c424f88cb308bff2}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!distribute\_residual\_uh\_barotropic@{distribute\_residual\_uh\_barotropic}}
\index{distribute\_residual\_uh\_barotropic@{distribute\_residual\_uh\_barotropic}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{distribute\_residual\_uh\_barotropic()}{distribute\_residual\_uh\_barotropic()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::distribute\+\_\+residual\+\_\+uh\+\_\+barotropic (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{hvol,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uh }\end{DoxyParamCaption})}



In the case where offline advection has failed to converge, redistribute the u-\/flux into remainder of the water column as a barotropic equivalent. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em hvol} & Mass of water in the cells at the end \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & Zonal mass transport within a timestep \mbox{[}kg\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 239 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{240   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{    !< ocean grid structure}}
\DoxyCodeLine{241   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{   !< ocean vertical grid structure}}
\DoxyCodeLine{242 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{243                            \textcolor{keywordtype}{intent(in   )} :: hvol\textcolor{comment}{ !< Mass of water in the cells at the end}}
\DoxyCodeLine{244 \textcolor{comment}{                                                 !! of the previous timestep [kg]}}
\DoxyCodeLine{245 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{246                            \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{   !< Zonal mass transport within a timestep [kg]}}
\DoxyCodeLine{247 }
\DoxyCodeLine{248 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZK\_(G))}   :: uh2d}
\DoxyCodeLine{249 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G))}           :: uh2d\_sum}
\DoxyCodeLine{250 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G))}    :: h2d}
\DoxyCodeLine{251 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G))}            :: h2d\_sum}
\DoxyCodeLine{252 }
\DoxyCodeLine{253   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz}
\DoxyCodeLine{254 \textcolor{keywordtype}{  real} :: uh\_neglect}
\DoxyCodeLine{255 }
\DoxyCodeLine{256   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{257   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{258 }
\DoxyCodeLine{259   \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{260     uh2d\_sum(:) = 0.0}
\DoxyCodeLine{261     \textcolor{comment}{! Copy over uh to a working array and sum up the remaining fluxes in a column}}
\DoxyCodeLine{262     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{263       uh2d(i,k) = uh(i,j,k)}
\DoxyCodeLine{264       uh2d\_sum(i) = uh2d\_sum(i) + uh2d(i,k)}
\DoxyCodeLine{265 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{266 }
\DoxyCodeLine{267     \textcolor{comment}{! Copy over h to a working array and calculate total column volume}}
\DoxyCodeLine{268     h2d\_sum(:) = 0.0}
\DoxyCodeLine{269     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{270       h2d(i,k) = hvol(i,j,k)}
\DoxyCodeLine{271       \textcolor{keywordflow}{if} (hvol(i,j,k)>0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{272         h2d\_sum(i) = h2d\_sum(i) + h2d(i,k)}
\DoxyCodeLine{273       \textcolor{keywordflow}{else}}
\DoxyCodeLine{274         h2d(i,k) = gv\%H\_subroundoff}
\DoxyCodeLine{275 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{276 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{277 }
\DoxyCodeLine{278     \textcolor{comment}{! Distribute flux. Note min/max is intended to make sure that the mass transport}}
\DoxyCodeLine{279     \textcolor{comment}{! does not deplete a cell}}
\DoxyCodeLine{280     \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{281       \textcolor{keywordflow}{if} ( uh2d\_sum(i)>0.0 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{282         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{283           uh2d(i,k) = uh2d\_sum(i)*(h2d(i,k)/h2d\_sum(i))}
\DoxyCodeLine{284 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{285       \textcolor{keywordflow}{elseif} (uh2d\_sum(i)<0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{286         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{287           uh2d(i,k) = uh2d\_sum(i)*(h2d(i+1,k)/h2d\_sum(i+1))}
\DoxyCodeLine{288 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{289       \textcolor{keywordflow}{else}}
\DoxyCodeLine{290         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{291           uh2d(i,k) = 0.0}
\DoxyCodeLine{292 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{293 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{294       \textcolor{comment}{! Calculate and check that column integrated transports match the original to}}
\DoxyCodeLine{295       \textcolor{comment}{! within the tolerance limit}}
\DoxyCodeLine{296       uh\_neglect = gv\%Angstrom\_H*g\%US\%L\_to\_m**2 * min(g\%areaT(i,j), g\%areaT(i+1,j))}
\DoxyCodeLine{297       \textcolor{keywordflow}{if} ( abs(sum(uh2d(i,:))-\/uh2d\_sum(i)) > uh\_neglect) \&}
\DoxyCodeLine{298         \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Column integral of uh does not match after "}//\&}
\DoxyCodeLine{299         \textcolor{stringliteral}{"barotropic redistribution"})}
\DoxyCodeLine{300 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{301 }
\DoxyCodeLine{302     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{303       uh(i,j,k) = uh2d(i,k)}
\DoxyCodeLine{304 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{305 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{306 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a926820f5e1a788c56f1f5f485f667a1f}\label{namespacemom__offline__aux_a926820f5e1a788c56f1f5f485f667a1f}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!distribute\_residual\_uh\_upwards@{distribute\_residual\_uh\_upwards}}
\index{distribute\_residual\_uh\_upwards@{distribute\_residual\_uh\_upwards}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{distribute\_residual\_uh\_upwards()}{distribute\_residual\_uh\_upwards()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::distribute\+\_\+residual\+\_\+uh\+\_\+upwards (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{hvol,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uh }\end{DoxyParamCaption})}



In the case where offline advection has failed to converge, redistribute the u-\/flux into layers above. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em hvol} & Mass of water in the cells at the end \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & Zonal mass transport within a timestep \mbox{[}kg\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 383 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{384   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{     !< ocean grid structure}}
\DoxyCodeLine{385   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{386 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{387                            \textcolor{keywordtype}{intent(in   )} :: hvol\textcolor{comment}{  !< Mass of water in the cells at the end}}
\DoxyCodeLine{388 \textcolor{comment}{                                                  !! of the previous timestep [kg]}}
\DoxyCodeLine{389 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{390                            \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{    !< Zonal mass transport within a timestep [kg]}}
\DoxyCodeLine{391 }
\DoxyCodeLine{392 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZK\_(G))}   :: uh2d}
\DoxyCodeLine{393 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZK\_(G))}    :: h2d}
\DoxyCodeLine{394 }
\DoxyCodeLine{395 \textcolor{keywordtype}{  real}  :: uh\_neglect, uh\_remain, uh\_add, uh\_sum, uh\_col, uh\_max}
\DoxyCodeLine{396 \textcolor{keywordtype}{  real}  :: hup, hdown, hlos, min\_h}
\DoxyCodeLine{397   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz, k\_rev}
\DoxyCodeLine{398 }
\DoxyCodeLine{399   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{400   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{401 }
\DoxyCodeLine{402   min\_h = gv\%Angstrom\_H*0.1}
\DoxyCodeLine{403 }
\DoxyCodeLine{404   \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{405     \textcolor{comment}{! Copy over uh and cell volume to working arrays}}
\DoxyCodeLine{406     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/2,ie+1}
\DoxyCodeLine{407       uh2d(i,k) = uh(i,j,k)}
\DoxyCodeLine{408 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{409     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{410       \textcolor{comment}{! Subtract just a little bit of thickness to avoid roundoff errors}}
\DoxyCodeLine{411       h2d(i,k) = hvol(i,j,k)-\/min\_h*g\%US\%L\_to\_m**2*g\%areaT(i,j)}
\DoxyCodeLine{412 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{413 }
\DoxyCodeLine{414     \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{415       uh\_col = sum(uh2d(i,:)) \textcolor{comment}{! Store original column-\/integrated transport}}
\DoxyCodeLine{416       \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{417         uh\_remain = uh2d(i,k)}
\DoxyCodeLine{418         uh2d(i,k) = 0.0}
\DoxyCodeLine{419         \textcolor{keywordflow}{if} (abs(uh\_remain)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{420           \textcolor{keywordflow}{do} k\_rev = k,1,-\/1}
\DoxyCodeLine{421             uh\_sum = uh\_remain + uh2d(i,k\_rev)}
\DoxyCodeLine{422             \textcolor{keywordflow}{if} (uh\_sum<0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! Transport to the left}}
\DoxyCodeLine{423               hup = h2d(i+1,k\_rev)}
\DoxyCodeLine{424               hlos = max(0.0,uh2d(i+1,k\_rev))}
\DoxyCodeLine{425               \textcolor{keywordflow}{if} ((((hup -\/ hlos) + uh\_sum) < 0.0) .and. \&}
\DoxyCodeLine{426                   ((0.5*hup + uh\_sum) < 0.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{427                 uh2d(i,k\_rev) = min(-\/0.5*hup,-\/hup+hlos,0.0)}
\DoxyCodeLine{428                 uh\_remain = uh\_sum -\/ uh2d(i,k\_rev)}
\DoxyCodeLine{429               \textcolor{keywordflow}{else}}
\DoxyCodeLine{430                 uh2d(i,k\_rev) = uh\_sum}
\DoxyCodeLine{431                 uh\_remain = 0.0}
\DoxyCodeLine{432                 \textcolor{keywordflow}{exit}}
\DoxyCodeLine{433 \textcolor{keywordflow}{              endif}}
\DoxyCodeLine{434             \textcolor{keywordflow}{else} \textcolor{comment}{! Transport to the right}}
\DoxyCodeLine{435               hup = h2d(i,k\_rev)}
\DoxyCodeLine{436               hlos = max(0.0,-\/uh2d(i-\/1,k\_rev))}
\DoxyCodeLine{437               \textcolor{keywordflow}{if} ((((hup -\/ hlos) -\/ uh\_sum) < 0.0) .and. \&}
\DoxyCodeLine{438                   ((0.5*hup -\/ uh\_sum) < 0.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{439                 uh2d(i,k\_rev) = max(0.5*hup,hup-\/hlos,0.0)}
\DoxyCodeLine{440                 uh\_remain = uh\_sum -\/ uh2d(i,k\_rev)}
\DoxyCodeLine{441               \textcolor{keywordflow}{else}}
\DoxyCodeLine{442                 uh2d(i,k\_rev) = uh\_sum}
\DoxyCodeLine{443                 uh\_remain = 0.0}
\DoxyCodeLine{444                 \textcolor{keywordflow}{exit}}
\DoxyCodeLine{445 \textcolor{keywordflow}{              endif}}
\DoxyCodeLine{446 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{447 \textcolor{keywordflow}{          enddo} \textcolor{comment}{! k\_rev}}
\DoxyCodeLine{448 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{449 }
\DoxyCodeLine{450         \textcolor{keywordflow}{if} (abs(uh\_remain)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{451           \textcolor{keywordflow}{if} (k<nz) \textcolor{keywordflow}{then}}
\DoxyCodeLine{452             uh2d(i,k+1) = uh2d(i,k+1) + uh\_remain}
\DoxyCodeLine{453           \textcolor{keywordflow}{else}}
\DoxyCodeLine{454             uh2d(i,k) = uh2d(i,k) + uh\_remain}
\DoxyCodeLine{455             \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Water column cannot accommodate UH redistribution. Tracer may not be conserved"})}
\DoxyCodeLine{456 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{457 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{458 \textcolor{keywordflow}{      enddo} \textcolor{comment}{! k-\/loop}}
\DoxyCodeLine{459 }
\DoxyCodeLine{460       \textcolor{comment}{! Calculate and check that column integrated transports match the original to}}
\DoxyCodeLine{461       \textcolor{comment}{! within the tolerance limit}}
\DoxyCodeLine{462       uh\_neglect = gv\%Angstrom\_H*g\%US\%L\_to\_m**2 * min(g\%areaT(i,j), g\%areaT(i+1,j))}
\DoxyCodeLine{463       \textcolor{keywordflow}{if} (abs(uh\_col -\/ sum(uh2d(i,:)))>uh\_neglect) \textcolor{keywordflow}{then}}
\DoxyCodeLine{464         \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Column integral of uh does not match after "}//\&}
\DoxyCodeLine{465         \textcolor{stringliteral}{"upwards redistribution"})}
\DoxyCodeLine{466 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{467 }
\DoxyCodeLine{468 \textcolor{keywordflow}{    enddo} \textcolor{comment}{! i-\/loop}}
\DoxyCodeLine{469 }
\DoxyCodeLine{470     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{471       uh(i,j,k) = uh2d(i,k)}
\DoxyCodeLine{472 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{473 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{474 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_ad23ced9ed480b299332ca600e97d82bc}\label{namespacemom__offline__aux_ad23ced9ed480b299332ca600e97d82bc}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!distribute\_residual\_vh\_barotropic@{distribute\_residual\_vh\_barotropic}}
\index{distribute\_residual\_vh\_barotropic@{distribute\_residual\_vh\_barotropic}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{distribute\_residual\_vh\_barotropic()}{distribute\_residual\_vh\_barotropic()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::distribute\+\_\+residual\+\_\+vh\+\_\+barotropic (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{hvol,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vh }\end{DoxyParamCaption})}



Redistribute the v-\/flux as a barotropic equivalent. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em hvol} & Mass of water in the cells at the end \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & Meridional mass transport within a timestep \mbox{[}kg\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 310 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{311   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{    !< ocean grid structure}}
\DoxyCodeLine{312   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{   !< ocean vertical grid structure}}
\DoxyCodeLine{313 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{314                            \textcolor{keywordtype}{intent(in   )} :: hvol\textcolor{comment}{ !< Mass of water in the cells at the end}}
\DoxyCodeLine{315 \textcolor{comment}{                                                 !! of the previous timestep [kg]}}
\DoxyCodeLine{316 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{317                            \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{   !< Meridional mass transport within a timestep [kg]}}
\DoxyCodeLine{318 }
\DoxyCodeLine{319 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJB\_(G),SZK\_(G))}   :: vh2d}
\DoxyCodeLine{320 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJB\_(G))}           :: vh2d\_sum}
\DoxyCodeLine{321 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJ\_(G),SZK\_(G))}    :: h2d}
\DoxyCodeLine{322 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJ\_(G))}            :: h2d\_sum}
\DoxyCodeLine{323 }
\DoxyCodeLine{324   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz}
\DoxyCodeLine{325 \textcolor{keywordtype}{  real} :: vh\_neglect}
\DoxyCodeLine{326 }
\DoxyCodeLine{327   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{328   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{329 }
\DoxyCodeLine{330   \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{331     vh2d\_sum(:) = 0.0}
\DoxyCodeLine{332     \textcolor{comment}{! Copy over uh to a working array and sum up the remaining fluxes in a column}}
\DoxyCodeLine{333     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je}
\DoxyCodeLine{334       vh2d(j,k) = vh(i,j,k)}
\DoxyCodeLine{335       vh2d\_sum(j) = vh2d\_sum(j) + vh2d(j,k)}
\DoxyCodeLine{336 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{337 }
\DoxyCodeLine{338     \textcolor{comment}{! Copy over h to a working array and calculate column volume}}
\DoxyCodeLine{339     h2d\_sum(:) = 0.0}
\DoxyCodeLine{340     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je+1}
\DoxyCodeLine{341       h2d(j,k) = hvol(i,j,k)}
\DoxyCodeLine{342       \textcolor{keywordflow}{if} (hvol(i,j,k)>0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{343         h2d\_sum(j) = h2d\_sum(j) + h2d(j,k)}
\DoxyCodeLine{344       \textcolor{keywordflow}{else}}
\DoxyCodeLine{345         h2d(j,k) = gv\%H\_subroundoff}
\DoxyCodeLine{346 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{347 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{348 }
\DoxyCodeLine{349     \textcolor{comment}{! Distribute flux evenly throughout a column}}
\DoxyCodeLine{350     \textcolor{keywordflow}{do} j=js-\/1,je}
\DoxyCodeLine{351       \textcolor{keywordflow}{if} ( vh2d\_sum(j)>0.0 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{352         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{353           vh2d(j,k) = vh2d\_sum(j)*(h2d(j,k)/h2d\_sum(j))}
\DoxyCodeLine{354 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{355       \textcolor{keywordflow}{elseif} (vh2d\_sum(j)<0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{356         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{357           vh2d(j,k) = vh2d\_sum(j)*(h2d(j+1,k)/h2d\_sum(j+1))}
\DoxyCodeLine{358 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{359       \textcolor{keywordflow}{else}}
\DoxyCodeLine{360         \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{361           vh2d(j,k) = 0.0}
\DoxyCodeLine{362 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{363 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{364       \textcolor{comment}{! Calculate and check that column integrated transports match the original to}}
\DoxyCodeLine{365       \textcolor{comment}{! within the tolerance limit}}
\DoxyCodeLine{366       vh\_neglect = gv\%Angstrom\_H*g\%US\%L\_to\_m**2 * min(g\%areaT(i,j), g\%areaT(i,j+1))}
\DoxyCodeLine{367       \textcolor{keywordflow}{if} ( abs(sum(vh2d(j,:))-\/vh2d\_sum(j)) > vh\_neglect) \textcolor{keywordflow}{then}}
\DoxyCodeLine{368           \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Column integral of vh does not match after "}//\&}
\DoxyCodeLine{369           \textcolor{stringliteral}{"barotropic redistribution"})}
\DoxyCodeLine{370 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{371 }
\DoxyCodeLine{372 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{373 }
\DoxyCodeLine{374     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je}
\DoxyCodeLine{375       vh(i,j,k) = vh2d(j,k)}
\DoxyCodeLine{376 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{377 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{378 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_ae89d0bdb8c648bc137a188c4f7fa956d}\label{namespacemom__offline__aux_ae89d0bdb8c648bc137a188c4f7fa956d}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!distribute\_residual\_vh\_upwards@{distribute\_residual\_vh\_upwards}}
\index{distribute\_residual\_vh\_upwards@{distribute\_residual\_vh\_upwards}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{distribute\_residual\_vh\_upwards()}{distribute\_residual\_vh\_upwards()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::distribute\+\_\+residual\+\_\+vh\+\_\+upwards (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{hvol,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vh }\end{DoxyParamCaption})}



In the case where offline advection has failed to converge, redistribute the u-\/flux into layers above. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em hvol} & Mass of water in the cells at the end \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & Meridional mass transport within a timestep \mbox{[}kg\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 479 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{480   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{     !< ocean grid structure}}
\DoxyCodeLine{481   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{482 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{483                            \textcolor{keywordtype}{intent(in   )} :: hvol\textcolor{comment}{  !< Mass of water in the cells at the end}}
\DoxyCodeLine{484 \textcolor{comment}{                                                  !! of the previous timestep [kg]}}
\DoxyCodeLine{485 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{486                            \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{    !< Meridional mass transport within a timestep [kg]}}
\DoxyCodeLine{487 }
\DoxyCodeLine{488 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJB\_(G),SZK\_(G))}   :: vh2d}
\DoxyCodeLine{489 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJB\_(G))}           :: vh2d\_sum}
\DoxyCodeLine{490 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJ\_(G),SZK\_(G))}    :: h2d}
\DoxyCodeLine{491 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZJ\_(G))}            :: h2d\_sum}
\DoxyCodeLine{492 }
\DoxyCodeLine{493 \textcolor{keywordtype}{  real}  :: vh\_neglect, vh\_remain, vh\_col, vh\_sum}
\DoxyCodeLine{494 \textcolor{keywordtype}{  real}  :: hup, hlos, min\_h}
\DoxyCodeLine{495   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz, k\_rev}
\DoxyCodeLine{496 }
\DoxyCodeLine{497   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{498   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{499 }
\DoxyCodeLine{500   min\_h = 0.1*gv\%Angstrom\_H}
\DoxyCodeLine{501 }
\DoxyCodeLine{502   \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{503     \textcolor{comment}{! Copy over uh and cell volume to working arrays}}
\DoxyCodeLine{504     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/2,je+1}
\DoxyCodeLine{505       vh2d(j,k) = vh(i,j,k)}
\DoxyCodeLine{506 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{507     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je+1}
\DoxyCodeLine{508       h2d(j,k) = hvol(i,j,k)-\/min\_h*g\%US\%L\_to\_m**2*g\%areaT(i,j)}
\DoxyCodeLine{509 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{510 }
\DoxyCodeLine{511     \textcolor{keywordflow}{do} j=js-\/1,je}
\DoxyCodeLine{512       vh\_col = sum(vh2d(j,:))}
\DoxyCodeLine{513       \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{514         vh\_remain = vh2d(j,k)}
\DoxyCodeLine{515         vh2d(j,k) = 0.0}
\DoxyCodeLine{516         \textcolor{keywordflow}{if} (abs(vh\_remain)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{517           \textcolor{keywordflow}{do} k\_rev = k,1,-\/1}
\DoxyCodeLine{518             vh\_sum = vh\_remain + vh2d(j,k\_rev)}
\DoxyCodeLine{519             \textcolor{keywordflow}{if} (vh\_sum<0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! Transport to the left}}
\DoxyCodeLine{520               hup = h2d(j+1,k\_rev)}
\DoxyCodeLine{521               hlos = max(0.0,vh2d(j+1,k\_rev))}
\DoxyCodeLine{522               \textcolor{keywordflow}{if} ((((hup -\/ hlos) + vh\_sum) < 0.0) .and. \&}
\DoxyCodeLine{523                   ((0.5*hup + vh\_sum) < 0.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{524                 vh2d(j,k\_rev) = min(-\/0.5*hup,-\/hup+hlos,0.0)}
\DoxyCodeLine{525                 vh\_remain = vh\_sum -\/ vh2d(j,k\_rev)}
\DoxyCodeLine{526               \textcolor{keywordflow}{else}}
\DoxyCodeLine{527                 vh2d(j,k\_rev) = vh\_sum}
\DoxyCodeLine{528                 vh\_remain = 0.0}
\DoxyCodeLine{529                 \textcolor{keywordflow}{exit}}
\DoxyCodeLine{530 \textcolor{keywordflow}{              endif}}
\DoxyCodeLine{531             \textcolor{keywordflow}{else} \textcolor{comment}{! Transport to the right}}
\DoxyCodeLine{532               hup = h2d(j,k\_rev)}
\DoxyCodeLine{533               hlos = max(0.0,-\/vh2d(j-\/1,k\_rev))}
\DoxyCodeLine{534               \textcolor{keywordflow}{if} ((((hup -\/ hlos) -\/ vh\_sum) < 0.0) .and. \&}
\DoxyCodeLine{535                   ((0.5*hup -\/ vh\_sum) < 0.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{536                 vh2d(j,k\_rev) = max(0.5*hup,hup-\/hlos,0.0)}
\DoxyCodeLine{537                 vh\_remain = vh\_sum -\/ vh2d(j,k\_rev)}
\DoxyCodeLine{538               \textcolor{keywordflow}{else}}
\DoxyCodeLine{539                 vh2d(j,k\_rev) = vh\_sum}
\DoxyCodeLine{540                 vh\_remain = 0.0}
\DoxyCodeLine{541                 \textcolor{keywordflow}{exit}}
\DoxyCodeLine{542 \textcolor{keywordflow}{              endif}}
\DoxyCodeLine{543 \textcolor{keywordflow}{            endif}}
\DoxyCodeLine{544 }
\DoxyCodeLine{545 \textcolor{keywordflow}{          enddo} \textcolor{comment}{! k\_rev}}
\DoxyCodeLine{546 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{547 }
\DoxyCodeLine{548         \textcolor{keywordflow}{if} (abs(vh\_remain)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{549          \textcolor{keywordflow}{if} (k<nz) \textcolor{keywordflow}{then}}
\DoxyCodeLine{550             vh2d(j,k+1) = vh2d(j,k+1) + vh\_remain}
\DoxyCodeLine{551           \textcolor{keywordflow}{else}}
\DoxyCodeLine{552             vh2d(j,k) = vh2d(j,k) + vh\_remain}
\DoxyCodeLine{553             \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Water column cannot accommodate VH redistribution. Tracer will not be conserved"})}
\DoxyCodeLine{554 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{555 \textcolor{keywordflow}{        endif} \textcolor{comment}{! k-\/loop}}
\DoxyCodeLine{556 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{557 }
\DoxyCodeLine{558       \textcolor{comment}{! Calculate and check that column integrated transports match the original to}}
\DoxyCodeLine{559       \textcolor{comment}{! within the tolerance limit}}
\DoxyCodeLine{560       vh\_neglect = gv\%Angstrom\_H*g\%US\%L\_to\_m**2 * min(g\%areaT(i,j), g\%areaT(i,j+1))}
\DoxyCodeLine{561       \textcolor{keywordflow}{if} ( abs(vh\_col-\/sum(vh2d(j,:))) > vh\_neglect) \textcolor{keywordflow}{then}}
\DoxyCodeLine{562         \textcolor{keyword}{call }mom\_error(warning,\textcolor{stringliteral}{"Column integral of vh does not match after "}//\&}
\DoxyCodeLine{563                                \textcolor{stringliteral}{"upwards redistribution"})}
\DoxyCodeLine{564 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{565 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{566 }
\DoxyCodeLine{567     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js-\/1,je}
\DoxyCodeLine{568       vh(i,j,k) = vh2d(j,k)}
\DoxyCodeLine{569 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{570 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{571 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a970148366cfc57cb311ab0c3fdbf0f6b}\label{namespacemom__offline__aux_a970148366cfc57cb311ab0c3fdbf0f6b}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!limit\_mass\_flux\_3d@{limit\_mass\_flux\_3d}}
\index{limit\_mass\_flux\_3d@{limit\_mass\_flux\_3d}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{limit\_mass\_flux\_3d()}{limit\_mass\_flux\_3d()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::limit\+\_\+mass\+\_\+flux\+\_\+3d (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{uh,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(inout)}]{vh,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{ea,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{eb,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h\+\_\+pre }\end{DoxyParamCaption})}



This routine limits the mass fluxes so that the a layer cannot be completely depleted. N\+O\+TE\+: Only used in non-\/\+A\+LE mode. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em uh} & Mass flux through zonal face \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vh} & Mass flux through meridional face \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em ea} & Mass of fluid entrained from the layer \\
\hline
\mbox{\texttt{ in,out}}  & {\em eb} & Mass of fluid entrained from the layer \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+pre} & Layer thicknesses at the end of the previous \\
\hline
\end{DoxyParams}


Definition at line 136 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{137   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{     !< ocean grid structure}}
\DoxyCodeLine{138   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{139 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{140                            \textcolor{keywordtype}{intent(inout)} :: uh\textcolor{comment}{    !< Mass flux through zonal face [kg]}}
\DoxyCodeLine{141 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{142                            \textcolor{keywordtype}{intent(inout)} :: vh\textcolor{comment}{    !< Mass flux through meridional face [kg]}}
\DoxyCodeLine{143 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{144                            \textcolor{keywordtype}{intent(inout)} :: ea\textcolor{comment}{    !< Mass of fluid entrained from the layer}}
\DoxyCodeLine{145 \textcolor{comment}{                                                  !! above within this timestep [kg m-\/2]}}
\DoxyCodeLine{146 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{147                            \textcolor{keywordtype}{intent(inout)} :: eb\textcolor{comment}{    !< Mass of fluid entrained from the layer}}
\DoxyCodeLine{148 \textcolor{comment}{                                                  !! below within this timestep [kg m-\/2]}}
\DoxyCodeLine{149 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{150                            \textcolor{keywordtype}{intent(in)}    :: h\_pre\textcolor{comment}{ !< Layer thicknesses at the end of the previous}}
\DoxyCodeLine{151 \textcolor{comment}{                                                  !! step [kg m-\/2].}}
\DoxyCodeLine{152 }
\DoxyCodeLine{153   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{154   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz}
\DoxyCodeLine{155 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: top\_flux, bottom\_flux}
\DoxyCodeLine{156 \textcolor{keywordtype}{  real} :: pos\_flux, hvol, h\_neglect, scale\_factor, max\_off\_cfl}
\DoxyCodeLine{157 }
\DoxyCodeLine{158   max\_off\_cfl =0.5}
\DoxyCodeLine{159 }
\DoxyCodeLine{160   \textcolor{comment}{! In this subroutine, fluxes out of the box are scaled away if they deplete}}
\DoxyCodeLine{161   \textcolor{comment}{! the layer, note that we define the positive direction as flux out of the box.}}
\DoxyCodeLine{162   \textcolor{comment}{! Hence, uh(I-\/1) is multipled by negative one, but uh(I) is not}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{165   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{166 }
\DoxyCodeLine{167   \textcolor{comment}{! Calculate top and bottom fluxes from ea and eb. Note the explicit negative signs}}
\DoxyCodeLine{168   \textcolor{comment}{! to enforce the positive out convention}}
\DoxyCodeLine{169   k = 1}
\DoxyCodeLine{170   \textcolor{keywordflow}{do} j=js-\/1,je+1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{171     top\_flux(i,j,k) = -\/ea(i,j,k)}
\DoxyCodeLine{172     bottom\_flux(i,j,k) = -\/(eb(i,j,k)-\/ea(i,j,k+1))}
\DoxyCodeLine{173 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{174 }
\DoxyCodeLine{175   \textcolor{keywordflow}{do} k=2, nz-\/1 ; \textcolor{keywordflow}{do} j=js-\/1,je+1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{176     top\_flux(i,j,k) = -\/(ea(i,j,k)-\/eb(i,j,k-\/1))}
\DoxyCodeLine{177     bottom\_flux(i,j,k) = -\/(eb(i,j,k)-\/ea(i,j,k+1))}
\DoxyCodeLine{178 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{179 }
\DoxyCodeLine{180   k=nz}
\DoxyCodeLine{181   \textcolor{keywordflow}{do} j=js-\/1,je+1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{182     top\_flux(i,j,k) = -\/(ea(i,j,k)-\/eb(i,j,k-\/1))}
\DoxyCodeLine{183     bottom\_flux(i,j,k) = -\/eb(i,j,k)}
\DoxyCodeLine{184 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{185 }
\DoxyCodeLine{186 }
\DoxyCodeLine{187   \textcolor{comment}{! Calculate sum of positive fluxes (negatives applied to enforce convention)}}
\DoxyCodeLine{188   \textcolor{comment}{! in a given cell and scale it back if it would deplete a layer}}
\DoxyCodeLine{189   \textcolor{keywordflow}{do} k = 1, nz ; \textcolor{keywordflow}{do} j=js-\/1,je+1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{190 }
\DoxyCodeLine{191     hvol = h\_pre(i,j,k)*g\%US\%L\_to\_m**2*g\%areaT(i,j)}
\DoxyCodeLine{192     pos\_flux  = max(0.0,-\/uh(i-\/1,j,k)) + max(0.0, -\/vh(i,j-\/1,k)) + \&}
\DoxyCodeLine{193       max(0.0, uh(i,j,k)) + max(0.0, vh(i,j,k)) + \&}
\DoxyCodeLine{194       max(0.0, top\_flux(i,j,k)*g\%US\%L\_to\_m**2*g\%areaT(i,j)) + max(0.0, bottom\_flux(i,j,k)*g\%US\%L\_to\_m**2*g\%areaT(i,j))}
\DoxyCodeLine{195 }
\DoxyCodeLine{196     \textcolor{keywordflow}{if} (pos\_flux>hvol .and. pos\_flux>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{197       scale\_factor = ( hvol )/pos\_flux*max\_off\_cfl}
\DoxyCodeLine{198     \textcolor{keywordflow}{else} \textcolor{comment}{! Don't scale}}
\DoxyCodeLine{199       scale\_factor = 1.0}
\DoxyCodeLine{200 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{201 }
\DoxyCodeLine{202     \textcolor{comment}{! Scale horizontal fluxes}}
\DoxyCodeLine{203     \textcolor{keywordflow}{if} (-\/uh(i-\/1,j,k)>0) uh(i-\/1,j,k) = uh(i-\/1,j,k)*scale\_factor}
\DoxyCodeLine{204     \textcolor{keywordflow}{if} (uh(i,j,k)>0)    uh(i,j,k)   = uh(i,j,k)*scale\_factor}
\DoxyCodeLine{205     \textcolor{keywordflow}{if} (-\/vh(i,j-\/1,k)>0) vh(i,j-\/1,k) = vh(i,j-\/1,k)*scale\_factor}
\DoxyCodeLine{206     \textcolor{keywordflow}{if} (vh(i,j,k)>0)    vh(i,j,k)   = vh(i,j,k)*scale\_factor}
\DoxyCodeLine{207 }
\DoxyCodeLine{208     \textcolor{keywordflow}{if} (k>1 .and. k<nz) \textcolor{keywordflow}{then}}
\DoxyCodeLine{209     \textcolor{comment}{! Scale interior layers}}
\DoxyCodeLine{210       \textcolor{keywordflow}{if} (top\_flux(i,j,k)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{211         ea(i,j,k) = ea(i,j,k)*scale\_factor}
\DoxyCodeLine{212         eb(i,j,k-\/1) = eb(i,j,k-\/1)*scale\_factor}
\DoxyCodeLine{213 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{214       \textcolor{keywordflow}{if} (bottom\_flux(i,j,k)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{215         eb(i,j,k) = eb(i,j,k)*scale\_factor}
\DoxyCodeLine{216         ea(i,j,k+1) = ea(i,j,k+1)*scale\_factor}
\DoxyCodeLine{217 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{218     \textcolor{comment}{! Scale top layer}}
\DoxyCodeLine{219     \textcolor{keywordflow}{elseif} (k==1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{220       \textcolor{keywordflow}{if} (top\_flux(i,j,k)>0.0)    ea(i,j,k) = ea(i,j,k)*scale\_factor}
\DoxyCodeLine{221       \textcolor{keywordflow}{if} (bottom\_flux(i,j,k)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{222         eb(i,j,k)   = eb(i,j,k)*scale\_factor}
\DoxyCodeLine{223         ea(i,j,k+1) = ea(i,j,k+1)*scale\_factor}
\DoxyCodeLine{224 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{225     \textcolor{comment}{! Scale bottom layer}}
\DoxyCodeLine{226     \textcolor{keywordflow}{elseif} (k==nz) \textcolor{keywordflow}{then}}
\DoxyCodeLine{227       \textcolor{keywordflow}{if} (top\_flux(i,j,k)>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{228         ea(i,j,k)   = ea(i,j,k)*scale\_factor}
\DoxyCodeLine{229         eb(i,j,k-\/1) = eb(i,j,k-\/1)*scale\_factor}
\DoxyCodeLine{230 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{231       \textcolor{keywordflow}{if} (bottom\_flux(i,j,k)>0.0) eb(i,j,k)=eb(i,j,k)*scale\_factor}
\DoxyCodeLine{232 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{233 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{234 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_ac03963f0ae27e12160f78c6a420bc7a8}\label{namespacemom__offline__aux_ac03963f0ae27e12160f78c6a420bc7a8}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!offline\_add\_diurnal\_sw@{offline\_add\_diurnal\_sw}}
\index{offline\_add\_diurnal\_sw@{offline\_add\_diurnal\_sw}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{offline\_add\_diurnal\_sw()}{offline\_add\_diurnal\_sw()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::offline\+\_\+add\+\_\+diurnal\+\_\+sw (\begin{DoxyParamCaption}\item[{type(forcing), intent(inout)}]{fluxes,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(time\+\_\+type), intent(in)}]{Time\+\_\+start,  }\item[{type(time\+\_\+type), intent(in)}]{Time\+\_\+end }\end{DoxyParamCaption})}



add\+\_\+diurnal\+\_\+\+SW adjusts the shortwave fluxes in an forcying\+\_\+type variable to add a synthetic diurnal cycle. Adapted from S\+I\+S2 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em fluxes} & The type with atmospheric fluxes to be adjusted. \\
\hline
\mbox{\texttt{ in}}  & {\em g} & The ocean lateral grid type. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+start} & The start time for this step. \\
\hline
\mbox{\texttt{ in}}  & {\em time\+\_\+end} & The ending time for this step. \\
\hline
\end{DoxyParams}


Definition at line 576 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{577   \textcolor{keywordtype}{type}(forcing),         \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{ !< The type with atmospheric fluxes to be adjusted.}}
\DoxyCodeLine{578   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{      !< The ocean lateral grid type.}}
\DoxyCodeLine{579   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: Time\_start\textcolor{comment}{ !< The start time for this step.}}
\DoxyCodeLine{580   \textcolor{keywordtype}{type}(time\_type),       \textcolor{keywordtype}{intent(in)}    :: Time\_end\textcolor{comment}{   !< The ending time for this step.}}
\DoxyCodeLine{581 }
\DoxyCodeLine{582 \textcolor{keywordtype}{  real} :: diurnal\_factor, time\_since\_ae, rad}
\DoxyCodeLine{583 \textcolor{keywordtype}{  real} :: fracday\_dt, fracday\_day}
\DoxyCodeLine{584 \textcolor{keywordtype}{  real} :: cosz\_day, cosz\_dt, rrsun\_day, rrsun\_dt}
\DoxyCodeLine{585   \textcolor{keywordtype}{type}(time\_type) :: dt\_here}
\DoxyCodeLine{586 }
\DoxyCodeLine{587   \textcolor{keywordtype}{integer} :: i, j, k, i2, j2, isc, iec, jsc, jec, i\_off, j\_off}
\DoxyCodeLine{588 }
\DoxyCodeLine{589   isc = g\%isc ; iec = g\%iec ; jsc = g\%jsc ; jec = g\%jec}
\DoxyCodeLine{590   i\_off = lbound(fluxes\%sens,1) -\/ g\%isc ; j\_off = lbound(fluxes\%sens,2) -\/ g\%jsc}
\DoxyCodeLine{591 }
\DoxyCodeLine{592   \textcolor{comment}{!   Orbital\_time extracts the time of year relative to the northern}}
\DoxyCodeLine{593   \textcolor{comment}{! hemisphere autumnal equinox from a time\_type variable.}}
\DoxyCodeLine{594   time\_since\_ae = orbital\_time(time\_start)}
\DoxyCodeLine{595   dt\_here = time\_end -\/ time\_start}
\DoxyCodeLine{596   rad = acos(-\/1.)/180.}
\DoxyCodeLine{597 }
\DoxyCodeLine{598 \textcolor{comment}{!\$OMP parallel do default(none) shared(isc,iec,jsc,jec,G,rad,Time\_start,dt\_here,time\_since\_ae, \&}}
\DoxyCodeLine{599 \textcolor{comment}{!\$OMP                                  fluxes,i\_off,j\_off) \&}}
\DoxyCodeLine{600 \textcolor{comment}{!\$OMP                          private(i,j,i2,j2,k,cosz\_dt,fracday\_dt,rrsun\_dt, \&}}
\DoxyCodeLine{601 \textcolor{comment}{!\$OMP                                  fracday\_day,cosz\_day,rrsun\_day,diurnal\_factor)}}
\DoxyCodeLine{602   \textcolor{keywordflow}{do} j=jsc,jec ; \textcolor{keywordflow}{do} i=isc,iec}
\DoxyCodeLine{603 \textcolor{comment}{!    Per Rick Hemler:}}
\DoxyCodeLine{604 \textcolor{comment}{!      Call diurnal\_solar with dtime=dt\_here to get cosz averaged over dt\_here.}}
\DoxyCodeLine{605 \textcolor{comment}{!      Call daily\_mean\_solar to get cosz averaged over a day.  Then}}
\DoxyCodeLine{606 \textcolor{comment}{!      diurnal\_factor = cosz\_dt\_ice*fracday\_dt\_ice*rrsun\_dt\_ice /}}
\DoxyCodeLine{607 \textcolor{comment}{!                       cosz\_day*fracday\_day*rrsun\_day}}
\DoxyCodeLine{608 }
\DoxyCodeLine{609     \textcolor{keyword}{call }diurnal\_solar(g\%geoLatT(i,j)*rad, g\%geoLonT(i,j)*rad, time\_start, cosz=cosz\_dt, \&}
\DoxyCodeLine{610                        fracday=fracday\_dt, rrsun=rrsun\_dt, dt\_time=dt\_here)}
\DoxyCodeLine{611     \textcolor{keyword}{call }daily\_mean\_solar(g\%geoLatT(i,j)*rad, time\_since\_ae, cosz\_day, fracday\_day, rrsun\_day)}
\DoxyCodeLine{612     diurnal\_factor = cosz\_dt*fracday\_dt*rrsun\_dt / \&}
\DoxyCodeLine{613                      max(1e-\/30, cosz\_day*fracday\_day*rrsun\_day)}
\DoxyCodeLine{614 }
\DoxyCodeLine{615     i2 = i+i\_off ; j2 = j+j\_off}
\DoxyCodeLine{616     fluxes\%sw(i2,j2) = fluxes\%sw(i2,j2) * diurnal\_factor}
\DoxyCodeLine{617     fluxes\%sw\_vis\_dir(i2,j2) = fluxes\%sw\_vis\_dir(i2,j2) * diurnal\_factor}
\DoxyCodeLine{618     fluxes\%sw\_vis\_dif(i2,j2) = fluxes\%sw\_vis\_dif(i2,j2) * diurnal\_factor}
\DoxyCodeLine{619     fluxes\%sw\_nir\_dir(i2,j2) = fluxes\%sw\_nir\_dir(i2,j2) * diurnal\_factor}
\DoxyCodeLine{620     fluxes\%sw\_nir\_dif(i2,j2) = fluxes\%sw\_nir\_dif(i2,j2) * diurnal\_factor}
\DoxyCodeLine{621 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{622 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a2a72a34fb47df31ad8a10ee51b4beca3}\label{namespacemom__offline__aux_a2a72a34fb47df31ad8a10ee51b4beca3}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!update\_h\_horizontal\_flux@{update\_h\_horizontal\_flux}}
\index{update\_h\_horizontal\_flux@{update\_h\_horizontal\_flux}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{update\_h\_horizontal\_flux()}{update\_h\_horizontal\_flux()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::update\+\_\+h\+\_\+horizontal\+\_\+flux (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{uhtr,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, g \%ke), intent(in)}]{vhtr,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h\+\_\+pre,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{h\+\_\+new }\end{DoxyParamCaption})}



This updates thickness based on the convergence of horizontal mass fluxes N\+O\+TE\+: Only used in non-\/\+A\+LE mode. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em uhtr} & Accumulated mass flux through zonal face \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em vhtr} & Accumulated mass flux through meridional face \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+pre} & Previous layer thicknesses \mbox{[}kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in,out}}  & {\em h\+\_\+new} & Updated layer thicknesses \mbox{[}kg m-\/2\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 45 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{46   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{     !< ocean grid structure}}
\DoxyCodeLine{47   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{48 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{49                            \textcolor{keywordtype}{intent(in)}    :: uhtr\textcolor{comment}{  !< Accumulated mass flux through zonal face [kg]}}
\DoxyCodeLine{50 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{51                            \textcolor{keywordtype}{intent(in)}    :: vhtr\textcolor{comment}{  !< Accumulated mass flux through meridional face [kg]}}
\DoxyCodeLine{52 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{53                            \textcolor{keywordtype}{intent(in)}    :: h\_pre\textcolor{comment}{ !< Previous layer thicknesses [kg m-\/2].}}
\DoxyCodeLine{54 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{55                            \textcolor{keywordtype}{intent(inout)} :: h\_new\textcolor{comment}{ !< Updated layer thicknesses [kg m-\/2].}}
\DoxyCodeLine{56 }
\DoxyCodeLine{57   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{58   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz}
\DoxyCodeLine{59   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{60   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{61 }
\DoxyCodeLine{62   \textcolor{keywordflow}{do} k = 1, nz}
\DoxyCodeLine{63     \textcolor{keywordflow}{do} i=is-\/1,ie+1 ; \textcolor{keywordflow}{do} j=js-\/1,je+1}
\DoxyCodeLine{64 }
\DoxyCodeLine{65       h\_new(i,j,k) = max(0.0, g\%US\%L\_to\_m**2*g\%areaT(i,j)*h\_pre(i,j,k) + \&}
\DoxyCodeLine{66         ((uhtr(i-\/1,j,k) -\/ uhtr(i,j,k)) + (vhtr(i,j-\/1,k) -\/ vhtr(i,j,k))))}
\DoxyCodeLine{67 }
\DoxyCodeLine{68       \textcolor{comment}{! In the case that the layer is now dramatically thinner than it was previously,}}
\DoxyCodeLine{69       \textcolor{comment}{! add a bit of mass to avoid truncation errors.  This will lead to}}
\DoxyCodeLine{70       \textcolor{comment}{! non-\/conservation of tracers}}
\DoxyCodeLine{71       h\_new(i,j,k) = h\_new(i,j,k) + \&}
\DoxyCodeLine{72         max(gv\%Angstrom\_H, 1.0e-\/13*h\_new(i,j,k) -\/ g\%US\%L\_to\_m**2*g\%areaT(i,j)*h\_pre(i,j,k))}
\DoxyCodeLine{73 }
\DoxyCodeLine{74       \textcolor{comment}{! Convert back to thickness}}
\DoxyCodeLine{75       h\_new(i,j,k) = h\_new(i,j,k) / (g\%US\%L\_to\_m**2*g\%areaT(i,j))}
\DoxyCodeLine{76 }
\DoxyCodeLine{77 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{78 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a1dd22761e228785bf84f2d6db11ba8cc}\label{namespacemom__offline__aux_a1dd22761e228785bf84f2d6db11ba8cc}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!update\_h\_vertical\_flux@{update\_h\_vertical\_flux}}
\index{update\_h\_vertical\_flux@{update\_h\_vertical\_flux}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{update\_h\_vertical\_flux()}{update\_h\_vertical\_flux()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::update\+\_\+h\+\_\+vertical\+\_\+flux (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), pointer}]{G,  }\item[{type(verticalgrid\+\_\+type), pointer}]{GV,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{ea,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{eb,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h\+\_\+pre,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(inout)}]{h\+\_\+new }\end{DoxyParamCaption})}



Updates layer thicknesses due to vertical mass transports N\+O\+TE\+: Only used in non-\/\+A\+LE configuration. 


\begin{DoxyParams}[1]{Parameters}
 & {\em g} & ocean grid structure \\
\hline
 & {\em gv} & ocean vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em ea} & Mass of fluid entrained from the layer \\
\hline
\mbox{\texttt{ in}}  & {\em eb} & Mass of fluid entrained from the layer \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+pre} & Layer thicknesses at the end of the previous \\
\hline
\mbox{\texttt{ in,out}}  & {\em h\+\_\+new} & Updated layer thicknesses \mbox{[}kg m-\/2\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 83 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{84   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{pointer}       :: G\textcolor{comment}{     !< ocean grid structure}}
\DoxyCodeLine{85   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{pointer}       :: GV\textcolor{comment}{    !< ocean vertical grid structure}}
\DoxyCodeLine{86 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{87                            \textcolor{keywordtype}{intent(in)}    :: ea\textcolor{comment}{    !< Mass of fluid entrained from the layer}}
\DoxyCodeLine{88 \textcolor{comment}{                                                  !! above within this timestep [kg m-\/2]}}
\DoxyCodeLine{89 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{90                            \textcolor{keywordtype}{intent(in)}    :: eb\textcolor{comment}{    !< Mass of fluid entrained from the layer}}
\DoxyCodeLine{91 \textcolor{comment}{                                                  !! below within this timestep [kg m-\/2]}}
\DoxyCodeLine{92 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{93                            \textcolor{keywordtype}{intent(in)}    :: h\_pre\textcolor{comment}{ !< Layer thicknesses at the end of the previous}}
\DoxyCodeLine{94 \textcolor{comment}{                                                  !! step [kg m-\/2].}}
\DoxyCodeLine{95 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{96                            \textcolor{keywordtype}{intent(inout)} :: h\_new\textcolor{comment}{ !< Updated layer thicknesses [kg m-\/2].}}
\DoxyCodeLine{97 }
\DoxyCodeLine{98   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{99   \textcolor{keywordtype}{integer} :: i, j, k, m, is, ie, js, je, nz}
\DoxyCodeLine{100   \textcolor{comment}{! Set index-\/related variables for fields on T-\/grid}}
\DoxyCodeLine{101   is  = g\%isc ; ie  = g\%iec ; js  = g\%jsc ; je  = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{102 }
\DoxyCodeLine{103   \textcolor{comment}{! Update h\_new with convergence of vertical mass transports}}
\DoxyCodeLine{104   \textcolor{keywordflow}{do} j=js-\/1,je+1}
\DoxyCodeLine{105     \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{106 }
\DoxyCodeLine{107       \textcolor{comment}{! Top layer}}
\DoxyCodeLine{108       h\_new(i,j,1) = max(0.0, h\_pre(i,j,1) + (eb(i,j,1) -\/ ea(i,j,2) + ea(i,j,1) ))}
\DoxyCodeLine{109       h\_new(i,j,1) = h\_new(i,j,1) + \&}
\DoxyCodeLine{110           max(0.0, 1.0e-\/13*h\_new(i,j,1) -\/ h\_pre(i,j,1))}
\DoxyCodeLine{111 }
\DoxyCodeLine{112       \textcolor{comment}{! Bottom layer}}
\DoxyCodeLine{113 \textcolor{comment}{!        h\_new(i,j,nz) = h\_pre(i,j,nz) + (ea(i,j,nz) -\/ eb(i,j,nz-\/1)+eb(i,j,nz))}}
\DoxyCodeLine{114       h\_new(i,j,nz) = max(0.0, h\_pre(i,j,nz) + (ea(i,j,nz) -\/ eb(i,j,nz-\/1)+eb(i,j,nz)))}
\DoxyCodeLine{115       h\_new(i,j,nz) = h\_new(i,j,nz) + \&}
\DoxyCodeLine{116           max(0.0, 1.0e-\/13*h\_new(i,j,nz) -\/ h\_pre(i,j,nz))}
\DoxyCodeLine{117 }
\DoxyCodeLine{118 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{119 }
\DoxyCodeLine{120     \textcolor{comment}{! Interior layers}}
\DoxyCodeLine{121     \textcolor{keywordflow}{do} k=2,nz-\/1 ; \textcolor{keywordflow}{do} i=is-\/1,ie+1}
\DoxyCodeLine{122 }
\DoxyCodeLine{123       h\_new(i,j,k) = max(0.0, h\_pre(i,j,k) + ((ea(i,j,k) -\/ eb(i,j,k-\/1)) + \&}
\DoxyCodeLine{124           (eb(i,j,k) -\/ ea(i,j,k+1))))}
\DoxyCodeLine{125       h\_new(i,j,k) = h\_new(i,j,k) + \&}
\DoxyCodeLine{126         max(0.0, 1.0e-\/13*h\_new(i,j,k) -\/ h\_pre(i,j,k))}
\DoxyCodeLine{127 }
\DoxyCodeLine{128 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{129 }
\DoxyCodeLine{130 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{131 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a6fc82d358eae9030a030182290a30858}\label{namespacemom__offline__aux_a6fc82d358eae9030a030182290a30858}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!update\_offline\_from\_arrays@{update\_offline\_from\_arrays}}
\index{update\_offline\_from\_arrays@{update\_offline\_from\_arrays}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{update\_offline\_from\_arrays()}{update\_offline\_from\_arrays()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::update\+\_\+offline\+\_\+from\+\_\+arrays (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{integer, intent(in)}]{nk\+\_\+input,  }\item[{integer, intent(in)}]{ridx\+\_\+sum,  }\item[{character(len=200), intent(in)}]{mean\+\_\+file,  }\item[{character(len=200), intent(in)}]{sum\+\_\+file,  }\item[{character(len=200), intent(in)}]{snap\+\_\+file,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uhtr,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vhtr,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{hend,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(inout), allocatable}]{uhtr\+\_\+all,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(inout), allocatable}]{vhtr\+\_\+all,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(inout), allocatable}]{hend\+\_\+all,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{temp,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{salt,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(inout), allocatable}]{temp\+\_\+all,  }\item[{real, dimension(\+:,\+:,\+:,\+:), intent(inout), allocatable}]{salt\+\_\+all }\end{DoxyParamCaption})}



Fields for offline transport are copied from the stored arrays read during initialization. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & Horizontal grid type \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid type \\
\hline
\mbox{\texttt{ in}}  & {\em nk\+\_\+input} & Number of levels in input file \\
\hline
\mbox{\texttt{ in}}  & {\em ridx\+\_\+sum} & Index to read from \\
\hline
\mbox{\texttt{ in}}  & {\em mean\+\_\+file} & Name of file with averages fields \\
\hline
\mbox{\texttt{ in}}  & {\em sum\+\_\+file} & Name of file with summed fields \\
\hline
\mbox{\texttt{ in}}  & {\em snap\+\_\+file} & Name of file with snapshot fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em uhtr} & Zonal mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vhtr} & Meridional mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em hend} & End of timestep layer thickness \mbox{[}kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em uhtr\+\_\+all} & Zonal mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vhtr\+\_\+all} & Meridional mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em hend\+\_\+all} & End of timestep layer thickness \mbox{[}kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em temp} & Temperature array \\
\hline
\mbox{\texttt{ in,out}}  & {\em salt} & Salinity array \\
\hline
\mbox{\texttt{ in,out}}  & {\em temp\+\_\+all} & Temperature array \\
\hline
\mbox{\texttt{ in,out}}  & {\em salt\+\_\+all} & Salinity array \\
\hline
\end{DoxyParams}


Definition at line 763 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{765   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{         !< Horizontal grid type}}
\DoxyCodeLine{766   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in   )} :: GV\textcolor{comment}{        !< Vertical grid type}}
\DoxyCodeLine{767   \textcolor{keywordtype}{integer},                                   \textcolor{keywordtype}{intent(in   )} :: nk\_input\textcolor{comment}{  !< Number of levels in input file}}
\DoxyCodeLine{768   \textcolor{keywordtype}{integer},                                   \textcolor{keywordtype}{intent(in   )} :: ridx\_sum\textcolor{comment}{  !< Index to read from}}
\DoxyCodeLine{769   \textcolor{keywordtype}{character(len=200)},                        \textcolor{keywordtype}{intent(in   )} :: mean\_file\textcolor{comment}{ !< Name of file with averages fields}}
\DoxyCodeLine{770   \textcolor{keywordtype}{character(len=200)},                        \textcolor{keywordtype}{intent(in   )} :: sum\_file\textcolor{comment}{  !< Name of file with summed fields}}
\DoxyCodeLine{771   \textcolor{keywordtype}{character(len=200)},                        \textcolor{keywordtype}{intent(in   )} :: snap\_file\textcolor{comment}{ !< Name of file with snapshot fields}}
\DoxyCodeLine{772 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: uhtr\textcolor{comment}{      !< Zonal mass fluxes [kg]}}
\DoxyCodeLine{773 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(inout)} :: vhtr\textcolor{comment}{      !< Meridional mass fluxes [kg]}}
\DoxyCodeLine{774 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(inout)} :: hend\textcolor{comment}{      !< End of timestep layer thickness [kg m-\/2]}}
\DoxyCodeLine{775 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{allocatable},     \textcolor{keywordtype}{intent(inout)} :: uhtr\_all\textcolor{comment}{  !< Zonal mass fluxes [kg]}}
\DoxyCodeLine{776 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{allocatable},     \textcolor{keywordtype}{intent(inout)} :: vhtr\_all\textcolor{comment}{  !< Meridional mass fluxes [kg]}}
\DoxyCodeLine{777 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{allocatable},     \textcolor{keywordtype}{intent(inout)} :: hend\_all\textcolor{comment}{  !< End of timestep layer thickness [kg m-\/2]}}
\DoxyCodeLine{778 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(inout)} :: temp\textcolor{comment}{      !< Temperature array}}
\DoxyCodeLine{779 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \textcolor{keywordtype}{intent(inout)} :: salt\textcolor{comment}{      !< Salinity array}}
\DoxyCodeLine{780 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{allocatable},     \textcolor{keywordtype}{intent(inout)} :: temp\_all\textcolor{comment}{  !< Temperature array}}
\DoxyCodeLine{781 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:,:,:,:)}, \textcolor{keywordtype}{allocatable},     \textcolor{keywordtype}{intent(inout)} :: salt\_all\textcolor{comment}{  !< Salinity array}}
\DoxyCodeLine{782 }
\DoxyCodeLine{783   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{784 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{parameter} :: fill\_value = 0.}
\DoxyCodeLine{785   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{786 }
\DoxyCodeLine{787   \textcolor{comment}{! Check that all fields are allocated (this is a redundant check)}}
\DoxyCodeLine{788   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(uhtr\_all)) \&}
\DoxyCodeLine{789       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"uhtr\_all not allocated before call to update\_transport\_from\_arrays"})}
\DoxyCodeLine{790   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(vhtr\_all)) \&}
\DoxyCodeLine{791       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"vhtr\_all not allocated before call to update\_transport\_from\_arrays"})}
\DoxyCodeLine{792   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(hend\_all)) \&}
\DoxyCodeLine{793       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"hend\_all not allocated before call to update\_transport\_from\_arrays"})}
\DoxyCodeLine{794   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(temp\_all)) \&}
\DoxyCodeLine{795       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"temp\_all not allocated before call to update\_transport\_from\_arrays"})}
\DoxyCodeLine{796   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{allocated}(salt\_all)) \&}
\DoxyCodeLine{797       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"salt\_all not allocated before call to update\_transport\_from\_arrays"})}
\DoxyCodeLine{798 }
\DoxyCodeLine{799   \textcolor{comment}{! Copy uh, vh, h\_end, temp, and salt}}
\DoxyCodeLine{800   \textcolor{keywordflow}{do} k=1,nk\_input ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{801     uhtr(i,j,k) = uhtr\_all(i,j,k,ridx\_sum)}
\DoxyCodeLine{802     vhtr(i,j,k) = vhtr\_all(i,j,k,ridx\_sum)}
\DoxyCodeLine{803     hend(i,j,k) = hend\_all(i,j,k,ridx\_sum)}
\DoxyCodeLine{804     temp(i,j,k) = temp\_all(i,j,k,ridx\_sum)}
\DoxyCodeLine{805     salt(i,j,k) = salt\_all(i,j,k,ridx\_sum)}
\DoxyCodeLine{806 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{807 }
\DoxyCodeLine{808   \textcolor{comment}{! Fill the rest of the arrays with 0s (fill\_value could probably be changed to a runtime parameter)}}
\DoxyCodeLine{809   \textcolor{keywordflow}{do} k=nk\_input+1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{810     uhtr(i,j,k) = fill\_value}
\DoxyCodeLine{811     vhtr(i,j,k) = fill\_value}
\DoxyCodeLine{812     hend(i,j,k) = fill\_value}
\DoxyCodeLine{813     temp(i,j,k) = fill\_value}
\DoxyCodeLine{814     salt(i,j,k) = fill\_value}
\DoxyCodeLine{815 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{816 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__offline__aux_a088f31cd992ae91a4610aafe43b04c08}\label{namespacemom__offline__aux_a088f31cd992ae91a4610aafe43b04c08}} 
\index{mom\_offline\_aux@{mom\_offline\_aux}!update\_offline\_from\_files@{update\_offline\_from\_files}}
\index{update\_offline\_from\_files@{update\_offline\_from\_files}!mom\_offline\_aux@{mom\_offline\_aux}}
\doxysubsubsection{\texorpdfstring{update\_offline\_from\_files()}{update\_offline\_from\_files()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+offline\+\_\+aux\+::update\+\_\+offline\+\_\+from\+\_\+files (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(inout)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{integer, intent(in)}]{nk\+\_\+input,  }\item[{character(len=$\ast$), intent(in)}]{mean\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{sum\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{snap\+\_\+file,  }\item[{character(len=$\ast$), intent(in)}]{surf\+\_\+file,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{h\+\_\+end,  }\item[{real, dimension(szib\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{uhtr,  }\item[{real, dimension(szi\+\_\+(g),szjb\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{vhtr,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{temp\+\_\+mean,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(inout)}]{salt\+\_\+mean,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g)), intent(inout)}]{mld,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)+1), intent(inout)}]{Kd,  }\item[{type(forcing), intent(inout)}]{fluxes,  }\item[{integer, intent(in)}]{ridx\+\_\+sum,  }\item[{integer, intent(in)}]{ridx\+\_\+snap,  }\item[{logical, intent(in)}]{read\+\_\+mld,  }\item[{logical, intent(in)}]{read\+\_\+sw,  }\item[{logical, intent(in)}]{read\+\_\+ts\+\_\+uvh,  }\item[{logical, intent(in), optional}]{do\+\_\+ale\+\_\+in }\end{DoxyParamCaption})}



Controls the reading in 3d mass fluxes, diffusive fluxes, and other fields stored in a previous integration of the online model. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in,out}}  & {\em g} & Horizontal grid type \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid type \\
\hline
\mbox{\texttt{ in}}  & {\em nk\+\_\+input} & Number of levels in input file \\
\hline
\mbox{\texttt{ in}}  & {\em mean\+\_\+file} & Name of file with averages fields \\
\hline
\mbox{\texttt{ in}}  & {\em sum\+\_\+file} & Name of file with summed fields \\
\hline
\mbox{\texttt{ in}}  & {\em snap\+\_\+file} & Name of file with snapshot fields \\
\hline
\mbox{\texttt{ in}}  & {\em surf\+\_\+file} & Name of file with surface fields \\
\hline
\mbox{\texttt{ in,out}}  & {\em uhtr} & Zonal mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em vhtr} & Meridional mass fluxes \mbox{[}kg\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em h\+\_\+end} & End of timestep layer thickness \\
\hline
\mbox{\texttt{ in,out}}  & {\em temp\+\_\+mean} & Averaged temperature \\
\hline
\mbox{\texttt{ in,out}}  & {\em salt\+\_\+mean} & Averaged salinity \\
\hline
\mbox{\texttt{ in,out}}  & {\em mld} & Averaged mixed layer depth \\
\hline
\mbox{\texttt{ in,out}}  & {\em kd} & Diapycnal diffusivities at interfaces \\
\hline
\mbox{\texttt{ in,out}}  & {\em fluxes} & Fields with surface fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em ridx\+\_\+sum} & Read index for sum, mean, and surf files \\
\hline
\mbox{\texttt{ in}}  & {\em ridx\+\_\+snap} & Read index for snapshot file \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+mld} & True if reading in M\+LD \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+sw} & True if reading in radiative fluxes \\
\hline
\mbox{\texttt{ in}}  & {\em read\+\_\+ts\+\_\+uvh} & True if reading in uh, vh, and h \\
\hline
\mbox{\texttt{ in}}  & {\em do\+\_\+ale\+\_\+in} & True if using A\+LE algorithms \\
\hline
\end{DoxyParams}


Definition at line 627 of file M\+O\+M\+\_\+offline\+\_\+aux.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{630 }
\DoxyCodeLine{631   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(inout)} :: G\textcolor{comment}{         !< Horizontal grid type}}
\DoxyCodeLine{632   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in   )} :: GV\textcolor{comment}{        !< Vertical grid type}}
\DoxyCodeLine{633   \textcolor{keywordtype}{integer},                 \textcolor{keywordtype}{intent(in   )} :: nk\_input\textcolor{comment}{  !< Number of levels in input file}}
\DoxyCodeLine{634   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in   )} :: mean\_file\textcolor{comment}{ !< Name of file with averages fields}}
\DoxyCodeLine{635   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in   )} :: sum\_file\textcolor{comment}{  !< Name of file with summed fields}}
\DoxyCodeLine{636   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in   )} :: snap\_file\textcolor{comment}{ !< Name of file with snapshot fields}}
\DoxyCodeLine{637   \textcolor{keywordtype}{character(len=*)},        \textcolor{keywordtype}{intent(in   )} :: surf\_file\textcolor{comment}{ !< Name of file with surface fields}}
\DoxyCodeLine{638 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{639                            \textcolor{keywordtype}{intent(inout)} :: uhtr\textcolor{comment}{      !< Zonal mass fluxes [kg]}}
\DoxyCodeLine{640 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{641                            \textcolor{keywordtype}{intent(inout)} :: vhtr\textcolor{comment}{      !< Meridional mass fluxes [kg]}}
\DoxyCodeLine{642 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{643                            \textcolor{keywordtype}{intent(inout)} :: h\_end\textcolor{comment}{     !< End of timestep layer thickness}}
\DoxyCodeLine{644 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{645                            \textcolor{keywordtype}{intent(inout)} :: temp\_mean\textcolor{comment}{ !< Averaged temperature}}
\DoxyCodeLine{646 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))},  \&}
\DoxyCodeLine{647                            \textcolor{keywordtype}{intent(inout)} :: salt\_mean\textcolor{comment}{ !< Averaged salinity}}
\DoxyCodeLine{648 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))},          \&}
\DoxyCodeLine{649                            \textcolor{keywordtype}{intent(inout)} :: mld\textcolor{comment}{       !< Averaged mixed layer depth}}
\DoxyCodeLine{650 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G)+1)}, \&}
\DoxyCodeLine{651                            \textcolor{keywordtype}{intent(inout)} :: Kd\textcolor{comment}{        !< Diapycnal diffusivities at interfaces}}
\DoxyCodeLine{652   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(inout)} :: fluxes\textcolor{comment}{    !< Fields with surface fluxes}}
\DoxyCodeLine{653   \textcolor{keywordtype}{integer},                 \textcolor{keywordtype}{intent(in   )} :: ridx\_sum\textcolor{comment}{  !< Read index for sum, mean, and surf files}}
\DoxyCodeLine{654   \textcolor{keywordtype}{integer},                 \textcolor{keywordtype}{intent(in   )} :: ridx\_snap\textcolor{comment}{ !< Read index for snapshot file}}
\DoxyCodeLine{655   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in   )} :: read\_mld\textcolor{comment}{  !< True if reading in MLD}}
\DoxyCodeLine{656   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in   )} :: read\_sw\textcolor{comment}{   !< True if reading in radiative fluxes}}
\DoxyCodeLine{657   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in   )} :: read\_ts\_uvh\textcolor{comment}{ !< True if reading in uh, vh, and h}}
\DoxyCodeLine{658   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in   )} :: do\_ale\_in\textcolor{comment}{ !< True if using ALE algorithms}}
\DoxyCodeLine{659 }
\DoxyCodeLine{660   \textcolor{keywordtype}{logical} :: do\_ale}
\DoxyCodeLine{661   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{662 \textcolor{keywordtype}{  real}    :: Initer\_vert}
\DoxyCodeLine{663 }
\DoxyCodeLine{664   do\_ale = .false.}
\DoxyCodeLine{665   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(do\_ale\_in) ) do\_ale = do\_ale\_in}
\DoxyCodeLine{666 }
\DoxyCodeLine{667   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{668 }
\DoxyCodeLine{669   \textcolor{comment}{! Check if reading in UH, VH, and h\_end}}
\DoxyCodeLine{670   \textcolor{keywordflow}{if} (read\_ts\_uvh) \textcolor{keywordflow}{then}}
\DoxyCodeLine{671     h\_end(:,:,:) = 0.0}
\DoxyCodeLine{672     temp\_mean(:,:,:) = 0.0}
\DoxyCodeLine{673     salt\_mean(:,:,:) = 0.0}
\DoxyCodeLine{674     uhtr(:,:,:) = 0.0}
\DoxyCodeLine{675     vhtr(:,:,:) = 0.0}
\DoxyCodeLine{676     \textcolor{comment}{! Time-\/summed fields}}
\DoxyCodeLine{677     \textcolor{keyword}{call }mom\_read\_vector(sum\_file, \textcolor{stringliteral}{'uhtr\_sum'}, \textcolor{stringliteral}{'vhtr\_sum'}, uhtr(:,:,1:nk\_input), \&}
\DoxyCodeLine{678                          vhtr(:,:,1:nk\_input), g\%Domain, timelevel=ridx\_sum)}
\DoxyCodeLine{679     \textcolor{keyword}{call }mom\_read\_data(snap\_file, \textcolor{stringliteral}{'h\_end'}, h\_end(:,:,1:nk\_input), g\%Domain, \&}
\DoxyCodeLine{680                        timelevel=ridx\_snap,position=center)}
\DoxyCodeLine{681     \textcolor{keyword}{call }mom\_read\_data(mean\_file, \textcolor{stringliteral}{'temp'}, temp\_mean(:,:,1:nk\_input), g\%Domain, \&}
\DoxyCodeLine{682                        timelevel=ridx\_sum,position=center)}
\DoxyCodeLine{683     \textcolor{keyword}{call }mom\_read\_data(mean\_file, \textcolor{stringliteral}{'salt'}, salt\_mean(:,:,1:nk\_input), g\%Domain, \&}
\DoxyCodeLine{684                        timelevel=ridx\_sum,position=center)}
\DoxyCodeLine{685 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{686 }
\DoxyCodeLine{687   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{688     \textcolor{keywordflow}{if} (g\%mask2dT(i,j)>0.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{689       temp\_mean(:,:,nk\_input:nz) = temp\_mean(i,j,nk\_input)}
\DoxyCodeLine{690       salt\_mean(:,:,nk\_input:nz) = salt\_mean(i,j,nk\_input)}
\DoxyCodeLine{691 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{692 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{693 }
\DoxyCodeLine{694   \textcolor{comment}{! Check if reading vertical diffusivities or entrainment fluxes}}
\DoxyCodeLine{695   \textcolor{keyword}{call }mom\_read\_data( mean\_file, \textcolor{stringliteral}{'Kd\_interface'}, kd(:,:,1:nk\_input+1), g\%Domain, \&}
\DoxyCodeLine{696                   timelevel=ridx\_sum,position=center)}
\DoxyCodeLine{697 }
\DoxyCodeLine{698   \textcolor{comment}{! This block makes sure that the fluxes control structure, which may not be used in the solo\_driver,}}
\DoxyCodeLine{699   \textcolor{comment}{! contains netMassIn and netMassOut which is necessary for the applyTracerBoundaryFluxesInOut routine}}
\DoxyCodeLine{700   \textcolor{keywordflow}{if} (do\_ale) \textcolor{keywordflow}{then}}
\DoxyCodeLine{701     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(fluxes\%netMassOut)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{702       \textcolor{keyword}{allocate}(fluxes\%netMassOut(g\%isd:g\%ied,g\%jsd:g\%jed))}
\DoxyCodeLine{703       fluxes\%netMassOut(:,:) = 0.0}
\DoxyCodeLine{704 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{705     \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(fluxes\%netMassIn)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{706       \textcolor{keyword}{allocate}(fluxes\%netMassIn(g\%isd:g\%ied,g\%jsd:g\%jed))}
\DoxyCodeLine{707       fluxes\%netMassIn(:,:) = 0.0}
\DoxyCodeLine{708 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{709 }
\DoxyCodeLine{710     fluxes\%netMassOut(:,:) = 0.0}
\DoxyCodeLine{711     fluxes\%netMassIn(:,:) = 0.0}
\DoxyCodeLine{712     \textcolor{keyword}{call }mom\_read\_data(surf\_file,\textcolor{stringliteral}{'massout\_flux\_sum'},fluxes\%netMassOut, g\%Domain, \&}
\DoxyCodeLine{713         timelevel=ridx\_sum)}
\DoxyCodeLine{714     \textcolor{keyword}{call }mom\_read\_data(surf\_file,\textcolor{stringliteral}{'massin\_flux\_sum'}, fluxes\%netMassIn,  g\%Domain, \&}
\DoxyCodeLine{715         timelevel=ridx\_sum)}
\DoxyCodeLine{716 }
\DoxyCodeLine{717     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{718       \textcolor{keywordflow}{if} (g\%mask2dT(i,j)<1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{719         fluxes\%netMassOut(i,j) = 0.0}
\DoxyCodeLine{720         fluxes\%netMassIn(i,j) = 0.0}
\DoxyCodeLine{721 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{722 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{723 }
\DoxyCodeLine{724 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{725 }
\DoxyCodeLine{726   \textcolor{keywordflow}{if} (read\_mld) \textcolor{keywordflow}{then}}
\DoxyCodeLine{727     \textcolor{keyword}{call }mom\_read\_data(surf\_file, \textcolor{stringliteral}{'ePBL\_h\_ML'}, mld, g\%Domain, timelevel=ridx\_sum)}
\DoxyCodeLine{728 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{729 }
\DoxyCodeLine{730   \textcolor{keywordflow}{if} (read\_sw) \textcolor{keywordflow}{then}}
\DoxyCodeLine{731     \textcolor{comment}{! Shortwave radiation is only needed for offline mode with biogeochemistry but without the coupler.}}
\DoxyCodeLine{732     \textcolor{comment}{! Need to double check, but set\_opacity seems to only need the sum of the diffuse and}}
\DoxyCodeLine{733     \textcolor{comment}{! direct fluxes in the visible and near-\/infrared bands. For convenience, we store the}}
\DoxyCodeLine{734     \textcolor{comment}{! sum of the direct and diffuse fluxes in the 'dir' field and set the 'dif' fields to zero}}
\DoxyCodeLine{735     \textcolor{keyword}{call }mom\_read\_data(mean\_file,\textcolor{stringliteral}{'sw\_vis'}, fluxes\%sw\_vis\_dir, g\%Domain, \&}
\DoxyCodeLine{736                        timelevel=ridx\_sum, scale=g\%US\%W\_m2\_to\_QRZ\_T)}
\DoxyCodeLine{737     \textcolor{keyword}{call }mom\_read\_data(mean\_file,\textcolor{stringliteral}{'sw\_nir'}, fluxes\%sw\_nir\_dir, g\%Domain, \&}
\DoxyCodeLine{738                        timelevel=ridx\_sum, scale=g\%US\%W\_m2\_to\_QRZ\_T)}
\DoxyCodeLine{739     fluxes\%sw\_vis\_dir(:,:) = fluxes\%sw\_vis\_dir(:,:)*0.5}
\DoxyCodeLine{740     fluxes\%sw\_vis\_dif(:,:) = fluxes\%sw\_vis\_dir(:,:)}
\DoxyCodeLine{741     fluxes\%sw\_nir\_dir(:,:) = fluxes\%sw\_nir\_dir(:,:)*0.5}
\DoxyCodeLine{742     fluxes\%sw\_nir\_dif(:,:) = fluxes\%sw\_nir\_dir(:,:)}
\DoxyCodeLine{743     fluxes\%sw = (fluxes\%sw\_vis\_dir + fluxes\%sw\_vis\_dif) + (fluxes\%sw\_nir\_dir + fluxes\%sw\_nir\_dif)}
\DoxyCodeLine{744     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{745       \textcolor{keywordflow}{if} (g\%mask2dT(i,j)<1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{746         fluxes\%sw(i,j) = 0.0}
\DoxyCodeLine{747         fluxes\%sw\_vis\_dir(i,j) = 0.0}
\DoxyCodeLine{748         fluxes\%sw\_nir\_dir(i,j) = 0.0}
\DoxyCodeLine{749         fluxes\%sw\_vis\_dif(i,j) = 0.0}
\DoxyCodeLine{750         fluxes\%sw\_nir\_dif(i,j) = 0.0}
\DoxyCodeLine{751 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{752 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{753     \textcolor{keyword}{call }pass\_var(fluxes\%sw,g\%Domain)}
\DoxyCodeLine{754     \textcolor{keyword}{call }pass\_var(fluxes\%sw\_vis\_dir,g\%Domain)}
\DoxyCodeLine{755     \textcolor{keyword}{call }pass\_var(fluxes\%sw\_vis\_dif,g\%Domain)}
\DoxyCodeLine{756     \textcolor{keyword}{call }pass\_var(fluxes\%sw\_nir\_dir,g\%Domain)}
\DoxyCodeLine{757     \textcolor{keyword}{call }pass\_var(fluxes\%sw\_nir\_dif,g\%Domain)}
\DoxyCodeLine{758 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{759 }

\end{DoxyCode}
