\hypertarget{namespacepseudo__salt__tracer}{}\section{pseudo\+\_\+salt\+\_\+tracer Module Reference}
\label{namespacepseudo__salt__tracer}\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}


\subsection{Detailed Description}
A tracer package that mimics salinity. 

By Andrew Shao, 2016.

This file contains the routines necessary to model a passive tracer that uses the same boundary fluxes as salinity. At the beginning of the run, salt is set to the same as tvS. Any deviations between this salt-\/like tracer and tvS signifies a difference between how active and passive tracers are treated. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}
\begin{DoxyCompactList}\small\item\em The control structure for the pseudo-\/salt tracer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \hyperlink{namespacepseudo__salt__tracer_a147eabcabc9a787c01310dd67a5bab08}{register\+\_\+pseudo\+\_\+salt\+\_\+tracer} (HI, GV, param\+\_\+file, CS, tr\+\_\+\+Reg, restart\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em Register the pseudo-\/salt tracer with M\+O\+M6. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacepseudo__salt__tracer_a012fcdab14755a8eec9c68f0ddbff012}{initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer} (restart, day, G, GV, h, diag, O\+BC, CS, sponge\+\_\+\+C\+Sp, tv)
\begin{DoxyCompactList}\small\item\em Initialize the pseudo-\/salt tracer. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacepseudo__salt__tracer_a7c534dce5f33ab195485552f63cff657}{pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics} (h\+\_\+old, h\+\_\+new, ea, eb, fluxes, dt, G, GV, US, CS, tv, debug, evap\+\_\+\+C\+F\+L\+\_\+limit, minimum\+\_\+forcing\+\_\+depth)
\begin{DoxyCompactList}\small\item\em Apply sources, sinks and diapycnal diffusion to the tracers in this package. \end{DoxyCompactList}\item 
integer function, public \hyperlink{namespacepseudo__salt__tracer_a282f3c84b7e7ccdaa6d9344342705a6e}{pseudo\+\_\+salt\+\_\+stock} (h, stocks, G, GV, CS, names, units, stock\+\_\+index)
\begin{DoxyCompactList}\small\item\em Calculates the mass-\/weighted integral of all tracer stocks, returning the number of stocks it has calculated. If the stock\+\_\+index is present, only the stock corresponding to that coded index is returned. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacepseudo__salt__tracer_aae962f10f82225feec43dd4a11faca6a}{pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state} (sfc\+\_\+state, h, G, CS)
\begin{DoxyCompactList}\small\item\em This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations. This particular tracer package does not report anything back to the coupler. \end{DoxyCompactList}\item 
subroutine, public \hyperlink{namespacepseudo__salt__tracer_a97689343fce90aaa0a60f836b7dea9ad}{pseudo\+\_\+salt\+\_\+tracer\+\_\+end} (CS)
\begin{DoxyCompactList}\small\item\em Deallocate memory associated with this tracer package. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_a012fcdab14755a8eec9c68f0ddbff012}\label{namespacepseudo__salt__tracer_a012fcdab14755a8eec9c68f0ddbff012}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer@{initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer}}
\index{initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer@{initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer()}{initialize\_pseudo\_salt\_tracer()}}
{\footnotesize\ttfamily subroutine, public pseudo\+\_\+salt\+\_\+tracer\+::initialize\+\_\+pseudo\+\_\+salt\+\_\+tracer (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{restart,  }\item[{type(time\+\_\+type), intent(in), target}]{day,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(diag\+\_\+ctrl), intent(in), target}]{diag,  }\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC,  }\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS,  }\item[{type(sponge\+\_\+cs), pointer}]{sponge\+\_\+\+C\+Sp,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv }\end{DoxyParamCaption})}



Initialize the pseudo-\/salt tracer. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em restart} & .true. if the fields have already been read from a restart file.\\
\hline
\mbox{\tt in}  & {\em day} & Time of the start of the run.\\
\hline
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em diag} & A structure that is used to regulate diagnostic output.\\
\hline
 & {\em obc} & This open boundary condition type specifies whether, where, and what open boundary conditions are used.\\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer.\\
\hline
 & {\em sponge\+\_\+csp} & Pointer to the control structure for the sponges.\\
