\hypertarget{namespaceisomip__tracer}{}\section{isomip\+\_\+tracer Module Reference}
\label{namespaceisomip__tracer}\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}}


\subsection{Detailed Description}
Routines used to set up and use a set of (one for now) dynamically passive tracers in the I\+S\+O\+M\+IP configuration. 

For now, just one passive tracer is injected in the sponge layer. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+tracer\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em I\+S\+O\+M\+IP tracer package control structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \mbox{\hyperlink{namespaceisomip__tracer_a7d66fe5ba12076654324a7e7d8ab2e4f}{register\+\_\+isomip\+\_\+tracer}} (HI, GV, param\+\_\+file, CS, tr\+\_\+\+Reg, restart\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em This subroutine is used to register tracer fields. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceisomip__tracer_aa268e488bb883f99ebc9cb321d442696}{initialize\+\_\+isomip\+\_\+tracer}} (restart, day, G, GV, h, diag, O\+BC, CS, A\+L\+E\+\_\+sponge\+\_\+\+C\+Sp)
\begin{DoxyCompactList}\small\item\em Initializes the N\+TR tracer fields in tr(\+:,\+:,\+:,\+:) \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceisomip__tracer_a7f06ffe89c033074c6b9bd7f375f6dd5}{isomip\+\_\+tracer\+\_\+column\+\_\+physics}} (h\+\_\+old, h\+\_\+new, ea, eb, fluxes, dt, G, GV, US, CS, evap\+\_\+\+C\+F\+L\+\_\+limit, minimum\+\_\+forcing\+\_\+depth)
\begin{DoxyCompactList}\small\item\em This subroutine applies diapycnal diffusion, including the surface boundary conditions and any other column tracer physics or chemistry to the tracers from this file. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceisomip__tracer_ac2571b7b6e4dce0d5936a483159ec379}{isomip\+\_\+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 \mbox{\hyperlink{namespaceisomip__tracer_a104a1c0d2098aa48a52684bd1509bbc4}{isomip\+\_\+tracer\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Deallocate any memory used by the I\+S\+O\+M\+IP tracer package. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespaceisomip__tracer_a45a3a4465d55afd6310d5a3412b2c9c5}\label{namespaceisomip__tracer_a45a3a4465d55afd6310d5a3412b2c9c5}} 
integer, parameter \mbox{\hyperlink{namespaceisomip__tracer_a45a3a4465d55afd6310d5a3412b2c9c5}{ntr}} = 1
\begin{DoxyCompactList}\small\item\em ntr is the number of tracers in this module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespaceisomip__tracer_aa268e488bb883f99ebc9cb321d442696}\label{namespaceisomip__tracer_aa268e488bb883f99ebc9cb321d442696}} 
\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}!initialize\+\_\+isomip\+\_\+tracer@{initialize\+\_\+isomip\+\_\+tracer}}
\index{initialize\+\_\+isomip\+\_\+tracer@{initialize\+\_\+isomip\+\_\+tracer}!isomip\+\_\+tracer@{isomip\+\_\+tracer}}
\subsubsection{\texorpdfstring{initialize\+\_\+isomip\+\_\+tracer()}{initialize\_isomip\_tracer()}}
{\footnotesize\ttfamily subroutine, public isomip\+\_\+tracer\+::initialize\+\_\+isomip\+\_\+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(\mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(ale\+\_\+sponge\+\_\+cs), pointer}]{A\+L\+E\+\_\+sponge\+\_\+\+C\+Sp }\end{DoxyParamCaption})}



Initializes the N\+TR tracer fields in tr(\+:,\+:,\+:,\+:) 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Grid structure.\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\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 h} & Layer thickness \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. This is not being used for now.\\
\hline
 & {\em cs} & The control structure returned by a previous call to I\+S\+O\+M\+I\+P\+\_\+register\+\_\+tracer.\\
\hline
 & {\em ale\+\_\+sponge\+\_\+csp} & A pointer to the control structure for the sponges, if they are in use. Otherwise this may be unassociated. \\
\hline
\end{DoxyParams}


Definition at line 150 of file I\+S\+O\+M\+I\+P\+\_\+tracer.\+F90.


