\hypertarget{namespacebaroclinic__zone__initialization}{}\section{baroclinic\+\_\+zone\+\_\+initialization Module Reference}
\label{namespacebaroclinic__zone__initialization}\index{baroclinic\+\_\+zone\+\_\+initialization@{baroclinic\+\_\+zone\+\_\+initialization}}


\subsection{Detailed Description}
Initial conditions for an idealized baroclinic zone. 

\hypertarget{namespacebaroclinic__zone__initialization_section_baroclinic_zone}{}\subsection{Description of the baroclinic zone initial conditions}\label{namespacebaroclinic__zone__initialization_section_baroclinic_zone}
yada yada yada \subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{namespacebaroclinic__zone__initialization_ae61a49364522c0a98058b170932974dc}{bcz\+\_\+params}} (G, GV, US, param\+\_\+file, S\+\_\+ref, d\+Sdz, delta\+\_\+S, d\+Sdx, T\+\_\+ref, d\+Tdz, delta\+\_\+T, d\+Tdx, L\+\_\+zone, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Reads the parameters unique to this module. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacebaroclinic__zone__initialization_a00eea273e33b70e67bc8df9a5e2b8793}{baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity}} (T, S, h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialization of temperature and salinity with the baroclinic zone initial conditions. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacebaroclinic__zone__initialization_a28cab2b958411c14f4ae24bc83f8faee}\label{namespacebaroclinic__zone__initialization_a28cab2b958411c14f4ae24bc83f8faee}} 
character(len=40) \mbox{\hyperlink{namespacebaroclinic__zone__initialization_a28cab2b958411c14f4ae24bc83f8faee}{mdl}} = \char`\"{}baroclinic\+\_\+zone\+\_\+initialization\char`\"{}
\begin{DoxyCompactList}\small\item\em This module\textquotesingle{}s name. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacebaroclinic__zone__initialization_a00eea273e33b70e67bc8df9a5e2b8793}\label{namespacebaroclinic__zone__initialization_a00eea273e33b70e67bc8df9a5e2b8793}} 
\index{baroclinic\+\_\+zone\+\_\+initialization@{baroclinic\+\_\+zone\+\_\+initialization}!baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity@{baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity}}
\index{baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity@{baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity}!baroclinic\+\_\+zone\+\_\+initialization@{baroclinic\+\_\+zone\+\_\+initialization}}
\subsubsection{\texorpdfstring{baroclinic\+\_\+zone\+\_\+init\+\_\+temperature\+\_\+salinity()}{baroclinic\_zone\_init\_temperature\_salinity()}}
{\footnotesize\ttfamily subroutine, public baroclinic\+\_\+zone\+\_\+initialization\+::baroclinic\+\_\+zone\+\_\+init\+\_\+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(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 temperature and salinity with the baroclinic zone initial conditions. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & 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 t} & Potential temperature \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt out}  & {\em s} & Salinity \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt in}  & {\em h} & The model thicknesses \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}\\
\hline
\mbox{\tt in}  & {\em param\+\_\+file} & Parameter file handle\\
\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 80 of file baroclinic\+\_\+zone\+\_\+initialization.\+F90.