\hline
\mbox{\tt in}  & {\em tv} & A structure pointing to various thermodynamic variables \\
\hline
\end{DoxyParams}


Definition at line 118 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
118   \textcolor{keywordtype}{logical},                            \textcolor{keywordtype}{intent(in)} :: restart\textcolor{comment}{ !< .true. if the fields have already}
119 \textcolor{comment}{                                                         !! been read from a restart file.}
120   \textcolor{keywordtype}{type}(time\_type),            \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: day\textcolor{comment}{  !< Time of the start of the run.}
121   \textcolor{keywordtype}{type}(ocean\_grid\_type),              \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure}
122   \textcolor{keywordtype}{type}(verticalgrid\_type),            \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
123   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
124                                       \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2]}
125   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< A structure that is used to regulate}
126 \textcolor{comment}{                                                         !! diagnostic output.}
127   \textcolor{keywordtype}{type}(ocean\_obc\_type),               \textcolor{keywordtype}{pointer}    :: obc\textcolor{comment}{  !< This open boundary condition type specifies}
128 \textcolor{comment}{                                                         !! whether, where, and what open boundary}
129 \textcolor{comment}{                                                         !! conditions are used.}
130   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs),        \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< The control structure returned by a previous}
131 \textcolor{comment}{                                                       !! call to register\_pseudo\_salt\_tracer.}
132   \textcolor{keywordtype}{type}(sponge\_cs),                    \textcolor{keywordtype}{pointer}    :: sponge\_csp\textcolor{comment}{ !< Pointer to the control structure for the
       sponges.}
133   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),              \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various thermodynamic
       variables}
134 \textcolor{comment}{!   This subroutine initializes the tracer fields in CS%ps(:,:,:).}
135 
136   \textcolor{comment}{! Local variables}
137   \textcolor{keywordtype}{character(len=16)} :: name     \textcolor{comment}{! A variable's name in a NetCDF file.}
138   \textcolor{keywordtype}{character(len=72)} :: longname \textcolor{comment}{! The long name of that variable.}
139   \textcolor{keywordtype}{character(len=48)} :: units    \textcolor{comment}{! The dimensions of the variable.}
140   \textcolor{keywordtype}{character(len=48)} :: flux\_units \textcolor{comment}{! The units for age tracer fluxes, either}
141                                 \textcolor{comment}{! years m3 s-1 or years kg s-1.}
142   \textcolor{keywordtype}{logical} :: ok
143   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
144   \textcolor{keywordtype}{integer} :: isdb, iedb, jsdb, jedb
145 
146   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
147   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs%diff)) \textcolor{keywordflow}{return}
148 
149   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
150   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
151   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
152 
153   cs%Time => day
154   cs%diag => diag
155   name = \textcolor{stringliteral}{"pseudo\_salt"}
156 
157   \textcolor{keyword}{call }query\_vardesc(cs%tr\_desc, name=name, caller=\textcolor{stringliteral}{"initialize\_pseudo\_salt\_tracer"})
158   \textcolor{keywordflow}{if} ((.not.restart) .or. (.not.query\_initialized(cs%ps, name, cs%restart\_CSp))) \textcolor{keywordflow}{then}
159     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied
160       cs%ps(i,j,k) = tv%S(i,j,k)
161 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
162 \textcolor{keywordflow}{  endif}
163 
164   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(obc)) \textcolor{keywordflow}{then}
165   \textcolor{comment}{! Steal from updated DOME in the fullness of time.}
166 \textcolor{keywordflow}{  endif}
167 
168   cs%id\_psd = register\_diag\_field(\textcolor{stringliteral}{"ocean\_model"}, \textcolor{stringliteral}{"pseudo\_salt\_diff"}, cs%diag%axesTL, &
169         day, \textcolor{stringliteral}{"Difference between pseudo salt passive tracer and salt tracer"}, \textcolor{stringliteral}{"psu"})
170 
\end{DoxyCode}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_a282f3c84b7e7ccdaa6d9344342705a6e}\label{namespacepseudo__salt__tracer_a282f3c84b7e7ccdaa6d9344342705a6e}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+stock@{pseudo\+\_\+salt\+\_\+stock}}
\index{pseudo\+\_\+salt\+\_\+stock@{pseudo\+\_\+salt\+\_\+stock}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{pseudo\+\_\+salt\+\_\+stock()}{pseudo\_salt\_stock()}}
{\footnotesize\ttfamily integer function, public pseudo\+\_\+salt\+\_\+tracer\+::pseudo\+\_\+salt\+\_\+stock (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{real, dimension(\+:), intent(out)}]{stocks,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS,  }\item[{character(len=$\ast$), dimension(\+:), intent(out)}]{names,  }\item[{character(len=$\ast$), dimension(\+:), intent(out)}]{units,  }\item[{integer, intent(in), optional}]{stock\+\_\+index }\end{DoxyParamCaption})}