\begin{DoxyCode}
150 
151   \textcolor{keywordtype}{type}(ocean\_grid\_type),                 \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< Grid structure.}
152   \textcolor{keywordtype}{type}(verticalGrid\_type),               \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}
153   \textcolor{keywordtype}{logical},                               \textcolor{keywordtype}{intent(in)} :: restart\textcolor{comment}{ !< .true. if the fields have already}
154 \textcolor{comment}{                                                       !! been read from a restart file.}
155   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{target},               \textcolor{keywordtype}{intent(in)} :: day\textcolor{comment}{ !< Time of the start of the run.}
156   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{ !< Layer thickness [H ~> m or kg m-2].}
157   \textcolor{keywordtype}{type}(diag\_ctrl),               \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< A structure that is used to regulate}
158 \textcolor{comment}{                                                       !! diagnostic output.}
159   \textcolor{keywordtype}{type}(ocean\_OBC\_type),                  \textcolor{keywordtype}{pointer}    :: OBC\textcolor{comment}{ !< This open boundary condition type specifies}
160 \textcolor{comment}{                                                       !! whether, where, and what open boundary conditions}
161 \textcolor{comment}{                                                       !! are used. This is not being used for now.}
162   \textcolor{keywordtype}{type}(ISOMIP\_tracer\_CS),                \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< The control structure returned by a previous
       call}
163 \textcolor{comment}{                                                       !! to ISOMIP\_register\_tracer.}
164   \textcolor{keywordtype}{type}(ALE\_sponge\_CS),                   \textcolor{keywordtype}{pointer}    :: ALE\_sponge\_CSp\textcolor{comment}{ !< A pointer to the control structure
       for}
