\hypertarget{namespacedome__tracer}{}\section{dome\+\_\+tracer Module Reference}
\label{namespacedome__tracer}\index{dome\+\_\+tracer@{dome\+\_\+tracer}}


\subsection{Detailed Description}
A tracer package that is used as a diagnostic in the D\+O\+ME experiments. 

By Robert Hallberg, 2002.

This file contains an example of the code that is needed to set up and use a set (in this case eleven) of dynamically passive tracers. These tracers dye the inflowing water or water initially within a range of latitudes or water initially in a range of depths.

A single subroutine is called from within each file to register each of the tracers for reinitialization and advection and to register the subroutine that initializes the tracers and set up their output and the subroutine that does any tracer physics or chemistry along with diapycnal mixing (included here because some tracers may float or swim vertically or dye diapycnal processes). \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+tracer\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em The D\+O\+M\+E\+\_\+tracer control structure. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \mbox{\hyperlink{namespacedome__tracer_a2a6918ef09b8674c6ad56f80dfc370ff}{register\+\_\+dome\+\_\+tracer}} (HI, GV, param\+\_\+file, CS, tr\+\_\+\+Reg, restart\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em Register tracer fields and subroutines to be used with M\+OM. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__tracer_a06a4e3eaa52d9e63528e5997081f989e}{initialize\+\_\+dome\+\_\+tracer}} (restart, day, G, GV, US, h, diag, O\+BC, CS, sponge\+\_\+\+C\+Sp, param\+\_\+file)
\begin{DoxyCompactList}\small\item\em Initializes the N\+TR tracer fields in tr(\+:,\+:,\+:,\+:) and sets up the tracer output. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__tracer_afcf9c716f103f76a5013ebdf53571920}{dome\+\_\+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 and any other column tracer physics or chemistry to the tracers from this file. This is a simple example of a set of advected passive tracers. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__tracer_ad0339c25b9e4fb077f55e990d4213c37}{dome\+\_\+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{namespacedome__tracer_a6604ab13177c5fb4a0dd8b43a17b4649}{dome\+\_\+tracer\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Clean up memory allocations, if any. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacedome__tracer_aff19e4480bbd15ebd5b1697d612bf756}\label{namespacedome__tracer_aff19e4480bbd15ebd5b1697d612bf756}} 
integer, parameter \mbox{\hyperlink{namespacedome__tracer_aff19e4480bbd15ebd5b1697d612bf756}{ntr}} = 11
\begin{DoxyCompactList}\small\item\em The number of tracers in this module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedome__tracer_afcf9c716f103f76a5013ebdf53571920}\label{namespacedome__tracer_afcf9c716f103f76a5013ebdf53571920}} 
\index{dome\+\_\+tracer@{dome\+\_\+tracer}!dome\+\_\+tracer\+\_\+column\+\_\+physics@{dome\+\_\+tracer\+\_\+column\+\_\+physics}}
\index{dome\+\_\+tracer\+\_\+column\+\_\+physics@{dome\+\_\+tracer\+\_\+column\+\_\+physics}!dome\+\_\+tracer@{dome\+\_\+tracer}}
\subsubsection{\texorpdfstring{dome\+\_\+tracer\+\_\+column\+\_\+physics()}{dome\_tracer\_column\_physics()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+tracer\+::dome\+\_\+tracer\+\_\+column\+\_\+physics (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h\+\_\+old,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, g \%ke), intent(in)}]{h\+\_\+new,  }\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[{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{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+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 and any other column tracer physics or chemistry to the tracers from this file. This is a simple example of a set of advected passive tracers. 

The arguments to this subroutine are redundant in that h\+\_\+new(k) = h\+\_\+old(k) + ea(k) -\/ eb(k-\/1) + eb(k) -\/ ea(k+1)


\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 D\+O\+M\+E\+\_\+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 287 of file D\+O\+M\+E\+\_\+tracer.\+F90.


\begin{DoxyCode}
287   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}
288   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
289   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
290                            \textcolor{keywordtype}{intent(in)} :: h\_old\textcolor{comment}{ !< Layer thickness before entrainment [H ~> m or kg m-2].}
291   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
292                            \textcolor{keywordtype}{intent(in)} :: h\_new\textcolor{comment}{ !< Layer thickness after entrainment [H ~> m or kg m-2].}
293   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
294                            \textcolor{keywordtype}{intent(in)} :: ea\textcolor{comment}{   !< an array to which the amount of fluid entrained}
295 \textcolor{comment}{                                              !! from the layer above during this call will be}
296 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
297   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
298                            \textcolor{keywordtype}{intent(in)} :: eb\textcolor{comment}{   !< an array to which the amount of fluid entrained}
299 \textcolor{comment}{                                              !! from the layer below during this call will be}
300 \textcolor{comment}{                                              !! added [H ~> m or kg m-2].}
301   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to thermodynamic}
302 \textcolor{comment}{                                              !! and tracer forcing fields.  Unused fields have NULL ptrs.}
303   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< The amount of time covered by this call [T ~> s]}
304   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}
305   \textcolor{keywordtype}{type}(DOME\_tracer\_CS),    \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{   !< The control structure returned by a previous}
306 \textcolor{comment}{                                              !! call to DOME\_register\_tracer.}
307   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: evap\_CFL\_limit\textcolor{comment}{ !< Limit on the fraction of the water that can}
308 \textcolor{comment}{                                              !! be fluxed out of the top layer in a timestep [nondim]}
309   \textcolor{keywordtype}{real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: minimum\_forcing\_depth\textcolor{comment}{ !< The smallest depth over which}
310 \textcolor{comment}{                                              !! fluxes can be applied [H ~> m or kg m-2]}
311 
312 \textcolor{comment}{! Local variables}
313   \textcolor{keywordtype}{real} :: b1(SZI\_(G))          \textcolor{comment}{! b1 and c1 are variables used by the}
314   \textcolor{keywordtype}{real} :: c1(SZI\_(G),SZK\_(G))  \textcolor{comment}{! tridiagonal solver.}
315   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_work \textcolor{comment}{! Used so that h can be modified}
316   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m
317   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
318 
319   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
320 
321   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(evap\_cfl\_limit) .and. \textcolor{keyword}{present}(minimum\_forcing\_depth)) \textcolor{keywordflow}{then}
322     \textcolor{keywordflow}{do} m=1,ntr
323       \textcolor{keywordflow}{do} k=1,nz ;\textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
324           h\_work(i,j,k) = h\_old(i,j,k)
325 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
326       \textcolor{keyword}{call }applytracerboundaryfluxesinout(g, gv, cs%tr(:,:,:,m), dt, fluxes, h\_work, &
327                                           evap\_cfl\_limit, minimum\_forcing\_depth)
328       \textcolor{keyword}{call }tracer\_vertdiff(h\_work, ea, eb, dt, cs%tr(:,:,:,m), g, gv)
329 \textcolor{keywordflow}{    enddo}
330   \textcolor{keywordflow}{else}
331     \textcolor{keywordflow}{do} m=1,ntr
332       \textcolor{keyword}{call }tracer\_vertdiff(h\_old, ea, eb, dt, cs%tr(:,:,:,m), g, gv)
333 \textcolor{keywordflow}{    enddo}
334 \textcolor{keywordflow}{  endif}
335 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__tracer_a6604ab13177c5fb4a0dd8b43a17b4649}\label{namespacedome__tracer_a6604ab13177c5fb4a0dd8b43a17b4649}} 
\index{dome\+\_\+tracer@{dome\+\_\+tracer}!dome\+\_\+tracer\+\_\+end@{dome\+\_\+tracer\+\_\+end}}
\index{dome\+\_\+tracer\+\_\+end@{dome\+\_\+tracer\+\_\+end}!dome\+\_\+tracer@{dome\+\_\+tracer}}
\subsubsection{\texorpdfstring{dome\+\_\+tracer\+\_\+end()}{dome\_tracer\_end()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+tracer\+::dome\+\_\+tracer\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+tracer\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Clean up memory allocations, if any. 


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


Definition at line 373 of file D\+O\+M\+E\+\_\+tracer.\+F90.


\begin{DoxyCode}
373   \textcolor{keywordtype}{type}(DOME\_tracer\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}
374 \textcolor{comment}{                                      !! call to DOME\_register\_tracer.}
375   \textcolor{keywordtype}{integer} :: m
376 
377   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}
378     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs%tr)) \textcolor{keyword}{deallocate}(cs%tr)
379     \textcolor{keyword}{deallocate}(cs)
380 \textcolor{keywordflow}{  endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__tracer_ad0339c25b9e4fb077f55e990d4213c37}\label{namespacedome__tracer_ad0339c25b9e4fb077f55e990d4213c37}} 
\index{dome\+\_\+tracer@{dome\+\_\+tracer}!dome\+\_\+tracer\+\_\+surface\+\_\+state@{dome\+\_\+tracer\+\_\+surface\+\_\+state}}
\index{dome\+\_\+tracer\+\_\+surface\+\_\+state@{dome\+\_\+tracer\+\_\+surface\+\_\+state}!dome\+\_\+tracer@{dome\+\_\+tracer}}
\subsubsection{\texorpdfstring{dome\+\_\+tracer\+\_\+surface\+\_\+state()}{dome\_tracer\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+tracer\+::dome\+\_\+tracer\+\_\+surface\+\_\+state (\begin{DoxyParamCaption}\item[{type(surface), intent(inout)}]{sfc\+\_\+state,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+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 D\+O\+M\+E\+\_\+register\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 342 of file D\+O\+M\+E\+\_\+tracer.\+F90.


\begin{DoxyCode}
342   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{  !< The ocean's grid structure.}
343   \textcolor{keywordtype}{type}(surface),          \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}
344 \textcolor{comment}{                                              !! describe the surface state of the ocean.}
345   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, &
346                           \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thickness [H ~> m or kg m-2].}
347   \textcolor{keywordtype}{type}(DOME\_tracer\_CS),   \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{ !< The control structure returned by a previous}
348 \textcolor{comment}{                                              !! call to DOME\_register\_tracer.}
349 
350   \textcolor{comment}{! This particular tracer package does not report anything back to the coupler.}
351   \textcolor{comment}{! The code that is here is just a rough guide for packages that would.}
352 
353   \textcolor{keywordtype}{integer} :: m, is, ie, js, je, isd, ied, jsd, jed
354   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
355   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
356 
357   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
358 
359   \textcolor{keywordflow}{if} (cs%coupled\_tracers) \textcolor{keywordflow}{then}
360     \textcolor{keywordflow}{do} m=1,ntr
361       \textcolor{comment}{!   This call loads the surface values into the appropriate array in the}
362       \textcolor{comment}{! coupler-type structure.}
363       \textcolor{keyword}{call }coupler\_type\_set\_data(cs%tr(:,:,1,m), cs%ind\_tr(m), ind\_csurf, &
364                    sfc\_state%tr\_fields, idim=(/isd, is, ie, ied/), &
365                    jdim=(/jsd, js, je, jed/) )
366 \textcolor{keywordflow}{    enddo}
367 \textcolor{keywordflow}{  endif}
368 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__tracer_a06a4e3eaa52d9e63528e5997081f989e}\label{namespacedome__tracer_a06a4e3eaa52d9e63528e5997081f989e}} 
\index{dome\+\_\+tracer@{dome\+\_\+tracer}!initialize\+\_\+dome\+\_\+tracer@{initialize\+\_\+dome\+\_\+tracer}}
\index{initialize\+\_\+dome\+\_\+tracer@{initialize\+\_\+dome\+\_\+tracer}!dome\+\_\+tracer@{dome\+\_\+tracer}}
\subsubsection{\texorpdfstring{initialize\+\_\+dome\+\_\+tracer()}{initialize\_dome\_tracer()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+tracer\+::initialize\+\_\+dome\+\_\+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[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(diag\+\_\+ctrl), intent(in), target}]{diag,  }\item[{type(ocean\+\_\+obc\+\_\+type), pointer}]{O\+BC,  }\item[{type(\mbox{\hyperlink{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(sponge\+\_\+cs), pointer}]{sponge\+\_\+\+C\+Sp,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file }\end{DoxyParamCaption})}



Initializes the N\+TR tracer fields in tr(\+:,\+:,\+:,\+:) and sets up the tracer output. 


\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 us} & A dimensional unit scaling type\\
\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 thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em diag} & Structure used to regulate diagnostic output.\\
\hline
 & {\em obc} & Structure specifying open boundary options.\\
\hline
 & {\em cs} & The control structure returned by a previous call to D\+O\+M\+E\+\_\+register\+\_\+tracer.\\
\hline
 & {\em sponge\+\_\+csp} & A pointer to the control structure for the sponges, if they are in use.\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


Definition at line 144 of file D\+O\+M\+E\+\_\+tracer.\+F90.


\begin{DoxyCode}
144   \textcolor{keywordtype}{type}(ocean\_grid\_type),                 \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}
145   \textcolor{keywordtype}{type}(verticalGrid\_type),               \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}
146   \textcolor{keywordtype}{type}(unit\_scale\_type),                 \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}
147   \textcolor{keywordtype}{logical},                               \textcolor{keywordtype}{intent(in)} :: restart\textcolor{comment}{ !< .true. if the fields have already}
148 \textcolor{comment}{                                                               !! been read from a restart file.}
149   \textcolor{keywordtype}{type}(time\_type), \textcolor{keywordtype}{target},               \textcolor{keywordtype}{intent(in)} :: day\textcolor{comment}{     !< Time of the start of the run.}
150   \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]}
151   \textcolor{keywordtype}{type}(diag\_ctrl), \textcolor{keywordtype}{target},               \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{    !< Structure used to regulate diagnostic
       output.}
