\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 \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 \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 \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 \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) \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{\tt in}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em tv} & Thermodynamics structure\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file structure\\
\hline
\mbox{\tt 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}
357   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: g\textcolor{comment}{  !< Ocean grid structure}
358   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)} :: gv\textcolor{comment}{ !< Vertical grid structure}
359   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: us\textcolor{comment}{ !< A dimensional unit scaling type}
360   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{ !< Thermodynamics structure}
361   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file structure}
362   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)} :: use\_ale\textcolor{comment}{ !< If true, indicates model is in ALE mode}
363   \textcolor{keywordtype}{type}(sponge\_cs),         \textcolor{keywordtype}{pointer}    :: csp\textcolor{comment}{ !< Layer-mode sponge structure}
364   \textcolor{keywordtype}{type}(ale\_sponge\_cs),     \textcolor{keywordtype}{pointer}    :: acsp\textcolor{comment}{ !< ALE-mode sponge structure}
365   \textcolor{comment}{! Local variables}
366   \textcolor{keywordtype}{real} :: t(szi\_(g),szj\_(g),szk\_(g))   \textcolor{comment}{! A temporary array for temp [degC]}
367   \textcolor{keywordtype}{real} :: s(szi\_(g),szj\_(g),szk\_(g))   \textcolor{comment}{! A temporary array for salt [ppt]}
368   \textcolor{keywordtype}{real} :: h(szi\_(g),szj\_(g),szk\_(g))   \textcolor{comment}{! A temporary array for thickness [H ~> m or kg m-2].}
369   \textcolor{keywordtype}{real} :: eta(szi\_(g),szj\_(g),szk\_(g)+1) \textcolor{comment}{! A temporary array for thickness [Z ~> m]}
370   \textcolor{keywordtype}{real} :: idamp(szi\_(g),szj\_(g))       \textcolor{comment}{! The inverse damping rate [T-1 ~> s-1].}
371   \textcolor{keywordtype}{real} :: s\_ref, t\_ref                 \textcolor{comment}{! Reference salinity and temerature within surface layer}
372   \textcolor{keywordtype}{real} :: s\_range, t\_range             \textcolor{comment}{! Range of salinities and temperatures over the vertical}
373   \textcolor{keywordtype}{real} :: e0(szk\_(g)+1)             \textcolor{comment}{! The resting interface heights [Z ~> m],}
374                                     \textcolor{comment}{! usually negative because it is positive upward.}
375   \textcolor{keywordtype}{real} :: eta1d(szk\_(g)+1)          \textcolor{comment}{! Interface height relative to the sea surface}
376                                     \textcolor{comment}{! positive upward [Z ~> m].}
377   \textcolor{keywordtype}{real} :: d\_eta(szk\_(g))            \textcolor{comment}{! The layer thickness in a column [Z ~> m].}
378   \textcolor{keywordtype}{real} :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay
379   \textcolor{keywordtype}{real} :: dome2d\_west\_sponge\_time\_scale, dome2d\_east\_sponge\_time\_scale \textcolor{comment}{! Sponge timescales [T ~> s]}
380   \textcolor{keywordtype}{real} :: dome2d\_west\_sponge\_width, dome2d\_east\_sponge\_width
381   \textcolor{keywordtype}{real} :: dummy1, x, z
382   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz
383 
384   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
385   isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
386 
387   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_WEST\_SPONGE\_TIME\_SCALE"}, dome2d\_west\_sponge\_time\_scale, &
388                  \textcolor{stringliteral}{'The time-scale on the west edge of the domain for restoring T/S '}//&
389                  \textcolor{stringliteral}{'in the sponge. If zero, the western sponge is disabled'}, &
390                  units=\textcolor{stringliteral}{'s'}, default=0., scale=us%s\_to\_T)
391   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_EAST\_SPONGE\_TIME\_SCALE"}, dome2d\_east\_sponge\_time\_scale, &
392                  \textcolor{stringliteral}{'The time-scale on the east edge of the domain for restoring T/S '}//&
393                  \textcolor{stringliteral}{'in the sponge. If zero, the eastern sponge is disabled'}, &
394                  units=\textcolor{stringliteral}{'s'}, default=0., scale=us%s\_to\_T)
395   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_WEST\_SPONGE\_WIDTH"}, dome2d\_west\_sponge\_width, &
396                  \textcolor{stringliteral}{'The fraction of the domain in which the western sponge for restoring T/S '}//&
397                  \textcolor{stringliteral}{'is active.'}, &
398                  units=\textcolor{stringliteral}{'nondim'}, default=0.1)
399   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_EAST\_SPONGE\_WIDTH"}, dome2d\_east\_sponge\_width, &
400                  \textcolor{stringliteral}{'The fraction of the domain in which the eastern sponge for restoring T/S '}//&
401                  \textcolor{stringliteral}{'is active.'}, &
402                  units=\textcolor{stringliteral}{'nondim'}, default=0.1)
403 
404   \textcolor{comment}{! Return if sponges are not in use}
405   \textcolor{keywordflow}{if} (dome2d\_west\_sponge\_time\_scale <= 0. .and. dome2d\_east\_sponge\_time\_scale <= 0.) \textcolor{keywordflow}{return}
406 
407   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(csp)) \textcolor{keyword}{call }mom\_error(fatal, &
408      \textcolor{stringliteral}{"DOME2d\_initialize\_sponges called with an associated control structure."})
409   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(acsp)) \textcolor{keyword}{call }mom\_error(fatal, &
410      \textcolor{stringliteral}{"DOME2d\_initialize\_sponges called with an associated ALE-sponge control structure."})
411 
412   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, &
413                  default=0.1, do\_not\_log=.true.)
414   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, &
415                  default=0.3, do\_not\_log=.true.)
416   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, &
417                  default=0.2, do\_not\_log=.true.)
418   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, default=35.0)
419   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_REF"}, t\_ref)
420   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_RANGE"}, s\_range, default=2.0)
421   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_RANGE"}, t\_range, default=0.0)
422 
423 
424   \textcolor{comment}{! Set the inverse damping rate as a function of position}
425   idamp(:,:) = 0.0
426   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
427     \textcolor{keywordflow}{if} (g%mask2dT(i,j) > 0.) \textcolor{keywordflow}{then} \textcolor{comment}{! Only set damping rate for wet points}
428       x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon \textcolor{comment}{! Non-dimensional position within domain (0,1)}
429       \textcolor{keywordflow}{if} ( dome2d\_west\_sponge\_time\_scale > 0. .and. x < dome2d\_west\_sponge\_width ) \textcolor{keywordflow}{then}
430         \textcolor{comment}{! Within half the shelf width from the left edge}
431         dummy1 = 1. - x / dome2d\_west\_sponge\_width
432         idamp(i,j) = 1./dome2d\_west\_sponge\_time\_scale * max(0., min(1., dummy1))
433       \textcolor{keywordflow}{elseif} ( dome2d\_east\_sponge\_time\_scale > 0. .and. x > ( 1. - dome2d\_east\_sponge\_width ) ) \textcolor{keywordflow}{then}
434         \textcolor{comment}{! Within a quarter of the basin width from the right}
435         dummy1 = 1. - ( 1. - x ) / dome2d\_east\_sponge\_width
436         idamp(i,j) = 1./dome2d\_east\_sponge\_time\_scale * max(0., min(1., dummy1))
437       \textcolor{keywordflow}{else}
438         idamp(i,j) = 0.
439 \textcolor{keywordflow}{      endif}
440     \textcolor{keywordflow}{else}
441       idamp(i,j) = 0.
442 \textcolor{keywordflow}{    endif}
443 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
444 
445 
446   \textcolor{keywordflow}{if} (use\_ale) \textcolor{keywordflow}{then}
447 
448     \textcolor{comment}{! Construct a grid (somewhat arbitrarily) to describe  the sponge T/S on}
449     \textcolor{keywordflow}{do} k=1,nz
450      e0(k) = -g%max\_depth * ( \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real(nz)} )
451 \textcolor{keywordflow}{    enddo}
452     e0(nz+1) = -g%max\_depth
453     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
454       eta1d(nz+1) = -g%bathyT(i,j)
455       \textcolor{keywordflow}{do} k=nz,1,-1
456         eta1d(k) = e0(k)
457         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv%Angstrom\_Z)) \textcolor{keywordflow}{then}
458           eta1d(k) = eta1d(k+1) + gv%Angstrom\_Z
459           h(i,j,k) = gv%Angstrom\_H
460         \textcolor{keywordflow}{else}
461           h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
462 \textcolor{keywordflow}{        endif}
463 \textcolor{keywordflow}{      enddo}
464 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
465     \textcolor{comment}{! Store the grid on which the T/S sponge data will reside}
466     \textcolor{keyword}{call }initialize\_ale\_sponge(idamp, g, param\_file, acsp, h, nz)
467 
468     \textcolor{comment}{! Construct temperature and salinity on the arbitrary grid}
469     t(:,:,:) = 0.0 ; s(:,:,:) = 0.0
470     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
471       z = -g%bathyT(i,j)
472       \textcolor{keywordflow}{do} k = nz,1,-1
473         z = z + 0.5 * gv%H\_to\_Z * h(i,j,k) \textcolor{comment}{! Position of the center of layer k}
474         s(i,j,k) = 34.0 - 1.0 * (z / (g%max\_depth))
475         \textcolor{keywordflow}{if} ( ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon < dome2d\_west\_sponge\_width ) &
476           s(i,j,k) = s\_ref + s\_range
477         z = z + 0.5 *  gv%H\_to\_Z * h(i,j,k) \textcolor{comment}{! Position of the interface k}
478 \textcolor{keywordflow}{      enddo}
479 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
480 
481     \textcolor{keywordflow}{if} ( \textcolor{keyword}{associated}(tv%T) ) \textcolor{keywordflow}{then}
482       \textcolor{keyword}{call }set\_up\_ale\_sponge\_field(t, g, tv%T, acsp)
483 \textcolor{keywordflow}{    endif}
484     \textcolor{keywordflow}{if} ( \textcolor{keyword}{associated}(tv%S) ) \textcolor{keywordflow}{then}
485       \textcolor{keyword}{call }set\_up\_ale\_sponge\_field(s, g, tv%S, acsp)
486 \textcolor{keywordflow}{    endif}
487 
488   \textcolor{keywordflow}{else}
489 
490     \textcolor{comment}{! Construct interface heights to restore toward}
491     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
492       eta1d(nz+1) = -g%bathyT(i,j)
493       \textcolor{keywordflow}{do} k=nz,1,-1
494         eta1d(k) = -g%max\_depth * \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real}(nz)
495         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv%Angstrom\_Z)) \textcolor{keywordflow}{then}
496           eta1d(k) = eta1d(k+1) + gv%Angstrom\_Z
497           d\_eta(k) = gv%Angstrom\_Z
498         \textcolor{keywordflow}{else}
499           d\_eta(k) = (eta1d(k) - eta1d(k+1))
500 \textcolor{keywordflow}{        endif}
501 \textcolor{keywordflow}{      enddo}
502 
503       x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
504       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
505         \textcolor{keywordflow}{do} k=1,nz-1 ; d\_eta(k) = gv%Angstrom\_Z ;\textcolor{keywordflow}{ enddo}
506         d\_eta(nz) = dome2d\_depth\_bay * g%max\_depth - (nz-1) * gv%Angstrom\_Z
507 \textcolor{keywordflow}{      endif}
508 
509       eta(i,j,nz+1) = -g%bathyT(i,j)
510       \textcolor{keywordflow}{do} k=nz,1,-1
511         eta(i,j,k) = eta(i,j,k+1) + d\_eta(k)
512 \textcolor{keywordflow}{      enddo}
513 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
514     \textcolor{keyword}{call }initialize\_sponge(idamp, eta, g, param\_file, csp, gv)
515 
516 \textcolor{keywordflow}{  endif}
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{\tt in}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure.\\
\hline
\mbox{\tt out}  & {\em t} & Potential temperature \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt out}  & {\em s} & Salinity \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt in}  & {\em h} & Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file structure\\
\hline
 & {\em eqn\+\_\+of\+\_\+state} & Equation of state structure\\