Calculates the mass-\/weighted integral of all tracer stocks, returning the number of stocks it has calculated. If the stock\+\_\+index is present, only the stock corresponding to that coded index is returned. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt out}  & {\em stocks} & the mass-\/weighted integrated amount of each tracer, in kg times concentration units \mbox{[}kg conc\mbox{]}.\\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer.\\
\hline
\mbox{\tt out}  & {\em names} & The names of the stocks calculated.\\
\hline
\mbox{\tt out}  & {\em units} & The units of the stocks calculated.\\
\hline
\mbox{\tt in}  & {\em stock\+\_\+index} & The coded index of a specific stock being sought.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Return value\+: the number of stocks calculated here. 
\end{DoxyReturn}


Definition at line 254 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
254   \textcolor{keywordtype}{type}(ocean\_grid\_type),              \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{    !< The ocean's grid structure}
255   \textcolor{keywordtype}{type}(verticalgrid\_type),            \textcolor{keywordtype}{intent(in)}    :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
256   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H ~> m or kg m-2]}
257   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)},                 \textcolor{keywordtype}{intent(out)}   :: stocks\textcolor{comment}{ !< the mass-weighted integrated amount of
       each}
258 \textcolor{comment}{                                                              !! tracer, in kg times concentration units
       [kg conc].}
