\hypertarget{namespaceboundary__impulse__tracer}{}\doxysection{boundary\+\_\+impulse\+\_\+tracer Module Reference}
\label{namespaceboundary__impulse__tracer}\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}


\doxysubsection{Detailed Description}
Implements a boundary impulse response tracer to calculate Green\textquotesingle{}s functions. 

\hypertarget{namespaceboundary__impulse__tracer_section_BIT_desc}{}\doxysubsection{Boundary Impulse Response Tracer and Transit Time Distributions}\label{namespaceboundary__impulse__tracer_section_BIT_desc}
Transit time distributions (T\+TD) are the Green\textquotesingle{}s function solution of the passive tracer equation between the oceanic surface and interior. The name derives from the idea that the \textquotesingle{}age\textquotesingle{} (e.\+g. time since last contact with the atmosphere) of a water parcel is best characterized as a distribution of ages because water parcels leaving the surface arrive at a particular interior point at different times. The more commonly used ideal age tracer is the first moment of the T\+TD, equivalently referred to as the mean age.

A boundary impulse response (B\+IR) is a passive tracer whose surface boundary condition is a rectangle function with width $\Delta t$. In the case of unsteady flow, multiple B\+I\+Rs, initiated at different times in the model can be used to infer the transit time distribution or Green\textquotesingle{}s function between the oceanic surface and interior. In the case of steady or cyclostationary flow, a single B\+IR is sufficient.

In the References section, both the theoretical discussion of T\+T\+Ds and B\+I\+Rs are listed along with modeling studies which have this used framework in scientific investigations\hypertarget{namespaceboundary__impulse__tracer_section_BIT_params}{}\doxysubsection{Run-\/time parameters}\label{namespaceboundary__impulse__tracer_section_BIT_params}
-\/D\+O\+\_\+\+B\+O\+U\+N\+D\+A\+R\+Y\+\_\+\+I\+M\+P\+U\+L\+S\+E\+\_\+\+T\+R\+A\+C\+ER\+: Enables the boundary impulse tracer model -\/I\+M\+P\+U\+L\+S\+E\+\_\+\+S\+O\+U\+R\+C\+E\+\_\+\+T\+I\+ME\+: Length of time that the surface layer acts as a source of the B\+IR tracer\hypertarget{namespaceboundary__impulse__tracer_section_BIT_refs}{}\doxysubsection{References}\label{namespaceboundary__impulse__tracer_section_BIT_refs}
\hypertarget{namespaceboundary__impulse__tracer_TTD}{}\doxysubsubsection{and B\+I\+R Theory}\label{namespaceboundary__impulse__tracer_TTD}
-\/Holzer, M., and T.\+M. Hall, 2000\+: Transit-\/time and tracer-\/age distributions in geophysical flows. J. Atmos. Sci., 57, 3539-\/3558, doi\+:10.\+1175/1520-\/0469(2000)057$<$3539\+:T\+T\+A\+T\+AD$>$2.\+0.\+CO;2. -\/\+T.\+W.\+N. Haine, H. Zhang, D.\+W. Waugh, M. Holzer, On transit-\/time distributions in unsteady circulation models, Ocean Modelling, Volume 21, Issues 1–2, 2008, Pages 35-\/45, I\+S\+SN 1463-\/5003 \href{http://dx.doi.org/10.1016/j.ocemod.2007.11.004}{\texttt{ http\+://dx.\+doi.\+org/10.\+1016/j.\+ocemod.\+2007.\+11.\+004}}. \hypertarget{namespaceboundary__impulse__tracer_section_BIT_apps}{}\doxysubsubsection{Modelling applications}\label{namespaceboundary__impulse__tracer_section_BIT_apps}
-\/Peacock, S., and M. Maltrud (2006), Transit-\/time distributions in a global ocean model, J. Phys. Oceanogr., 36(3), 474–495, doi\+:10.\+1175/\+J\+P\+O2860.1. -\/Maltrud, M., Bryan, F. \& Peacock, Boundary impulse response functions in a century-\/long eddying global ocean simulation, S. Environ Fluid Mech (2010) 10\+: 275. doi\+:10.\+1007/s10652-\/009-\/9154-\/3 \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em The control structure for the boundary impulse tracer package. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
logical function, public \mbox{\hyperlink{namespaceboundary__impulse__tracer_a8c333281de8a3f7a255a0da4187427ad}{register\+\_\+boundary\+\_\+impulse\+\_\+tracer}} (HI, GV, param\+\_\+file, CS, tr\+\_\+\+Reg, restart\+\_\+\+CS)
\begin{DoxyCompactList}\small\item\em Read in runtime options and add boundary impulse tracer to tracer registry. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceboundary__impulse__tracer_a8e0ee5617450d93cd6bc5ac33298b4d2}{initialize\+\_\+boundary\+\_\+impulse\+\_\+tracer}} (restart, day, G, GV, h, diag, O\+BC, CS, sponge\+\_\+\+C\+Sp, tv)
\begin{DoxyCompactList}\small\item\em Initialize tracer from restart or set to 1 at surface to initialize. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceboundary__impulse__tracer_ae5c5e088ee2daf72dfec738fb0d6e1a6}{boundary\+\_\+impulse\+\_\+tracer\+\_\+column\+\_\+physics}} (h\+\_\+old, h\+\_\+new, ea, eb, fluxes, dt, G, GV, US, CS, tv, debug, evap\+\_\+\+C\+F\+L\+\_\+limit, minimum\+\_\+forcing\+\_\+depth)
\begin{DoxyCompactList}\small\item\em Apply source or sink at boundary and do vertical diffusion. \end{DoxyCompactList}\item 
integer function, public \mbox{\hyperlink{namespaceboundary__impulse__tracer_a9c170481eec5074f1a3b2b5e09a142fc}{boundary\+\_\+impulse\+\_\+stock}} (h, stocks, G, GV, CS, names, units, stock\+\_\+index)
\begin{DoxyCompactList}\small\item\em Calculate total inventory of tracer. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespaceboundary__impulse__tracer_aaebcc49c1b19cea2f27b1a0aa2e0d510}{boundary\+\_\+impulse\+\_\+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{namespaceboundary__impulse__tracer_a20724ec7b461ae2be28735833169a7ab}{boundary\+\_\+impulse\+\_\+tracer\+\_\+end}} (CS)
\begin{DoxyCompactList}\small\item\em Performs finalization of boundary impulse tracer. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_ac5642b1edb9e4ada26fb0741e77bf0b8}\label{namespaceboundary__impulse__tracer_ac5642b1edb9e4ada26fb0741e77bf0b8}} 
integer, parameter \mbox{\hyperlink{namespaceboundary__impulse__tracer_ac5642b1edb9e4ada26fb0741e77bf0b8}{ntr\+\_\+max}} = 1
\begin{DoxyCompactList}\small\item\em N\+T\+R\+\_\+\+M\+AX is the maximum number of tracers in this module. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_a9c170481eec5074f1a3b2b5e09a142fc}\label{namespaceboundary__impulse__tracer_a9c170481eec5074f1a3b2b5e09a142fc}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!boundary\_impulse\_stock@{boundary\_impulse\_stock}}
\index{boundary\_impulse\_stock@{boundary\_impulse\_stock}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{boundary\_impulse\_stock()}{boundary\_impulse\_stock()}}
{\footnotesize\ttfamily integer function, public boundary\+\_\+impulse\+\_\+tracer\+::boundary\+\_\+impulse\+\_\+stock (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{real, dimension(\+:), intent(out)}]{stocks,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{character(len=$\ast$), dimension(\+:), intent(out)}]{names,  }\item[{character(len=$\ast$), dimension(\+:), intent(out)}]{units,  }\item[{integer, intent(in), optional}]{stock\+\_\+index }\end{DoxyParamCaption})}