165 \textcolor{comment}{                                                       !! the sponges, if they are in use.  Otherwise this}
166 \textcolor{comment}{                                                       !! may be unassociated.}
167 
168   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable} :: temp(:,:,:)
169   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:,:)} :: &
170     OBC\_tr1\_u => null(), & \textcolor{comment}{! These arrays should be allocated and set to}
171     obc\_tr1\_v => null()    \textcolor{comment}{! specify the values of tracer 1 that should come}
172                            \textcolor{comment}{! in through u- and v- points through the open}
173                            \textcolor{comment}{! boundary conditions, in the same units as tr.}
174   \textcolor{keywordtype}{character(len=16)} :: name     \textcolor{comment}{! A variable's name in a NetCDF file.}
175   \textcolor{keywordtype}{character(len=72)} :: longname \textcolor{comment}{! The long name of that variable.}
176   \textcolor{keywordtype}{character(len=48)} :: units    \textcolor{comment}{! The dimensions of the variable.}
177   \textcolor{keywordtype}{character(len=48)} :: flux\_units \textcolor{comment}{! The units for tracer fluxes, usually}
178                             \textcolor{comment}{! kg(tracer) kg(water)-1 m3 s-1 or kg(tracer) s-1.}
179   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer} :: tr\_ptr(:,:,:) => null()
180   \textcolor{keywordtype}{real} :: h\_neglect         \textcolor{comment}{! A thickness that is so small it is usually lost}
181                             \textcolor{comment}{! in roundoff and can be neglected [H ~> m or kg m-2].}
182   \textcolor{keywordtype}{real} :: e(SZK\_(G)+1), e\_top, e\_bot, d\_tr
183   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz, m
184   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB
185 
186   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
187   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
188   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
189   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
190   h\_neglect = gv%H\_subroundoff
191 
192   cs%Time => day
193   cs%diag => diag
194 
195   \textcolor{keywordflow}{if} (.not.restart) \textcolor{keywordflow}{then}
196     \textcolor{keywordflow}{if} (len\_trim(cs%tracer\_IC\_file) >= 1) \textcolor{keywordflow}{then}
197       \textcolor{comment}{!  Read the tracer concentrations from a netcdf file.}
198       \textcolor{keywordflow}{if} (.not.file\_exists(cs%tracer\_IC\_file, g%Domain)) &
199         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"ISOMIP\_initialize\_tracer: Unable to open "}// &
200                         cs%tracer\_IC\_file)
201       \textcolor{keywordflow}{do} m=1,ntr
202         \textcolor{keyword}{call }query\_vardesc(cs%tr\_desc(m), name, caller=\textcolor{stringliteral}{"initialize\_ISOMIP\_tracer"})
203         \textcolor{keyword}{call }mom\_read\_data(cs%tracer\_IC\_file, trim(name), cs%tr(:,:,:,m), g%Domain)
204 \textcolor{keywordflow}{      enddo}
205     \textcolor{keywordflow}{else}
206       \textcolor{keywordflow}{do} m=1,ntr
207         \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
208           cs%tr(i,j,k,m) = 0.0
209 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
210 \textcolor{keywordflow}{      enddo}
211 \textcolor{keywordflow}{    endif}
212 \textcolor{keywordflow}{  endif} \textcolor{comment}{! restart}
213 
214 \textcolor{comment}{! the following does not work in layer mode yet}
215 \textcolor{comment}{!!  if ( CS%use\_sponge ) then}
216   \textcolor{comment}{!   If sponges are used, this example damps tracers in sponges in the}
217   \textcolor{comment}{! northern half of the domain to 1 and tracers in the southern half}
218   \textcolor{comment}{! to 0.  For any tracers that are not damped in the sponge, the call}
219   \textcolor{comment}{! to set\_up\_sponge\_field can simply be omitted.}
220 \textcolor{comment}{!    if (.not.associated(ALE\_sponge\_CSp)) &}
221 \textcolor{comment}{!      call MOM\_error(FATAL, "ISOMIP\_initialize\_tracer: "// &}
222 \textcolor{comment}{!        "The pointer to ALEsponge\_CSp must be associated if SPONGE is defined.")}
223 
224 \textcolor{comment}{!    allocate(temp(G%isd:G%ied,G%jsd:G%jed,nz))}
225 
226 \textcolor{comment}{!    do j=js,je ; do i=is,ie}
227 \textcolor{comment}{!      if (G%geoLonT(i,j) >= 790.0 .AND. G%geoLonT(i,j) <= 800.0) then}
228 \textcolor{comment}{!        temp(i,j,:) = 1.0}
229 \textcolor{comment}{!      else}
230 \textcolor{comment}{!        temp(i,j,:) = 0.0}
231 \textcolor{comment}{!      endif}
232 \textcolor{comment}{!    enddo ; enddo}
233 
234       \textcolor{comment}{!   do m=1,NTR}
235 \textcolor{comment}{!    do m=1,1}
236       \textcolor{comment}{! This is needed to force the compiler not to do a copy in the sponge}
237       \textcolor{comment}{! calls.  Curses on the designers and implementers of Fortran90.}
238 \textcolor{comment}{!      tr\_ptr => CS%tr(:,:,:,m)}
239 \textcolor{comment}{!      call set\_up\_ALE\_sponge\_field(temp, G, tr\_ptr, ALE\_sponge\_CSp)}
240 \textcolor{comment}{!    enddo}
241 \textcolor{comment}{!    deallocate(temp)}
242 \textcolor{comment}{!  endif}
243 
\end{DoxyCode}
\mbox{\Hypertarget{namespaceisomip__tracer_a7f06ffe89c033074c6b9bd7f375f6dd5}\label{namespaceisomip__tracer_a7f06ffe89c033074c6b9bd7f375f6dd5}} 
\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}!isomip\+\_\+tracer\+\_\+column\+\_\+physics@{isomip\+\_\+tracer\+\_\+column\+\_\+physics}}
\index{isomip\+\_\+tracer\+\_\+column\+\_\+physics@{isomip\+\_\+tracer\+\_\+column\+\_\+physics}!isomip\+\_\+tracer@{isomip\+\_\+tracer}}
\subsubsection{\texorpdfstring{isomip\+\_\+tracer\+\_\+column\+\_\+physics()}{isomip\_tracer\_column\_physics()}}
{\footnotesize\ttfamily subroutine, public isomip\+\_\+tracer\+::isomip\+\_\+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(\mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{real, intent(in), optional}]{evap\+\_\+\+C\+F\+L\+\_\+limit,  }\item[{real, intent(in), optional}]{minimum\+\_\+forcing\+\_\+depth }\end{DoxyParamCaption})}



This subroutine applies diapycnal diffusion, including the surface boundary conditions and any other column tracer physics or chemistry to the tracers from this file. 


\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 I\+S\+O\+M\+I\+P\+\_\+register\+\_\+tracer.\\
\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 250 of file I\+S\+O\+M\+I\+P\+\_\+tracer.\+F90.


