\hypertarget{namespacedome__initialization}{}\doxysection{dome\+\_\+initialization Module Reference}
\label{namespacedome__initialization}\index{dome\_initialization@{dome\_initialization}}


\doxysubsection{Detailed Description}
Configures the model for the \char`\"{}\+D\+O\+M\+E\char`\"{} experiment. D\+O\+ME = Dynamics of Overflows and Mixing Experiment. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacedome__initialization_a80775c1d93b437bb2cc4c75c3c99ecb4}{dome\+\_\+initialize\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth, US)
\begin{DoxyCompactList}\small\item\em This subroutine sets up the D\+O\+ME topography. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__initialization_a1b4bfeba991ebd8b460ae6b6a998320d}{dome\+\_\+initialize\+\_\+thickness}} (h, G, GV, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em This subroutine initializes layer thicknesses for the D\+O\+ME experiment. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__initialization_a41b5a1805fffbbcbdce1ac7bfc7623f1}{dome\+\_\+initialize\+\_\+sponges}} (G, GV, US, tv, PF, C\+Sp)
\begin{DoxyCompactList}\small\item\em This subroutine sets the inverse restoration time (Idamp), and ! the values towards which the interface heights and an arbitrary ! number of tracers should be restored within each sponge. The ! interface height is always subject to damping, and must always be ! the first registered field. ! \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome__initialization_a7f1f259541709210b38665ea779e623c}{dome\+\_\+set\+\_\+obc\+\_\+data}} (O\+BC, tv, G, GV, US, param\+\_\+file, tr\+\_\+\+Reg)
\begin{DoxyCompactList}\small\item\em This subroutine sets the properties of flow at open boundary conditions. This particular example is for the D\+O\+ME inflow describe in Legg et al. 2006. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedome__initialization_a41b5a1805fffbbcbdce1ac7bfc7623f1}\label{namespacedome__initialization_a41b5a1805fffbbcbdce1ac7bfc7623f1}} 
\index{dome\_initialization@{dome\_initialization}!dome\_initialize\_sponges@{dome\_initialize\_sponges}}
\index{dome\_initialize\_sponges@{dome\_initialize\_sponges}!dome\_initialization@{dome\_initialization}}
\doxysubsubsection{\texorpdfstring{dome\_initialize\_sponges()}{dome\_initialize\_sponges()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+initialization\+::dome\+\_\+initialize\+\_\+sponges (\begin{DoxyParamCaption}\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{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{PF,  }\item[{type(\mbox{\hyperlink{structmom__sponge_1_1sponge__cs}{sponge\+\_\+cs}}), pointer}]{C\+Sp }\end{DoxyParamCaption})}



This subroutine sets the inverse restoration time (Idamp), and ! the values towards which the interface heights and an arbitrary ! number of tracers should be restored within each sponge. The ! interface height is always subject to damping, and must always be ! the first registered field. ! 


\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 tv} & A structure containing pointers to any available thermodynamic fields, including potential temperature and salinity or mixed layer density. Absent fields have N\+U\+LL ptrs. \\
\hline
\mbox{\texttt{ in}}  & {\em pf} & A structure indicating the open file to parse for model parameter values. \\
\hline
 & {\em csp} & A pointer that is set to point to the control structure for this module. \\
\hline
\end{DoxyParams}


Definition at line 148 of file D\+O\+M\+E\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{149   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{150   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}}
\DoxyCodeLine{151   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{152   \textcolor{keywordtype}{type}(thermo\_var\_ptrs), \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure containing pointers to any available}}
\DoxyCodeLine{153 \textcolor{comment}{                               !! thermodynamic fields, including potential temperature and}}
\DoxyCodeLine{154 \textcolor{comment}{                               !! salinity or mixed layer density. Absent fields have NULL ptrs.}}
\DoxyCodeLine{155   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: PF\textcolor{comment}{   !< A structure indicating the open file to}}
\DoxyCodeLine{156 \textcolor{comment}{                                            !! parse for model parameter values.}}
\DoxyCodeLine{157   \textcolor{keywordtype}{type}(sponge\_CS),       \textcolor{keywordtype}{pointer}    :: CSp\textcolor{comment}{  !< A pointer that is set to point to the control}}
\DoxyCodeLine{158 \textcolor{comment}{                                            !! structure for this module.}}
\DoxyCodeLine{159 }
\DoxyCodeLine{160 \textcolor{keywordtype}{  real} :: eta(SZI\_(G),SZJ\_(G),SZK\_(G)+1) \textcolor{comment}{! A temporary array for eta [Z \string~> m].}}
\DoxyCodeLine{161 \textcolor{keywordtype}{  real} :: temp(SZI\_(G),SZJ\_(G),SZK\_(G))  \textcolor{comment}{! A temporary array for other variables. !}}
\DoxyCodeLine{162 \textcolor{keywordtype}{  real} :: Idamp(SZI\_(G),SZJ\_(G))    \textcolor{comment}{! The inverse damping rate [T-\/1 \string~> s-\/1].}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164 \textcolor{keywordtype}{  real} :: H0(SZK\_(G))  \textcolor{comment}{! Interface heights [Z \string~> m].}}
\DoxyCodeLine{165 \textcolor{keywordtype}{  real} :: min\_depth    \textcolor{comment}{! The minimum depth at which to apply damping [Z \string~> m]}}
\DoxyCodeLine{166 \textcolor{keywordtype}{  real} :: damp, damp\_new \textcolor{comment}{! Damping rates in the sponge [days]}}
\DoxyCodeLine{167 \textcolor{keywordtype}{  real} :: e\_dense      \textcolor{comment}{! The depth of the densest interfaces [Z \string~> m]}}
\DoxyCodeLine{168   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}DOME\_initialize\_sponges"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{169   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{170 }
\DoxyCodeLine{171   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{172   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{173 }
\DoxyCodeLine{174   eta(:,:,:) = 0.0 ; temp(:,:,:) = 0.0 ; idamp(:,:) = 0.0}
\DoxyCodeLine{175 }
\DoxyCodeLine{176 \textcolor{comment}{!  Here the inverse damping time [s-\/1], is set. Set Idamp to 0     !}}
\DoxyCodeLine{177 \textcolor{comment}{!  wherever there is no sponge, and the subroutines that are called  !}}
\DoxyCodeLine{178 \textcolor{comment}{!  will automatically set up the sponges only where Idamp is positive!}}
\DoxyCodeLine{179 \textcolor{comment}{!  and mask2dT is 1.                                                   !}}
\DoxyCodeLine{180 }
\DoxyCodeLine{181 \textcolor{comment}{!   Set up sponges for DOME configuration}}
\DoxyCodeLine{182   \textcolor{keyword}{call }get\_param(pf, mdl, \textcolor{stringliteral}{"{}MINIMUM\_DEPTH"{}}, min\_depth, \&}
\DoxyCodeLine{183                  \textcolor{stringliteral}{"{}The minimum depth of the ocean."{}}, units=\textcolor{stringliteral}{"{}m"{}}, default=0.0, scale=us\%m\_to\_Z)}
\DoxyCodeLine{184 }
\DoxyCodeLine{185   h0(1) = 0.0}
\DoxyCodeLine{186   \textcolor{keywordflow}{do} k=2,nz ; h0(k) = -\/(real(k-\/1)-\/0.5)*g\%max\_depth / real(nz-\/1) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{187   \textcolor{keywordflow}{do} i=is,ie; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{188     \textcolor{keywordflow}{if} (g\%geoLonT(i,j) < 100.0) \textcolor{keywordflow}{then} ; damp = 10.0}
\DoxyCodeLine{189     \textcolor{keywordflow}{elseif} (g\%geoLonT(i,j) < 200.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{190       damp = 10.0 * (200.0-\/g\%geoLonT(i,j))/100.0}
\DoxyCodeLine{191     \textcolor{keywordflow}{else} ; damp=0.0}
\DoxyCodeLine{192 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{193 }
\DoxyCodeLine{194     \textcolor{keywordflow}{if} (g\%geoLonT(i,j) > 1400.0) \textcolor{keywordflow}{then} ; damp\_new = 10.0}
\DoxyCodeLine{195     \textcolor{keywordflow}{elseif} (g\%geoLonT(i,j) > 1300.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{196        damp\_new = 10.0 * (g\%geoLonT(i,j)-\/1300.0)/100.0}
\DoxyCodeLine{197     \textcolor{keywordflow}{else} ; damp\_new = 0.0}
\DoxyCodeLine{198 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{199 }
\DoxyCodeLine{200     \textcolor{keywordflow}{if} (damp <= damp\_new) damp = damp\_new}
\DoxyCodeLine{201     damp = us\%T\_to\_s*damp}
\DoxyCodeLine{202 }
\DoxyCodeLine{203     \textcolor{comment}{! These will be stretched inside of apply\_sponge, so they can be in}}
\DoxyCodeLine{204     \textcolor{comment}{! depth space for Boussinesq or non-\/Boussinesq models.}}
\DoxyCodeLine{205     eta(i,j,1) = 0.0}
\DoxyCodeLine{206     \textcolor{keywordflow}{do} k=2,nz}
\DoxyCodeLine{207 \textcolor{comment}{!     eta(i,j,K)=max(H0(k), -\/G\%bathyT(i,j), GV\%Angstrom\_Z*(nz-\/k+1) -\/ G\%bathyT(i,j))}}
\DoxyCodeLine{208       e\_dense = -\/g\%bathyT(i,j)}
\DoxyCodeLine{209       \textcolor{keywordflow}{if} (e\_dense >= h0(k)) \textcolor{keywordflow}{then} ; eta(i,j,k) = e\_dense}
\DoxyCodeLine{210       \textcolor{keywordflow}{else} ; eta(i,j,k) = h0(k) ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{211       \textcolor{keywordflow}{if} (eta(i,j,k) < gv\%Angstrom\_Z*(nz-\/k+1) -\/ g\%bathyT(i,j)) \&}
\DoxyCodeLine{212           eta(i,j,k) = gv\%Angstrom\_Z*(nz-\/k+1) -\/ g\%bathyT(i,j)}
\DoxyCodeLine{213 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{214     eta(i,j,nz+1) = -\/g\%bathyT(i,j)}
\DoxyCodeLine{215 }
\DoxyCodeLine{216     \textcolor{keywordflow}{if} (g\%bathyT(i,j) > min\_depth) \textcolor{keywordflow}{then}}
\DoxyCodeLine{217       idamp(i,j) = damp / 86400.0}
\DoxyCodeLine{218     \textcolor{keywordflow}{else} ; idamp(i,j) = 0.0 ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{219 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{220 }
\DoxyCodeLine{221 \textcolor{comment}{!  This call sets up the damping rates and interface heights.}}
\DoxyCodeLine{222 \textcolor{comment}{!  This sets the inverse damping timescale fields in the sponges.    !}}
\DoxyCodeLine{223   \textcolor{keyword}{call }initialize\_sponge(idamp, eta, g, pf, csp, gv)}
\DoxyCodeLine{224 }
\DoxyCodeLine{225 \textcolor{comment}{!   Now register all of the fields which are damped in the sponge.   !}}
\DoxyCodeLine{226 \textcolor{comment}{! By default, momentum is advected vertically within the sponge, but !}}
\DoxyCodeLine{227 \textcolor{comment}{! momentum is typically not damped within the sponge.                !}}
\DoxyCodeLine{228 }
\DoxyCodeLine{229 \textcolor{comment}{! At this point, the DOME configuration is done. The following are here as a}}
\DoxyCodeLine{230 \textcolor{comment}{! template for other configurations.}}
\DoxyCodeLine{231 }
\DoxyCodeLine{232 \textcolor{comment}{!  The remaining calls to set\_up\_sponge\_field can be in any order. !}}
\DoxyCodeLine{233   \textcolor{keywordflow}{if} ( \textcolor{keyword}{associated}(tv\%T) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{234     \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"{}DOME\_initialize\_sponges is not set up for use with"{}}//\&}
\DoxyCodeLine{235                          \textcolor{stringliteral}{"{} a temperatures defined."{}})}
\DoxyCodeLine{236     \textcolor{comment}{! This should use the target values of T in temp.}}
\DoxyCodeLine{237     \textcolor{keyword}{call }set\_up\_sponge\_field(temp, tv\%T, g, nz, csp)}
\DoxyCodeLine{238     \textcolor{comment}{! This should use the target values of S in temp.}}
\DoxyCodeLine{239     \textcolor{keyword}{call }set\_up\_sponge\_field(temp, tv\%S, g, nz, csp)}
\DoxyCodeLine{240 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{241 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__initialization_a1b4bfeba991ebd8b460ae6b6a998320d}\label{namespacedome__initialization_a1b4bfeba991ebd8b460ae6b6a998320d}} 
\index{dome\_initialization@{dome\_initialization}!dome\_initialize\_thickness@{dome\_initialize\_thickness}}
\index{dome\_initialize\_thickness@{dome\_initialize\_thickness}!dome\_initialization@{dome\_initialization}}
\doxysubsubsection{\texorpdfstring{dome\_initialize\_thickness()}{dome\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+initialization\+::dome\+\_\+initialize\+\_\+thickness (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(out)}]{h,  }\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__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



This subroutine initializes layer thicknesses for the D\+O\+ME experiment. 


\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{ out}}  & {\em h} & The thickness that is being initialized \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure indicating the open file to parse for model parameter values. \\
\hline
\mbox{\texttt{ in}}  & {\em just\+\_\+read\+\_\+params} & If present and true, this call will only read parameters without changing h. \\
\hline
\end{DoxyParams}


Definition at line 90 of file D\+O\+M\+E\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{91   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{           !< The ocean's grid structure.}}
\DoxyCodeLine{92   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{          !< The ocean's vertical grid structure.}}
\DoxyCodeLine{93 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{94                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{95   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}}
\DoxyCodeLine{96 \textcolor{comment}{                                                      !! to parse for model parameter values.}}
\DoxyCodeLine{97   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{98 \textcolor{comment}{                                                      !! only read parameters without changing h.}}
\DoxyCodeLine{99 }
\DoxyCodeLine{100 \textcolor{keywordtype}{  real} :: e0(SZK\_(GV)+1)    \textcolor{comment}{! The resting interface heights [Z \string~> m], usually}}
\DoxyCodeLine{101                             \textcolor{comment}{! negative because it is positive upward [Z \string~> m].}}
\DoxyCodeLine{102 \textcolor{keywordtype}{  real} :: eta1D(SZK\_(GV)+1) \textcolor{comment}{! Interface height relative to the sea surface}}
\DoxyCodeLine{103                             \textcolor{comment}{! positive upward [Z \string~> m].}}
\DoxyCodeLine{104   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{105   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}DOME\_initialize\_thickness"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{106   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{107 }
\DoxyCodeLine{108   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{109 }
\DoxyCodeLine{110   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{111 }
\DoxyCodeLine{112   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! This subroutine has no run-\/time parameters.}}
\DoxyCodeLine{113 }
\DoxyCodeLine{114   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"{}  DOME\_initialization.F90, DOME\_initialize\_thickness: setting thickness"{}}, 5)}
\DoxyCodeLine{115 }
\DoxyCodeLine{116   e0(1)=0.0}
\DoxyCodeLine{117   \textcolor{keywordflow}{do} k=2,nz}
\DoxyCodeLine{118     e0(k) = -\/g\%max\_depth * (real(k-\/1)-\/0.5)/real(nz-\/1)}
\DoxyCodeLine{119 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{120 }
\DoxyCodeLine{121   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{122 \textcolor{comment}{!    This sets the initial thickness (in m) of the layers.  The      !}}
\DoxyCodeLine{123 \textcolor{comment}{!  thicknesses are set to insure that: 1.  each layer is at least an !}}
\DoxyCodeLine{124 \textcolor{comment}{!  Angstrom thick, and 2.  the interfaces are where they should be   !}}
\DoxyCodeLine{125 \textcolor{comment}{!  based on the resting depths and interface height perturbations,   !}}
\DoxyCodeLine{126 \textcolor{comment}{!  as long at this doesn't interfere with 1.                         !}}
\DoxyCodeLine{127     eta1d(nz+1) = -\/g\%bathyT(i,j)}
\DoxyCodeLine{128     \textcolor{keywordflow}{do} k=nz,1,-\/1}
\DoxyCodeLine{129       eta1d(k) = e0(k)}
\DoxyCodeLine{130       \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv\%Angstrom\_Z)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{131         eta1d(k) = eta1d(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{132         h(i,j,k) = gv\%Angstrom\_H}
\DoxyCodeLine{133       \textcolor{keywordflow}{else}}
\DoxyCodeLine{134         h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) -\/ eta1d(k+1))}
\DoxyCodeLine{135 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{136 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{137 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{138 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__initialization_a80775c1d93b437bb2cc4c75c3c99ecb4}\label{namespacedome__initialization_a80775c1d93b437bb2cc4c75c3c99ecb4}} 
\index{dome\_initialization@{dome\_initialization}!dome\_initialize\_topography@{dome\_initialize\_topography}}
\index{dome\_initialize\_topography@{dome\_initialize\_topography}!dome\_initialization@{dome\_initialization}}
\doxysubsubsection{\texorpdfstring{dome\_initialize\_topography()}{dome\_initialize\_topography()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+initialization\+::dome\+\_\+initialize\+\_\+topography (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{D,  }\item[{type(\mbox{\hyperlink{structmom__dyn__horgrid_1_1dyn__horgrid__type}{dyn\+\_\+horgrid\+\_\+type}}), intent(in)}]{G,  }\item[{type(\mbox{\hyperlink{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{real, intent(in)}]{max\+\_\+depth,  }\item[{type(\mbox{\hyperlink{structmom__unit__scaling_1_1unit__scale__type}{unit\+\_\+scale\+\_\+type}}), intent(in), optional}]{US }\end{DoxyParamCaption})}



This subroutine sets up the D\+O\+ME topography. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em d} & Ocean bottom depth in m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & Maximum model depth in the units of D \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 40 of file D\+O\+M\+E\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{41   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),          \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{42 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{43                                    \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{44   \textcolor{keywordtype}{type}(param\_file\_type),           \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{45 \textcolor{keywordtype}{  real},                            \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum model depth in the units of D}}
\DoxyCodeLine{46   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{47 }
\DoxyCodeLine{48   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{49 \textcolor{keywordtype}{  real} :: m\_to\_Z  \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{50 \textcolor{keywordtype}{  real} :: min\_depth \textcolor{comment}{! The minimum and maximum depths [Z \string~> m].}}
\DoxyCodeLine{51   \textcolor{comment}{! This include declares and sets the variable "{}version"{}.}}
\DoxyCodeLine{52 \textcolor{preprocessor}{\# include "{}version\_variable.h"{}}}
\DoxyCodeLine{53 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}DOME\_initialize\_topography"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{54   \textcolor{keywordtype}{integer} :: i, j, is, ie, js, je, isd, ied, jsd, jed}
\DoxyCodeLine{55   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{56   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{57 }
\DoxyCodeLine{58   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"{}  DOME\_initialization.F90, DOME\_initialize\_topography: setting topography"{}}, 5)}
\DoxyCodeLine{59 }
\DoxyCodeLine{60   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{61 }
\DoxyCodeLine{62   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{"{}"{}})}
\DoxyCodeLine{63   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"{}MINIMUM\_DEPTH"{}}, min\_depth, \&}
\DoxyCodeLine{64                  \textcolor{stringliteral}{"{}The minimum depth of the ocean."{}}, units=\textcolor{stringliteral}{"{}m"{}}, default=0.0, scale=m\_to\_z)}
\DoxyCodeLine{65 }
\DoxyCodeLine{66   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{67     \textcolor{keywordflow}{if} (g\%geoLatT(i,j) < 600.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{68       \textcolor{keywordflow}{if} (g\%geoLatT(i,j) < 300.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{69         d(i,j) = max\_depth}
\DoxyCodeLine{70       \textcolor{keywordflow}{else}}
\DoxyCodeLine{71         d(i,j) = max\_depth -\/ 10.0*m\_to\_z * (g\%geoLatT(i,j)-\/300.0)}
\DoxyCodeLine{72 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{73     \textcolor{keywordflow}{else}}
\DoxyCodeLine{74       \textcolor{keywordflow}{if} ((g\%geoLonT(i,j) > 1000.0) .AND. (g\%geoLonT(i,j) < 1100.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{75         d(i,j) = 600.0*m\_to\_z}
\DoxyCodeLine{76       \textcolor{keywordflow}{else}}
\DoxyCodeLine{77         d(i,j) = 0.5*min\_depth}
\DoxyCodeLine{78 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{79 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{80 }
\DoxyCodeLine{81     \textcolor{keywordflow}{if} (d(i,j) > max\_depth) d(i,j) = max\_depth}
\DoxyCodeLine{82     \textcolor{keywordflow}{if} (d(i,j) < min\_depth) d(i,j) = 0.5*min\_depth}
\DoxyCodeLine{83 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{84 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome__initialization_a7f1f259541709210b38665ea779e623c}\label{namespacedome__initialization_a7f1f259541709210b38665ea779e623c}} 
\index{dome\_initialization@{dome\_initialization}!dome\_set\_obc\_data@{dome\_set\_obc\_data}}
\index{dome\_set\_obc\_data@{dome\_set\_obc\_data}!dome\_initialization@{dome\_initialization}}
\doxysubsubsection{\texorpdfstring{dome\_set\_obc\_data()}{dome\_set\_obc\_data()}}
{\footnotesize\ttfamily subroutine, public dome\+\_\+initialization\+::dome\+\_\+set\+\_\+obc\+\_\+data (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__open__boundary_1_1ocean__obc__type}{ocean\+\_\+obc\+\_\+type}}), pointer}]{O\+BC,  }\item[{type(\mbox{\hyperlink{structmom__variables_1_1thermo__var__ptrs}{thermo\+\_\+var\+\_\+ptrs}}), intent(in)}]{tv,  }\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{structmom__file__parser_1_1param__file__type}{param\+\_\+file\+\_\+type}}), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__tracer__registry_1_1tracer__registry__type}{tracer\+\_\+registry\+\_\+type}}), pointer}]{tr\+\_\+\+Reg }\end{DoxyParamCaption})}



This subroutine sets the properties of flow at open boundary conditions. This particular example is for the D\+O\+ME inflow describe in Legg et al. 2006. 


\begin{DoxyParams}[1]{Parameters}
 & {\em obc} & This open boundary condition type specifies whether, where, and what open boundary conditions are used. \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure containing pointers to any available thermodynamic fields, including potential temperature and salinity or mixed layer density. Absent fields have N\+U\+LL ptrs. \\
\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 us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure indicating the open file to parse for model parameter values. \\
\hline
 & {\em tr\+\_\+reg} & Tracer registry. \\
\hline
\end{DoxyParams}


Definition at line 246 of file D\+O\+M\+E\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{247   \textcolor{keywordtype}{type}(ocean\_OBC\_type),       \textcolor{keywordtype}{pointer}    :: OBC\textcolor{comment}{ !< This open boundary condition type specifies}}
\DoxyCodeLine{248 \textcolor{comment}{                                                !! whether, where, and what open boundary}}
\DoxyCodeLine{249 \textcolor{comment}{                                                !! conditions are used.}}
\DoxyCodeLine{250   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),      \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{  !< A structure containing pointers to any}}
\DoxyCodeLine{251 \textcolor{comment}{                              !! available thermodynamic fields, including potential}}
\DoxyCodeLine{252 \textcolor{comment}{                              !! temperature and salinity or mixed layer density. Absent}}
\DoxyCodeLine{253 \textcolor{comment}{                              !! fields have NULL ptrs.}}
\DoxyCodeLine{254   \textcolor{keywordtype}{type}(ocean\_grid\_type),      \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{   !< The ocean's grid structure.}}
\DoxyCodeLine{255   \textcolor{keywordtype}{type}(verticalGrid\_type),    \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{  !< The ocean's vertical grid structure.}}
\DoxyCodeLine{256   \textcolor{keywordtype}{type}(unit\_scale\_type),      \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{  !< A dimensional unit scaling type}}
\DoxyCodeLine{257   \textcolor{keywordtype}{type}(param\_file\_type),      \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure indicating the open file}}
\DoxyCodeLine{258 \textcolor{comment}{                              !! to parse for model parameter values.}}
\DoxyCodeLine{259   \textcolor{keywordtype}{type}(tracer\_registry\_type), \textcolor{keywordtype}{pointer}    :: tr\_Reg\textcolor{comment}{ !< Tracer registry.}}
\DoxyCodeLine{260 }
\DoxyCodeLine{261 \textcolor{comment}{! Local variables}}
\DoxyCodeLine{262   \textcolor{comment}{! The following variables are used to set the target temperature and salinity.}}
\DoxyCodeLine{263 \textcolor{keywordtype}{  real} :: T0(SZK\_(G)), S0(SZK\_(G))}
\DoxyCodeLine{264 \textcolor{keywordtype}{  real} :: pres(SZK\_(G))      \textcolor{comment}{! An array of the reference pressure [R L2 T-\/2 \string~> Pa].}}
\DoxyCodeLine{265 \textcolor{keywordtype}{  real} :: drho\_dT(SZK\_(G))   \textcolor{comment}{! Derivative of density with temperature [R degC-\/1 \string~> kg m-\/3 degC-\/1].}}
\DoxyCodeLine{266 \textcolor{keywordtype}{  real} :: drho\_dS(SZK\_(G))   \textcolor{comment}{! Derivative of density with salinity [R ppt-\/1 \string~> kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{267 \textcolor{keywordtype}{  real} :: rho\_guess(SZK\_(G)) \textcolor{comment}{! Potential density at T0 \& S0 [R \string~> kg m-\/3].}}
\DoxyCodeLine{268   \textcolor{comment}{! The following variables are used to set up the transport in the DOME example.}}
\DoxyCodeLine{269 \textcolor{keywordtype}{  real} :: tr\_0, y1, y2, tr\_k, rst, rsb, rc, v\_k, lon\_im1}
\DoxyCodeLine{270 \textcolor{keywordtype}{  real} :: D\_edge            \textcolor{comment}{! The thickness [Z \string~> m], of the dense fluid at the}}
\DoxyCodeLine{271                             \textcolor{comment}{! inner edge of the inflow.}}
\DoxyCodeLine{272 \textcolor{keywordtype}{  real} :: g\_prime\_tot       \textcolor{comment}{! The reduced gravity across all layers [L2 Z-\/1 T-\/2 \string~> m s-\/2].}}
\DoxyCodeLine{273 \textcolor{keywordtype}{  real} :: Def\_Rad           \textcolor{comment}{! The deformation radius, based on fluid of}}
\DoxyCodeLine{274                             \textcolor{comment}{! thickness D\_edge, in the same units as lat [m].}}
\DoxyCodeLine{275 \textcolor{keywordtype}{  real} :: Ri\_trans          \textcolor{comment}{! The shear Richardson number in the transition}}
\DoxyCodeLine{276                             \textcolor{comment}{! region of the specified shear profile.}}
\DoxyCodeLine{277   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"{}DOME\_set\_OBC\_data"{}} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{278   \textcolor{keywordtype}{character(len=32)}  :: name}
\DoxyCodeLine{279   \textcolor{keywordtype}{integer} :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, m, nz, NTR}
\DoxyCodeLine{280   \textcolor{keywordtype}{integer} :: IsdB, IedB, JsdB, JedB}
\DoxyCodeLine{281   \textcolor{keywordtype}{type}(OBC\_segment\_type), \textcolor{keywordtype}{pointer} :: segment => null()}
\DoxyCodeLine{282   \textcolor{keywordtype}{type}(tracer\_type), \textcolor{keywordtype}{pointer}      :: tr\_ptr => null()}
\DoxyCodeLine{283 }
\DoxyCodeLine{284   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{285   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{286   isdb = g\%IsdB ; iedb = g\%IedB ; jsdb = g\%JsdB ; jedb = g\%JedB}
\DoxyCodeLine{287 }
\DoxyCodeLine{288   \textcolor{comment}{! The following variables should be transformed into runtime parameters.}}
\DoxyCodeLine{289   d\_edge = 300.0*us\%m\_to\_Z  \textcolor{comment}{! The thickness of dense fluid in the inflow.}}
\DoxyCodeLine{290   ri\_trans = 1.0/3.0 \textcolor{comment}{! The shear Richardson number in the transition region}}
\DoxyCodeLine{291                      \textcolor{comment}{! region of the specified shear profile.}}
\DoxyCodeLine{292 }
\DoxyCodeLine{293   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(obc)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{294 }
\DoxyCodeLine{295   g\_prime\_tot = (gv\%g\_Earth / gv\%Rho0) * 2.0*us\%kg\_m3\_to\_R}
\DoxyCodeLine{296   def\_rad = us\%L\_to\_m*sqrt(d\_edge*g\_prime\_tot) / (1.0e-\/4*us\%T\_to\_s * 1000.0)}
\DoxyCodeLine{297   tr\_0 = (-\/d\_edge*sqrt(d\_edge*g\_prime\_tot)*0.5e3*us\%m\_to\_L*def\_rad) * gv\%Z\_to\_H}
\DoxyCodeLine{298 }
\DoxyCodeLine{299   \textcolor{keywordflow}{if} (obc\%number\_of\_segments /= 1) \textcolor{keywordflow}{then}}
\DoxyCodeLine{300     \textcolor{keyword}{call }mom\_error(warning, \textcolor{stringliteral}{'Error in DOME OBC segment setup'}, .true.)}
\DoxyCodeLine{301     \textcolor{keywordflow}{return}   \textcolor{comment}{!!! Need a better error message here}}
\DoxyCodeLine{302 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{303 }
\DoxyCodeLine{304   ntr = tr\_reg\%NTR}
\DoxyCodeLine{305 }
\DoxyCodeLine{306   \textcolor{comment}{! Stash this information away for the messy tracer restarts.}}
\DoxyCodeLine{307   obc\%ntr = ntr}
\DoxyCodeLine{308   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(obc\%tracer\_x\_reservoirs\_used)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{309     \textcolor{keyword}{allocate}(obc\%tracer\_x\_reservoirs\_used(ntr))}
\DoxyCodeLine{310     \textcolor{keyword}{allocate}(obc\%tracer\_y\_reservoirs\_used(ntr))}
\DoxyCodeLine{311     obc\%tracer\_x\_reservoirs\_used(:) = .false.}
\DoxyCodeLine{312     obc\%tracer\_y\_reservoirs\_used(:) = .false.}
\DoxyCodeLine{313     obc\%tracer\_y\_reservoirs\_used(1) = .true.}
\DoxyCodeLine{314 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{315 }
\DoxyCodeLine{316   segment => obc\%segment(1)}
\DoxyCodeLine{317   \textcolor{keywordflow}{if} (.not. segment\%on\_pe) \textcolor{keywordflow}{return}}
\DoxyCodeLine{318 }
\DoxyCodeLine{319   \textcolor{keyword}{allocate}(segment\%field(ntr))}
\DoxyCodeLine{320 }
\DoxyCodeLine{321   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{322     rst = -\/1.0}
\DoxyCodeLine{323     \textcolor{keywordflow}{if} (k>1) rst = -\/1.0 + (real(k-\/1)-\/0.5)/real(nz-\/1)}
\DoxyCodeLine{324 }
\DoxyCodeLine{325     rsb = 0.0}
\DoxyCodeLine{326     \textcolor{keywordflow}{if} (k<nz) rsb = -\/1.0 + (real(k-\/1)+0.5)/real(nz-\/1)}
\DoxyCodeLine{327     rc = -\/1.0 + real(k-\/1)/real(nz-\/1)}
\DoxyCodeLine{328 }
\DoxyCodeLine{329     \textcolor{comment}{! These come from assuming geostrophy and a constant Ri profile.}}
\DoxyCodeLine{330     y1 = (2.0*ri\_trans*rst + ri\_trans + 2.0)/(2.0 -\/ ri\_trans)}
\DoxyCodeLine{331     y2 = (2.0*ri\_trans*rsb + ri\_trans + 2.0)/(2.0 -\/ ri\_trans)}
\DoxyCodeLine{332     tr\_k = tr\_0 * (2.0/(ri\_trans*(2.0-\/ri\_trans))) * \&}
\DoxyCodeLine{333            ((log(y1)+1.0)/y1 -\/ (log(y2)+1.0)/y2)}
\DoxyCodeLine{334     v\_k = -\/sqrt(d\_edge*g\_prime\_tot)*log((2.0 + ri\_trans*(1.0 + 2.0*rc)) / \&}
\DoxyCodeLine{335                                         (2.0 -\/ ri\_trans))}
\DoxyCodeLine{336     \textcolor{keywordflow}{if} (k == nz)  tr\_k = tr\_k + tr\_0 * (2.0/(ri\_trans*(2.0+ri\_trans))) * \&}
\DoxyCodeLine{337                                        log((2.0+ri\_trans)/(2.0-\/ri\_trans))}
\DoxyCodeLine{338     \textcolor{comment}{! New way}}
\DoxyCodeLine{339     isd = segment\%HI\%isd ; ied = segment\%HI\%ied}
\DoxyCodeLine{340     jsdb = segment\%HI\%JsdB ; jedb = segment\%HI\%JedB}
\DoxyCodeLine{341     \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{342       lon\_im1 = 2.0*g\%geoLonCv(i,j) -\/ g\%geoLonBu(i,j)}
\DoxyCodeLine{343       segment\%normal\_trans(i,j,k) = tr\_k * (exp(-\/2.0*(lon\_im1 -\/ 1000.0)/def\_rad) -\/\&}
\DoxyCodeLine{344                                   exp(-\/2.0*(g\%geoLonBu(i,j) -\/ 1000.0)/def\_rad))}
\DoxyCodeLine{345       segment\%normal\_vel(i,j,k) = v\_k * exp(-\/2.0*(g\%geoLonCv(i,j) -\/ 1000.0)/def\_rad)}
\DoxyCodeLine{346 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{347 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{348 }
\DoxyCodeLine{349   \textcolor{comment}{!   The inflow values of temperature and salinity also need to be set here if}}
\DoxyCodeLine{350   \textcolor{comment}{! these variables are used.  The following code is just a naive example.}}
\DoxyCodeLine{351   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%S)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{352     \textcolor{comment}{! In this example, all S inflows have values of 35 psu.}}
\DoxyCodeLine{353     name = \textcolor{stringliteral}{'salt'}}
\DoxyCodeLine{354     \textcolor{keyword}{call }tracer\_name\_lookup(tr\_reg, tr\_ptr, name)}
\DoxyCodeLine{355     \textcolor{keyword}{call }register\_segment\_tracer(tr\_ptr, param\_file, gv, segment, obc\_scalar=35.0)}
\DoxyCodeLine{356 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{357   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv\%T)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{358     \textcolor{comment}{! In this example, the T values are set to be consistent with the layer}}
\DoxyCodeLine{359     \textcolor{comment}{! target density and a salinity of 35 psu.  This code is taken from}}
\DoxyCodeLine{360     \textcolor{comment}{! USER\_initialize\_temp\_sal.}}
\DoxyCodeLine{361     pres(:) = tv\%P\_Ref ; s0(:) = 35.0 ; t0(1) = 25.0}
\DoxyCodeLine{362     \textcolor{keyword}{call }calculate\_density(t0(1), s0(1), pres(1), rho\_guess(1), tv\%eqn\_of\_state)}
\DoxyCodeLine{363     \textcolor{keyword}{call }calculate\_density\_derivs(t0, s0, pres, drho\_dt, drho\_ds, tv\%eqn\_of\_state, (/1,1/) )}
\DoxyCodeLine{364 }
\DoxyCodeLine{365     \textcolor{keywordflow}{do} k=1,nz ; t0(k) = t0(1) + (gv\%Rlay(k)-\/rho\_guess(1)) / drho\_dt(1) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{366     \textcolor{keywordflow}{do} itt=1,6}
\DoxyCodeLine{367       \textcolor{keyword}{call }calculate\_density(t0, s0, pres, rho\_guess, tv\%eqn\_of\_state)}
\DoxyCodeLine{368       \textcolor{keyword}{call }calculate\_density\_derivs(t0, s0, pres, drho\_dt, drho\_ds, tv\%eqn\_of\_state)}
\DoxyCodeLine{369       \textcolor{keywordflow}{do} k=1,nz ; t0(k) = t0(k) + (gv\%Rlay(k)-\/rho\_guess(k)) / drho\_dt(k) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{370 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{371 }
\DoxyCodeLine{372     \textcolor{comment}{! Temperature on tracer 1???}}
\DoxyCodeLine{373     \textcolor{keyword}{allocate}(segment\%field(1)\%buffer\_src(segment\%HI\%isd:segment\%HI\%ied,segment\%HI\%JsdB:segment\%HI\%JedB,nz))}
\DoxyCodeLine{374     \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=jsdb,jedb ; \textcolor{keywordflow}{do} i=isd,ied}
\DoxyCodeLine{375       segment\%field(1)\%buffer\_src(i,j,k) = t0(k)}
\DoxyCodeLine{376 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{377     name = \textcolor{stringliteral}{'temp'}}
\DoxyCodeLine{378     \textcolor{keyword}{call }tracer\_name\_lookup(tr\_reg, tr\_ptr, name)}
\DoxyCodeLine{379     \textcolor{keyword}{call }register\_segment\_tracer(tr\_ptr, param\_file, gv, segment, obc\_array=.true.)}
\DoxyCodeLine{380 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{381 }
\DoxyCodeLine{382   \textcolor{comment}{! Dye tracers -\/ fight with T,S???}}
\DoxyCodeLine{383   \textcolor{comment}{! First dye -\/ only one with OBC values}}
\DoxyCodeLine{384   \textcolor{comment}{! This field(1) requires tr\_D1 to be the first tracer.}}
\DoxyCodeLine{385   \textcolor{keyword}{allocate}(segment\%field(1)\%buffer\_src(segment\%HI\%isd:segment\%HI\%ied,segment\%HI\%JsdB:segment\%HI\%JedB,nz))}
\DoxyCodeLine{386   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=segment\%HI\%jsd,segment\%HI\%jed ; \textcolor{keywordflow}{do} i=segment\%HI\%isd,segment\%HI\%ied}
\DoxyCodeLine{387     \textcolor{keywordflow}{if} (k < nz/2) \textcolor{keywordflow}{then} ; segment\%field(1)\%buffer\_src(i,j,k) = 0.0}
\DoxyCodeLine{388     \textcolor{keywordflow}{else} ; segment\%field(1)\%buffer\_src(i,j,k) = 1.0 ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{389 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{390   name = \textcolor{stringliteral}{'tr\_D1'}}
\DoxyCodeLine{391   \textcolor{keyword}{call }tracer\_name\_lookup(tr\_reg, tr\_ptr, name)}
\DoxyCodeLine{392   \textcolor{keyword}{call }register\_segment\_tracer(tr\_ptr, param\_file, gv, \&}
\DoxyCodeLine{393                                obc\%segment(1), obc\_array=.true.)}
\DoxyCodeLine{394 }
\DoxyCodeLine{395   \textcolor{comment}{! All tracers but the first have 0 concentration in their inflows. As this}}
\DoxyCodeLine{396   \textcolor{comment}{! is the default value, the following calls are unnecessary.}}
\DoxyCodeLine{397   \textcolor{keywordflow}{do} m=2,ntr}
\DoxyCodeLine{398     \textcolor{keywordflow}{if} (m < 10) \textcolor{keywordflow}{then} ; \textcolor{keyword}{write}(name,\textcolor{stringliteral}{'("{}tr\_D"{},I1.1)'}) m}
\DoxyCodeLine{399     \textcolor{keywordflow}{else} ; \textcolor{keyword}{write}(name,\textcolor{stringliteral}{'("{}tr\_D"{},I2.2)'}) m ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{400     \textcolor{keyword}{call }tracer\_name\_lookup(tr\_reg, tr\_ptr, name)}
\DoxyCodeLine{401     \textcolor{keyword}{call }register\_segment\_tracer(tr\_ptr, param\_file, gv, \&}
\DoxyCodeLine{402                                  obc\%segment(1), obc\_scalar=0.0)}
\DoxyCodeLine{403 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{404 }

\end{DoxyCode}