259   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs),        \textcolor{keywordtype}{pointer}       :: cs\textcolor{comment}{ !< The control structure returned by a previous}
260 \textcolor{comment}{                                                          !! call to register\_pseudo\_salt\_tracer.}
261   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{dimension(:)},     \textcolor{keywordtype}{intent(out)}   :: names\textcolor{comment}{  !< The names of the stocks calculated.}
262   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{dimension(:)},     \textcolor{keywordtype}{intent(out)}   :: units\textcolor{comment}{  !< The units of the stocks calculated.}
263   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},                  \textcolor{keywordtype}{intent(in)}    :: stock\_index\textcolor{comment}{ !< The coded index of a specific stock}
264 \textcolor{comment}{                                                              !! being sought.}
265   \textcolor{keywordtype}{integer}                                           :: pseudo\_salt\_stock\textcolor{comment}{ !< Return value: the number of}
266 \textcolor{comment}{                                                              !! stocks calculated here.}
267 
268 \textcolor{comment}{! This function calculates the mass-weighted integral of all tracer stocks,}
269 \textcolor{comment}{! returning the number of stocks it has calculated.  If the stock\_index}
270 \textcolor{comment}{! is present, only the stock corresponding to that coded index is returned.}
271 
272   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz
273   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
274 
275   pseudo\_salt\_stock = 0
276   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
277   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs%diff)) \textcolor{keywordflow}{return}
278 
279   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(stock\_index)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (stock\_index > 0) \textcolor{keywordflow}{then}
280     \textcolor{comment}{! Check whether this stock is available from this routine.}
281 
282     \textcolor{comment}{! No stocks from this routine are being checked yet.  Return 0.}
283     \textcolor{keywordflow}{return}
284 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}
285 
286   \textcolor{keyword}{call }query\_vardesc(cs%tr\_desc, name=names(1), units=units(1), caller=\textcolor{stringliteral}{"pseudo\_salt\_stock"})
287   units(1) = trim(units(1))//\textcolor{stringliteral}{" kg"}
288   stocks(1) = 0.0
289   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
290     stocks(1) = stocks(1) + cs%diff(i,j,k) * &
291                          (g%mask2dT(i,j) * g%US%L\_to\_m**2*g%areaT(i,j) * h(i,j,k))
292 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
293   stocks(1) = gv%H\_to\_kg\_m2 * stocks(1)
294 
295   pseudo\_salt\_stock = 1
296 
\end{DoxyCode}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_a7c534dce5f33ab195485552f63cff657}\label{namespacepseudo__salt__tracer_a7c534dce5f33ab195485552f63cff657}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics@{pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics}}
\index{pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics@{pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics()}{pseudo\_salt\_tracer\_column\_physics()}}
{\footnotesize\ttfamily subroutine, public pseudo\+\_\+salt\+\_\+tracer\+::pseudo\+\_\+salt\+\_\+tracer\+\_\+column\+\_\+physics (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h\+\_\+old,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h\+\_\+new,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{ea,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{eb,  }\item[{type(forcing), intent(in)}]{fluxes,  }\item[{real, intent(in)}]{dt,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{logical, intent(in)}]{debug,  }\item[{real, intent(in), optional}]{evap\+\_\+\+C\+F\+L\+\_\+limit,  }\item[{real, intent(in), optional}]{minimum\+\_\+forcing\+\_\+depth }\end{DoxyParamCaption})}



Apply sources, sinks and diapycnal diffusion to the tracers in this package. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em h\+\_\+old} & Layer thickness before entrainment \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em h\+\_\+new} & Layer thickness after entrainment \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em ea} & an array to which the amount of fluid entrained\\
\hline
\mbox{\tt in}  & {\em eb} & an array to which the amount of fluid entrained\\
\hline
\mbox{\tt in}  & {\em fluxes} & A structure containing pointers to thermodynamic and tracer forcing fields. Unused fields have N\+U\+LL ptrs.\\
\hline
\mbox{\tt in}  & {\em dt} & The amount of time covered by this call \mbox{[}T $\sim$$>$ s\mbox{]}\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer.\\
\hline
\mbox{\tt in}  & {\em tv} & A structure pointing to various thermodynamic variables\\
\hline
\mbox{\tt in}  & {\em debug} & If true calculate checksums\\
\hline
\mbox{\tt in}  & {\em evap\+\_\+cfl\+\_\+limit} & Limit on the fraction of the water that can be fluxed out of the top layer in a timestep \mbox{[}nondim\mbox{]}\\
\hline
\mbox{\tt in}  & {\em minimum\+\_\+forcing\+\_\+depth} & The smallest depth over which fluxes can be applied \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 176 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
176   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{    !< The ocean's grid structure}
177   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
178   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
179                            \textcolor{keywordtype}{intent(in)} :: h\_old\textcolor{comment}{ !< Layer thickness before entrainment [H ~> m or kg m-2].}
180   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
181                            \textcolor{keywordtype}{intent(in)} :: h\_new\textcolor{comment}{ !< Layer thickness after entrainment [H ~> m or kg m-2].}
182   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
183                            \textcolor{keywordtype}{intent(in)} :: ea\textcolor{comment}{   !< an array to which the amount of fluid entrained}
184 \textcolor{comment}{                                              !! from the layer above during this call will be}
185 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
186   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
187                            \textcolor{keywordtype}{intent(in)} :: eb\textcolor{comment}{   !< an array to which the amount of fluid entrained}
188 \textcolor{comment}{                                              !! from the layer below during this call will be}
189 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
190   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to thermodynamic}
191 \textcolor{comment}{                                              !! and tracer forcing fields.  Unused fields have NULL ptrs.}
192   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< The amount of time covered by this call [T ~> s]}
193   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{   !< A dimensional unit scaling type}
194   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{  !< The control structure returned by a previous}
195 \textcolor{comment}{                                              !! call to register\_pseudo\_salt\_tracer.}
196   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various thermodynamic variables}
197   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)} :: debug\textcolor{comment}{ !< If true calculate checksums}
198   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: evap\_cfl\_limit\textcolor{comment}{ !< Limit on the fraction of the water that can}
199 \textcolor{comment}{                                              !! be fluxed out of the top layer in a timestep [nondim]}
200   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: minimum\_forcing\_depth\textcolor{comment}{ !< The smallest depth over which}
201 \textcolor{comment}{                                              !! fluxes can be applied [H ~> m or kg m-2]}
202 
203 \textcolor{comment}{!   This subroutine applies diapycnal diffusion and any other column}
204 \textcolor{comment}{! tracer physics or chemistry to the tracers from this file.}
205 
206 \textcolor{comment}{! The arguments to this subroutine are redundant in that}
207 \textcolor{comment}{!     h\_new(k) = h\_old(k) + ea(k) - eb(k-1) + eb(k) - ea(k+1)}
208 
209   \textcolor{comment}{! Local variables}
210   \textcolor{keywordtype}{real} :: year, h\_total, scale, htot, ih\_limit
211   \textcolor{keywordtype}{integer} :: secs, days
212   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, k\_max
213   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_work \textcolor{comment}{! Used so that h can be modified}
214 
215   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
216 
217   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
218   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs%diff)) \textcolor{keywordflow}{return}
219 
220   \textcolor{keywordflow}{if} (debug) \textcolor{keywordflow}{then}
221     \textcolor{keyword}{call }hchksum(tv%S,\textcolor{stringliteral}{"salt pre pseudo-salt vertdiff"}, g%HI)
222     \textcolor{keyword}{call }hchksum(cs%ps,\textcolor{stringliteral}{"pseudo\_salt pre pseudo-salt vertdiff"}, g%HI)
223 \textcolor{keywordflow}{  endif}
224 
225   \textcolor{comment}{! This uses applyTracerBoundaryFluxesInOut, usually in ALE mode}
226   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(evap\_cfl\_limit) .and. \textcolor{keyword}{present}(minimum\_forcing\_depth)) \textcolor{keywordflow}{then}
227     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
228       h\_work(i,j,k) = h\_old(i,j,k)
229 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
230     \textcolor{keyword}{call }applytracerboundaryfluxesinout(g, gv, cs%ps, dt, fluxes, h\_work, &
231                                         evap\_cfl\_limit, minimum\_forcing\_depth, out\_flux\_optional=fluxes
      %netSalt)