152   \textcolor{keywordtype}{type}(ocean\_OBC\_type),                  \textcolor{keywordtype}{pointer}    :: OBC\textcolor{comment}{     !< Structure specifying open boundary
       options.}
153   \textcolor{keywordtype}{type}(DOME\_tracer\_CS),                  \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{      !< The control structure returned by a
       previous}
154 \textcolor{comment}{                                                               !! call to DOME\_register\_tracer.}
155   \textcolor{keywordtype}{type}(sponge\_CS),                       \textcolor{keywordtype}{pointer}    :: sponge\_CSp\textcolor{comment}{    !< A pointer to the control structure}
156 \textcolor{comment}{                                                                     !! for the sponges, if they are in
       use.}
157   \textcolor{keywordtype}{type}(param\_file\_type),                 \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure to parse for run-time
       parameters}
158 
159 \textcolor{comment}{! Local variables}
160   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{allocatable} :: temp(:,:,:)
161   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer}, \textcolor{keywordtype}{dimension(:,:,:)} :: &
162     OBC\_tr1\_u => null(), & \textcolor{comment}{! These arrays should be allocated and set to}
163     obc\_tr1\_v => null()    \textcolor{comment}{! specify the values of tracer 1 that should come}
164                            \textcolor{comment}{! in through u- and v- points through the open}
165                            \textcolor{comment}{! boundary conditions, in the same units as tr.}
166   \textcolor{keywordtype}{character(len=16)} :: name     \textcolor{comment}{! A variable's name in a NetCDF file.}
167   \textcolor{keywordtype}{character(len=72)} :: longname \textcolor{comment}{! The long name of that variable.}
168   \textcolor{keywordtype}{character(len=48)} :: units    \textcolor{comment}{! The dimensions of the variable.}
169   \textcolor{keywordtype}{character(len=48)} :: flux\_units \textcolor{comment}{! The units for tracer fluxes, usually}
170                             \textcolor{comment}{! kg(tracer) kg(water)-1 m3 s-1 or kg(tracer) s-1.}
171   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{pointer} :: tr\_ptr(:,:,:) => null()
172   \textcolor{keywordtype}{real} :: PI     \textcolor{comment}{! 3.1415926... calculated as 4*atan(1)}
173   \textcolor{keywordtype}{real} :: tr\_y   \textcolor{comment}{! Initial zonally uniform tracer concentrations.}
174   \textcolor{keywordtype}{real} :: h\_neglect         \textcolor{comment}{! A thickness that is so small it is usually lost}
175                             \textcolor{comment}{! in roundoff and can be neglected [H ~> m or kg m-2].}
176   \textcolor{keywordtype}{real} :: e(SZK\_(G)+1), e\_top, e\_bot \textcolor{comment}{! Heights [Z ~> m].}
177   \textcolor{keywordtype}{real} :: d\_tr   \textcolor{comment}{! A change in tracer concentraions, in tracer units.}
178   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz, m
179   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB
180 
181   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
182   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = gv%ke
183   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
184   isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
185   h\_neglect = gv%H\_subroundoff
186 
187   cs%Time => day
188   cs%diag => diag
189 
190   \textcolor{keywordflow}{if} (.not.restart) \textcolor{keywordflow}{then}
191     \textcolor{keywordflow}{if} (len\_trim(cs%tracer\_IC\_file) >= 1) \textcolor{keywordflow}{then}
192       \textcolor{comment}{!  Read the tracer concentrations from a netcdf file.}
193       \textcolor{keywordflow}{if} (.not.file\_exists(cs%tracer\_IC\_file, g%Domain)) &
194         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"DOME\_initialize\_tracer: Unable to open "}// &
195                         cs%tracer\_IC\_file)
196       \textcolor{keywordflow}{do} m=1,ntr
197         \textcolor{keyword}{call }query\_vardesc(cs%tr\_desc(m), name, caller=\textcolor{stringliteral}{"initialize\_DOME\_tracer"})
198         \textcolor{keyword}{call }mom\_read\_data(cs%tracer\_IC\_file, trim(name), cs%tr(:,:,:,m), g%Domain)
199 \textcolor{keywordflow}{      enddo}
200     \textcolor{keywordflow}{else}
201       \textcolor{keywordflow}{do} m=1,ntr
202         \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
203           cs%tr(i,j,k,m) = 1.0e-20 \textcolor{comment}{! This could just as well be 0.}
204 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
205 \textcolor{keywordflow}{      enddo}
206 
207 \textcolor{comment}{!    This sets a stripe of tracer across the basin.}
208       \textcolor{keywordflow}{do} m=2,ntr ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
209         tr\_y = 0.0
210         \textcolor{keywordflow}{if} ((m <= 6) .and. (g%geoLatT(i,j) > (300.0+50.0*\textcolor{keywordtype}{real}(m-1))) .and. &
211             (G%geoLatT(i,j) < (350.0+50.0*\textcolor{keywordtype}{real}(m-1)))) tr\_y = 1.0
212         \textcolor{keywordflow}{do} k=1,nz
213 \textcolor{comment}{!      This adds the stripes of tracer to every layer.}
214             cs%tr(i,j,k,m) = cs%tr(i,j,k,m) + tr\_y
215 \textcolor{keywordflow}{        enddo}
216 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
217 
218       \textcolor{keywordflow}{if} (ntr > 7) \textcolor{keywordflow}{then}
219         \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
220           e(nz+1) = -g%bathyT(i,j)
221           \textcolor{keywordflow}{do} k=nz,1,-1
222             e(k) = e(k+1) + h(i,j,k)*gv%H\_to\_Z
223             \textcolor{keywordflow}{do} m=7,ntr
224               e\_top = (-600.0*\textcolor{keywordtype}{real(m-1)} + 3000.0) * US%m\_to\_Z
225               e\_bot = (-600.0*\textcolor{keywordtype}{real(m-1)} + 2700.0) * US%m\_to\_Z
226               \textcolor{keywordflow}{if} (e\_top < e(k)) \textcolor{keywordflow}{then}
227                 \textcolor{keywordflow}{if} (e\_top < e(k+1)) \textcolor{keywordflow}{then} ; d\_tr = 0.0
228                 \textcolor{keywordflow}{elseif} (e\_bot < e(k+1)) \textcolor{keywordflow}{then}
229                   d\_tr = 1.0 * (e\_top-e(k+1)) / ((h(i,j,k)+h\_neglect)*gv%H\_to\_Z)
230                 \textcolor{keywordflow}{else} ; d\_tr = 1.0 * (e\_top-e\_bot) / ((h(i,j,k)+h\_neglect)*gv%H\_to\_Z)
231 \textcolor{keywordflow}{                endif}
232               \textcolor{keywordflow}{elseif} (e\_bot < e(k)) \textcolor{keywordflow}{then}
233                 \textcolor{keywordflow}{if} (e\_bot < e(k+1)) \textcolor{keywordflow}{then} ; d\_tr = 1.0
234                 \textcolor{keywordflow}{else} ; d\_tr = 1.0 * (e(k)-e\_bot) / ((h(i,j,k)+h\_neglect)*gv%H\_to\_Z)
235 \textcolor{keywordflow}{                endif}
236               \textcolor{keywordflow}{else}
237                 d\_tr = 0.0
238 \textcolor{keywordflow}{              endif}
239               \textcolor{keywordflow}{if} (h(i,j,k) < 2.0*gv%Angstrom\_H) d\_tr=0.0
240               cs%tr(i,j,k,m) = cs%tr(i,j,k,m) + d\_tr
241 \textcolor{keywordflow}{            enddo}
242 \textcolor{keywordflow}{          enddo}
243 \textcolor{keywordflow}{        enddo} ;\textcolor{keywordflow}{ enddo}
244 \textcolor{keywordflow}{      endif}
245 
246 \textcolor{keywordflow}{    endif}
247 \textcolor{keywordflow}{  endif} \textcolor{comment}{! restart}
248 
249   \textcolor{keywordflow}{if} ( cs%use\_sponge ) \textcolor{keywordflow}{then}
250 \textcolor{comment}{!   If sponges are used, this example damps tracers in sponges in the}
251 \textcolor{comment}{! northern half of the domain to 1 and tracers in the southern half}
252 \textcolor{comment}{! to 0.  For any tracers that are not damped in the sponge, the call}
253 \textcolor{comment}{! to set\_up\_sponge\_field can simply be omitted.}
254     \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(sponge\_csp)) &
255       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"DOME\_initialize\_tracer: "}// &
256         \textcolor{stringliteral}{"The pointer to sponge\_CSp must be associated if SPONGE is defined."})
257 
258     \textcolor{keyword}{allocate}(temp(g%isd:g%ied,g%jsd:g%jed,nz))
259     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
260       \textcolor{keywordflow}{if} (g%geoLatT(i,j) > 700.0 .and. (k > nz/2)) \textcolor{keywordflow}{then}
261         temp(i,j,k) = 1.0
262       \textcolor{keywordflow}{else}
263         temp(i,j,k) = 0.0
264 \textcolor{keywordflow}{      endif}
265 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}
266 
267 \textcolor{comment}{!   do m=1,NTR}
268     \textcolor{keywordflow}{do} m=1,1
269       \textcolor{comment}{! This is needed to force the compiler not to do a copy in the sponge}
270       \textcolor{comment}{! calls.  Curses on the designers and implementers of Fortran90.}
271       tr\_ptr => cs%tr(:,:,:,m)
272       \textcolor{keyword}{call }set\_up\_sponge\_field(temp, tr\_ptr, g, nz, sponge\_csp)
273 \textcolor{keywordflow}{    enddo}
274     \textcolor{keyword}{deallocate}(temp)
275 \textcolor{keywordflow}{  endif}
276 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__tracer_a2a6918ef09b8674c6ad56f80dfc370ff}\label{namespacedome__tracer_a2a6918ef09b8674c6ad56f80dfc370ff}} 
\index{dome\+\_\+tracer@{dome\+\_\+tracer}!register\+\_\+dome\+\_\+tracer@{register\+\_\+dome\+\_\+tracer}}
\index{register\+\_\+dome\+\_\+tracer@{register\+\_\+dome\+\_\+tracer}!dome\+\_\+tracer@{dome\+\_\+tracer}}
\subsubsection{\texorpdfstring{register\+\_\+dome\+\_\+tracer()}{register\_dome\_tracer()}}
{\footnotesize\ttfamily logical function, public dome\+\_\+tracer\+::register\+\_\+dome\+\_\+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{structdome__tracer_1_1dome__tracer__cs}{dome\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(tracer\+\_\+registry\+\_\+type), pointer}]{tr\+\_\+\+Reg,  }\item[{type(mom\+\_\+restart\+\_\+cs), pointer}]{restart\+\_\+\+CS }\end{DoxyParamCaption})}



Register tracer fields and subroutines to be used with M\+OM. 


\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} & A pointer that is set to point to the control structure for this module\\
\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 64 of file D\+O\+M\+E\+\_\+tracer.\+F90.


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