\hypertarget{namespacedome2d__initialization}{}\section{dome2d\+\_\+initialization Module Reference}
\label{namespacedome2d__initialization}\index{dome2d\_initialization@{dome2d\_initialization}}


\subsection{Detailed Description}
Initialization of the 2D D\+O\+ME experiment with density water initialized on a coastal shelf. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacedome2d__initialization_ae850c5e89a9275c4333c02828187bf81}{dome2d\+\_\+initialize\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth)
\begin{DoxyCompactList}\small\item\em Initialize topography with a shelf and slope in a 2D domain. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome2d__initialization_af81a58104c43891770e023e273319f51}{dome2d\+\_\+initialize\+\_\+thickness}} (h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialize thicknesses according to coordinate mode. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome2d__initialization_a90ce9a4aafc3efa64d4b73c4db3e9a79}{dome2d\+\_\+initialize\+\_\+temperature\+\_\+salinity}} (T, S, h, G, GV, param\+\_\+file, eqn\+\_\+of\+\_\+state, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialize temperature and salinity in the 2d D\+O\+ME configuration. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedome2d__initialization_a0be7c5cc017fb5f8d3dd84934409a5ee}{dome2d\+\_\+initialize\+\_\+sponges}} (G, GV, US, tv, param\+\_\+file, use\+\_\+\+A\+LE, C\+Sp, A\+C\+Sp)
\begin{DoxyCompactList}\small\item\em Set up sponges in 2d D\+O\+ME configuration. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacedome2d__initialization_a6c29798ebca4af3d877877f8f43dbf17}\label{namespacedome2d__initialization_a6c29798ebca4af3d877877f8f43dbf17}} 
character(len=40) \mbox{\hyperlink{namespacedome2d__initialization_a6c29798ebca4af3d877877f8f43dbf17}{mdl}} = \char`\"{}D\+O\+M\+E2\+D\+\_\+initialization\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedome2d__initialization_a0be7c5cc017fb5f8d3dd84934409a5ee}\label{namespacedome2d__initialization_a0be7c5cc017fb5f8d3dd84934409a5ee}} 
\index{dome2d\_initialization@{dome2d\_initialization}!dome2d\_initialize\_sponges@{dome2d\_initialize\_sponges}}
\index{dome2d\_initialize\_sponges@{dome2d\_initialize\_sponges}!dome2d\_initialization@{dome2d\_initialization}}
\subsubsection{\texorpdfstring{dome2d\_initialize\_sponges()}{dome2d\_initialize\_sponges()}}
{\footnotesize\ttfamily subroutine, public dome2d\+\_\+initialization\+::dome2d\+\_\+initialize\+\_\+sponges (\begin{DoxyParamCaption}\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(thermo\+\_\+var\+\_\+ptrs), intent(in)}]{tv,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in)}]{use\+\_\+\+A\+LE,  }\item[{type(sponge\+\_\+cs), pointer}]{C\+Sp,  }\item[{type(ale\+\_\+sponge\+\_\+cs), pointer}]{A\+C\+Sp }\end{DoxyParamCaption})}



Set up sponges in 2d D\+O\+ME configuration. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & Thermodynamics structure \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+ale} & If true, indicates model is in A\+LE mode \\
\hline
 & {\em csp} & Layer-\/mode sponge structure \\
\hline
 & {\em acsp} & A\+L\+E-\/mode sponge structure \\
\hline
\end{DoxyParams}


Definition at line 357 of file D\+O\+M\+E2d\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{357   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{  !< Ocean grid structure}}
\DoxyCodeLine{358   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< Vertical grid structure}}
\DoxyCodeLine{359   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{360   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{ !< Thermodynamics structure}}
\DoxyCodeLine{361   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{362   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)} :: use\_ALE\textcolor{comment}{ !< If true, indicates model is in ALE mode}}
\DoxyCodeLine{363   \textcolor{keywordtype}{type}(sponge\_CS),         \textcolor{keywordtype}{pointer}    :: CSp\textcolor{comment}{ !< Layer-mode sponge structure}}
\DoxyCodeLine{364   \textcolor{keywordtype}{type}(ALE\_sponge\_CS),     \textcolor{keywordtype}{pointer}    :: ACSp\textcolor{comment}{ !< ALE-mode sponge structure}}
\DoxyCodeLine{365   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{366 \textcolor{keywordtype}{  real} :: T(SZI\_(G),SZJ\_(G),SZK\_(G))   \textcolor{comment}{! A temporary array for temp [degC]}}
\DoxyCodeLine{367 \textcolor{keywordtype}{  real} :: S(SZI\_(G),SZJ\_(G),SZK\_(G))   \textcolor{comment}{! A temporary array for salt [ppt]}}
\DoxyCodeLine{368 \textcolor{keywordtype}{  real} :: h(SZI\_(G),SZJ\_(G),SZK\_(G))   \textcolor{comment}{! A temporary array for thickness [H ~> m or kg m-2].}}
\DoxyCodeLine{369 \textcolor{keywordtype}{  real} :: eta(SZI\_(G),SZJ\_(G),SZK\_(G)+1) \textcolor{comment}{! A temporary array for thickness [Z ~> m]}}
\DoxyCodeLine{370 \textcolor{keywordtype}{  real} :: Idamp(SZI\_(G),SZJ\_(G))       \textcolor{comment}{! The inverse damping rate [T-1 ~> s-1].}}
\DoxyCodeLine{371 \textcolor{keywordtype}{  real} :: S\_ref, T\_ref                 \textcolor{comment}{! Reference salinity and temerature within surface layer}}
\DoxyCodeLine{372 \textcolor{keywordtype}{  real} :: S\_range, T\_range             \textcolor{comment}{! Range of salinities and temperatures over the vertical}}
\DoxyCodeLine{373 \textcolor{keywordtype}{  real} :: e0(SZK\_(G)+1)             \textcolor{comment}{! The resting interface heights [Z ~> m],}}
\DoxyCodeLine{374                                     \textcolor{comment}{! usually negative because it is positive upward.}}
\DoxyCodeLine{375 \textcolor{keywordtype}{  real} :: eta1D(SZK\_(G)+1)          \textcolor{comment}{! Interface height relative to the sea surface}}
\DoxyCodeLine{376                                     \textcolor{comment}{! positive upward [Z ~> m].}}
\DoxyCodeLine{377 \textcolor{keywordtype}{  real} :: d\_eta(SZK\_(G))            \textcolor{comment}{! The layer thickness in a column [Z ~> m].}}
\DoxyCodeLine{378 \textcolor{keywordtype}{  real} :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay}
\DoxyCodeLine{379 \textcolor{keywordtype}{  real} :: dome2d\_west\_sponge\_time\_scale, dome2d\_east\_sponge\_time\_scale \textcolor{comment}{! Sponge timescales [T ~> s]}}
\DoxyCodeLine{380 \textcolor{keywordtype}{  real} :: dome2d\_west\_sponge\_width, dome2d\_east\_sponge\_width}
\DoxyCodeLine{381 \textcolor{keywordtype}{  real} :: dummy1, x, z}
\DoxyCodeLine{382   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{383 }
\DoxyCodeLine{384   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{385   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{386 }
\DoxyCodeLine{387   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_WEST\_SPONGE\_TIME\_SCALE"}, dome2d\_west\_sponge\_time\_scale, \&}
\DoxyCodeLine{388                  \textcolor{stringliteral}{'The time-scale on the west edge of the domain for restoring T/S '}//\&}
\DoxyCodeLine{389                  \textcolor{stringliteral}{'in the sponge. If zero, the western sponge is disabled'}, \&}
\DoxyCodeLine{390                  units=\textcolor{stringliteral}{'s'}, default=0., scale=us\%s\_to\_T)}
\DoxyCodeLine{391   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_EAST\_SPONGE\_TIME\_SCALE"}, dome2d\_east\_sponge\_time\_scale, \&}
\DoxyCodeLine{392                  \textcolor{stringliteral}{'The time-scale on the east edge of the domain for restoring T/S '}//\&}
\DoxyCodeLine{393                  \textcolor{stringliteral}{'in the sponge. If zero, the eastern sponge is disabled'}, \&}
\DoxyCodeLine{394                  units=\textcolor{stringliteral}{'s'}, default=0., scale=us\%s\_to\_T)}
\DoxyCodeLine{395   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_WEST\_SPONGE\_WIDTH"}, dome2d\_west\_sponge\_width, \&}
\DoxyCodeLine{396                  \textcolor{stringliteral}{'The fraction of the domain in which the western sponge for restoring T/S '}//\&}
\DoxyCodeLine{397                  \textcolor{stringliteral}{'is active.'}, \&}
\DoxyCodeLine{398                  units=\textcolor{stringliteral}{'nondim'}, default=0.1)}
\DoxyCodeLine{399   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_EAST\_SPONGE\_WIDTH"}, dome2d\_east\_sponge\_width, \&}
\DoxyCodeLine{400                  \textcolor{stringliteral}{'The fraction of the domain in which the eastern sponge for restoring T/S '}//\&}
\DoxyCodeLine{401                  \textcolor{stringliteral}{'is active.'}, \&}
\DoxyCodeLine{402                  units=\textcolor{stringliteral}{'nondim'}, default=0.1)}
\DoxyCodeLine{403 }
\DoxyCodeLine{404   \textcolor{comment}{! Return if sponges are not in use}}
\DoxyCodeLine{405   \textcolor{keywordflow}{if} (dome2d\_west\_sponge\_time\_scale <= 0. .and. dome2d\_east\_sponge\_time\_scale <= 0.) \textcolor{keywordflow}{return}}
\DoxyCodeLine{406 }
\DoxyCodeLine{407   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(csp)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{408      \textcolor{stringliteral}{"DOME2d\_initialize\_sponges called with an associated control structure."})}
\DoxyCodeLine{409   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(acsp)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{410      \textcolor{stringliteral}{"DOME2d\_initialize\_sponges called with an associated ALE-sponge control structure."})}
\DoxyCodeLine{411 }
\DoxyCodeLine{412   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, \&}
\DoxyCodeLine{413                  default=0.1, do\_not\_log=.true.)}
\DoxyCodeLine{414   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, \&}
\DoxyCodeLine{415                  default=0.3, do\_not\_log=.true.)}
\DoxyCodeLine{416   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, \&}
\DoxyCodeLine{417                  default=0.2, do\_not\_log=.true.)}
\DoxyCodeLine{418   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, default=35.0)}
\DoxyCodeLine{419   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_REF"}, t\_ref)}
\DoxyCodeLine{420   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_RANGE"}, s\_range, default=2.0)}
\DoxyCodeLine{421   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_RANGE"}, t\_range, default=0.0)}
\DoxyCodeLine{422 }
\DoxyCodeLine{423 }
\DoxyCodeLine{424   \textcolor{comment}{! Set the inverse damping rate as a function of position}}
\DoxyCodeLine{425   idamp(:,:) = 0.0}
\DoxyCodeLine{426   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{427     \textcolor{keywordflow}{if} (g\%mask2dT(i,j) > 0.) \textcolor{keywordflow}{then} \textcolor{comment}{! Only set damping rate for wet points}}
\DoxyCodeLine{428       x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon \textcolor{comment}{! Non-dimensional position within domain (0,1)}}
\DoxyCodeLine{429       \textcolor{keywordflow}{if} ( dome2d\_west\_sponge\_time\_scale > 0. .and. x < dome2d\_west\_sponge\_width ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{430         \textcolor{comment}{! Within half the shelf width from the left edge}}
\DoxyCodeLine{431         dummy1 = 1. - x / dome2d\_west\_sponge\_width}
\DoxyCodeLine{432         idamp(i,j) = 1./dome2d\_west\_sponge\_time\_scale * max(0., min(1., dummy1))}
\DoxyCodeLine{433       \textcolor{keywordflow}{elseif} ( dome2d\_east\_sponge\_time\_scale > 0. .and. x > ( 1. - dome2d\_east\_sponge\_width ) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{434         \textcolor{comment}{! Within a quarter of the basin width from the right}}
\DoxyCodeLine{435         dummy1 = 1. - ( 1. - x ) / dome2d\_east\_sponge\_width}
\DoxyCodeLine{436         idamp(i,j) = 1./dome2d\_east\_sponge\_time\_scale * max(0., min(1., dummy1))}
\DoxyCodeLine{437       \textcolor{keywordflow}{else}}
\DoxyCodeLine{438         idamp(i,j) = 0.}
\DoxyCodeLine{439 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{440     \textcolor{keywordflow}{else}}
\DoxyCodeLine{441       idamp(i,j) = 0.}
\DoxyCodeLine{442 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{443 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{444 }
\DoxyCodeLine{445 }
\DoxyCodeLine{446   \textcolor{keywordflow}{if} (use\_ale) \textcolor{keywordflow}{then}}
\DoxyCodeLine{447 }
\DoxyCodeLine{448     \textcolor{comment}{! Construct a grid (somewhat arbitrarily) to describe  the sponge T/S on}}
\DoxyCodeLine{449     \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{450      e0(k) = -g\%max\_depth * ( real(k-1) / real(nz) )}
\DoxyCodeLine{451 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{452     e0(nz+1) = -g\%max\_depth}
\DoxyCodeLine{453     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{454       eta1d(nz+1) = -g\%bathyT(i,j)}
\DoxyCodeLine{455       \textcolor{keywordflow}{do} k=nz,1,-1}
\DoxyCodeLine{456         eta1d(k) = e0(k)}
\DoxyCodeLine{457         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv\%Angstrom\_Z)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{458           eta1d(k) = eta1d(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{459           h(i,j,k) = gv\%Angstrom\_H}
\DoxyCodeLine{460         \textcolor{keywordflow}{else}}
\DoxyCodeLine{461           h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) - eta1d(k+1))}
\DoxyCodeLine{462 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{463 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{464 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{465     \textcolor{comment}{! Store the grid on which the T/S sponge data will reside}}
\DoxyCodeLine{466     \textcolor{keyword}{call }initialize\_ale\_sponge(idamp, g, param\_file, acsp, h, nz)}
\DoxyCodeLine{467 }
\DoxyCodeLine{468     \textcolor{comment}{! Construct temperature and salinity on the arbitrary grid}}
\DoxyCodeLine{469     t(:,:,:) = 0.0 ; s(:,:,:) = 0.0}
\DoxyCodeLine{470     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{471       z = -g\%bathyT(i,j)}
\DoxyCodeLine{472       \textcolor{keywordflow}{do} k = nz,1,-1}
\DoxyCodeLine{473         z = z + 0.5 * gv\%H\_to\_Z * h(i,j,k) \textcolor{comment}{! Position of the center of layer k}}
\DoxyCodeLine{474         s(i,j,k) = 34.0 - 1.0 * (z / (g\%max\_depth))}
\DoxyCodeLine{475         \textcolor{keywordflow}{if} ( ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon < dome2d\_west\_sponge\_width ) \&}
\DoxyCodeLine{476           s(i,j,k) = s\_ref + s\_range}
\DoxyCodeLine{477         z = z + 0.5 *  gv\%H\_to\_Z * h(i,j,k) \textcolor{comment}{! Position of the interface k}}
\DoxyCodeLine{478 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{479 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{480 }
\DoxyCodeLine{481     \textcolor{keywordflow}{if} ( \textcolor{keyword}{associated}(tv\%T) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{482       \textcolor{keyword}{call }set\_up\_ale\_sponge\_field(t, g, tv\%T, acsp)}
\DoxyCodeLine{483 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{484     \textcolor{keywordflow}{if} ( \textcolor{keyword}{associated}(tv\%S) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{485       \textcolor{keyword}{call }set\_up\_ale\_sponge\_field(s, g, tv\%S, acsp)}
\DoxyCodeLine{486 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{487 }
\DoxyCodeLine{488   \textcolor{keywordflow}{else}}
\DoxyCodeLine{489 }
\DoxyCodeLine{490     \textcolor{comment}{! Construct interface heights to restore toward}}
\DoxyCodeLine{491     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{492       eta1d(nz+1) = -g\%bathyT(i,j)}
\DoxyCodeLine{493       \textcolor{keywordflow}{do} k=nz,1,-1}
\DoxyCodeLine{494         eta1d(k) = -g\%max\_depth * real(k-1) / real(nz)}
\DoxyCodeLine{495         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv\%Angstrom\_Z)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{496           eta1d(k) = eta1d(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{497           d\_eta(k) = gv\%Angstrom\_Z}
\DoxyCodeLine{498         \textcolor{keywordflow}{else}}
\DoxyCodeLine{499           d\_eta(k) = (eta1d(k) - eta1d(k+1))}
\DoxyCodeLine{500 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{501 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{502 }
\DoxyCodeLine{503       x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{504       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{505         \textcolor{keywordflow}{do} k=1,nz-1 ; d\_eta(k) = gv\%Angstrom\_Z ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{506         d\_eta(nz) = dome2d\_depth\_bay * g\%max\_depth - (nz-1) * gv\%Angstrom\_Z}
\DoxyCodeLine{507 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{508 }
\DoxyCodeLine{509       eta(i,j,nz+1) = -g\%bathyT(i,j)}
\DoxyCodeLine{510       \textcolor{keywordflow}{do} k=nz,1,-1}
\DoxyCodeLine{511         eta(i,j,k) = eta(i,j,k+1) + d\_eta(k)}
\DoxyCodeLine{512 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{513 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{514     \textcolor{keyword}{call }initialize\_sponge(idamp, eta, g, param\_file, csp, gv)}
\DoxyCodeLine{515 }
\DoxyCodeLine{516 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{517 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome2d__initialization_a90ce9a4aafc3efa64d4b73c4db3e9a79}\label{namespacedome2d__initialization_a90ce9a4aafc3efa64d4b73c4db3e9a79}} 
\index{dome2d\_initialization@{dome2d\_initialization}!dome2d\_initialize\_temperature\_salinity@{dome2d\_initialize\_temperature\_salinity}}
\index{dome2d\_initialize\_temperature\_salinity@{dome2d\_initialize\_temperature\_salinity}!dome2d\_initialization@{dome2d\_initialization}}
\subsubsection{\texorpdfstring{dome2d\_initialize\_temperature\_salinity()}{dome2d\_initialize\_temperature\_salinity()}}
{\footnotesize\ttfamily subroutine, public dome2d\+\_\+initialization\+::dome2d\+\_\+initialize\+\_\+temperature\+\_\+salinity (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed,  g \%ke), intent(out)}]{T,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed,  g \%ke), intent(out)}]{S,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed,  g \%ke), intent(in)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(eos\+\_\+type), pointer}]{eqn\+\_\+of\+\_\+state,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



Initialize temperature and salinity in the 2d D\+O\+ME configuration. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ out}}  & {\em t} & Potential temperature \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em just\+\_\+read\+\_\+params} & If present and true, this call will only read parameters without changing T \& S. \\
\hline
\end{DoxyParams}


Definition at line 226 of file D\+O\+M\+E2d\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{226   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< Ocean grid structure}}
\DoxyCodeLine{227   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}}
\DoxyCodeLine{228 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: T\textcolor{comment}{ !< Potential temperature [degC]}}
\DoxyCodeLine{229 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{230 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{ !< Layer thickness [H ~> m or kg m-2]}}
\DoxyCodeLine{231   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{232   \textcolor{keywordtype}{type}(EOS\_type),                            \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{233   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{234 \textcolor{comment}{                                                      !! only read parameters without changing T \& S.}}
\DoxyCodeLine{235 }
\DoxyCodeLine{236   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{237   \textcolor{keywordtype}{integer}   :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{238 \textcolor{keywordtype}{  real}      :: x}
\DoxyCodeLine{239   \textcolor{keywordtype}{integer}   :: index\_bay\_z}
\DoxyCodeLine{240 \textcolor{keywordtype}{  real}      :: delta\_S, delta\_T}
\DoxyCodeLine{241 \textcolor{keywordtype}{  real}      :: S\_ref, T\_ref;        \textcolor{comment}{! Reference salinity and temperature within surface layer}}
\DoxyCodeLine{242 \textcolor{keywordtype}{  real}      :: S\_range, T\_range;    \textcolor{comment}{! Range of salinities and temperatures over the vertical}}
\DoxyCodeLine{243 \textcolor{keywordtype}{  real}      :: xi0, xi1}
\DoxyCodeLine{244   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{245   \textcolor{keywordtype}{character(len=40)} :: verticalCoordinate}
\DoxyCodeLine{246 \textcolor{keywordtype}{  real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay}
\DoxyCodeLine{247 }
\DoxyCodeLine{248   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{249 }
\DoxyCodeLine{250   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{251 }
\DoxyCodeLine{252   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, \&}
\DoxyCodeLine{253                  default=default\_coordinate\_mode, do\_not\_log=.true.)}
\DoxyCodeLine{254   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, \&}
\DoxyCodeLine{255                  default=0.1, do\_not\_log=.true.)}
\DoxyCodeLine{256   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, \&}
\DoxyCodeLine{257                  default=0.3, do\_not\_log=.true.)}
\DoxyCodeLine{258   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, \&}
\DoxyCodeLine{259                  default=0.2, do\_not\_log=.true.)}
\DoxyCodeLine{260   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, \textcolor{stringliteral}{'Reference salinity'}, \&}
\DoxyCodeLine{261                  default=35.0, units=\textcolor{stringliteral}{'1e-3'}, do\_not\_log=just\_read)}
\DoxyCodeLine{262   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_REF"},t\_ref,\textcolor{stringliteral}{'Reference temperature'}, units=\textcolor{stringliteral}{'degC'}, \&}
\DoxyCodeLine{263                 fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{264   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"S\_RANGE"},s\_range,\textcolor{stringliteral}{'Initial salinity range'}, \&}
\DoxyCodeLine{265                 units=\textcolor{stringliteral}{'1e-3'}, default=2.0, do\_not\_log=just\_read)}
\DoxyCodeLine{266   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_RANGE"},t\_range,\textcolor{stringliteral}{'Initial temperature range'}, \&}
\DoxyCodeLine{267                 units=\textcolor{stringliteral}{'1e-3'}, default=0.0, do\_not\_log=just\_read)}
\DoxyCodeLine{268 }
\DoxyCodeLine{269   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}}
\DoxyCodeLine{270 }
\DoxyCodeLine{271   t(:,:,:) = 0.0}
\DoxyCodeLine{272   s(:,:,:) = 0.0}
\DoxyCodeLine{273 }
\DoxyCodeLine{274   \textcolor{comment}{! Linear salinity profile}}
\DoxyCodeLine{275 }
\DoxyCodeLine{276   \textcolor{keywordflow}{select case} ( coordinatemode(verticalcoordinate) )}
\DoxyCodeLine{277 }
\DoxyCodeLine{278     \textcolor{keywordflow}{case} ( regridding\_zstar, regridding\_sigma )}
\DoxyCodeLine{279 }
\DoxyCodeLine{280       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{281         xi0 = 0.0}
\DoxyCodeLine{282         \textcolor{keywordflow}{do} k = 1,nz}
\DoxyCodeLine{283           xi1 = xi0 + (gv\%H\_to\_Z * h(i,j,k)) / g\%max\_depth}
\DoxyCodeLine{284           s(i,j,k) = 34.0 + 0.5 * s\_range * (xi0 + xi1)}
\DoxyCodeLine{285           xi0 = xi1}
\DoxyCodeLine{286 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{287 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{288 }
\DoxyCodeLine{289     \textcolor{keywordflow}{case} ( regridding\_rho )}
\DoxyCodeLine{290 }
\DoxyCodeLine{291       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{292         xi0 = 0.0}
\DoxyCodeLine{293         \textcolor{keywordflow}{do} k = 1,nz}
\DoxyCodeLine{294           xi1 = xi0 + (gv\%H\_to\_Z * h(i,j,k)) / g\%max\_depth}
\DoxyCodeLine{295           s(i,j,k) = 34.0 + 0.5 * s\_range * (xi0 + xi1)}
\DoxyCodeLine{296           xi0 = xi1}
\DoxyCodeLine{297 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{298         x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{299         \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{300           s(i,j,nz) = 34.0 + s\_range}
\DoxyCodeLine{301 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{302 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{303 }
\DoxyCodeLine{304     \textcolor{keywordflow}{case} ( regridding\_layer )}
\DoxyCodeLine{305 }
\DoxyCodeLine{306       delta\_s = s\_range / ( g\%ke - 1.0 )}
\DoxyCodeLine{307       s(:,:,1) = s\_ref}
\DoxyCodeLine{308       \textcolor{keywordflow}{do} k = 2,g\%ke}
\DoxyCodeLine{309         s(:,:,k) = s(:,:,k-1) + delta\_s}
\DoxyCodeLine{310 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{311 }
\DoxyCodeLine{312 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{313       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"dome2d\_initialize: "}// \&}
\DoxyCodeLine{314       \textcolor{stringliteral}{"Unrecognized i.c. setup - set REGRIDDING\_COORDINATE\_MODE"})}
\DoxyCodeLine{315 }
\DoxyCodeLine{316 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{317 }
\DoxyCodeLine{318   \textcolor{comment}{! Modify salinity and temperature when z coordinates are used}}
\DoxyCodeLine{319   \textcolor{keywordflow}{if} ( coordinatemode(verticalcoordinate) == regridding\_zstar ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{320     index\_bay\_z = nint( dome2d\_depth\_bay * g\%ke )}
\DoxyCodeLine{321     \textcolor{keywordflow}{do} j = g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i = g\%isc,g\%iec}
\DoxyCodeLine{322       x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{323       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{324         s(i,j,1:index\_bay\_z) = s\_ref + s\_range; \textcolor{comment}{! Use for z coordinates}}
\DoxyCodeLine{325         t(i,j,1:index\_bay\_z) = 1.0;             \textcolor{comment}{! Use for z coordinates}}
\DoxyCodeLine{326 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{327 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} \textcolor{comment}{! i and j loops}}
\DoxyCodeLine{328 \textcolor{keywordflow}{  endif} \textcolor{comment}{! Z initial conditions}}
\DoxyCodeLine{329 }
\DoxyCodeLine{330   \textcolor{comment}{! Modify salinity and temperature when sigma coordinates are used}}
\DoxyCodeLine{331   \textcolor{keywordflow}{if} ( coordinatemode(verticalcoordinate) == regridding\_sigma ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{332     \textcolor{keywordflow}{do} i = g\%isc,g\%iec ; \textcolor{keywordflow}{do} j = g\%jsc,g\%jec}
\DoxyCodeLine{333       x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{334       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{335         s(i,j,1:g\%ke) = s\_ref + s\_range;    \textcolor{comment}{! Use for sigma coordinates}}
\DoxyCodeLine{336         t(i,j,1:g\%ke) = 1.0;                \textcolor{comment}{! Use for sigma coordinates}}
\DoxyCodeLine{337 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{338 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{339 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{340 }
\DoxyCodeLine{341   \textcolor{comment}{! Modify temperature when rho coordinates are used}}
\DoxyCodeLine{342   t(g\%isc:g\%iec,g\%jsc:g\%jec,1:g\%ke) = 0.0}
\DoxyCodeLine{343   \textcolor{keywordflow}{if} (( coordinatemode(verticalcoordinate) == regridding\_rho ) .or. \&}
\DoxyCodeLine{344       ( coordinatemode(verticalcoordinate) == regridding\_layer )) \textcolor{keywordflow}{then}}
\DoxyCodeLine{345     \textcolor{keywordflow}{do} i = g\%isc,g\%iec ; \textcolor{keywordflow}{do} j = g\%jsc,g\%jec}
\DoxyCodeLine{346       x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{347       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{348         t(i,j,g\%ke) = 1.0}
\DoxyCodeLine{349 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{350 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{351 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{352 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome2d__initialization_af81a58104c43891770e023e273319f51}\label{namespacedome2d__initialization_af81a58104c43891770e023e273319f51}} 
\index{dome2d\_initialization@{dome2d\_initialization}!dome2d\_initialize\_thickness@{dome2d\_initialize\_thickness}}
\index{dome2d\_initialize\_thickness@{dome2d\_initialize\_thickness}!dome2d\_initialization@{dome2d\_initialization}}
\subsubsection{\texorpdfstring{dome2d\_initialize\_thickness()}{dome2d\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public dome2d\+\_\+initialization\+::dome2d\+\_\+initialize\+\_\+thickness (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g),szk\+\_\+(gv)), intent(out)}]{h,  }\item[{type(ocean\+\_\+grid\+\_\+type), intent(in)}]{G,  }\item[{type(verticalgrid\+\_\+type), intent(in)}]{GV,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in)}]{US,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})}



Initialize thicknesses according to coordinate mode. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Ocean grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\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 94 of file D\+O\+M\+E2d\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{94   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< Ocean grid structure}}
\DoxyCodeLine{95   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< Vertical grid structure}}
\DoxyCodeLine{96   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{97 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{98                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H ~> m or kg m-2].}}
\DoxyCodeLine{99   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}}
\DoxyCodeLine{100 \textcolor{comment}{                                                      !! to parse for model parameter values.}}
\DoxyCodeLine{101   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{102 \textcolor{comment}{                                                      !! only read parameters without changing h.}}
\DoxyCodeLine{103 }
\DoxyCodeLine{104   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{105 \textcolor{keywordtype}{  real} :: e0(SZK\_(GV))     \textcolor{comment}{! The resting interface heights, in depth units [Z ~> m], usually}}
\DoxyCodeLine{106                            \textcolor{comment}{! negative because it is positive upward.}}
\DoxyCodeLine{107 \textcolor{keywordtype}{  real} :: eta1D(SZK\_(GV)+1)\textcolor{comment}{! Interface height relative to the sea surface}}
\DoxyCodeLine{108                            \textcolor{comment}{! positive upward, in depth units [Z ~> m].}}
\DoxyCodeLine{109   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{110 \textcolor{keywordtype}{  real}    :: x}
\DoxyCodeLine{111 \textcolor{keywordtype}{  real}    :: delta\_h}
\DoxyCodeLine{112 \textcolor{keywordtype}{  real}    :: min\_thickness}
\DoxyCodeLine{113 \textcolor{keywordtype}{  real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay}
\DoxyCodeLine{114   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{115   \textcolor{keywordtype}{character(len=40)} :: verticalCoordinate}
\DoxyCodeLine{116 }
\DoxyCodeLine{117   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{118 }
\DoxyCodeLine{119   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{120 }
\DoxyCodeLine{121   \textcolor{keywordflow}{if} (.not.just\_read) \&}
\DoxyCodeLine{122     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"MOM\_initialization.F90, DOME2d\_initialize\_thickness: setting thickness"})}
\DoxyCodeLine{123 }
\DoxyCodeLine{124   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"MIN\_THICKNESS"},min\_thickness, \&}
\DoxyCodeLine{125                  default=1.e-3, units=\textcolor{stringliteral}{"m"}, do\_not\_log=.true., scale=us\%m\_to\_Z)}
\DoxyCodeLine{126   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, \&}
\DoxyCodeLine{127                  default=default\_coordinate\_mode, do\_not\_log=.true.)}
\DoxyCodeLine{128   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, \&}
\DoxyCodeLine{129                  default=0.1, do\_not\_log=.true.)}
\DoxyCodeLine{130   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, \&}
\DoxyCodeLine{131                  default=0.3, do\_not\_log=.true.)}
\DoxyCodeLine{132   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, \&}
\DoxyCodeLine{133                  default=0.2, do\_not\_log=.true.)}
\DoxyCodeLine{134 }
\DoxyCodeLine{135   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}}
\DoxyCodeLine{136 }
\DoxyCodeLine{137   \textcolor{comment}{! WARNING: this routine specifies the interface heights so that the last layer}}
\DoxyCodeLine{138   \textcolor{comment}{!          is vanished, even at maximum depth. In order to have a uniform}}
\DoxyCodeLine{139   \textcolor{comment}{!          layer distribution, use this line of code within the loop:}}
\DoxyCodeLine{140   \textcolor{comment}{!          e0(k) = -G\%max\_depth * real(k-1) / real(nz)}}
\DoxyCodeLine{141   \textcolor{comment}{!          To obtain a thickness distribution where the last layer is}}
\DoxyCodeLine{142   \textcolor{comment}{!          vanished and the other thicknesses uniformly distributed, use:}}
\DoxyCodeLine{143   \textcolor{comment}{!          e0(k) = -G\%max\_depth * real(k-1) / real(nz-1)}}
\DoxyCodeLine{144   \textcolor{keywordflow}{do} k=1,nz}
\DoxyCodeLine{145     e0(k) = -g\%max\_depth * real(k-1) / real(nz)}
\DoxyCodeLine{146 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{147 }
\DoxyCodeLine{148   \textcolor{keywordflow}{select case} ( coordinatemode(verticalcoordinate) )}
\DoxyCodeLine{149 }
\DoxyCodeLine{150     \textcolor{keywordflow}{case} ( regridding\_layer, regridding\_rho )}
\DoxyCodeLine{151 }
\DoxyCodeLine{152       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{153         eta1d(nz+1) = -g\%bathyT(i,j)}
\DoxyCodeLine{154         \textcolor{keywordflow}{do} k=nz,1,-1}
\DoxyCodeLine{155           eta1d(k) = e0(k)}
\DoxyCodeLine{156           \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv\%Angstrom\_Z)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{157             eta1d(k) = eta1d(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{158             h(i,j,k) = gv\%Angstrom\_H}
\DoxyCodeLine{159           \textcolor{keywordflow}{else}}
\DoxyCodeLine{160             h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) - eta1d(k+1))}
\DoxyCodeLine{161 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{162 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164         x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{165         \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{166           h(i,j,1:nz-1) = gv\%Angstrom\_H}
\DoxyCodeLine{167           h(i,j,nz) = gv\%Z\_to\_H * dome2d\_depth\_bay * g\%max\_depth - (nz-1) * gv\%Angstrom\_H}
\DoxyCodeLine{168 \textcolor{keywordflow}{        endif}}
\DoxyCodeLine{169 }
\DoxyCodeLine{170 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{171 }
\DoxyCodeLine{172  \textcolor{comment}{!  case ( IC\_RHO\_C )}}
\DoxyCodeLine{173  \textcolor{comment}{!}}
\DoxyCodeLine{174  \textcolor{comment}{!    do j=js,je ; do i=is,ie}}
\DoxyCodeLine{175  \textcolor{comment}{!       eta1D(nz+1) = -G\%bathyT(i,j)}}
\DoxyCodeLine{176  \textcolor{comment}{!       do k=nz,1,-1}}
\DoxyCodeLine{177  \textcolor{comment}{!         eta1D(k) = e0(k)}}
\DoxyCodeLine{178  \textcolor{comment}{!         if (eta1D(k) < (eta1D(k+1) + min\_thickness)) then}}
\DoxyCodeLine{179  \textcolor{comment}{!           eta1D(k) = eta1D(k+1) + min\_thickness}}
\DoxyCodeLine{180  \textcolor{comment}{!           h(i,j,k) = GV\%Z\_to\_H * min\_thickness}}
\DoxyCodeLine{181  \textcolor{comment}{!         else}}
\DoxyCodeLine{182  \textcolor{comment}{!           h(i,j,k) = GV\%Z\_to\_H * (eta1D(k) - eta1D(k+1))}}
\DoxyCodeLine{183  \textcolor{comment}{!         endif}}
\DoxyCodeLine{184  \textcolor{comment}{!       enddo}}
\DoxyCodeLine{185  \textcolor{comment}{!}}
\DoxyCodeLine{186  \textcolor{comment}{!       x = G\%geoLonT(i,j) / G\%len\_lon}}
\DoxyCodeLine{187  \textcolor{comment}{!       if ( x <= dome2d\_width\_bay ) then}}
\DoxyCodeLine{188  \textcolor{comment}{!         h(i,j,1:nz-1) = GV\%Z\_to\_H * min\_thickness}}
\DoxyCodeLine{189  \textcolor{comment}{!         h(i,j,nz) = GV\%Z\_to\_H * (dome2d\_depth\_bay * G\%max\_depth - (nz-1) * min\_thickness)}}
\DoxyCodeLine{190  \textcolor{comment}{!       endif}}
\DoxyCodeLine{191  \textcolor{comment}{!}}
\DoxyCodeLine{192  \textcolor{comment}{!    enddo ; enddo}}
\DoxyCodeLine{193 }
\DoxyCodeLine{194     \textcolor{keywordflow}{case} ( regridding\_zstar )}
\DoxyCodeLine{195 }
\DoxyCodeLine{196       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{197         eta1d(nz+1) = -g\%bathyT(i,j)}
\DoxyCodeLine{198         \textcolor{keywordflow}{do} k=nz,1,-1}
\DoxyCodeLine{199           eta1d(k) = e0(k)}
\DoxyCodeLine{200           \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + min\_thickness)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{201             eta1d(k) = eta1d(k+1) + min\_thickness}
\DoxyCodeLine{202             h(i,j,k) = gv\%Z\_to\_H * min\_thickness}
\DoxyCodeLine{203           \textcolor{keywordflow}{else}}
\DoxyCodeLine{204             h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) - eta1d(k+1))}
\DoxyCodeLine{205 \textcolor{keywordflow}{          endif}}
\DoxyCodeLine{206 \textcolor{keywordflow}{        enddo}}
\DoxyCodeLine{207 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{208 }
\DoxyCodeLine{209     \textcolor{keywordflow}{case} ( regridding\_sigma )}
\DoxyCodeLine{210       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{211         h(i,j,:) = gv\%Z\_to\_H*g\%bathyT(i,j) / nz}
\DoxyCodeLine{212 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{213 }
\DoxyCodeLine{214 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{215       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"dome2d\_initialize: "}// \&}
\DoxyCodeLine{216       \textcolor{stringliteral}{"Unrecognized i.c. setup - set REGRIDDING\_COORDINATE\_MODE"})}
\DoxyCodeLine{217 }
\DoxyCodeLine{218 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{219 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacedome2d__initialization_ae850c5e89a9275c4333c02828187bf81}\label{namespacedome2d__initialization_ae850c5e89a9275c4333c02828187bf81}} 
\index{dome2d\_initialization@{dome2d\_initialization}!dome2d\_initialize\_topography@{dome2d\_initialize\_topography}}
\index{dome2d\_initialize\_topography@{dome2d\_initialize\_topography}!dome2d\_initialization@{dome2d\_initialization}}
\subsubsection{\texorpdfstring{dome2d\_initialize\_topography()}{dome2d\_initialize\_topography()}}
{\footnotesize\ttfamily subroutine, public dome2d\+\_\+initialization\+::dome2d\+\_\+initialize\+\_\+topography (\begin{DoxyParamCaption}\item[{real, dimension(g\%isd\+:g\%ied,g\%jsd\+:g\%jed), intent(out)}]{D,  }\item[{type(dyn\+\_\+horgrid\+\_\+type), intent(in)}]{G,  }\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{real, intent(in)}]{max\+\_\+depth }\end{DoxyParamCaption})}



Initialize topography with a shelf and slope in a 2D domain. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em d} & Ocean bottom depth in the units of depth\+\_\+max \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & Maximum ocean depth in arbitrary units \\
\hline
\end{DoxyParams}


Definition at line 42 of file D\+O\+M\+E2d\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{42   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),  \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{43 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{44                            \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in the units of depth\_max}}
\DoxyCodeLine{45   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{46 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum ocean depth in arbitrary units}}
\DoxyCodeLine{47 }
\DoxyCodeLine{48   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{49   \textcolor{keywordtype}{integer} :: i, j}
\DoxyCodeLine{50 \textcolor{keywordtype}{  real}    :: x, bay\_depth, l1, l2}
\DoxyCodeLine{51 \textcolor{keywordtype}{  real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay}
\DoxyCodeLine{52   \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{53 \textcolor{preprocessor}{\# include "version\_variable.h"}}
\DoxyCodeLine{54 \textcolor{preprocessor}{}}
\DoxyCodeLine{55   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{56   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, \&}
\DoxyCodeLine{57                  \textcolor{stringliteral}{'Width of shelf, as fraction of domain, in 2d DOME configuration.'}, \&}
\DoxyCodeLine{58                  units=\textcolor{stringliteral}{'nondim'},default=0.1)}
\DoxyCodeLine{59   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, \&}
\DoxyCodeLine{60                  \textcolor{stringliteral}{'Width of deep ocean basin, as fraction of domain, in 2d DOME configuration.'}, \&}
\DoxyCodeLine{61                  units=\textcolor{stringliteral}{'nondim'},default=0.3)}
\DoxyCodeLine{62   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, \&}
\DoxyCodeLine{63                  \textcolor{stringliteral}{'Depth of shelf, as fraction of basin depth, in 2d DOME configuration.'}, \&}
\DoxyCodeLine{64                  units=\textcolor{stringliteral}{'nondim'},default=0.2)}
\DoxyCodeLine{65 }
\DoxyCodeLine{66   \textcolor{comment}{! location where downslope starts}}
\DoxyCodeLine{67   l1 = dome2d\_width\_bay}
\DoxyCodeLine{68 }
\DoxyCodeLine{69   \textcolor{comment}{! location where downslope reaches maximum depth}}
\DoxyCodeLine{70   l2 = 1.0 - dome2d\_width\_bottom}
\DoxyCodeLine{71 }
\DoxyCodeLine{72   bay\_depth = dome2d\_depth\_bay}
\DoxyCodeLine{73 }
\DoxyCodeLine{74   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{75 }
\DoxyCodeLine{76     \textcolor{comment}{! Compute normalized zonal coordinate}}
\DoxyCodeLine{77     x = ( g\%geoLonT(i,j) - g\%west\_lon ) / g\%len\_lon}
\DoxyCodeLine{78 }
\DoxyCodeLine{79     \textcolor{keywordflow}{if} ( x <= l1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{80       d(i,j) = bay\_depth * max\_depth}
\DoxyCodeLine{81     \textcolor{keywordflow}{elseif} (( x > l1 ) .and. ( x < l2 )) \textcolor{keywordflow}{then}}
\DoxyCodeLine{82       d(i,j) = bay\_depth * max\_depth + (1.0-bay\_depth) * max\_depth * \&}
\DoxyCodeLine{83                ( x - l1 ) / (l2 - l1)}
\DoxyCodeLine{84     \textcolor{keywordflow}{else}}
\DoxyCodeLine{85       d(i,j) = max\_depth}
\DoxyCodeLine{86 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{87 }
\DoxyCodeLine{88 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{89 }

\end{DoxyCode}
