\hypertarget{namespacedumbbell__initialization}{}\section{dumbbell\+\_\+initialization Module Reference}
\label{namespacedumbbell__initialization}\index{dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}}


\subsection{Detailed Description}
Configures the model for the idealized dumbbell test case. \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__initialization_aba31e0ec02e4c1c0e5987d8843be5e76}{dumbbell\+\_\+initialize\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth)
\begin{DoxyCompactList}\small\item\em Initialization of topography. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__initialization_a265452b61d468b64683545f2bf0cf2c6}{dumbbell\+\_\+initialize\+\_\+thickness}} (h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initializes the layer thicknesses to be uniform in the dumbbell test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__initialization_ab755e35e9e8cda3c40922930ccf595f8}{dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity}} (T, S, h, G, GV, param\+\_\+file, eqn\+\_\+of\+\_\+state, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initial values for temperature and salinity for the dumbbell test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacedumbbell__initialization_a13361a11ddf3cb55689b7899f281c273}{dumbbell\+\_\+initialize\+\_\+sponges}} (G, GV, US, tv, param\+\_\+file, use\+\_\+\+A\+LE, C\+Sp, A\+C\+Sp)
\begin{DoxyCompactList}\small\item\em Initialize the restoring sponges for the dumbbell test case. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacedumbbell__initialization_a1a1ee45454d965674b4dfa06cccf4403}\label{namespacedumbbell__initialization_a1a1ee45454d965674b4dfa06cccf4403}} 
character(len=40) \mbox{\hyperlink{namespacedumbbell__initialization_a1a1ee45454d965674b4dfa06cccf4403}{mdl}} = \char`\"{}dumbbell\+\_\+initialization\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacedumbbell__initialization_a13361a11ddf3cb55689b7899f281c273}\label{namespacedumbbell__initialization_a13361a11ddf3cb55689b7899f281c273}} 
\index{dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}!dumbbell\+\_\+initialize\+\_\+sponges@{dumbbell\+\_\+initialize\+\_\+sponges}}
\index{dumbbell\+\_\+initialize\+\_\+sponges@{dumbbell\+\_\+initialize\+\_\+sponges}!dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}}
\subsubsection{\texorpdfstring{dumbbell\+\_\+initialize\+\_\+sponges()}{dumbbell\_initialize\_sponges()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+initialization\+::dumbbell\+\_\+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})}



Initialize the restoring sponges for the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Horizontal grid control structure\\
\hline
\mbox{\tt in}  & {\em gv} & Vertical grid control structure\\
\hline
\mbox{\tt in}  & {\em us} & A dimensional unit scaling type\\
\hline
\mbox{\tt in}  & {\em tv} & Thermodynamic variables\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file structure\\
\hline
\mbox{\tt in}  & {\em use\+\_\+ale} & A\+LE flag\\
\hline
 & {\em csp} & Layered sponge control structure pointer\\
\hline
 & {\em acsp} & A\+LE sponge control structure pointer \\
\hline
\end{DoxyParams}


Definition at line 288 of file dumbbell\+\_\+initialization.\+F90.


\begin{DoxyCode}
288   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{ !< Horizontal grid control structure}
289   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< Vertical grid control structure}
290   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{ !< A dimensional unit scaling type}
291   \textcolor{keywordtype}{type}(thermo\_var\_ptrs),   \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{ !< Thermodynamic variables}
292   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file structure}
293   \textcolor{keywordtype}{logical},                 \textcolor{keywordtype}{intent(in)} :: use\_ALE\textcolor{comment}{ !< ALE flag}
294   \textcolor{keywordtype}{type}(sponge\_CS),         \textcolor{keywordtype}{pointer}    :: CSp\textcolor{comment}{ !< Layered sponge control structure pointer}
295   \textcolor{keywordtype}{type}(ALE\_sponge\_CS),     \textcolor{keywordtype}{pointer}    :: ACSp\textcolor{comment}{ !< ALE sponge control structure pointer}
296 
297   \textcolor{keywordtype}{real} :: sponge\_time\_scale  \textcolor{comment}{! The damping time scale [T ~> s]}
298 
299   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G))} :: Idamp \textcolor{comment}{! inverse damping timescale [T-1 ~> s-1]}
300   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))} :: h, T, S \textcolor{comment}{! sponge thicknesses, temp and salt}
301   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZK\_(GV)+1)} :: e0, eta1D \textcolor{comment}{! interface positions for ALE sponge}
302 
303   \textcolor{keywordtype}{integer} :: i, j, k, nz
304   \textcolor{keywordtype}{real} :: x, zi, zmid, dist, min\_thickness, dblen
305   \textcolor{keywordtype}{real} :: mld, S\_ref, S\_range, S\_dense, T\_ref, sill\_height
306   \textcolor{keywordtype}{logical} :: dbrotate    \textcolor{comment}{! If true, rotate the domain.}
307 
308   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_LEN"},dblen, &
309                 \textcolor{stringliteral}{'Lateral Length scale for dumbbell '},&
310                  units=\textcolor{stringliteral}{'k'}, default=600., do\_not\_log=.true.)
311   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_ROTATION"}, dbrotate, &
312                 \textcolor{stringliteral}{'Logical for rotation of dumbbell domain.'},&
313                  units=\textcolor{stringliteral}{'nondim'}, default=.false., do\_not\_log=.true.)
314 
315   \textcolor{keywordflow}{if} (g%x\_axis\_units == \textcolor{stringliteral}{'m'}) \textcolor{keywordflow}{then}
316     dblen=dblen*1.e3
317 \textcolor{keywordflow}{  endif}
318 
319   nz = gv%ke
320 
321   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_SPONGE\_TIME\_SCALE"}, sponge\_time\_scale, &
322        \textcolor{stringliteral}{"The time scale in the reservoir for restoring. If zero, the sponge is disabled."}, &
323        units=\textcolor{stringliteral}{"s"}, default=0., scale=us%s\_to\_T)
324   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_SREF"}, s\_ref, do\_not\_log=.true.)
325   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_S\_RANGE"}, s\_range, do\_not\_log=.true.)
326   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"MIN\_THICKNESS"}, min\_thickness, &
327                 \textcolor{stringliteral}{'Minimum thickness for layer'},&
328                  units=\textcolor{stringliteral}{'m'}, default=1.0e-3, do\_not\_log=.true., scale=us%m\_to\_Z)
329 
330   \textcolor{comment}{! no active sponges}
331   \textcolor{keywordflow}{if} (sponge\_time\_scale <= 0.) \textcolor{keywordflow}{return}
332 
333   \textcolor{comment}{! everywhere is initially unsponged}
334   idamp(:,:) = 0.0
335 
336   \textcolor{keywordflow}{do} j = g%jsc, g%jec
337     \textcolor{keywordflow}{do} i = g%isc,g%iec
338       \textcolor{keywordflow}{if} (g%mask2dT(i,j) > 0.) \textcolor{keywordflow}{then}
339         \textcolor{comment}{! nondimensional x position}
340         \textcolor{keywordflow}{if} (dbrotate) \textcolor{keywordflow}{then}
341           \textcolor{comment}{! This is really y in the rotated case}
342           x = ( g%geoLatT(i,j) ) / dblen
343         \textcolor{keywordflow}{else}
344           x = ( g%geoLonT(i,j) ) / dblen
345 \textcolor{keywordflow}{        endif}
346         \textcolor{keywordflow}{if} (x > 0.25 .or. x < -0.25) \textcolor{keywordflow}{then}
347           \textcolor{comment}{! scale restoring by depth into sponge}
348           idamp(i,j) = 1. / sponge\_time\_scale
349 \textcolor{keywordflow}{        endif}
350 \textcolor{keywordflow}{      endif}
351 \textcolor{keywordflow}{    enddo}
352 \textcolor{keywordflow}{  enddo}
353 
354   \textcolor{keywordflow}{if} (use\_ale) \textcolor{keywordflow}{then}
355     \textcolor{comment}{! construct a uniform grid for the sponge}
356     \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
357       eta1d(nz+1) = -g%bathyT(i,j)
358       \textcolor{keywordflow}{do} k=nz,1,-1
359         eta1d(k) = -g%max\_depth * \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real}(nz)
360         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + min\_thickness)) \textcolor{keywordflow}{then}
361           eta1d(k) = eta1d(k+1) + min\_thickness
362           h(i,j,k) = gv%Z\_to\_H * min\_thickness
363         \textcolor{keywordflow}{else}
364           h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
365 \textcolor{keywordflow}{        endif}
366 \textcolor{keywordflow}{      enddo}
367 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
368 
369     \textcolor{keyword}{call }initialize\_ale\_sponge(idamp, g, param\_file, acsp, h, nz)
370 
371     \textcolor{comment}{! construct temperature and salinity for the sponge}
372     \textcolor{comment}{! start with initial condition}
373     s(:,:,:) = 0.0
374 
375     \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
376       \textcolor{comment}{! Compute normalized zonal coordinates (x,y=0 at center of domain)}
377       \textcolor{keywordflow}{if} (dbrotate) \textcolor{keywordflow}{then}
378         \textcolor{comment}{! This is really y in the rotated case}
379         x = ( g%geoLatT(i,j) ) / dblen
380       \textcolor{keywordflow}{else}
381         x = ( g%geoLonT(i,j) ) / dblen
382 \textcolor{keywordflow}{      endif}
383       \textcolor{keywordflow}{if} (x>=0.25 ) \textcolor{keywordflow}{then}
384         \textcolor{keywordflow}{do} k=1,nz
385           s(i,j,k)=s\_ref + 0.5*s\_range
386 \textcolor{keywordflow}{        enddo}
387 \textcolor{keywordflow}{      endif}
388       \textcolor{keywordflow}{if} (x<=-0.25 ) \textcolor{keywordflow}{then}
389         \textcolor{keywordflow}{do} k=1,nz
390           s(i,j,k)=s\_ref - 0.5*s\_range
391 \textcolor{keywordflow}{        enddo}
392 \textcolor{keywordflow}{      endif}
393 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
394 \textcolor{keywordflow}{  endif}
395 
396   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(tv%S)) \textcolor{keyword}{call }set\_up\_ale\_sponge\_field(s, g, tv%S, acsp)
397 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedumbbell__initialization_ab755e35e9e8cda3c40922930ccf595f8}\label{namespacedumbbell__initialization_ab755e35e9e8cda3c40922930ccf595f8}} 
\index{dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}!dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity@{dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity}}
\index{dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity@{dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity}!dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}}
\subsubsection{\texorpdfstring{dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity()}{dumbbell\_initialize\_temperature\_salinity()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+initialization\+::dumbbell\+\_\+initialize\+\_\+temperature\+\_\+salinity (\begin{DoxyParamCaption}\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g), szk\+\_\+(g)), intent(out)}]{T,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g), szk\+\_\+(g)), intent(out)}]{S,  }\item[{real, dimension(szi\+\_\+(g),szj\+\_\+(g), szk\+\_\+(g)), 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})}



Initial values for temperature and salinity for the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & Ocean grid structure\\
\hline
\mbox{\tt in}  & {\em gv} & 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 h. \\
\hline
\end{DoxyParams}


Definition at line 212 of file dumbbell\+\_\+initialization.\+F90.


\begin{DoxyCode}
212   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< Ocean grid structure}
213   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< Vertical grid structure}
214   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: T\textcolor{comment}{ !< Potential temperature [degC]}
215   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: S\textcolor{comment}{ !< Salinity [ppt]}
216   \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]}
217   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}
218   \textcolor{keywordtype}{type}(EOS\_type),                            \textcolor{keywordtype}{pointer}     :: eqn\_of\_state\textcolor{comment}{ !< Equation of state structure}
219   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
220 \textcolor{comment}{                                                      !! only read parameters without changing h.}
221 
222   \textcolor{comment}{! Local variables}
223   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, k\_light
224   \textcolor{keywordtype}{real}    :: xi0, xi1, dxi, r, S\_surf, T\_surf, S\_range, T\_range
225   \textcolor{keywordtype}{real}    :: x, y, dblen
226   \textcolor{keywordtype}{real}    :: T\_ref, T\_Light, T\_Dense, S\_ref, S\_Light, S\_Dense, a1, frac\_dense, k\_frac, res\_rat
227   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
228   \textcolor{keywordtype}{logical} :: dbrotate     \textcolor{comment}{! If true, rotate the domain.}
229   \textcolor{keywordtype}{character(len=20)} :: verticalCoordinate, density\_profile
230 
231   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
232 
233   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
234 
235   t\_surf = 20.0
236 
237   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, &
238                  default=default\_coordinate\_mode, do\_not\_log=just\_read)
239   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"INITIAL\_DENSITY\_PROFILE"}, density\_profile, &
240                  \textcolor{stringliteral}{'Initial profile shape. Valid values are "linear", "parabolic" '}// &
241                  \textcolor{stringliteral}{'and "exponential".'}, default=\textcolor{stringliteral}{'linear'}, do\_not\_log=just\_read)
242   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_SREF"}, s\_surf, &
243                  \textcolor{stringliteral}{'DUMBBELL REFERENCE SALINITY'}, units=\textcolor{stringliteral}{'1e-3'}, default=34., do\_not\_log=just\_read)
244   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_S\_RANGE"}, s\_range, &
245                  \textcolor{stringliteral}{'DUMBBELL salinity range (right-left)'}, units=\textcolor{stringliteral}{'1e-3'}, &
246                  default=2., do\_not\_log=just\_read)
247   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_LEN"},dblen, &
248                 \textcolor{stringliteral}{'Lateral Length scale for dumbbell '},&
249                  units=\textcolor{stringliteral}{'k'}, default=600., do\_not\_log=just\_read)
250   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_ROTATION"}, dbrotate, &
251                 \textcolor{stringliteral}{'Logical for rotation of dumbbell domain.'},&
252                  units=\textcolor{stringliteral}{'nondim'}, default=.false., do\_not\_log=just\_read)
253 
254   \textcolor{keywordflow}{if} (g%x\_axis\_units == \textcolor{stringliteral}{'m'}) \textcolor{keywordflow}{then}
255     dblen=dblen*1.e3
256 \textcolor{keywordflow}{  endif}
257 
258   \textcolor{keywordflow}{do} j=g%jsc,g%jec
259     \textcolor{keywordflow}{do} i=g%isc,g%iec
260     \textcolor{comment}{! Compute normalized zonal coordinates (x,y=0 at center of domain)}
261       \textcolor{keywordflow}{if} (dbrotate) \textcolor{keywordflow}{then}
262         \textcolor{comment}{! This is really y in the rotated case}
263         x = ( g%geoLatT(i,j) ) / dblen
264       \textcolor{keywordflow}{else}
265         x = ( g%geoLonT(i,j) ) / dblen
266 \textcolor{keywordflow}{      endif}
267       \textcolor{keywordflow}{do} k=1,nz
268         t(i,j,k)=t\_surf
269 \textcolor{keywordflow}{      enddo}
270       \textcolor{keywordflow}{if} (x>=0. ) \textcolor{keywordflow}{then}
271         \textcolor{keywordflow}{do} k=1,nz
272           s(i,j,k)=s\_surf + 0.5*s\_range
273 \textcolor{keywordflow}{        enddo}
274 \textcolor{keywordflow}{      endif}
275       \textcolor{keywordflow}{if} (x<0. ) \textcolor{keywordflow}{then}
276         \textcolor{keywordflow}{do} k=1,nz
277           s(i,j,k)=s\_surf - 0.5*s\_range
278 \textcolor{keywordflow}{        enddo}
279 \textcolor{keywordflow}{      endif}
280 
281 \textcolor{keywordflow}{    enddo}
282 \textcolor{keywordflow}{  enddo}
283 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedumbbell__initialization_a265452b61d468b64683545f2bf0cf2c6}\label{namespacedumbbell__initialization_a265452b61d468b64683545f2bf0cf2c6}} 
\index{dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}!dumbbell\+\_\+initialize\+\_\+thickness@{dumbbell\+\_\+initialize\+\_\+thickness}}
\index{dumbbell\+\_\+initialize\+\_\+thickness@{dumbbell\+\_\+initialize\+\_\+thickness}!dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}}
\subsubsection{\texorpdfstring{dumbbell\+\_\+initialize\+\_\+thickness()}{dumbbell\_initialize\_thickness()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+initialization\+::dumbbell\+\_\+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})}



Initializes the layer thicknesses to be uniform in the dumbbell test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & The ocean\textquotesingle{}s grid structure.\\
\hline
\mbox{\tt in}  & {\em gv} & The ocean\textquotesingle{}s 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 dumbbell\+\_\+initialization.\+F90.


\begin{DoxyCode}
94   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{           !< The ocean's grid structure.}
95   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{          !< The ocean's 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{keywordtype}{real} :: e0(SZK\_(G)+1)   \textcolor{comment}{! The resting interface heights [Z ~> m], usually}
105                           \textcolor{comment}{! negative because it is positive upward.}
106   \textcolor{keywordtype}{real} :: eta1D(SZK\_(G)+1)\textcolor{comment}{! Interface height relative to the sea surface}
107                           \textcolor{comment}{! positive upward [Z ~> m].}
108   \textcolor{keywordtype}{real} :: min\_thickness   \textcolor{comment}{! The minimum layer thicknesses [Z ~> m].}
109   \textcolor{keywordtype}{real} :: S\_surf, S\_range, S\_ref, S\_light, S\_dense \textcolor{comment}{! Various salinities [ppt].}
110   \textcolor{keywordtype}{real} :: eta\_IC\_quanta   \textcolor{comment}{! The granularity of quantization of intial interface heights [Z-1 ~> m-1].}
111   \textcolor{comment}{! This include declares and sets the variable "version".}
112 \textcolor{preprocessor}{# include "version\_variable.h"}
113 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=20)} :: verticalCoordinate
114   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
115   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz
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, initialize\_thickness\_uniform: setting thickness"})
123 
124   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})
125   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"MIN\_THICKNESS"}, min\_thickness, &
126                 \textcolor{stringliteral}{'Minimum thickness for layer'},&
127                  units=\textcolor{stringliteral}{'m'}, default=1.0e-3, do\_not\_log=just\_read, scale=us%m\_to\_Z)
128   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"REGRIDDING\_COORDINATE\_MODE"}, verticalcoordinate, &
129                  default=default\_coordinate\_mode, do\_not\_log=just\_read)
130 
131   \textcolor{comment}{! WARNING: this routine specifies the interface heights so that the last layer}
132   \textcolor{comment}{!          is vanished, even at maximum depth. In order to have a uniform}
133   \textcolor{comment}{!          layer distribution, use this line of code within the loop:}
134   \textcolor{comment}{!          e0(k) = -G%max\_depth * real(k-1) / real(nz)}
135   \textcolor{comment}{!          To obtain a thickness distribution where the last layer is}
136   \textcolor{comment}{!          vanished and the other thicknesses uniformly distributed, use:}
137   \textcolor{comment}{!          e0(k) = -G%max\_depth * real(k-1) / real(nz-1)}
138   \textcolor{comment}{!do k=1,nz+1}
139   \textcolor{comment}{!  e0(k) = -G%max\_depth * real(k-1) / real(nz)}
140   \textcolor{comment}{!enddo}
141 
142   \textcolor{keywordflow}{select case} ( coordinatemode(verticalcoordinate) )
143 
144   \textcolor{keywordflow}{case} ( regridding\_layer, regridding\_rho ) \textcolor{comment}{! Initial thicknesses for isopycnal coordinates}
145     \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"INITIAL\_SSS"}, s\_surf, default=34., do\_not\_log=.true.)
146     \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"INITIAL\_S\_RANGE"}, s\_range, default=2., do\_not\_log=.true.)
147     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, default=35.0, do\_not\_log=.true.)
148     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_S\_LIGHT"}, s\_light, default = s\_ref, do\_not\_log=.true.)
149     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TS\_RANGE\_S\_DENSE"}, s\_dense, default = s\_ref, do\_not\_log=.true.)
150     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"INTERFACE\_IC\_QUANTA"}, eta\_ic\_quanta, &
151                    \textcolor{stringliteral}{"The granularity of initial interface height values "}//&
152                    \textcolor{stringliteral}{"per meter, to avoid sensivity to order-of-arithmetic changes."}, &
153                    default=2048.0, units=\textcolor{stringliteral}{"m-1"}, scale=us%Z\_to\_m, do\_not\_log=just\_read)
154     \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
155 
156     \textcolor{keywordflow}{do} k=1,nz+1
157       \textcolor{comment}{! Salinity of layer k is S\_light + (k-1)/(nz-1) * (S\_dense - S\_light)}
158       \textcolor{comment}{! Salinity of interface K is S\_light + (K-3/2)/(nz-1) * (S\_dense - S\_light)}
159       \textcolor{comment}{! Salinity at depth z should be S(z) = S\_surf - S\_range * z/max\_depth}
160       \textcolor{comment}{! Equating: S\_surf - S\_range * z/max\_depth = S\_light + (K-3/2)/(nz-1) * (S\_dense - S\_light)}
161       \textcolor{comment}{! Equating: - S\_range * z/max\_depth = S\_light - S\_surf + (K-3/2)/(nz-1) * (S\_dense - S\_light)}
162       \textcolor{comment}{! Equating: z/max\_depth = - ( S\_light - S\_surf + (K-3/2)/(nz-1) * (S\_dense - S\_light) ) / S\_range}
163       e0(k) = - g%max\_depth * ( ( s\_light  - s\_surf ) + ( s\_dense - s\_light ) * &
164                 ( (\textcolor{keywordtype}{real}(K)-1.5) / \textcolor{keywordtype}{real(nz-1)} ) ) / S\_range
165       \textcolor{comment}{! Force round numbers ... the above expression has irrational factors ...}
166       \textcolor{keywordflow}{if} (eta\_ic\_quanta > 0.0) &
167         e0(k) = nint(eta\_ic\_quanta*e0(k)) / eta\_ic\_quanta
168       e0(k) = min(\textcolor{keywordtype}{real}(1-K)*GV%Angstrom\_Z, e0(K)) \textcolor{comment}{! Bound by surface}
169       e0(k) = max(-g%max\_depth, e0(k)) \textcolor{comment}{! Bound by bottom}
170 \textcolor{keywordflow}{    enddo}
171     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
172       eta1d(nz+1) = -g%bathyT(i,j)
173       \textcolor{keywordflow}{do} k=nz,1,-1
174         eta1d(k) = e0(k)
175         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv%Angstrom\_Z)) \textcolor{keywordflow}{then}
176           eta1d(k) = eta1d(k+1) + gv%Angstrom\_Z
177           h(i,j,k) = gv%Angstrom\_H
178         \textcolor{keywordflow}{else}
179           h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
180 \textcolor{keywordflow}{        endif}
181 \textcolor{keywordflow}{      enddo}
182 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
183 
184   \textcolor{keywordflow}{case} ( regridding\_zstar )                       \textcolor{comment}{! Initial thicknesses for z coordinates}
185     \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
186     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
187       eta1d(nz+1) = -g%bathyT(i,j)
188       \textcolor{keywordflow}{do} k=nz,1,-1
189         eta1d(k) = -g%max\_depth * \textcolor{keywordtype}{real(k-1)} / \textcolor{keywordtype}{real}(nz)
190         \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + min\_thickness)) \textcolor{keywordflow}{then}
191           eta1d(k) = eta1d(k+1) + min\_thickness
192           h(i,j,k) = gv%Z\_to\_H * min\_thickness
193         \textcolor{keywordflow}{else}
194           h(i,j,k) = gv%Z\_to\_H * (eta1d(k) - eta1d(k+1))
195 \textcolor{keywordflow}{        endif}
196 \textcolor{keywordflow}{      enddo}
197 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
198 
199   \textcolor{keywordflow}{case} ( regridding\_sigma )             \textcolor{comment}{! Initial thicknesses for sigma coordinates}
200     \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
201     \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie
202       h(i,j,:) = gv%Z\_to\_H * g%bathyT(i,j) / dfloat(nz)
203 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
204 
205 \textcolor{keywordflow}{end select}
206 
\end{DoxyCode}
\mbox{\Hypertarget{namespacedumbbell__initialization_aba31e0ec02e4c1c0e5987d8843be5e76}\label{namespacedumbbell__initialization_aba31e0ec02e4c1c0e5987d8843be5e76}} 
\index{dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}!dumbbell\+\_\+initialize\+\_\+topography@{dumbbell\+\_\+initialize\+\_\+topography}}
\index{dumbbell\+\_\+initialize\+\_\+topography@{dumbbell\+\_\+initialize\+\_\+topography}!dumbbell\+\_\+initialization@{dumbbell\+\_\+initialization}}
\subsubsection{\texorpdfstring{dumbbell\+\_\+initialize\+\_\+topography()}{dumbbell\_initialize\_topography()}}
{\footnotesize\ttfamily subroutine, public dumbbell\+\_\+initialization\+::dumbbell\+\_\+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{\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 43 of file dumbbell\+\_\+initialization.\+F90.


\begin{DoxyCode}
43   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),  \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}
44   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(G%isd:G%ied,G%jsd:G%jed)}, &
45                            \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in the units of depth\_max}
46   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}
47   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum ocean depth in arbitrary units}
48 
49   \textcolor{comment}{! Local variables}
50   \textcolor{keywordtype}{integer}   :: i, j
51   \textcolor{keywordtype}{real}      :: x, y, delta, dblen, dbfrac
52   \textcolor{keywordtype}{logical}   :: dbrotate
53 
54   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_LEN"},dblen, &
55                 \textcolor{stringliteral}{'Lateral Length scale for dumbbell.'},&
56                  units=\textcolor{stringliteral}{'k'}, default=600., do\_not\_log=.false.)
57   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DUMBBELL\_FRACTION"},dbfrac, &
58                 \textcolor{stringliteral}{'Meridional fraction for narrow part of dumbbell.'},&
59                  units=\textcolor{stringliteral}{'nondim'}, default=0.5, do\_not\_log=.false.)
60   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DUMBBELL\_ROTATION"}, dbrotate, &
61                 \textcolor{stringliteral}{'Logical for rotation of dumbbell domain.'},&
62                  units=\textcolor{stringliteral}{'nondim'}, default=.false., do\_not\_log=.false.)
63 
64   \textcolor{keywordflow}{if} (g%x\_axis\_units == \textcolor{stringliteral}{'m'}) \textcolor{keywordflow}{then}
65     dblen=dblen*1.e3
66 \textcolor{keywordflow}{  endif}
67 
68   \textcolor{keywordflow}{if} (dbrotate) \textcolor{keywordflow}{then}
69     \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
70       \textcolor{comment}{! Compute normalized zonal coordinates (x,y=0 at center of domain)}
71       x = ( g%geoLonT(i,j) ) / g%len\_lon
72       y = ( g%geoLatT(i,j)  ) / dblen
73       d(i,j) = g%max\_depth
74       \textcolor{keywordflow}{if} ((y>=-0.25 .and. y<=0.25) .and. (x <= -0.5*dbfrac .or. x >= 0.5*dbfrac)) \textcolor{keywordflow}{then}
75         d(i,j) = 0.0
76 \textcolor{keywordflow}{      endif}
77 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
78   \textcolor{keywordflow}{else}
79     \textcolor{keywordflow}{do} j=g%jsc,g%jec ; \textcolor{keywordflow}{do} i=g%isc,g%iec
80       \textcolor{comment}{! Compute normalized zonal coordinates (x,y=0 at center of domain)}
81       x = ( g%geoLonT(i,j) ) / dblen
82       y = ( g%geoLatT(i,j)  ) / g%len\_lat
83       d(i,j) = g%max\_depth
84       \textcolor{keywordflow}{if} ((x>=-0.25 .and. x<=0.25) .and. (y <= -0.5*dbfrac .or. y >= 0.5*dbfrac)) \textcolor{keywordflow}{then}
85         d(i,j) = 0.0
86 \textcolor{keywordflow}{      endif}
87 \textcolor{keywordflow}{    enddo} ;\textcolor{keywordflow}{ enddo}
88 \textcolor{keywordflow}{  endif}
89 
\end{DoxyCode}