\begin{DoxyCode}
80   \textcolor{keywordtype}{type}(ocean\_grid\_type),                     \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< Grid structure}
81   \textcolor{keywordtype}{type}(verticalGrid\_type),                   \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< The ocean's vertical grid structure.}
82   \textcolor{keywordtype}{type}(unit\_scale\_type),                     \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}
83   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: T\textcolor{comment}{  !< Potential temperature [degC]}
84   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(out)} :: S\textcolor{comment}{  !< Salinity [ppt]}
85   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G), SZK\_(G))}, \textcolor{keywordtype}{intent(in)}  :: h\textcolor{comment}{  !< The model thicknesses [H ~> m or kg m-2]}
86   \textcolor{keywordtype}{type}(param\_file\_type),                     \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{  !< Parameter file handle}
87   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
88 \textcolor{comment}{                                                      !! only read parameters without changing T & S.}
89 
90   \textcolor{keywordtype}{integer}   :: i, j, k, is, ie, js, je, nz
91   \textcolor{keywordtype}{real}      :: T\_ref, dTdz, dTdx, delta\_T \textcolor{comment}{! Parameters describing temperature distribution}
92   \textcolor{keywordtype}{real}      :: S\_ref, dSdz, dSdx, delta\_S \textcolor{comment}{! Parameters describing salinity distribution}
93   \textcolor{keywordtype}{real}      :: L\_zone \textcolor{comment}{! Width of baroclinic zone in [G%axis\_units]}
94   \textcolor{keywordtype}{real}      :: zc, zi \textcolor{comment}{! Depths in depth units [Z ~> m]}
95   \textcolor{keywordtype}{real}      :: x, xd, xs, y, yd, fn
96   \textcolor{keywordtype}{real}      :: PI                   \textcolor{comment}{! 3.1415926... calculated as 4*atan(1)}
97   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
98 
99   is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
100   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
101 
102   \textcolor{keyword}{call }bcz\_params(g, gv, us, param\_file, s\_ref, dsdz, delta\_s, dsdx, t\_ref, dtdz, &
103                   delta\_t, dtdx, l\_zone, just\_read\_params)
104 
105   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-time parameters have been read, so return.}
106 
107   t(:,:,:) = 0.
108   s(:,:,:) = 0.
109   pi = 4.*atan(1.)
110 
111   \textcolor{keywordflow}{do} j = g%jsc,g%jec ; \textcolor{keywordflow}{do} i = g%isc,g%iec
112     zi = -g%bathyT(i,j)
113     x = g%geoLonT(i,j) - (g%west\_lon + 0.5*g%len\_lon) \textcolor{comment}{! Relative to center of domain}
114     xd = x / g%len\_lon \textcolor{comment}{! -1/2 < xd 1/2}
115     y = g%geoLatT(i,j) - (g%south\_lat + 0.5*g%len\_lat) \textcolor{comment}{! Relative to center of domain}
116     yd = y / g%len\_lat \textcolor{comment}{! -1/2 < yd 1/2}
117     \textcolor{keywordflow}{if} (l\_zone/=0.) \textcolor{keywordflow}{then}
118       xs = min(1., max(-1., x/l\_zone)) \textcolor{comment}{! -1 < ys < 1}
119       fn = sin((0.5*pi)*xs)
120     \textcolor{keywordflow}{else}
121       xs = sign(1., x) \textcolor{comment}{! +/- 1}
122       fn = xs
123 \textcolor{keywordflow}{    endif}
124     \textcolor{keywordflow}{do} k = nz, 1, -1
125       zc = zi + 0.5*h(i,j,k)*gv%H\_to\_Z \textcolor{comment}{! Position of middle of cell}
126       zi = zi + h(i,j,k)*gv%H\_to\_Z    \textcolor{comment}{! Top interface position}
127       t(i,j,k) = t\_ref + dtdz * zc  & \textcolor{comment}{! Linear temperature stratification}
128                  + dtdx * x         & \textcolor{comment}{! Linear gradient}
129                  + delta\_t * fn       \textcolor{comment}{! Smooth fn of width L\_zone}
130       s(i,j,k) = s\_ref + dsdz * zc  & \textcolor{comment}{! Linear temperature stratification}
131                  + dsdx * x         & \textcolor{comment}{! Linear gradient}
132                  + delta\_s * fn       \textcolor{comment}{! Smooth fn of width L\_zone}
133 \textcolor{keywordflow}{    enddo}
134 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
135 
\end{DoxyCode}
\mbox{\Hypertarget{namespacebaroclinic__zone__initialization_ae61a49364522c0a98058b170932974dc}\label{namespacebaroclinic__zone__initialization_ae61a49364522c0a98058b170932974dc}} 
\index{baroclinic\+\_\+zone\+\_\+initialization@{baroclinic\+\_\+zone\+\_\+initialization}!bcz\+\_\+params@{bcz\+\_\+params}}
\index{bcz\+\_\+params@{bcz\+\_\+params}!baroclinic\+\_\+zone\+\_\+initialization@{baroclinic\+\_\+zone\+\_\+initialization}}
\subsubsection{\texorpdfstring{bcz\+\_\+params()}{bcz\_params()}}
{\footnotesize\ttfamily subroutine baroclinic\+\_\+zone\+\_\+initialization\+::bcz\+\_\+params (\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(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{real, intent(out)}]{S\+\_\+ref,  }\item[{real, intent(out)}]{d\+Sdz,  }\item[{real, intent(out)}]{delta\+\_\+S,  }\item[{real, intent(out)}]{d\+Sdx,  }\item[{real, intent(out)}]{T\+\_\+ref,  }\item[{real, intent(out)}]{d\+Tdz,  }\item[{real, intent(out)}]{delta\+\_\+T,  }\item[{real, intent(out)}]{d\+Tdx,  }\item[{real, intent(out)}]{L\+\_\+zone,  }\item[{logical, intent(in), optional}]{just\+\_\+read\+\_\+params }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Reads the parameters unique to this module. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em g} & 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 in}  & {\em param\+\_\+file} & Parameter file handle\\
\hline
\mbox{\tt out}  & {\em s\+\_\+ref} & Reference salinity \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt out}  & {\em dsdz} & Salinity stratification \mbox{[}ppt Z-\/1 $\sim$$>$ ppt m-\/1\mbox{]}\\
\hline
\mbox{\tt out}  & {\em delta\+\_\+s} & Salinity difference across baroclinic zone \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt out}  & {\em dsdx} & Linear salinity gradient \mbox{[}ppt m-\/1\mbox{]}\\
\hline
\mbox{\tt out}  & {\em t\+\_\+ref} & Reference temperature \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt out}  & {\em dtdz} & Temperature stratification \mbox{[}degC Z-\/1 $\sim$$>$ degC m-\/1\mbox{]}\\
\hline
\mbox{\tt out}  & {\em delta\+\_\+t} & Temperature difference across baroclinic zone \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt out}  & {\em dtdx} & Linear temperature gradient in \mbox{[}degC Gx\+\_\+axis\+\_\+units-\/1\mbox{]}\\
\hline
\mbox{\tt out}  & {\em l\+\_\+zone} & Width of baroclinic zone in \mbox{[}Gx\+\_\+axis\+\_\+units\mbox{]}\\
\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 32 of file baroclinic\+\_\+zone\+\_\+initialization.\+F90.