\begin{DoxyCode}
250   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}
251   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
252   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
253                            \textcolor{keywordtype}{intent(in)} :: h\_old\textcolor{comment}{ !< Layer thickness before entrainment [H ~> m or kg m-2].}
254   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
255                            \textcolor{keywordtype}{intent(in)} :: h\_new\textcolor{comment}{ !< Layer thickness after entrainment [H ~> m or kg m-2].}
256   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
257                            \textcolor{keywordtype}{intent(in)} :: ea\textcolor{comment}{   !< an array to which the amount of fluid entrained}
258 \textcolor{comment}{                                              !! from the layer above during this call will be}
259 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
260   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
261                            \textcolor{keywordtype}{intent(in)} :: eb\textcolor{comment}{   !< an array to which the amount of fluid entrained}
262 \textcolor{comment}{                                              !! from the layer below during this call will be}
263 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
264   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to thermodynamic}
265 \textcolor{comment}{                                              !! and tracer forcing fields.  Unused fields have NULL ptrs.}
266   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< The amount of time covered by this call [T ~> s]}
267   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}
268   \textcolor{keywordtype}{type}(ISOMIP\_tracer\_CS),  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< The control structure returned by a previous}
269 \textcolor{comment}{                                              !! call to ISOMIP\_register\_tracer.}
270   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: evap\_CFL\_limit\textcolor{comment}{ !< Limit on the fraction of the water that can}
271 \textcolor{comment}{                                              !! be fluxed out of the top layer in a timestep [nondim]}
272   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: minimum\_forcing\_depth\textcolor{comment}{ !< The smallest depth over which}
273 \textcolor{comment}{                                              !! fluxes can be applied [H ~> m or kg m-2]}
274 
275 \textcolor{comment}{! The arguments to this subroutine are redundant in that}
276 \textcolor{comment}{!     h\_new(k) = h\_old(k) + ea(k) - eb(k-1) + eb(k) - ea(k+1)}
277 
278   \textcolor{comment}{! Local variables}
279   \textcolor{keywordtype}{real} :: b1(SZI\_(G))          \textcolor{comment}{! b1 and c1 are variables used by the}
280   \textcolor{keywordtype}{real} :: c1(SZI\_(G),SZK\_(G))  \textcolor{comment}{! tridiagonal solver.}
281   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_work \textcolor{comment}{! Used so that h can be modified}
282   \textcolor{keywordtype}{real} :: melt(SZI\_(G),SZJ\_(G)) \textcolor{comment}{! melt water (positive for melting, negative for freezing) [R Z T-1 ~> kg
       m-2 s-1]}