\hline
\mbox{\tt 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}
226   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{ !< Ocean grid structure}
227   \textcolor{keywordtype}{type}(verticalgrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: gv\textcolor{comment}{ !< The ocean's vertical grid structure.}
228   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: t\textcolor{comment}{ !< Potential temperature [degC]}
229   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: s\textcolor{comment}{ !< Salinity [ppt]}
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]}
231   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}
232   \textcolor{keywordtype}{type}(eos\_type),                            \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}
233   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
234 \textcolor{comment}{                                                      !! only read parameters without changing T & S.}
235 
236   \textcolor{comment}{! Local variables}
237   \textcolor{keywordtype}{integer}   :: i, j, k, is, ie, js, je, nz
238   \textcolor{keywordtype}{real}      :: x
239   \textcolor{keywordtype}{integer}   :: index\_bay\_z
240   \textcolor{keywordtype}{real}      :: delta\_s, delta\_t
241   \textcolor{keywordtype}{real}      :: s\_ref, t\_ref;        \textcolor{comment}{! Reference salinity and temperature within surface layer}
242   \textcolor{keywordtype}{real}      :: s\_range, t\_range;    \textcolor{comment}{! Range of salinities and temperatures over the vertical}
243   \textcolor{keywordtype}{real}      :: xi0, xi1
244   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
245   \textcolor{keywordtype}{character(len=40)} :: verticalcoordinate
246   \textcolor{keywordtype}{real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay
247 
248   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
249 
250   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
251 
252   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, &
253                  default=default\_coordinate\_mode, do\_not\_log=.true.)
254   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, &
255                  default=0.1, do\_not\_log=.true.)
256   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, &
257                  default=0.3, do\_not\_log=.true.)
258   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, &
259                  default=0.2, do\_not\_log=.true.)
260   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, \textcolor{stringliteral}{'Reference salinity'}, &
261                  default=35.0, units=\textcolor{stringliteral}{'1e-3'}, do\_not\_log=just\_read)
262   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_REF"},t\_ref,\textcolor{stringliteral}{'Reference temperature'}, units=\textcolor{stringliteral}{'degC'}, &
263                 fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)
264   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"S\_RANGE"},s\_range,\textcolor{stringliteral}{'Initial salinity range'}, &
265                 units=\textcolor{stringliteral}{'1e-3'}, default=2.0, do\_not\_log=just\_read)
266   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_RANGE"},t\_range,\textcolor{stringliteral}{'Initial temperature range'}, &
267                 units=\textcolor{stringliteral}{'1e-3'}, default=0.0, do\_not\_log=just\_read)
268 
269   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
270 
271   t(:,:,:) = 0.0
272   s(:,:,:) = 0.0
273 
274   \textcolor{comment}{! Linear salinity profile}
275 
276   \textcolor{keywordflow}{select case} ( coordinatemode(verticalcoordinate) )
277 
278     \textcolor{keywordflow}{case} ( regridding\_zstar, regridding\_sigma )
279 
280       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
281         xi0 = 0.0
282         \textcolor{keywordflow}{do} k = 1,nz
283           xi1 = xi0 + (gv%H\_to\_Z * h(i,j,k)) / g%max\_depth
284           s(i,j,k) = 34.0 + 0.5 * s\_range * (xi0 + xi1)
285           xi0 = xi1
286 \textcolor{keywordflow}{        enddo}
287 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
288 
289     \textcolor{keywordflow}{case} ( regridding\_rho )
290 
291       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
292         xi0 = 0.0
293         \textcolor{keywordflow}{do} k = 1,nz
294           xi1 = xi0 + (gv%H\_to\_Z * h(i,j,k)) / g%max\_depth
295           s(i,j,k) = 34.0 + 0.5 * s\_range * (xi0 + xi1)
296           xi0 = xi1
297 \textcolor{keywordflow}{        enddo}
298         x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
299         \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
300           s(i,j,nz) = 34.0 + s\_range
301 \textcolor{keywordflow}{        endif}
302 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
303 
304     \textcolor{keywordflow}{case} ( regridding\_layer )
305 
306       delta\_s = s\_range / ( g%ke - 1.0 )
307       s(:,:,1) = s\_ref
308       \textcolor{keywordflow}{do} k = 2,g%ke
309         s(:,:,k) = s(:,:,k-1) + delta\_s
310 \textcolor{keywordflow}{      enddo}
311 
312 \textcolor{keywordflow}{    case default}
313       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"dome2d\_initialize: "}// &
314       \textcolor{stringliteral}{"Unrecognized i.c. setup - set REGRIDDING\_COORDINATE\_MODE"})
315 
316 \textcolor{keywordflow}{  end select}
317 
318   \textcolor{comment}{! Modify salinity and temperature when z coordinates are used}
319   \textcolor{keywordflow}{if} ( coordinatemode(verticalcoordinate) == regridding\_zstar ) \textcolor{keywordflow}{then}
320     index\_bay\_z = nint( dome2d\_depth\_bay * g%ke )
321     \textcolor{keywordflow}{do} j = g%jsc,g%jec ; \textcolor{keywordflow}{do} i = g%isc,g%iec
322       x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
323       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
324         s(i,j,1:index\_bay\_z) = s\_ref + s\_range; \textcolor{comment}{! Use for z coordinates}
325         t(i,j,1:index\_bay\_z) = 1.0;             \textcolor{comment}{! Use for z coordinates}
326 \textcolor{keywordflow}{      endif}
327 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo} \textcolor{comment}{! i and j loops}
328 \textcolor{keywordflow}{  endif} \textcolor{comment}{! Z initial conditions}
329 
330   \textcolor{comment}{! Modify salinity and temperature when sigma coordinates are used}
331   \textcolor{keywordflow}{if} ( coordinatemode(verticalcoordinate) == regridding\_sigma ) \textcolor{keywordflow}{then}
332     \textcolor{keywordflow}{do} i = g%isc,g%iec ; \textcolor{keywordflow}{do} j = g%jsc,g%jec
333       x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
334       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
335         s(i,j,1:g%ke) = s\_ref + s\_range;    \textcolor{comment}{! Use for sigma coordinates}
336         t(i,j,1:g%ke) = 1.0;                \textcolor{comment}{! Use for sigma coordinates}
337 \textcolor{keywordflow}{      endif}
338 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
339 \textcolor{keywordflow}{  endif}
340 
341   \textcolor{comment}{! Modify temperature when rho coordinates are used}
342   t(g%isc:g%iec,g%jsc:g%jec,1:g%ke) = 0.0
343   \textcolor{keywordflow}{if} (( coordinatemode(verticalcoordinate) == regridding\_rho ) .or. &
344       ( coordinatemode(verticalcoordinate) == regridding\_layer )) \textcolor{keywordflow}{then}
345     \textcolor{keywordflow}{do} i = g%isc,g%iec ; \textcolor{keywordflow}{do} j = g%jsc,g%jec
346       x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
347       \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
348         t(i,j,g%ke) = 1.0
349 \textcolor{keywordflow}{      endif}
350 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
351 \textcolor{keywordflow}{  endif}
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{\tt in}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt out}  & {\em h} & The thickness that is being initialized \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & A structure indicating the open file to parse for model parameter values.\\
\hline
\mbox{\tt 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}
94   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{  !< Ocean grid structure}
95   \textcolor{keywordtype}{type}(verticalgrid\_type), \textcolor{keywordtype}{intent(in)}  :: gv\textcolor{comment}{ !< Vertical grid structure}
96   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: us\textcolor{comment}{ !< A dimensional unit scaling type}
97   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, &
98                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H ~> m or
       kg m-2].}