\begin{DoxyCode}
32   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{          !< Grid structure}
33   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}
34   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{    !< A dimensional unit scaling type}
35   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file handle}
36   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: S\_ref\textcolor{comment}{      !< Reference salinity [ppt]}
37   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: dSdz\textcolor{comment}{       !< Salinity stratification [ppt Z-1 ~> ppt m-1]}
38   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: delta\_S\textcolor{comment}{    !< Salinity difference across baroclinic zone [ppt]}
39   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: dSdx\textcolor{comment}{       !< Linear salinity gradient [ppt m-1]}
40   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: T\_ref\textcolor{comment}{      !< Reference temperature [degC]}
41   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: dTdz\textcolor{comment}{       !< Temperature stratification [degC Z-1 ~> degC m-1]}
42   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: delta\_T\textcolor{comment}{    !< Temperature difference across baroclinic zone
       [degC]}
43   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: dTdx\textcolor{comment}{       !< Linear temperature gradient in [degC
       G%x\_axis\_units-1]}
44   \textcolor{keywordtype}{real},                    \textcolor{keywordtype}{intent(out)} :: L\_zone\textcolor{comment}{     !< Width of baroclinic zone in [G%x\_axis\_units]}
45   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}
46 \textcolor{comment}{                                                     !! only read parameters without changing h.}
47 
48   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}
49 
50   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params
51 
52   \textcolor{keywordflow}{if} (.not.just\_read) &
53     \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{'Initialization of an analytic baroclinic zone'})
54   \textcolor{keyword}{call }openparameterblock(param\_file,\textcolor{stringliteral}{'BCZIC'})
55   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"S\_REF"}, s\_ref, \textcolor{stringliteral}{'Reference salinity'}, units=\textcolor{stringliteral}{'ppt'}, &
56                  default=35., do\_not\_log=just\_read)
57   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DSDZ"}, dsdz, \textcolor{stringliteral}{'Salinity stratification'}, &
58                  units=\textcolor{stringliteral}{'ppt/m'}, default=0.0, scale=us%Z\_to\_m, do\_not\_log=just\_read)
59   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DELTA\_S"},delta\_s,\textcolor{stringliteral}{'Salinity difference across baroclinic zone'}, &
60                  units=\textcolor{stringliteral}{'ppt'}, default=0.0, do\_not\_log=just\_read)
61   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DSDX"},dsdx,\textcolor{stringliteral}{'Meridional salinity difference'}, &
62                  units=\textcolor{stringliteral}{'ppt/'}//trim(g%x\_axis\_units), default=0.0, do\_not\_log=just\_read)
63   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"T\_REF"},t\_ref,\textcolor{stringliteral}{'Reference temperature'},units=\textcolor{stringliteral}{'C'}, &
64                  default=10., do\_not\_log=just\_read)
65   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DTDZ"}, dtdz, \textcolor{stringliteral}{'Temperature stratification'}, &
66                  units=\textcolor{stringliteral}{'C/m'}, default=0.0, scale=us%Z\_to\_m, do\_not\_log=just\_read)
67   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DELTA\_T"},delta\_t,\textcolor{stringliteral}{'Temperature difference across baroclinic zone'}, &
68                  units=\textcolor{stringliteral}{'C'}, default=0.0, do\_not\_log=just\_read)
69   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"DTDX"},dtdx,\textcolor{stringliteral}{'Meridional temperature difference'}, &
70                  units=\textcolor{stringliteral}{'C/'}//trim(g%x\_axis\_units), default=0.0, do\_not\_log=just\_read)
71   \textcolor{keyword}{call }get\_param(param\_file, mdl,\textcolor{stringliteral}{"L\_ZONE"},l\_zone,\textcolor{stringliteral}{'Width of baroclinic zone'}, &
72                  units=g%x\_axis\_units, default=0.5*g%len\_lat, do\_not\_log=just\_read)
73   \textcolor{keyword}{call }closeparameterblock(param\_file)
74 
\end{DoxyCode}