232     \textcolor{keyword}{call }tracer\_vertdiff(h\_work, ea, eb, dt, cs%ps, g, gv)
233   \textcolor{keywordflow}{else}
234     \textcolor{keyword}{call }tracer\_vertdiff(h\_old, ea, eb, dt, cs%ps, g, gv)
235 \textcolor{keywordflow}{  endif}
236 
237   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
238     cs%diff(i,j,k) = cs%ps(i,j,k)-tv%S(i,j,k)
239 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
240 
241   \textcolor{keywordflow}{if} (debug) \textcolor{keywordflow}{then}
242     \textcolor{keyword}{call }hchksum(tv%S,\textcolor{stringliteral}{"salt post pseudo-salt vertdiff"}, g%HI)
243     \textcolor{keyword}{call }hchksum(cs%ps,\textcolor{stringliteral}{"pseudo\_salt post pseudo-salt vertdiff"}, g%HI)
244 \textcolor{keywordflow}{  endif}
245 
246   \textcolor{keywordflow}{if} (cs%id\_psd>0) \textcolor{keyword}{call }post\_data(cs%id\_psd, cs%diff, cs%diag)
247 
\end{DoxyCode}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_a97689343fce90aaa0a60f836b7dea9ad}\label{namespacepseudo__salt__tracer_a97689343fce90aaa0a60f836b7dea9ad}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+tracer\+\_\+end@{pseudo\+\_\+salt\+\_\+tracer\+\_\+end}}
\index{pseudo\+\_\+salt\+\_\+tracer\+\_\+end@{pseudo\+\_\+salt\+\_\+tracer\+\_\+end}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{pseudo\+\_\+salt\+\_\+tracer\+\_\+end()}{pseudo\_salt\_tracer\_end()}}
{\footnotesize\ttfamily subroutine, public pseudo\+\_\+salt\+\_\+tracer\+::pseudo\+\_\+salt\+\_\+tracer\+\_\+end (\begin{DoxyParamCaption}\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



Deallocate memory associated with this tracer package. 


\begin{DoxyParams}{Parameters}
{\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 326 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
326   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< The control structure returned by a previous}
327 \textcolor{comment}{                                              !! call to register\_pseudo\_salt\_tracer.}
328   \textcolor{keywordtype}{integer} :: m
329 
330   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
331     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%ps)) \textcolor{keyword}{deallocate}(cs%ps)
332     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%diff)) \textcolor{keyword}{deallocate}(cs%diff)
333     \textcolor{keyword}{deallocate}(cs)
334 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_aae962f10f82225feec43dd4a11faca6a}\label{namespacepseudo__salt__tracer_aae962f10f82225feec43dd4a11faca6a}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state@{pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state}}
\index{pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state@{pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state()}{pseudo\_salt\_tracer\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public pseudo\+\_\+salt\+\_\+tracer\+::pseudo\+\_\+salt\+\_\+tracer\+\_\+surface\+\_\+state (\begin{DoxyParamCaption}\item[{type(surface), intent(inout)}]{sfc\+\_\+state,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine extracts the surface fields from this tracer package that are to be shared with the atmosphere in coupled configurations. This particular tracer package does not report anything back to the coupler. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in,out}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean.\\
\hline
\mbox{\tt in}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 303 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
303   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: g\textcolor{comment}{  !< The ocean's grid structure.}
304   \textcolor{keywordtype}{type}(surface),          \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}
305 \textcolor{comment}{                                              !! describe the surface state of the ocean.}
306   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
307                           \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thickness [H ~> m or kg m-2].}
308   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs), \textcolor{keywordtype}{pointer}  :: cs\textcolor{comment}{ !< The control structure returned by a previous}
309 \textcolor{comment}{                                              !! call to register\_pseudo\_salt\_tracer.}
310 
311   \textcolor{comment}{! This particular tracer package does not report anything back to the coupler.}
312   \textcolor{comment}{! The code that is here is just a rough guide for packages that would.}
313 
314   \textcolor{keywordtype}{integer} :: m, is, ie, js, je, isd, ied, jsd, jed
315   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
316   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
317 
318   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
319 
320   \textcolor{comment}{! By design, this tracer package does not return any surface states.}
321 
\end{DoxyCode}
\mbox{\Hypertarget{namespacepseudo__salt__tracer_a147eabcabc9a787c01310dd67a5bab08}\label{namespacepseudo__salt__tracer_a147eabcabc9a787c01310dd67a5bab08}} 
\index{pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}!register\+\_\+pseudo\+\_\+salt\+\_\+tracer@{register\+\_\+pseudo\+\_\+salt\+\_\+tracer}}
\index{register\+\_\+pseudo\+\_\+salt\+\_\+tracer@{register\+\_\+pseudo\+\_\+salt\+\_\+tracer}!pseudo\+\_\+salt\+\_\+tracer@{pseudo\+\_\+salt\+\_\+tracer}}
\subsubsection{\texorpdfstring{register\+\_\+pseudo\+\_\+salt\+\_\+tracer()}{register\_pseudo\_salt\_tracer()}}
{\footnotesize\ttfamily logical function, public pseudo\+\_\+salt\+\_\+tracer\+::register\+\_\+pseudo\+\_\+salt\+\_\+tracer (\begin{DoxyParamCaption}\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\hyperlink{structpseudo__salt__tracer_1_1pseudo__salt__tracer__cs}{pseudo\+\_\+salt\+\_\+tracer\+\_\+cs}), pointer}]{CS,  }\item[{type(tracer\+\_\+registry\+\_\+type), pointer}]{tr\+\_\+\+Reg,  }\item[{type(mom\+\_\+restart\+\_\+cs), pointer}]{restart\+\_\+\+CS }\end{DoxyParamCaption})}