283   \textcolor{keywordtype}{real} :: mmax                \textcolor{comment}{! The global maximum melting rate [R Z T-1 ~> kg m-2 s-1]}
284   \textcolor{keywordtype}{character(len=256)} :: mesg  \textcolor{comment}{! The text of an error message}
285   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m
286   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
287 
288   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
289 
290   melt(:,:) = fluxes%iceshelf\_melt(:,:)
291 
292   \textcolor{comment}{! max. melt}
293   mmax = maxval(melt(is:ie,js:je))
294   \textcolor{keyword}{call }max\_across\_pes(mmax)
295   \textcolor{comment}{! write(mesg,*) 'max melt = ', mmax}
296   \textcolor{comment}{! call MOM\_mesg(mesg, 5)}
297   \textcolor{comment}{! dye melt water (m=1), dye = 1 if melt=max(melt)}
298   \textcolor{keywordflow}{do} m=1,ntr
299     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
300       \textcolor{keywordflow}{if} (melt(i,j) > 0.0) \textcolor{keywordflow}{then} \textcolor{comment}{! melting}
301         cs%tr(i,j,1:2,m) = melt(i,j)/mmax \textcolor{comment}{! inject dye in the ML}
302       \textcolor{keywordflow}{else} \textcolor{comment}{! freezing}
303         cs%tr(i,j,1:2,m) = 0.0
304 \textcolor{keywordflow}{      endif}
305 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
306 \textcolor{keywordflow}{  enddo}
307 
308   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(evap\_cfl\_limit) .and. \textcolor{keyword}{present}(minimum\_forcing\_depth)) \textcolor{keywordflow}{then}
309     \textcolor{keywordflow}{do} m=1,ntr
310       \textcolor{keywordflow}{do} k=1,nz ;\textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
311         h\_work(i,j,k) = h\_old(i,j,k)
312 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
313       \textcolor{keyword}{call }applytracerboundaryfluxesinout(g, gv, cs%tr(:,:,:,m), dt, fluxes, h\_work, &
314                                           evap\_cfl\_limit, minimum\_forcing\_depth)
315       \textcolor{keyword}{call }tracer\_vertdiff(h\_work, ea, eb, dt, cs%tr(:,:,:,m), g, gv)
316 \textcolor{keywordflow}{    enddo}
317   \textcolor{keywordflow}{else}
318     \textcolor{keywordflow}{do} m=1,ntr
319       \textcolor{keyword}{call }tracer\_vertdiff(h\_old, ea, eb, dt, cs%tr(:,:,:,m), g, gv)
320 \textcolor{keywordflow}{    enddo}
321 \textcolor{keywordflow}{  endif}
322 
\end{DoxyCode}
\mbox{\Hypertarget{namespaceisomip__tracer_a104a1c0d2098aa48a52684bd1509bbc4}\label{namespaceisomip__tracer_a104a1c0d2098aa48a52684bd1509bbc4}} 
\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}!isomip\+\_\+tracer\+\_\+end@{isomip\+\_\+tracer\+\_\+end}}
\index{isomip\+\_\+tracer\+\_\+end@{isomip\+\_\+tracer\+\_\+end}!isomip\+\_\+tracer@{isomip\+\_\+tracer}}
\subsubsection{\texorpdfstring{isomip\+\_\+tracer\+\_\+end()}{isomip\_tracer\_end()}}
{\footnotesize\ttfamily subroutine, public isomip\+\_\+tracer\+::isomip\+\_\+tracer\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+tracer\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Deallocate any memory used by the I\+S\+O\+M\+IP tracer package. 


\begin{DoxyParams}{Parameters}
{\em cs} & The control structure returned by a previous call to I\+S\+O\+M\+I\+P\+\_\+register\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 360 of file I\+S\+O\+M\+I\+P\+\_\+tracer.\+F90.


\begin{DoxyCode}
360   \textcolor{keywordtype}{type}(ISOMIP\_tracer\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}
361 \textcolor{comment}{                                        !! call to ISOMIP\_register\_tracer.}
362   \textcolor{keywordtype}{integer} :: m
363 
364   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
365     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%tr)) \textcolor{keyword}{deallocate}(cs%tr)
366     \textcolor{keyword}{deallocate}(cs)
367 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespaceisomip__tracer_ac2571b7b6e4dce0d5936a483159ec379}\label{namespaceisomip__tracer_ac2571b7b6e4dce0d5936a483159ec379}} 
\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}!isomip\+\_\+tracer\+\_\+surface\+\_\+state@{isomip\+\_\+tracer\+\_\+surface\+\_\+state}}
\index{isomip\+\_\+tracer\+\_\+surface\+\_\+state@{isomip\+\_\+tracer\+\_\+surface\+\_\+state}!isomip\+\_\+tracer@{isomip\+\_\+tracer}}
\subsubsection{\texorpdfstring{isomip\+\_\+tracer\+\_\+surface\+\_\+state()}{isomip\_tracer\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public isomip\+\_\+tracer\+::isomip\+\_\+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(\mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+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 I\+S\+O\+M\+I\+P\+\_\+register\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 329 of file I\+S\+O\+M\+I\+P\+\_\+tracer.\+F90.


\begin{DoxyCode}
329   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{  !< The ocean's grid structure.}
330   \textcolor{keywordtype}{type}(surface),          \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}
331 \textcolor{comment}{                                              !! describe the surface state of the ocean.}
332   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
333                           \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thickness [H ~> m or kg m-2].}
334   \textcolor{keywordtype}{type}(ISOMIP\_tracer\_CS), \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{ !< The control structure returned by a previous}
335 \textcolor{comment}{                                              !! call to ISOMIP\_register\_tracer.}
336 
337   \textcolor{comment}{! This particular tracer package does not report anything back to the coupler.}
338   \textcolor{comment}{! The code that is here is just a rough guide for packages that would.}
339 
340   \textcolor{keywordtype}{integer} :: m, is, ie, js, je, isd, ied, jsd, jed
341   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
342   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
343 
344   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
345 
346   \textcolor{keywordflow}{if} (cs%coupled\_tracers) \textcolor{keywordflow}{then}
347     \textcolor{keywordflow}{do} m=1,ntr
348       \textcolor{comment}{!   This call loads the surface values into the appropriate array in the}
349       \textcolor{comment}{! coupler-type structure.}
350       \textcolor{keyword}{call }coupler\_type\_set\_data(cs%tr(:,:,1,m), cs%ind\_tr(m), ind\_csurf, &
351                    sfc\_state%tr\_fields, idim=(/isd, is, ie, ied/), &
352                    jdim=(/jsd, js, je, jed/) )
353 \textcolor{keywordflow}{    enddo}
354 \textcolor{keywordflow}{  endif}
355 
\end{DoxyCode}
\mbox{\Hypertarget{namespaceisomip__tracer_a7d66fe5ba12076654324a7e7d8ab2e4f}\label{namespaceisomip__tracer_a7d66fe5ba12076654324a7e7d8ab2e4f}} 
\index{isomip\+\_\+tracer@{isomip\+\_\+tracer}!register\+\_\+isomip\+\_\+tracer@{register\+\_\+isomip\+\_\+tracer}}
\index{register\+\_\+isomip\+\_\+tracer@{register\+\_\+isomip\+\_\+tracer}!isomip\+\_\+tracer@{isomip\+\_\+tracer}}
\subsubsection{\texorpdfstring{register\+\_\+isomip\+\_\+tracer()}{register\_isomip\_tracer()}}
{\footnotesize\ttfamily logical function, public isomip\+\_\+tracer\+::register\+\_\+isomip\+\_\+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(\mbox{\hyperlink{structisomip__tracer_1_1isomip__tracer__cs}{isomip\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(tracer\+\_\+registry\+\_\+type), pointer}]{tr\+\_\+\+Reg,  }\item[{type(mom\+\_\+restart\+\_\+cs), pointer}]{restart\+\_\+\+CS }\end{DoxyParamCaption})}



This subroutine is used to register tracer fields. 


\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 indicating the open file to parse for model parameter values.\\
\hline
 & {\em cs} & A pointer that is set to point to the control structure for this module (in/out).\\
\hline
 & {\em tr\+\_\+reg} & A pointer to the tracer registry.\\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure. \\
\hline
\end{DoxyParams}


Definition at line 69 of file I\+S\+O\+M\+I\+P\+\_\+tracer.\+F90.


\begin{DoxyCode}
69   \textcolor{keywordtype}{type}(hor\_index\_type),      \textcolor{keywordtype}{intent(in)} :: HI\textcolor{comment}{    !<A horizontal index type structure.}
70   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure.}
71   \textcolor{keywordtype}{type}(param\_file\_type),      \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure indicating the open file}
72 \textcolor{comment}{                                                       !! to parse for model parameter values.}
73   \textcolor{keywordtype}{type}(ISOMIP\_tracer\_CS),     \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !<A pointer that is set to point to the control}
74 \textcolor{comment}{                                                       !! structure for this module (in/out).}
75   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: tr\_Reg\textcolor{comment}{ !<A pointer to the tracer registry.}
76   \textcolor{keywordtype}{type}(MOM\_restart\_CS),       \textcolor{keywordtype}{pointer}    :: restart\_CS\textcolor{comment}{ !<A pointer to the restart control structure.}
77 
78   \textcolor{keywordtype}{character(len=80)}  :: name, longname
79 \textcolor{comment}{! This include declares and sets the variable "version".}
80 \textcolor{preprocessor}{#include "version\_variable.h"}
81 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"ISOMIP\_tracer"} \textcolor{comment}{! This module's name.}
82   \textcolor{keywordtype}{character(len=200)} :: inputdir
83   \textcolor{keywordtype}{character(len=48)}  :: flux\_units \textcolor{comment}{! The units for tracer fluxes, usually}
84                             \textcolor{comment}{! kg(tracer) kg(water)-1 m3 s-1 or kg(tracer) s-1.}
85   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer} :: tr\_ptr(:,:,:) => null()
86   \textcolor{keywordtype}{logical} :: register\_ISOMIP\_tracer
87   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, m
88   isd = hi%isd ; ied = hi%ied ; jsd = hi%jsd ; jed = hi%jed ; nz = gv%ke
89 
90   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
91     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"ISOMIP\_register\_tracer called with an "}// &
92                             \textcolor{stringliteral}{"associated control structure."})
93     \textcolor{keywordflow}{return}
94 \textcolor{keywordflow}{  endif}
95   \textcolor{keyword}{allocate}(cs)
96 
97   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}
98   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
99   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"ISOMIP\_TRACER\_IC\_FILE"}, cs%tracer\_IC\_file, &
100                  \textcolor{stringliteral}{"The name of a file from which to read the initial "}//&
101                  \textcolor{stringliteral}{"conditions for the ISOMIP tracers, or blank to initialize "}//&
102                  \textcolor{stringliteral}{"them internally."}, default=\textcolor{stringliteral}{" "})
103   \textcolor{keywordflow}{if} (len\_trim(cs%tracer\_IC\_file) >= 1) \textcolor{keywordflow}{then}
104     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR"}, inputdir, default=\textcolor{stringliteral}{"."})
105     inputdir = slasher(inputdir)
106     cs%tracer\_IC\_file = trim(inputdir)//trim(cs%tracer\_IC\_file)
107     \textcolor{keyword}{call }log\_param(param\_file, mdl, \textcolor{stringliteral}{"INPUTDIR/ISOMIP\_TRACER\_IC\_FILE"}, &
108                    cs%tracer\_IC\_file)
109 \textcolor{keywordflow}{  endif}
110   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SPONGE"}, cs%use\_sponge, &
111                  \textcolor{stringliteral}{"If true, sponges may be applied anywhere in the domain. "}//&
112                  \textcolor{stringliteral}{"The exact location and properties of those sponges are "}//&
113                  \textcolor{stringliteral}{"specified from MOM\_initialization.F90."}, default=.false.)
114 
115   \textcolor{keyword}{allocate}(cs%tr(isd:ied,jsd:jed,nz,ntr)) ; cs%tr(:,:,:,:) = 0.0
116 
117   \textcolor{keywordflow}{do} m=1,ntr
118     \textcolor{keywordflow}{if} (m < 10) \textcolor{keywordflow}{then} ; \textcolor{keyword}{write}(name,\textcolor{stringliteral}{'("tr\_D",I1.1)'}) m
119     \textcolor{keywordflow}{else} ; \textcolor{keyword}{write}(name,\textcolor{stringliteral}{'("tr\_D",I2.2)'}) m ;\textcolor{keywordflow}{ endif}
120     \textcolor{keyword}{write}(longname,\textcolor{stringliteral}{'("Concentration of ISOMIP Tracer ",I2.2)'}) m
121     cs%tr\_desc(m) = var\_desc(name, units=\textcolor{stringliteral}{"kg kg-1"}, longname=longname, caller=mdl)
122     \textcolor{keywordflow}{if} (gv%Boussinesq) \textcolor{keywordflow}{then} ; flux\_units = \textcolor{stringliteral}{"kg kg-1 m3 s-1"}
123     \textcolor{keywordflow}{else} ; flux\_units = \textcolor{stringliteral}{"kg s-1"} ;\textcolor{keywordflow}{ endif}
124 
125     \textcolor{comment}{! This is needed to force the compiler not to do a copy in the registration}
126     \textcolor{comment}{! calls.  Curses on the designers and implementers of Fortran90.}
127     tr\_ptr => cs%tr(:,:,:,m)
128     \textcolor{comment}{! Register the tracer for horizontal advection, diffusion, and restarts.}
129     \textcolor{keyword}{call }register\_tracer(tr\_ptr, tr\_reg, param\_file, hi, gv, &
130                          name=name, longname=longname, units=\textcolor{stringliteral}{"kg kg-1"}, &
131                          registry\_diags=.true., flux\_units=flux\_units, &
132                          restart\_cs=restart\_cs)
133 
134     \textcolor{comment}{!   Set coupled\_tracers to be true (hard-coded above) to provide the surface}
135     \textcolor{comment}{! values to the coupler (if any).  This is meta-code and its arguments will}
136     \textcolor{comment}{! currently (deliberately) give fatal errors if it is used.}
137     \textcolor{keywordflow}{if} (cs%coupled\_tracers) &
138       cs%ind\_tr(m) = aof\_set\_coupler\_flux(trim(name)//\textcolor{stringliteral}{'\_flux'}, &
139           flux\_type=\textcolor{stringliteral}{' '}, implementation=\textcolor{stringliteral}{' '}, caller=\textcolor{stringliteral}{"register\_ISOMIP\_tracer"})
140 \textcolor{keywordflow}{  enddo}
141 
142   cs%tr\_Reg => tr\_reg
143   register\_isomip\_tracer = .true.
\end{DoxyCode}
