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


\doxysubsection{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). \doxysubsection*{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}
\doxysubsection*{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}
\doxysubsection*{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}


\doxysubsection{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+old} & Layer thickness before entrainment \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em h\+\_\+new} & Layer thickness after entrainment \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em ea} & an array to which the amount of fluid entrained \\
\hline
\mbox{\texttt{ in}}  & {\em eb} & an array to which the amount of fluid entrained \\
\hline
\mbox{\texttt{ in}}  & {\em fluxes} & A structure containing pointers to thermodynamic and tracer forcing fields. Unused fields have N\+U\+LL ptrs. \\
\hline
\mbox{\texttt{ in}}  & {\em dt} & The amount of time covered by this call \mbox{[}T $\sim$$>$ s\mbox{]} \\
\hline
\mbox{\texttt{ 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{\texttt{ 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{\texttt{ 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 285 of file D\+O\+M\+E\+\_\+tracer.\+F90.


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


\begin{DoxyCode}{0}
\DoxyCodeLine{373   \textcolor{keywordtype}{type}(DOME\_tracer\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}}
\DoxyCodeLine{374 \textcolor{comment}{                                      !! call to DOME\_register\_tracer.}}
\DoxyCodeLine{375   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{376 }
\DoxyCodeLine{377   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{378     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%tr)) \textcolor{keyword}{deallocate}(cs\%tr)}
\DoxyCodeLine{379     \textcolor{keyword}{deallocate}(cs)}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in,out}}  & {\em sfc\+\_\+state} & A structure containing fields that describe the surface state of the ocean. \\
\hline
\mbox{\texttt{ 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 341 of file D\+O\+M\+E\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{342   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{  !< The ocean's grid structure.}}
\DoxyCodeLine{343   \textcolor{keywordtype}{type}(surface),          \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}}
\DoxyCodeLine{344 \textcolor{comment}{                                              !! describe the surface state of the ocean.}}
\DoxyCodeLine{345 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{346                           \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{347   \textcolor{keywordtype}{type}(DOME\_tracer\_CS),   \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{ !< The control structure returned by a previous}}
\DoxyCodeLine{348 \textcolor{comment}{                                              !! call to DOME\_register\_tracer.}}
\DoxyCodeLine{349 }
\DoxyCodeLine{350   \textcolor{comment}{! This particular tracer package does not report anything back to the coupler.}}
\DoxyCodeLine{351   \textcolor{comment}{! The code that is here is just a rough guide for packages that would.}}
\DoxyCodeLine{352 }
\DoxyCodeLine{353   \textcolor{keywordtype}{integer} :: m, is, ie, js, je, isd, ied, jsd, jed}
\DoxyCodeLine{354   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{355   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{356 }
\DoxyCodeLine{357   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{358 }
\DoxyCodeLine{359   \textcolor{keywordflow}{if} (cs\%coupled\_tracers) \textcolor{keywordflow}{then}}
\DoxyCodeLine{360     \textcolor{keywordflow}{do} m=1,ntr}
\DoxyCodeLine{361       \textcolor{comment}{!   This call loads the surface values into the appropriate array in the}}
\DoxyCodeLine{362       \textcolor{comment}{! coupler-\/type structure.}}
\DoxyCodeLine{363       \textcolor{keyword}{call }coupler\_type\_set\_data(cs\%tr(:,:,1,m), cs\%ind\_tr(m), ind\_csurf, \&}
\DoxyCodeLine{364                    sfc\_state\%tr\_fields, idim=(/isd, is, ie, ied/), \&}
\DoxyCodeLine{365                    jdim=(/jsd, js, je, jed/) )}
\DoxyCodeLine{366 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{367 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em restart} & .true. if the fields have already been read from a restart file. \\
\hline
\mbox{\texttt{ in}}  & {\em day} & Time of the start of the run. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ 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{\texttt{ in}}  & {\em param\+\_\+file} & A structure to parse for run-\/time parameters \\
\hline
\end{DoxyParams}


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


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


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

\end{DoxyCode}