Calculate total inventory of tracer. 


\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} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em stocks} & the mass-\/weighted integrated amount of each tracer, in kg times concentration units \mbox{[}kg conc\mbox{]}. \\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+boundary\+\_\+impulse\+\_\+tracer. \\
\hline
\mbox{\texttt{ out}}  & {\em names} & The names of the stocks calculated. \\
\hline
\mbox{\texttt{ out}}  & {\em units} & The units of the stocks calculated. \\
\hline
\mbox{\texttt{ in}}  & {\em stock\+\_\+index} & The coded index of a specific stock being sought. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Return value\+: the number of stocks calculated here. 
\end{DoxyReturn}


Definition at line 286 of file boundary\+\_\+impulse\+\_\+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))}, \textcolor{keywordtype}{intent(in   )} :: h\textcolor{comment}{    !< Layer thicknesses [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{290 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},                       \textcolor{keywordtype}{intent(  out)} :: stocks\textcolor{comment}{ !< the mass-\/weighted integrated amount of each}}
\DoxyCodeLine{291 \textcolor{comment}{                                                                  !! tracer, in kg times concentration units [kg conc].}}
\DoxyCodeLine{292   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS),         \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< The control structure returned by a previous}}
\DoxyCodeLine{293 \textcolor{comment}{                                                                  !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{294   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{dimension(:)},           \textcolor{keywordtype}{intent(  out)} :: names\textcolor{comment}{  !< The names of the stocks calculated.}}
\DoxyCodeLine{295   \textcolor{keywordtype}{character(len=*)}, \textcolor{keywordtype}{dimension(:)},           \textcolor{keywordtype}{intent(  out)} :: units\textcolor{comment}{  !< The units of the stocks calculated.}}
\DoxyCodeLine{296   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional},                        \textcolor{keywordtype}{intent(in   )} :: stock\_index\textcolor{comment}{ !< The coded index of a specific stock}}
\DoxyCodeLine{297 \textcolor{comment}{                                                                  !! being sought.}}
\DoxyCodeLine{298   \textcolor{keywordtype}{integer} :: boundary\_impulse\_stock\textcolor{comment}{  !< Return value: the number of stocks calculated here.}}
\DoxyCodeLine{299 }
\DoxyCodeLine{300 \textcolor{comment}{! This function calculates the mass-\/weighted integral of all tracer stocks,}}
\DoxyCodeLine{301 \textcolor{comment}{! returning the number of stocks it has calculated.  If the stock\_index}}
\DoxyCodeLine{302 \textcolor{comment}{! is present, only the stock corresponding to that coded index is returned.}}
\DoxyCodeLine{303 }
\DoxyCodeLine{304   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{305   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m}
\DoxyCodeLine{306   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{307 }
\DoxyCodeLine{308   boundary\_impulse\_stock = 0}
\DoxyCodeLine{309   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{310   \textcolor{keywordflow}{if} (cs\%ntr < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{311 }
\DoxyCodeLine{312   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(stock\_index)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (stock\_index > 0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{313     \textcolor{comment}{! Check whether this stock is available from this routine.}}
\DoxyCodeLine{314 }
\DoxyCodeLine{315     \textcolor{comment}{! No stocks from this routine are being checked yet.  Return 0.}}
\DoxyCodeLine{316     \textcolor{keywordflow}{return}}
\DoxyCodeLine{317 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{318 }
\DoxyCodeLine{319   \textcolor{keywordflow}{do} m=1,1}
\DoxyCodeLine{320     \textcolor{keyword}{call }query\_vardesc(cs\%tr\_desc(m), name=names(m), units=units(m), caller=\textcolor{stringliteral}{"{}boundary\_impulse\_stock"{}})}
\DoxyCodeLine{321     units(m) = trim(units(m))//\textcolor{stringliteral}{"{} kg"{}}}
\DoxyCodeLine{322     stocks(m) = 0.0}
\DoxyCodeLine{323     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{324       stocks(m) = stocks(m) + cs\%tr(i,j,k,m) * \&}
\DoxyCodeLine{325                            (g\%mask2dT(i,j) * g\%US\%L\_to\_m**2*g\%areaT(i,j) * h(i,j,k))}
\DoxyCodeLine{326 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{327     stocks(m) = gv\%H\_to\_kg\_m2 * stocks(m)}
\DoxyCodeLine{328 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{329 }
\DoxyCodeLine{330   boundary\_impulse\_stock = cs\%ntr}
\DoxyCodeLine{331 }

\end{DoxyCode}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_ae5c5e088ee2daf72dfec738fb0d6e1a6}\label{namespaceboundary__impulse__tracer_ae5c5e088ee2daf72dfec738fb0d6e1a6}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!boundary\_impulse\_tracer\_column\_physics@{boundary\_impulse\_tracer\_column\_physics}}
\index{boundary\_impulse\_tracer\_column\_physics@{boundary\_impulse\_tracer\_column\_physics}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{boundary\_impulse\_tracer\_column\_physics()}{boundary\_impulse\_tracer\_column\_physics()}}
{\footnotesize\ttfamily subroutine, public boundary\+\_\+impulse\+\_\+tracer\+::boundary\+\_\+impulse\+\_\+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(\mbox{\hyperlink{structmom__forcing__type_1_1forcing}{forcing}}), intent(in)}]{fluxes,  }\item[{real, intent(in)}]{dt,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in)}]{US,  }\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv,  }\item[{logical, intent(in)}]{debug,  }\item[{real, intent(in), optional}]{evap\+\_\+\+C\+F\+L\+\_\+limit,  }\item[{real, intent(in), optional}]{minimum\+\_\+forcing\+\_\+depth }\end{DoxyParamCaption})}



Apply source or sink at boundary and do vertical diffusion. 


\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 register\+\_\+boundary\+\_\+impulse\+\_\+tracer. \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure pointing to various thermodynamic variables \\
\hline
\mbox{\texttt{ in}}  & {\em debug} & If true calculate checksums \\
\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 207 of file boundary\+\_\+impulse\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{209   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{210   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{211 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{212                            \textcolor{keywordtype}{intent(in)} :: h\_old\textcolor{comment}{ !< Layer thickness before entrainment [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{213 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{214                            \textcolor{keywordtype}{intent(in)} :: h\_new\textcolor{comment}{ !< Layer thickness after entrainment [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{215 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{216                            \textcolor{keywordtype}{intent(in)} :: ea\textcolor{comment}{   !< an array to which the amount of fluid entrained}}
\DoxyCodeLine{217 \textcolor{comment}{                                              !! from the layer above during this call will be}}
\DoxyCodeLine{218 \textcolor{comment}{                                              !! added [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{219 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{220                            \textcolor{keywordtype}{intent(in)} :: eb\textcolor{comment}{   !< an array to which the amount of fluid entrained}}
\DoxyCodeLine{221 \textcolor{comment}{                                              !! from the layer below during this call will be}}
\DoxyCodeLine{222 \textcolor{comment}{                                              !! added [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{223   \textcolor{keywordtype}{type}(forcing),           \textcolor{keywordtype}{intent(in)} :: fluxes\textcolor{comment}{ !< A structure containing pointers to thermodynamic}}
\DoxyCodeLine{224 \textcolor{comment}{                                              !! and tracer forcing fields.  Unused fields have NULL ptrs.}}
\DoxyCodeLine{225 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)} :: dt\textcolor{comment}{   !< The amount of time covered by this call [T \string~> s]}}
\DoxyCodeLine{226   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{227   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS),  \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}}
\DoxyCodeLine{228 \textcolor{comment}{                                              !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{229   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various}}
\DoxyCodeLine{230 \textcolor{comment}{                                              !! thermodynamic variables}}
\DoxyCodeLine{231   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)} :: debug\textcolor{comment}{ !< If true calculate checksums}}
\DoxyCodeLine{232 \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{233 \textcolor{comment}{                                              !! be fluxed out of the top layer in a timestep [nondim]}}
\DoxyCodeLine{234 \textcolor{keywordtype}{  real},          \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: minimum\_forcing\_depth\textcolor{comment}{ !< The smallest depth over which}}
\DoxyCodeLine{235 \textcolor{comment}{                                              !! fluxes can be applied [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{236 }
\DoxyCodeLine{237 \textcolor{comment}{!   This subroutine applies diapycnal diffusion and any other column}}
\DoxyCodeLine{238 \textcolor{comment}{! tracer physics or chemistry to the tracers from this file.}}
\DoxyCodeLine{239 \textcolor{comment}{! This is a simple example of a set of advected passive tracers.}}
\DoxyCodeLine{240 }
\DoxyCodeLine{241 \textcolor{comment}{! The arguments to this subroutine are redundant in that}}
\DoxyCodeLine{242 \textcolor{comment}{!     h\_new(k) = h\_old(k) + ea(k) -\/ eb(k-\/1) + eb(k) -\/ ea(k+1)}}
\DoxyCodeLine{243 }
\DoxyCodeLine{244   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{245 \textcolor{keywordtype}{  real} :: Isecs\_per\_year = 1.0 / (365.0*86400.0)}
\DoxyCodeLine{246 \textcolor{keywordtype}{  real} :: year, h\_total, scale, htot, Ih\_limit}
\DoxyCodeLine{247   \textcolor{keywordtype}{integer} :: secs, days}
\DoxyCodeLine{248   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m, k\_max}
\DoxyCodeLine{249 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))} :: h\_work \textcolor{comment}{! Used so that h can be modified}}
\DoxyCodeLine{250 }
\DoxyCodeLine{251   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = gv\%ke}
\DoxyCodeLine{252 }
\DoxyCodeLine{253   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{254   \textcolor{keywordflow}{if} (cs\%ntr < 1) \textcolor{keywordflow}{return}}
\DoxyCodeLine{255 }
\DoxyCodeLine{256   \textcolor{comment}{! This uses applyTracerBoundaryFluxesInOut, usually in ALE mode}}
\DoxyCodeLine{257   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(evap\_cfl\_limit) .and. \textcolor{keyword}{present}(minimum\_forcing\_depth)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{258     \textcolor{keywordflow}{do} k=1,nz ;\textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{259       h\_work(i,j,k) = h\_old(i,j,k)}
\DoxyCodeLine{260 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{261     \textcolor{keyword}{call }applytracerboundaryfluxesinout(g, gv, cs\%tr(:,:,:,1), dt, fluxes, h\_work, \&}
\DoxyCodeLine{262                                         evap\_cfl\_limit, minimum\_forcing\_depth)}
\DoxyCodeLine{263     \textcolor{keyword}{call }tracer\_vertdiff(h\_work, ea, eb, dt, cs\%tr(:,:,:,1), g, gv)}
\DoxyCodeLine{264   \textcolor{keywordflow}{else}}
\DoxyCodeLine{265     \textcolor{keyword}{call }tracer\_vertdiff(h\_old, ea, eb, dt, cs\%tr(:,:,:,1), g, gv)}
\DoxyCodeLine{266 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{267 }
\DoxyCodeLine{268   \textcolor{comment}{! Set surface conditions}}
\DoxyCodeLine{269   \textcolor{keywordflow}{do} m=1,1}
\DoxyCodeLine{270     \textcolor{keywordflow}{if} (cs\%remaining\_source\_time>0.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{271       \textcolor{keywordflow}{do} k=1,cs\%nkml ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{272         cs\%tr(i,j,k,m) = 1.0}
\DoxyCodeLine{273 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{274       cs\%remaining\_source\_time = cs\%remaining\_source\_time-\/us\%T\_to\_s*dt}
\DoxyCodeLine{275     \textcolor{keywordflow}{else}}
\DoxyCodeLine{276       \textcolor{keywordflow}{do} k=1,cs\%nkml ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{277         cs\%tr(i,j,k,m) = 0.0}
\DoxyCodeLine{278 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{279 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{280 }
\DoxyCodeLine{281 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{282 }

\end{DoxyCode}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_a20724ec7b461ae2be28735833169a7ab}\label{namespaceboundary__impulse__tracer_a20724ec7b461ae2be28735833169a7ab}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!boundary\_impulse\_tracer\_end@{boundary\_impulse\_tracer\_end}}
\index{boundary\_impulse\_tracer\_end@{boundary\_impulse\_tracer\_end}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{boundary\_impulse\_tracer\_end()}{boundary\_impulse\_tracer\_end()}}
{\footnotesize\ttfamily subroutine, public boundary\+\_\+impulse\+\_\+tracer\+::boundary\+\_\+impulse\+\_\+tracer\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



Performs finalization of boundary impulse tracer. 


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


Definition at line 368 of file boundary\+\_\+impulse\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{369   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{   !< The control structure returned by a previous}}
\DoxyCodeLine{370 \textcolor{comment}{                                                    !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{371   \textcolor{keywordtype}{integer} :: m}
\DoxyCodeLine{372 }
\DoxyCodeLine{373   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{374     \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs\%tr)) \textcolor{keyword}{deallocate}(cs\%tr)}
\DoxyCodeLine{375     \textcolor{keyword}{deallocate}(cs)}
\DoxyCodeLine{376 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_aaebcc49c1b19cea2f27b1a0aa2e0d510}\label{namespaceboundary__impulse__tracer_aaebcc49c1b19cea2f27b1a0aa2e0d510}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!boundary\_impulse\_tracer\_surface\_state@{boundary\_impulse\_tracer\_surface\_state}}
\index{boundary\_impulse\_tracer\_surface\_state@{boundary\_impulse\_tracer\_surface\_state}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{boundary\_impulse\_tracer\_surface\_state()}{boundary\_impulse\_tracer\_surface\_state()}}
{\footnotesize\ttfamily subroutine, public boundary\+\_\+impulse\+\_\+tracer\+::boundary\+\_\+impulse\+\_\+tracer\+\_\+surface\+\_\+state (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__variables_1_1surface}{surface}}), intent(inout)}]{sfc\+\_\+state,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+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 register\+\_\+boundary\+\_\+impulse\+\_\+tracer. \\
\hline
\end{DoxyParams}


Definition at line 337 of file boundary\+\_\+impulse\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{338   \textcolor{keywordtype}{type}(ocean\_grid\_type),  \textcolor{keywordtype}{intent(in)}    :: G\textcolor{comment}{  !< The ocean's grid structure.}}
\DoxyCodeLine{339   \textcolor{keywordtype}{type}(surface),          \textcolor{keywordtype}{intent(inout)} :: sfc\_state\textcolor{comment}{ !< A structure containing fields that}}
\DoxyCodeLine{340 \textcolor{comment}{                                              !! describe the surface state of the ocean.}}
\DoxyCodeLine{341 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{342                           \textcolor{keywordtype}{intent(in)}    :: h\textcolor{comment}{  !< Layer thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{343   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< The control structure returned by a previous}}
\DoxyCodeLine{344 \textcolor{comment}{                                              !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{345 }
\DoxyCodeLine{346   \textcolor{comment}{! This particular tracer package does not report anything back to the coupler.}}
\DoxyCodeLine{347   \textcolor{comment}{! The code that is here is just a rough guide for packages that would.}}
\DoxyCodeLine{348 }
\DoxyCodeLine{349   \textcolor{keywordtype}{integer} :: m, is, ie, js, je, isd, ied, jsd, jed}
\DoxyCodeLine{350   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{351   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{352 }
\DoxyCodeLine{353   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{354 }
\DoxyCodeLine{355   \textcolor{keywordflow}{if} (cs\%coupled\_tracers) \textcolor{keywordflow}{then}}
\DoxyCodeLine{356     \textcolor{keywordflow}{do} m=1,cs\%ntr}
\DoxyCodeLine{357       \textcolor{comment}{!   This call loads the surface values into the appropriate array in the}}
\DoxyCodeLine{358       \textcolor{comment}{! coupler-\/type structure.}}
\DoxyCodeLine{359       \textcolor{keyword}{call }coupler\_type\_set\_data(cs\%tr(:,:,1,m), cs\%ind\_tr(m), ind\_csurf, \&}
\DoxyCodeLine{360                    sfc\_state\%tr\_fields, idim=(/isd, is, ie, ied/), \&}
\DoxyCodeLine{361                    jdim=(/jsd, js, je, jed/) )}
\DoxyCodeLine{362 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{363 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{364 }

\end{DoxyCode}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_a8e0ee5617450d93cd6bc5ac33298b4d2}\label{namespaceboundary__impulse__tracer_a8e0ee5617450d93cd6bc5ac33298b4d2}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!initialize\_boundary\_impulse\_tracer@{initialize\_boundary\_impulse\_tracer}}
\index{initialize\_boundary\_impulse\_tracer@{initialize\_boundary\_impulse\_tracer}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{initialize\_boundary\_impulse\_tracer()}{initialize\_boundary\_impulse\_tracer()}}
{\footnotesize\ttfamily subroutine, public boundary\+\_\+impulse\+\_\+tracer\+::initialize\+\_\+boundary\+\_\+impulse\+\_\+tracer (\begin{DoxyParamCaption}\item[{logical, intent(in)}]{restart,  }\item[{type(time\+\_\+type), intent(in), target}]{day,  }\item[{type(\mbox{\hyperlink{structmom__grid_1_1ocean__grid__type}{ocean\+\_\+grid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(g)), intent(in)}]{h,  }\item[{type(\mbox{\hyperlink{structmom__diag__mediator_1_1diag__ctrl}{diag\+\_\+ctrl}}), intent(in), target}]{diag,  }\item[{type(\mbox{\hyperlink{structmom__open__boundary_1_1ocean__obc__type}{ocean\+\_\+obc\+\_\+type}}), pointer}]{O\+BC,  }\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(\mbox{\hyperlink{structmom__sponge_1_1sponge__cs}{sponge\+\_\+cs}}), pointer}]{sponge\+\_\+\+C\+Sp,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv }\end{DoxyParamCaption})}



Initialize tracer from restart or set to 1 at surface to initialize. 


\begin{DoxyParams}[1]{Parameters}
\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 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} & Layer thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em diag} & A structure that is used to regulate diagnostic output. \\
\hline
 & {\em obc} & This open boundary condition type specifies whether, where, and what open boundary conditions are used. \\
\hline
 & {\em cs} & The control structure returned by a previous call to register\+\_\+boundary\+\_\+impulse\+\_\+tracer. \\
\hline
 & {\em sponge\+\_\+csp} & Pointer to the control structure for the sponges. \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure pointing to various thermodynamic variables \\
\hline
\end{DoxyParams}


Definition at line 151 of file boundary\+\_\+impulse\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{153   \textcolor{keywordtype}{logical},                            \textcolor{keywordtype}{intent(in)} :: restart\textcolor{comment}{ !< .true. if the fields have already}}
\DoxyCodeLine{154 \textcolor{comment}{                                                         !! been read from a restart file.}}
\DoxyCodeLine{155   \textcolor{keywordtype}{type}(time\_type),            \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: day\textcolor{comment}{  !< Time of the start of the run.}}
\DoxyCodeLine{156   \textcolor{keywordtype}{type}(ocean\_grid\_type),              \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure}}
\DoxyCodeLine{157   \textcolor{keywordtype}{type}(verticalGrid\_type),            \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{158 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(G))}, \&}
\DoxyCodeLine{159                                       \textcolor{keywordtype}{intent(in)} :: h\textcolor{comment}{    !< Layer thicknesses [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{160   \textcolor{keywordtype}{type}(diag\_ctrl),            \textcolor{keywordtype}{target}, \textcolor{keywordtype}{intent(in)} :: diag\textcolor{comment}{ !< A structure that is used to regulate}}
\DoxyCodeLine{161 \textcolor{comment}{                                                         !! diagnostic output.}}
\DoxyCodeLine{162   \textcolor{keywordtype}{type}(ocean\_OBC\_type),               \textcolor{keywordtype}{pointer}    :: OBC\textcolor{comment}{  !< This open boundary condition type specifies}}
\DoxyCodeLine{163 \textcolor{comment}{                                                         !! whether, where, and what open boundary}}
\DoxyCodeLine{164 \textcolor{comment}{                                                         !! conditions are used.}}
\DoxyCodeLine{165   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS),   \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{   !< The control structure returned by a previous}}
\DoxyCodeLine{166 \textcolor{comment}{                                                         !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{167   \textcolor{keywordtype}{type}(sponge\_CS),                    \textcolor{keywordtype}{pointer}    :: sponge\_CSp\textcolor{comment}{ !< Pointer to the control structure for the sponges.}}
\DoxyCodeLine{168   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),              \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure pointing to various}}
\DoxyCodeLine{169 \textcolor{comment}{                                                         !! thermodynamic variables}}
\DoxyCodeLine{170   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{171   \textcolor{keywordtype}{character(len=16)} :: name     \textcolor{comment}{! A variable's name in a NetCDF file.}}
\DoxyCodeLine{172   \textcolor{keywordtype}{character(len=72)} :: longname \textcolor{comment}{! The long name of that variable.}}
\DoxyCodeLine{173   \textcolor{keywordtype}{character(len=48)} :: units    \textcolor{comment}{! The dimensions of the variable.}}
\DoxyCodeLine{174   \textcolor{keywordtype}{character(len=48)} :: flux\_units \textcolor{comment}{! The units for age tracer fluxes, either}}
\DoxyCodeLine{175                                 \textcolor{comment}{! years m3 s-\/1 or years kg s-\/1.}}
\DoxyCodeLine{176   \textcolor{keywordtype}{logical} :: OK}
\DoxyCodeLine{177   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz, m}
\DoxyCodeLine{178   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{179 }
\DoxyCodeLine{180   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{181   \textcolor{keywordflow}{if} (cs\%ntr < 1) \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 }
\DoxyCodeLine{186   cs\%Time => day}
\DoxyCodeLine{187   cs\%diag => diag}
\DoxyCodeLine{188   name = \textcolor{stringliteral}{"{}boundary\_impulse"{}}}
\DoxyCodeLine{189 }
\DoxyCodeLine{190   \textcolor{keywordflow}{do} m=1,cs\%ntr}
\DoxyCodeLine{191     \textcolor{keyword}{call }query\_vardesc(cs\%tr\_desc(m), name=name, caller=\textcolor{stringliteral}{"{}initialize\_boundary\_impulse\_tracer"{}})}
\DoxyCodeLine{192     \textcolor{keywordflow}{if} ((.not.restart) .or. (.not. \&}
\DoxyCodeLine{193         query\_initialized(cs\%tr(:,:,:,m), name, cs\%restart\_CSp))) \textcolor{keywordflow}{then}}
\DoxyCodeLine{194       \textcolor{keywordflow}{do} k=1,cs\%nkml ; \textcolor{keywordflow}{do} j=jsd,jed ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{195         cs\%tr(i,j,k,m) = 1.0}
\DoxyCodeLine{196 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{197 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{198 \textcolor{keywordflow}{  enddo} \textcolor{comment}{! Tracer loop}}
\DoxyCodeLine{199 }
\DoxyCodeLine{200   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(obc)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{201   \textcolor{comment}{! Steal from updated DOME in the fullness of time.}}
\DoxyCodeLine{202 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{203 }

\end{DoxyCode}
\mbox{\Hypertarget{namespaceboundary__impulse__tracer_a8c333281de8a3f7a255a0da4187427ad}\label{namespaceboundary__impulse__tracer_a8c333281de8a3f7a255a0da4187427ad}} 
\index{boundary\_impulse\_tracer@{boundary\_impulse\_tracer}!register\_boundary\_impulse\_tracer@{register\_boundary\_impulse\_tracer}}
\index{register\_boundary\_impulse\_tracer@{register\_boundary\_impulse\_tracer}!boundary\_impulse\_tracer@{boundary\_impulse\_tracer}}
\doxysubsubsection{\texorpdfstring{register\_boundary\_impulse\_tracer()}{register\_boundary\_impulse\_tracer()}}
{\footnotesize\ttfamily logical function, public boundary\+\_\+impulse\+\_\+tracer\+::register\+\_\+boundary\+\_\+impulse\+\_\+tracer (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__hor__index_1_1hor__index__type}{hor\+\_\+index\+\_\+type}}), intent(in)}]{HI,  }\item[{type(\mbox{\hyperlink{structmom__verticalgrid_1_1verticalgrid__type}{verticalgrid\+\_\+type}}), intent(in)}]{GV,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structboundary__impulse__tracer_1_1boundary__impulse__tracer__cs}{boundary\+\_\+impulse\+\_\+tracer\+\_\+cs}}), pointer}]{CS,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{tr\+\_\+\+Reg,  }\item[{type(\mbox{\hyperlink{structmom__restart_1_1mom__restart__cs}{mom\+\_\+restart\+\_\+cs}}), pointer}]{restart\+\_\+\+CS }\end{DoxyParamCaption})}



Read in runtime options and add boundary impulse tracer to tracer registry. 


\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} & The control structure returned by a previous call to register\+\_\+boundary\+\_\+impulse\+\_\+tracer. \\
\hline
 & {\em tr\+\_\+reg} & A pointer that is set to point to the control structure for the tracer advection and diffusion module \\
\hline
 & {\em restart\+\_\+cs} & A pointer to the restart control structure \\
\hline
\end{DoxyParams}


Definition at line 66 of file boundary\+\_\+impulse\+\_\+tracer.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{67   \textcolor{keywordtype}{type}(hor\_index\_type),             \textcolor{keywordtype}{intent(in   )} :: HI\textcolor{comment}{   !< A horizontal index type structure}}
\DoxyCodeLine{68   \textcolor{keywordtype}{type}(verticalGrid\_type),          \textcolor{keywordtype}{intent(in   )} :: GV\textcolor{comment}{   !< The ocean's vertical grid structure}}
\DoxyCodeLine{69   \textcolor{keywordtype}{type}(param\_file\_type),            \textcolor{keywordtype}{intent(in   )} :: param\_file\textcolor{comment}{ !< A structure to parse for run-\/time parameters}}
\DoxyCodeLine{70   \textcolor{keywordtype}{type}(boundary\_impulse\_tracer\_CS), \textcolor{keywordtype}{pointer}       :: CS\textcolor{comment}{   !< The control structure returned by a previous}}
\DoxyCodeLine{71 \textcolor{comment}{                                                          !! call to register\_boundary\_impulse\_tracer.}}
\DoxyCodeLine{72   \textcolor{keywordtype}{type}(tracer\_registry\_type),       \textcolor{keywordtype}{pointer}       :: tr\_Reg\textcolor{comment}{ !< A pointer that is set to point to the control}}
\DoxyCodeLine{73 \textcolor{comment}{                                                          !! structure for the tracer advection and}}
\DoxyCodeLine{74 \textcolor{comment}{                                                          !! diffusion module}}
\DoxyCodeLine{75   \textcolor{keywordtype}{type}(MOM\_restart\_CS),             \textcolor{keywordtype}{pointer}       :: restart\_CS\textcolor{comment}{ !< A pointer to the restart control structure}}
\DoxyCodeLine{76 }
\DoxyCodeLine{77   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{78   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}boundary\_impulse\_tracer"{}} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{79   \textcolor{keywordtype}{character(len=200)} :: inputdir \textcolor{comment}{! The directory where the input files are.}}
\DoxyCodeLine{80   \textcolor{keywordtype}{character(len=48)}  :: var\_name \textcolor{comment}{! The variable's name.}}
\DoxyCodeLine{81   \textcolor{keywordtype}{character(len=3)}   :: name\_tag \textcolor{comment}{! String for creating identifying boundary\_impulse}}
\DoxyCodeLine{82   \textcolor{keywordtype}{character(len=48)}  :: flux\_units \textcolor{comment}{! The units for tracer fluxes, usually}}
\DoxyCodeLine{83                             \textcolor{comment}{! kg(tracer) kg(water)-\/1 m3 s-\/1 or kg(tracer) s-\/1.}}
\DoxyCodeLine{84   \textcolor{comment}{! This include declares and sets the variable "{}version"{}.}}
\DoxyCodeLine{85 \textcolor{preprocessor}{\#include "{}version\_variable.h"{}}}
\DoxyCodeLine{86 \textcolor{preprocessor}{}\textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer} :: tr\_ptr(:,:,:) => null()}
\DoxyCodeLine{87 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{pointer} :: rem\_time\_ptr => null()}
\DoxyCodeLine{88   \textcolor{keywordtype}{logical} :: register\_boundary\_impulse\_tracer}
\DoxyCodeLine{89   \textcolor{keywordtype}{integer} :: isd, ied, jsd, jed, nz, m, i, j}
\DoxyCodeLine{90   isd = hi\%isd ; ied = hi\%ied ; jsd = hi\%jsd ; jed = hi\%jed ; nz = gv\%ke}
\DoxyCodeLine{91 }
\DoxyCodeLine{92   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{93     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{"{}register\_boundary\_impulse\_tracer called with an "{}}// \&}
\DoxyCodeLine{94                              \textcolor{stringliteral}{"{}associated control structure."{}})}
\DoxyCodeLine{95     \textcolor{keywordflow}{return}}
\DoxyCodeLine{96 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{97   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{98 }
\DoxyCodeLine{99   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{100   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{"{}"{}})}
\DoxyCodeLine{101   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}IMPULSE\_SOURCE\_TIME"{}}, cs\%remaining\_source\_time, \&}
\DoxyCodeLine{102                  \textcolor{stringliteral}{"{}Length of time for the boundary tracer to be injected "{}}//\&}
\DoxyCodeLine{103                  \textcolor{stringliteral}{"{}into the mixed layer. After this time has elapsed, the "{}}//\&}
\DoxyCodeLine{104                  \textcolor{stringliteral}{"{}surface becomes a sink for the boundary impulse tracer."{}}, \&}
\DoxyCodeLine{105                  default=31536000.0)}
\DoxyCodeLine{106   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}TRACERS\_MAY\_REINIT"{}}, cs\%tracers\_may\_reinit, \&}
\DoxyCodeLine{107                  \textcolor{stringliteral}{"{}If true, tracers may go through the initialization code "{}}//\&}
\DoxyCodeLine{108                  \textcolor{stringliteral}{"{}if they are not found in the restart files.  Otherwise "{}}//\&}
\DoxyCodeLine{109                  \textcolor{stringliteral}{"{}it is a fatal error if the tracers are not found in the "{}}//\&}
\DoxyCodeLine{110                  \textcolor{stringliteral}{"{}restart files of a restarted run."{}}, default=.false.)}
\DoxyCodeLine{111   cs\%ntr = ntr\_max}
\DoxyCodeLine{112   \textcolor{keyword}{allocate}(cs\%tr(isd:ied,jsd:jed,nz,cs\%ntr)) ; cs\%tr(:,:,:,:) = 0.0}
\DoxyCodeLine{113 }
\DoxyCodeLine{114   cs\%nkml = max(gv\%nkml,1)}
\DoxyCodeLine{115 }
\DoxyCodeLine{116   \textcolor{keywordflow}{do} m=1,cs\%ntr}
\DoxyCodeLine{117     \textcolor{comment}{! This is needed to force the compiler not to do a copy in the registration}}
\DoxyCodeLine{118     \textcolor{comment}{! calls.  Curses on the designers and implementers of Fortran90.}}
\DoxyCodeLine{119     cs\%tr\_desc(m) = var\_desc(trim(\textcolor{stringliteral}{"{}boundary\_impulse"{}}), \textcolor{stringliteral}{"{}kg kg-\/1"{}}, \&}
\DoxyCodeLine{120         \textcolor{stringliteral}{"{}Boundary impulse tracer"{}}, caller=mdl)}
\DoxyCodeLine{121     \textcolor{keywordflow}{if} (gv\%Boussinesq) \textcolor{keywordflow}{then} ; flux\_units = \textcolor{stringliteral}{"{}kg kg-\/1 m3 s-\/1"{}}}
\DoxyCodeLine{122     \textcolor{keywordflow}{else} ; flux\_units = \textcolor{stringliteral}{"{}kg s-\/1"{}} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{123 }
\DoxyCodeLine{124     tr\_ptr => cs\%tr(:,:,:,m)}
\DoxyCodeLine{125     \textcolor{keyword}{call }query\_vardesc(cs\%tr\_desc(m), name=var\_name, caller=\textcolor{stringliteral}{"{}register\_boundary\_impulse\_tracer"{}})}
\DoxyCodeLine{126     \textcolor{comment}{! Register the tracer for horizontal advection, diffusion, and restarts.}}
\DoxyCodeLine{127     \textcolor{keyword}{call }register\_tracer(tr\_ptr, tr\_reg, param\_file, hi, gv, tr\_desc=cs\%tr\_desc(m), \&}
\DoxyCodeLine{128                          registry\_diags=.true., flux\_units=flux\_units, \&}
\DoxyCodeLine{129                          restart\_cs=restart\_cs, mandatory=.not.cs\%tracers\_may\_reinit)}
\DoxyCodeLine{130 }
\DoxyCodeLine{131     \textcolor{comment}{!   Set coupled\_tracers to be true (hard-\/coded above) to provide the surface}}
\DoxyCodeLine{132     \textcolor{comment}{! values to the coupler (if any).  This is meta-\/code and its arguments will}}
\DoxyCodeLine{133     \textcolor{comment}{! currently (deliberately) give fatal errors if it is used.}}
\DoxyCodeLine{134     \textcolor{keywordflow}{if} (cs\%coupled\_tracers) \&}
\DoxyCodeLine{135       cs\%ind\_tr(m) = aof\_set\_coupler\_flux(trim(var\_name)//\textcolor{stringliteral}{'\_flux'}, \&}
\DoxyCodeLine{136           flux\_type=\textcolor{stringliteral}{' '}, implementation=\textcolor{stringliteral}{' '}, caller=\textcolor{stringliteral}{"{}register\_boundary\_impulse\_tracer"{}})}
\DoxyCodeLine{137 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{138   \textcolor{comment}{! Register remaining source time as a restart field}}
\DoxyCodeLine{139   rem\_time\_ptr => cs\%remaining\_source\_time}
\DoxyCodeLine{140   \textcolor{keyword}{call }register\_restart\_field(rem\_time\_ptr, \textcolor{stringliteral}{"{}bir\_remain\_time"{}}, \&}
\DoxyCodeLine{141                               .not.cs\%tracers\_may\_reinit, restart\_cs, \&}
\DoxyCodeLine{142                               \textcolor{stringliteral}{"{}Remaining time to apply BIR source"{}}, \textcolor{stringliteral}{"{}s"{}})}
\DoxyCodeLine{143 }
\DoxyCodeLine{144   cs\%tr\_Reg => tr\_reg}
\DoxyCodeLine{145   cs\%restart\_CSp => restart\_cs}
\DoxyCodeLine{146   register\_boundary\_impulse\_tracer = .true.}
\DoxyCodeLine{147 }

\end{DoxyCode}