Register the pseudo-\/salt tracer with M\+O\+M6. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em hi} & A horizontal index type structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters\\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+pseudo\+\_\+salt\+\_\+tracer.\\
\hline
 & {\em tr\+\_\+reg} & A pointer that is set to point to the control structure for the tracer advection and diffusion module\\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure \\
\hline
\end{DoxyParams}


Definition at line 61 of file pseudo\+\_\+salt\+\_\+tracer.\+F90.


\begin{DoxyCode}
61   \textcolor{keywordtype}{type}(hor\_index\_type),       \textcolor{keywordtype}{intent(in)} :: hi\textcolor{comment}{   !< A horizontal index type structure}
62   \textcolor{keywordtype}{type}(verticalgrid\_type),    \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{   !< The ocean's vertical grid structure}
63   \textcolor{keywordtype}{type}(param\_file\_type),      \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-time parameters}
64   \textcolor{keywordtype}{type}(pseudo\_salt\_tracer\_cs),  \textcolor{keywordtype}{pointer}  :: cs\textcolor{comment}{ !< The control structure returned by a previous}
65 \textcolor{comment}{                                               !! call to register\_pseudo\_salt\_tracer.}
66   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: tr\_reg\textcolor{comment}{ !< A pointer that is set to point to the control}
67 \textcolor{comment}{                                                  !! structure for the tracer advection and}
68 \textcolor{comment}{                                                  !! diffusion module}
69   \textcolor{keywordtype}{type}(mom\_restart\_cs),       \textcolor{keywordtype}{pointer}    :: restart\_cs\textcolor{comment}{ !< A pointer to the restart control structure}
70 \textcolor{comment}{! This subroutine is used to register tracer fields and subroutines}
71 \textcolor{comment}{! to be used with MOM.}
72 
73   \textcolor{comment}{! Local variables}
74   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"pseudo\_salt\_tracer"} \textcolor{comment}{! This module's name.}
75   \textcolor{keywordtype}{character(len=200)} :: inputdir \textcolor{comment}{! The directory where the input files are.}
76   \textcolor{keywordtype}{character(len=48)}  :: var\_name \textcolor{comment}{! The variable's name.}
77   \textcolor{keywordtype}{character(len=3)}   :: name\_tag \textcolor{comment}{! String for creating identifying pseudo\_salt}
78 \textcolor{comment}{! This include declares and sets the variable "version".}
79 \textcolor{preprocessor}{#include "version\_variable.h"}
80 \textcolor{preprocessor}{}  \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer} :: tr\_ptr(:,:,:) => null()
81   \textcolor{keywordtype}{logical} :: register\_pseudo\_salt\_tracer
82   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, i, j
83   isd = hi%isd ; ied = hi%ied ; jsd = hi%jsd ; jed = hi%jed ; nz = gv%ke
84 
85   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
86     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"register\_pseudo\_salt\_tracer called with an "}// &
87                              \textcolor{stringliteral}{"associated control structure."})
88     \textcolor{keywordflow}{return}
89 \textcolor{keywordflow}{  endif}
90   \textcolor{keyword}{allocate}(cs)
91 
92   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
93   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
94 
95   \textcolor{keyword}{allocate}(cs%ps(isd:ied,jsd:jed,nz)) ; cs%ps(:,:,:) = 0.0
96   \textcolor{keyword}{allocate}(cs%diff(isd:ied,jsd:jed,nz)) ; cs%diff(:,:,:) = 0.0
97 
98   cs%tr\_desc = var\_desc(trim(\textcolor{stringliteral}{"pseudo\_salt"}), \textcolor{stringliteral}{"psu"}, &
99                      \textcolor{stringliteral}{"Pseudo salt passive tracer"}, caller=mdl)
100 
101   tr\_ptr => cs%ps(:,:,:)
102   \textcolor{keyword}{call }query\_vardesc(cs%tr\_desc, name=var\_name, caller=\textcolor{stringliteral}{"register\_pseudo\_salt\_tracer"})
103   \textcolor{comment}{! Register the tracer for horizontal advection, diffusion, and restarts.}
104   \textcolor{keyword}{call }register\_tracer(tr\_ptr, tr\_reg, param\_file, hi, gv, name=\textcolor{stringliteral}{"pseudo\_salt"}, &
105                        longname=\textcolor{stringliteral}{"Pseudo salt passive tracer"}, units=\textcolor{stringliteral}{"psu"}, &
106                        registry\_diags=.true., restart\_cs=restart\_cs, &
107                        mandatory=.not.cs%pseudo\_salt\_may\_reinit)
108 
109   cs%tr\_Reg => tr\_reg
110   cs%restart\_CSp => restart\_cs
111   register\_pseudo\_salt\_tracer = .true.
112 
\end{DoxyCode}
