\hypertarget{namespacesloshing__initialization}{}\doxysection{sloshing\+\_\+initialization Module Reference}
\label{namespacesloshing__initialization}\index{sloshing\_initialization@{sloshing\_initialization}}


\doxysubsection{Detailed Description}
Initialization for the \char`\"{}sloshing\char`\"{} internal waves configuration. 

The module configures the model for the non-\/rotating sloshing test case. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacesloshing__initialization_a0ecf019d4e63415fc16ce5ca4158f7f3}{sloshing\+\_\+initialize\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth)
\begin{DoxyCompactList}\small\item\em Initialization of topography. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacesloshing__initialization_a5f999277fd41bc2730d6ef1dffffdb59}{sloshing\+\_\+initialize\+\_\+thickness}} (h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialization of thicknesses This routine is called when T\+H\+I\+C\+K\+N\+E\+S\+S\+\_\+\+C\+O\+N\+F\+IG is set to \textquotesingle{}sloshing\textquotesingle{}. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacesloshing__initialization_a7806e9a52f01ac49906e7285e2c2bb3b}{sloshing\+\_\+initialize\+\_\+temperature\+\_\+salinity}} (T, S, h, G, GV, param\+\_\+file, eqn\+\_\+of\+\_\+state, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialization of temperature and salinity. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacesloshing__initialization_a7806e9a52f01ac49906e7285e2c2bb3b}\label{namespacesloshing__initialization_a7806e9a52f01ac49906e7285e2c2bb3b}} 
\index{sloshing\_initialization@{sloshing\_initialization}!sloshing\_initialize\_temperature\_salinity@{sloshing\_initialize\_temperature\_salinity}}
\index{sloshing\_initialize\_temperature\_salinity@{sloshing\_initialize\_temperature\_salinity}!sloshing\_initialization@{sloshing\_initialization}}
\doxysubsubsection{\texorpdfstring{sloshing\_initialize\_temperature\_salinity()}{sloshing\_initialize\_temperature\_salinity()}}
{\footnotesize\ttfamily subroutine, public sloshing\+\_\+initialization\+::sloshing\+\_\+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})}



Initialization of temperature and salinity. 

This subroutine initializes linear profiles for T and S according to reference surface layer salinity and temperature and a specified range. Note that the linear distribution is set up with respect to the layer number, not the physical position). 
\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} & A structure indicating the open file to parse for model parameter values. \\
\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 h. \\
\hline
\end{DoxyParams}