99   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}
100 \textcolor{comment}{                                                      !! to parse for model parameter values.}
101   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
102 \textcolor{comment}{                                                      !! only read parameters without changing h.}
103 
104   \textcolor{comment}{! Local variables}
105   \textcolor{keywordtype}{real} :: e0(szk\_(gv))     \textcolor{comment}{! The resting interface heights, in depth units [Z ~> m], usually}
106                            \textcolor{comment}{! negative because it is positive upward.}
107   \textcolor{keywordtype}{real} :: eta1d(szk\_(gv)+1)\textcolor{comment}{! Interface height relative to the sea surface}
108                            \textcolor{comment}{! positive upward, in depth units [Z ~> m].}
109   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz
110   \textcolor{keywordtype}{real}    :: x
111   \textcolor{keywordtype}{real}    :: delta\_h
112   \textcolor{keywordtype}{real}    :: min\_thickness
113   \textcolor{keywordtype}{real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay
114   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
115   \textcolor{keywordtype}{character(len=40)} :: verticalcoordinate
116 
117   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
118 
119   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
120 
121   \textcolor{keywordflow}{if} (.not.just\_read) &
122     \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{"MOM\_initialization.F90, DOME2d\_initialize\_thickness: setting thickness"})
123 
124   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"MIN\_THICKNESS"},min\_thickness, &
125                  default=1.e-3, units=\textcolor{stringliteral}{"m"}, do\_not\_log=.true., scale=us%m\_to\_Z)
126   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, &
127                  default=default\_coordinate\_mode, do\_not\_log=.true.)
128   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, &
129                  default=0.1, do\_not\_log=.true.)
130   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, &
131                  default=0.3, do\_not\_log=.true.)
132   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, &
133                  default=0.2, do\_not\_log=.true.)
134 
135   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
136 
137   \textcolor{comment}{! WARNING: this routine specifies the interface heights so that the last layer}
138   \textcolor{comment}{!          is vanished, even at maximum depth. In order to have a uniform}
139   \textcolor{comment}{!          layer distribution, use this line of code within the loop:}
140   \textcolor{comment}{!          e0(k) = -G%max\_depth * real(k-1) / real(nz)}
141   \textcolor{comment}{!          To obtain a thickness distribution where the last layer is}
142   \textcolor{comment}{!          vanished and the other thicknesses uniformly distributed, use:}
143   \textcolor{comment}{!          e0(k) = -G%max\_depth * real(k-1) / real(nz-1)}
144   \textcolor{keywordflow}{do} k=1,nz
145     e0(k) = -g%max\_depth * \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real}(nz)
146 \textcolor{keywordflow}{  enddo}
147 
148   \textcolor{keywordflow}{select case} ( coordinatemode(verticalcoordinate) )
149 
150     \textcolor{keywordflow}{case} ( regridding\_layer, regridding\_rho )
151 
152       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
153         eta1d(nz+1) = -g%bathyT(i,j)
154         \textcolor{keywordflow}{do} k=nz,1,-1
155           eta1d(k) = e0(k)
156           \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv%Angstrom\_Z)) \textcolor{keywordflow}{then}
157             eta1d(k) = eta1d(k+1) + gv%Angstrom\_Z
158             h(i,j,k) = gv%Angstrom\_H
159           \textcolor{keywordflow}{else}
160             h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
161 \textcolor{keywordflow}{          endif}
162 \textcolor{keywordflow}{        enddo}
163 
164         x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
165         \textcolor{keywordflow}{if} ( x <= dome2d\_width\_bay ) \textcolor{keywordflow}{then}
166           h(i,j,1:nz-1) = gv%Angstrom\_H
167           h(i,j,nz) = gv%Z\_to\_H * dome2d\_depth\_bay * g%max\_depth - (nz-1) * gv%Angstrom\_H
168 \textcolor{keywordflow}{        endif}
169 
170 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
171 
172  \textcolor{comment}{!  case ( IC\_RHO\_C )}
173  \textcolor{comment}{!}
174  \textcolor{comment}{!    do j=js,je ; do i=is,ie}
175  \textcolor{comment}{!       eta1D(nz+1) = -G%bathyT(i,j)}
176  \textcolor{comment}{!       do k=nz,1,-1}
177  \textcolor{comment}{!         eta1D(k) = e0(k)}
178  \textcolor{comment}{!         if (eta1D(k) < (eta1D(k+1) + min\_thickness)) then}
179  \textcolor{comment}{!           eta1D(k) = eta1D(k+1) + min\_thickness}
180  \textcolor{comment}{!           h(i,j,k) = GV%Z\_to\_H * min\_thickness}
181  \textcolor{comment}{!         else}
182  \textcolor{comment}{!           h(i,j,k) = GV%Z\_to\_H * (eta1D(k) - eta1D(k+1))}
183  \textcolor{comment}{!         endif}
184  \textcolor{comment}{!       enddo}
185  \textcolor{comment}{!}
186  \textcolor{comment}{!       x = G%geoLonT(i,j) / G%len\_lon}
187  \textcolor{comment}{!       if ( x <= dome2d\_width\_bay ) then}
188  \textcolor{comment}{!         h(i,j,1:nz-1) = GV%Z\_to\_H * min\_thickness}
189  \textcolor{comment}{!         h(i,j,nz) = GV%Z\_to\_H * (dome2d\_depth\_bay * G%max\_depth - (nz-1) * min\_thickness)}
190  \textcolor{comment}{!       endif}
191  \textcolor{comment}{!}
192  \textcolor{comment}{!    enddo ; enddo}
193 
194     \textcolor{keywordflow}{case} ( regridding\_zstar )
195 
196       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
197         eta1d(nz+1) = -g%bathyT(i,j)
198         \textcolor{keywordflow}{do} k=nz,1,-1
199           eta1d(k) = e0(k)
200           \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + min\_thickness)) \textcolor{keywordflow}{then}
201             eta1d(k) = eta1d(k+1) + min\_thickness
202             h(i,j,k) = gv%Z\_to\_H * min\_thickness
203           \textcolor{keywordflow}{else}
204             h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
205 \textcolor{keywordflow}{          endif}
206 \textcolor{keywordflow}{        enddo}
207 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
208 
209     \textcolor{keywordflow}{case} ( regridding\_sigma )
210       \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
211         h(i,j,:) = gv%Z\_to\_H*g%bathyT(i,j) / nz
212 \textcolor{keywordflow}{      enddo} ;\textcolor{keywordflow}{ enddo}
213 
214 \textcolor{keywordflow}{    case default}
215       \textcolor{keyword}{call }mom\_error(fatal,\textcolor{stringliteral}{"dome2d\_initialize: "}// &
216       \textcolor{stringliteral}{"Unrecognized i.c. setup - set REGRIDDING\_COORDINATE\_MODE"})
217 
218 \textcolor{keywordflow}{  end select}
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{\tt in}  & {\em g} & The dynamic horizontal grid type\\
\hline
\mbox{\tt out}  & {\em d} & Ocean bottom depth in the units of depth\+\_\+max\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file structure\\
\hline
\mbox{\tt 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}
42   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),  \textcolor{keywordtype}{intent(in)}  :: g\textcolor{comment}{ !< The dynamic horizontal grid type}
43   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(G%isd:G%ied,G%jsd:G%jed)}, &
44                            \textcolor{keywordtype}{intent(out)} :: d\textcolor{comment}{ !< Ocean bottom depth in the units of depth\_max}
45   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}
46   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum ocean depth in arbitrary units}
47 
48   \textcolor{comment}{! Local variables}
49   \textcolor{keywordtype}{integer} :: i, j
50   \textcolor{keywordtype}{real}    :: x, bay\_depth, l1, l2
51   \textcolor{keywordtype}{real}    :: dome2d\_width\_bay, dome2d\_width\_bottom, dome2d\_depth\_bay
52   \textcolor{comment}{! This include declares and sets the variable "version".}
53 \textcolor{preprocessor}{# include "version\_variable.h"}
54 \textcolor{preprocessor}{}
55   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
56   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_WIDTH"}, dome2d\_width\_bay, &
57                  \textcolor{stringliteral}{'Width of shelf, as fraction of domain, in 2d DOME configuration.'}, &
58                  units=\textcolor{stringliteral}{'nondim'},default=0.1)
59   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_BASIN\_WIDTH"}, dome2d\_width\_bottom, &
60                  \textcolor{stringliteral}{'Width of deep ocean basin, as fraction of domain, in 2d DOME configuration.'}, &
61                  units=\textcolor{stringliteral}{'nondim'},default=0.3)
62   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DOME2D\_SHELF\_DEPTH"}, dome2d\_depth\_bay, &
63                  \textcolor{stringliteral}{'Depth of shelf, as fraction of basin depth, in 2d DOME configuration.'}, &
64                  units=\textcolor{stringliteral}{'nondim'},default=0.2)
65 
66   \textcolor{comment}{! location where downslope starts}
67   l1 = dome2d\_width\_bay
68 
69   \textcolor{comment}{! location where downslope reaches maximum depth}
70   l2 = 1.0 - dome2d\_width\_bottom
71 
72   bay\_depth = dome2d\_depth\_bay
73 
74   \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
75 
76     \textcolor{comment}{! Compute normalized zonal coordinate}
77     x = ( g%geoLonT(i,j) - g%west\_lon ) / g%len\_lon
78 
79     \textcolor{keywordflow}{if} ( x <= l1 ) \textcolor{keywordflow}{then}
80       d(i,j) = bay\_depth * max\_depth
81     \textcolor{keywordflow}{elseif} (( x > l1 ) .and. ( x < l2 )) \textcolor{keywordflow}{then}
82       d(i,j) = bay\_depth * max\_depth + (1.0-bay\_depth) * max\_depth * &
83                ( x - l1 ) / (l2 - l1)
84     \textcolor{keywordflow}{else}
85       d(i,j) = max\_depth
86 \textcolor{keywordflow}{    endif}
87 
88 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
89 
\end{DoxyCode}