Definition at line 181 of file sloshing\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{181   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< Ocean grid structure.}}
\DoxyCodeLine{182   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}}
\DoxyCodeLine{183 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: T\textcolor{comment}{ !< Potential temperature [degC].}}
\DoxyCodeLine{184 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: S\textcolor{comment}{ !< Salinity [ppt].}}
\DoxyCodeLine{185 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{ !< Layer thickness [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{186   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure indicating the}}
\DoxyCodeLine{187 \textcolor{comment}{                                                            !! open file to parse for model}}
\DoxyCodeLine{188 \textcolor{comment}{                                                            !! parameter values.}}
\DoxyCodeLine{189   \textcolor{keywordtype}{type}(EOS\_type),                            \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure.}}
\DoxyCodeLine{190   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{191 \textcolor{comment}{                                                      !! only read parameters without changing h.}}
\DoxyCodeLine{192 }
\DoxyCodeLine{193   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz}
\DoxyCodeLine{194 \textcolor{keywordtype}{  real}    :: delta\_S, delta\_T}
\DoxyCodeLine{195 \textcolor{keywordtype}{  real}    :: S\_ref, T\_ref;      \textcolor{comment}{! Reference salinity and temerature within}}
\DoxyCodeLine{196                                 \textcolor{comment}{! surface layer}}
\DoxyCodeLine{197 \textcolor{keywordtype}{  real}    :: S\_range, T\_range;  \textcolor{comment}{! Range of salinities and temperatures over the}}
\DoxyCodeLine{198                                 \textcolor{comment}{! vertical}}
\DoxyCodeLine{199   \textcolor{keywordtype}{integer} :: kdelta}
\DoxyCodeLine{200 \textcolor{keywordtype}{  real}    :: deltah}
\DoxyCodeLine{201 \textcolor{keywordtype}{  real}    :: xi0, xi1}
\DoxyCodeLine{202   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{203   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"initialize\_temp\_salt\_linear"} \textcolor{comment}{! This subroutine's}}
\DoxyCodeLine{204                                                             \textcolor{comment}{! name.}}
\DoxyCodeLine{205 }
\DoxyCodeLine{206   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{207 }
\DoxyCodeLine{208   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{209 }
\DoxyCodeLine{210   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, \textcolor{stringliteral}{'Reference value for salinity'}, \&}
\DoxyCodeLine{211                  default=35.0, units=\textcolor{stringliteral}{'1e-\/3'}, do\_not\_log=just\_read)}
\DoxyCodeLine{212   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"T\_REF"}, t\_ref, \textcolor{stringliteral}{'Reference value for temperature'}, \&}
\DoxyCodeLine{213                  units=\textcolor{stringliteral}{'degC'}, fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{214 }
\DoxyCodeLine{215   \textcolor{comment}{! The default is to assume an increase by 2 ppt for the salinity and a uniform temperature.}}
\DoxyCodeLine{216   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"S\_RANGE"},s\_range,\textcolor{stringliteral}{'Initial salinity range.'}, \&}
\DoxyCodeLine{217                  units=\textcolor{stringliteral}{'1e-\/3'}, default=2.0, do\_not\_log=just\_read)}
\DoxyCodeLine{218   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_RANGE"},t\_range,\textcolor{stringliteral}{'Initial temperature range'}, \&}
\DoxyCodeLine{219                  units=\textcolor{stringliteral}{'degC'}, default=0.0, do\_not\_log=just\_read)}
\DoxyCodeLine{220 }
\DoxyCodeLine{221   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{222 }
\DoxyCodeLine{223   \textcolor{comment}{! Prescribe salinity}}
\DoxyCodeLine{224   \textcolor{comment}{!delta\_S = S\_range / ( G\%ke -\/ 1.0 )}}
\DoxyCodeLine{225 }
\DoxyCodeLine{226   \textcolor{comment}{!S(:,:,1) = S\_ref}}
\DoxyCodeLine{227   \textcolor{comment}{!do k = 2,G\%ke}}
\DoxyCodeLine{228   \textcolor{comment}{!  S(:,:,k) = S(:,:,k-\/1) + delta\_S}}
\DoxyCodeLine{229   \textcolor{comment}{!enddo}}
\DoxyCodeLine{230 }
\DoxyCodeLine{231   deltah = g\%max\_depth / nz}
\DoxyCodeLine{232   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{233     xi0 = 0.0}
\DoxyCodeLine{234     \textcolor{keywordflow}{do} k = 1,nz}
\DoxyCodeLine{235       xi1 = xi0 + deltah / g\%max\_depth \textcolor{comment}{! =  xi0 + 1.0 / real(nz)}}
\DoxyCodeLine{236       s(i,j,k) = 34.0 + 0.5 * s\_range * (xi0 + xi1)}
\DoxyCodeLine{237       xi0 = xi1}
\DoxyCodeLine{238 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{239 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{240 }
\DoxyCodeLine{241   \textcolor{comment}{! Prescribe temperature}}
\DoxyCodeLine{242   delta\_t = t\_range / ( g\%ke -\/ 1.0 )}
\DoxyCodeLine{243 }
\DoxyCodeLine{244   t(:,:,1) = t\_ref}
\DoxyCodeLine{245   \textcolor{keywordflow}{do} k = 2,g\%ke}
\DoxyCodeLine{246     t(:,:,k) = t(:,:,k-\/1) + delta\_t}
\DoxyCodeLine{247 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{248   kdelta = 2}
\DoxyCodeLine{249   t(:,:,g\%ke/2 -\/ (kdelta-\/1):g\%ke/2 + kdelta) = 1.0}
\DoxyCodeLine{250 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacesloshing__initialization_a5f999277fd41bc2730d6ef1dffffdb59}\label{namespacesloshing__initialization_a5f999277fd41bc2730d6ef1dffffdb59}} 
\index{sloshing\_initialization@{sloshing\_initialization}!sloshing\_initialize\_thickness@{sloshing\_initialize\_thickness}}
\index{sloshing\_initialize\_thickness@{sloshing\_initialize\_thickness}!sloshing\_initialization@{sloshing\_initialization}}
\doxysubsubsection{\texorpdfstring{sloshing\_initialize\_thickness()}{sloshing\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public sloshing\+\_\+initialization\+::sloshing\+\_\+initialize\+\_\+thickness (\begin{DoxyParamCaption}\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, gv \%ke), 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})}



Initialization of thicknesses This routine is called when T\+H\+I\+C\+K\+N\+E\+S\+S\+\_\+\+C\+O\+N\+F\+IG is set to \textquotesingle{}sloshing\textquotesingle{}. 

This routine initializes layer positions to set off a sloshing motion in the zonal direction in a rectangular basin. All layers have initially the same thickness but all interfaces (except bottom and sea surface) are displaced according to a half-\/period cosine, with maximum value on the left and minimum value on the right. This sets off a regular sloshing motion. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & The ocean\textquotesingle{}s vertical grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ 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 57 of file sloshing\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{57   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{           !< The ocean's grid structure.}}
\DoxyCodeLine{58   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{          !< The ocean's vertical grid structure.}}
\DoxyCodeLine{59   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{          !< A dimensional unit scaling type}}
\DoxyCodeLine{60 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{61                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{           !< The thickness that is being initialized [H \string~> m or kg m-\/2].}}
\DoxyCodeLine{62   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< A structure indicating the open file}}
\DoxyCodeLine{63 \textcolor{comment}{                                                      !! to parse for model parameter values.}}
\DoxyCodeLine{64   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{65 \textcolor{comment}{                                                      !! only read parameters without changing h.}}
\DoxyCodeLine{66 }
\DoxyCodeLine{67 \textcolor{keywordtype}{  real}    :: displ(SZK\_(G)+1)   \textcolor{comment}{! The interface displacement in depth units.}}
\DoxyCodeLine{68 \textcolor{keywordtype}{  real}    :: z\_unif(SZK\_(G)+1)  \textcolor{comment}{! Fractional uniform interface heights [nondim].}}
\DoxyCodeLine{69 \textcolor{keywordtype}{  real}    :: z\_inter(SZK\_(G)+1) \textcolor{comment}{! Interface heights, in depth units.}}
\DoxyCodeLine{70 \textcolor{keywordtype}{  real}    :: a0                 \textcolor{comment}{! The displacement amplitude in depth units.}}
\DoxyCodeLine{71 \textcolor{keywordtype}{  real}    :: weight\_z           \textcolor{comment}{! A (misused?) depth-\/space weighting, in inconsistent units.}}
\DoxyCodeLine{72 \textcolor{keywordtype}{  real}    :: x1, y1, x2, y2     \textcolor{comment}{! Dimensonless parameters.}}
\DoxyCodeLine{73 \textcolor{keywordtype}{  real}    :: x, t               \textcolor{comment}{! Dimensionless depth coordinates?}}
\DoxyCodeLine{74   \textcolor{keywordtype}{logical} :: use\_IC\_bug         \textcolor{comment}{! If true, set the initial conditions retaining an old bug.}}
\DoxyCodeLine{75   \textcolor{keywordtype}{logical} :: just\_read          \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{76   \textcolor{comment}{! This include declares and sets the variable "version".}}
\DoxyCodeLine{77 \textcolor{preprocessor}{\# include "version\_variable.h"}}
\DoxyCodeLine{78 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"sloshing\_initialization"}\textcolor{comment}{ !< This module's name.}}
\DoxyCodeLine{79 }
\DoxyCodeLine{80   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nx, nz}
\DoxyCodeLine{81 }
\DoxyCodeLine{82   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{83 }
\DoxyCodeLine{84   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{85   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{86   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SLOSHING\_IC\_AMPLITUDE"}, a0, \&}
\DoxyCodeLine{87                  \textcolor{stringliteral}{"Initial amplitude of sloshing internal interface height "}//\&}
\DoxyCodeLine{88                  \textcolor{stringliteral}{"displacements it the sloshing test case."}, \&}
\DoxyCodeLine{89                  units=\textcolor{stringliteral}{'m'}, default=75.0, scale=us\%m\_to\_Z, do\_not\_log=just\_read)}
\DoxyCodeLine{90   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SLOSHING\_IC\_BUG"}, use\_ic\_bug, \&}
\DoxyCodeLine{91                  \textcolor{stringliteral}{"If true, use code with a bug to set the sloshing initial conditions."}, \&}
\DoxyCodeLine{92                  default=.false., do\_not\_log=just\_read)}
\DoxyCodeLine{93 }
\DoxyCodeLine{94   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{95 }
\DoxyCodeLine{96   \textcolor{comment}{! Define thicknesses}}
\DoxyCodeLine{97   \textcolor{keywordflow}{do} j=g\%jsc,g\%jec ; \textcolor{keywordflow}{do} i=g\%isc,g\%iec}
\DoxyCodeLine{98 }
\DoxyCodeLine{99     \textcolor{comment}{! Define uniform interfaces}}
\DoxyCodeLine{100     \textcolor{keywordflow}{do} k = 0,nz}
\DoxyCodeLine{101       z\_unif(k+1) = -\/real(k)/real(nz)}
\DoxyCodeLine{102 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{103 }
\DoxyCodeLine{104     \textcolor{comment}{! 1. Define stratification}}
\DoxyCodeLine{105     \textcolor{keywordflow}{do} k = 1,nz+1}
\DoxyCodeLine{106 }
\DoxyCodeLine{107       \textcolor{comment}{! Thin pycnocline in the middle}}
\DoxyCodeLine{108       \textcolor{comment}{!z\_inter(k) = (2.0**(n-\/1)) * (z\_unif(k) + 0.5)**n -\/ 0.5}}
\DoxyCodeLine{109 }
\DoxyCodeLine{110       \textcolor{comment}{! Thin pycnocline in the middle (piecewise linear profile)}}
\DoxyCodeLine{111       x1 = 0.30; y1 = 0.48; x2 = 0.70; y2 = 0.52}
\DoxyCodeLine{112 }
\DoxyCodeLine{113       x = -\/z\_unif(k)}
\DoxyCodeLine{114 }
\DoxyCodeLine{115       \textcolor{keywordflow}{if} ( x <= x1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{116         t = y1*x/x1}
\DoxyCodeLine{117       \textcolor{keywordflow}{elseif} ( (x > x1 ) .and. ( x < x2 )) \textcolor{keywordflow}{then}}
\DoxyCodeLine{118         t = y1 + (y2-\/y1) * (x-\/x1) / (x2-\/x1)}
\DoxyCodeLine{119       \textcolor{keywordflow}{else}}
\DoxyCodeLine{120         t = y2 + (1.0-\/y2) * (x-\/x2) / (1.0-\/x2)}
\DoxyCodeLine{121 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{122 }
\DoxyCodeLine{123       t = -\/ z\_unif(k)}
\DoxyCodeLine{124 }
\DoxyCodeLine{125       z\_inter(k) = -\/t * g\%max\_depth}
\DoxyCodeLine{126 }
\DoxyCodeLine{127 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{128 }
\DoxyCodeLine{129     \textcolor{comment}{! 2. Define displacement}}
\DoxyCodeLine{130     \textcolor{comment}{! a0 is set via get\_param; by default a0 is a 75m Displacement amplitude in depth units.}}
\DoxyCodeLine{131     \textcolor{keywordflow}{do} k = 1,nz+1}
\DoxyCodeLine{132 }
\DoxyCodeLine{133       weight\_z = -\/ 4.0 * ( z\_unif(k) + 0.5 )**2 + 1.0}
\DoxyCodeLine{134 }
\DoxyCodeLine{135       x = g\%geoLonT(i,j) / g\%len\_lon}
\DoxyCodeLine{136       \textcolor{keywordflow}{if} (use\_ic\_bug) \textcolor{keywordflow}{then}}
\DoxyCodeLine{137         displ(k) = a0 * cos(acos(-\/1.0)*x) + weight\_z * us\%m\_to\_Z}
\DoxyCodeLine{138       \textcolor{keywordflow}{else}}
\DoxyCodeLine{139         displ(k) = a0 * cos(acos(-\/1.0)*x) * weight\_z}
\DoxyCodeLine{140 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{141 }
\DoxyCodeLine{142       \textcolor{keywordflow}{if} ( k == 1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{143         displ(k) = 0.0}
\DoxyCodeLine{144 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{145 }
\DoxyCodeLine{146       \textcolor{keywordflow}{if} ( k == nz+1 ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{147         displ(k) = 0.0}
\DoxyCodeLine{148 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{149 }
\DoxyCodeLine{150       z\_inter(k) = z\_inter(k) + displ(k)}
\DoxyCodeLine{151 }
\DoxyCodeLine{152 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{153 }
\DoxyCodeLine{154     \textcolor{comment}{! 3. The last interface must coincide with the seabed}}
\DoxyCodeLine{155     z\_inter(nz+1) = -\/g\%bathyT(i,j)}
\DoxyCodeLine{156     \textcolor{comment}{! Modify interface heights to make sure all thicknesses are strictly positive}}
\DoxyCodeLine{157     \textcolor{keywordflow}{do} k = nz,1,-\/1}
\DoxyCodeLine{158       \textcolor{keywordflow}{if} ( z\_inter(k) < (z\_inter(k+1) + gv\%Angstrom\_Z) ) \textcolor{keywordflow}{then}}
\DoxyCodeLine{159         z\_inter(k) = z\_inter(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{160 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{161 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{162 }
\DoxyCodeLine{163     \textcolor{comment}{! 4. Define layers}}
\DoxyCodeLine{164     \textcolor{keywordflow}{do} k = 1,nz}
\DoxyCodeLine{165       h(i,j,k) = gv\%Z\_to\_H * (z\_inter(k) -\/ z\_inter(k+1))}
\DoxyCodeLine{166 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{167 }
\DoxyCodeLine{168 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{169 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacesloshing__initialization_a0ecf019d4e63415fc16ce5ca4158f7f3}\label{namespacesloshing__initialization_a0ecf019d4e63415fc16ce5ca4158f7f3}} 
\index{sloshing\_initialization@{sloshing\_initialization}!sloshing\_initialize\_topography@{sloshing\_initialize\_topography}}
\index{sloshing\_initialize\_topography@{sloshing\_initialize\_topography}!sloshing\_initialization@{sloshing\_initialization}}
\doxysubsubsection{\texorpdfstring{sloshing\_initialize\_topography()}{sloshing\_initialize\_topography()}}
{\footnotesize\ttfamily subroutine, public sloshing\+\_\+initialization\+::sloshing\+\_\+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})}



Initialization of topography. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The dynamic horizontal grid type \\
\hline
\mbox{\texttt{ out}}  & {\em d} & Ocean bottom depth in 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 32 of file sloshing\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{32   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),  \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{33 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{34                            \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in the units of depth\_max}}
\DoxyCodeLine{35   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{36 \textcolor{keywordtype}{  real},                    \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum ocean depth in arbitrary units}}
\DoxyCodeLine{37 }
\DoxyCodeLine{38   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{39   \textcolor{keywordtype}{integer}   :: i, j}
\DoxyCodeLine{40 }
\DoxyCodeLine{41   \textcolor{keywordflow}{do} i=g\%isc,g\%iec ; \textcolor{keywordflow}{do} j=g\%jsc,g\%jec}
\DoxyCodeLine{42     d(i,j) = max\_depth}
\DoxyCodeLine{43 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{44 }

\end{DoxyCode}
