\hypertarget{namespacephillips__initialization}{}\doxysection{phillips\+\_\+initialization Module Reference}
\label{namespacephillips__initialization}\index{phillips\_initialization@{phillips\_initialization}}


\doxysubsection{Detailed Description}
Initialization for the \char`\"{}\+Phillips\char`\"{} channel configuration. 

By Robert Hallberg, April 1994 -\/ June 2002

This subroutine initializes the fields for the simulations. The one argument passed to initialize, Time, is set to the current time of the simulation. The fields which are initialized here are\+: u -\/ Zonal velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. v -\/ Meridional velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]}. h -\/ Layer thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} (must be positive) D -\/ Basin depth \mbox{[}Z $\sim$$>$ m\mbox{]} (positive downward) f -\/ The Coriolis parameter \mbox{[}T-\/1 $\sim$$>$ s-\/1\mbox{]}. If E\+N\+A\+B\+L\+E\+\_\+\+T\+H\+E\+R\+M\+O\+D\+Y\+N\+A\+M\+I\+CS is defined\+: T -\/ Temperature \mbox{[}degC\mbox{]}. S -\/ Salinity \mbox{[}ppt\mbox{]}. If S\+P\+O\+N\+GE is defined\+: A series of subroutine calls are made to set up the damping rates and reference profiles for all variables that are damped in the sponge. Any user provided tracer code is also first linked through this subroutine.

Forcing-\/related fields (taux, tauy, buoy, ustar, etc.) are set in \mbox{\hyperlink{MOM__surface__forcing_8F90_source}{M\+O\+M\+\_\+surface\+\_\+forcing.\+F90}}.

These variables are all set in the set of subroutines (in this file) Phillips\+\_\+initialize\+\_\+thickness, Phillips\+\_\+initialize\+\_\+velocity, Phillips\+\_\+initialize\+\_\+topography and Phillips\+\_\+initialize\+\_\+sponges that seet up fields that are specific to the Phillips instability test case. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacephillips__initialization_a9b205a2cb366a24e22b6b3c84e5e3302}{phillips\+\_\+initialize\+\_\+thickness}} (h, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialize the thickness field for the Phillips model test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacephillips__initialization_a328589bb31bd695e9d1a0ed906f0f808}{phillips\+\_\+initialize\+\_\+velocity}} (u, v, G, GV, US, param\+\_\+file, just\+\_\+read\+\_\+params)
\begin{DoxyCompactList}\small\item\em Initialize the velocity fields for the Phillips model test case. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacephillips__initialization_ac1b07586a1ded5ee253cba3c67d0249a}{phillips\+\_\+initialize\+\_\+sponges}} (G, GV, US, tv, param\+\_\+file, C\+Sp, h)
\begin{DoxyCompactList}\small\item\em Sets up the the inverse restoration time (Idamp), and the values towards which the interface heights and an arbitrary number of tracers should be restored within each sponge for the Phillips model test case. \end{DoxyCompactList}\item 
real function \mbox{\hyperlink{namespacephillips__initialization_a88d1be48e4a24bdcefce251a16a0ea10}{sech}} (x)
\begin{DoxyCompactList}\small\item\em sech calculates the hyperbolic secant. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacephillips__initialization_a99b5e25a77486b3004be63895ab57b73}{phillips\+\_\+initialize\+\_\+topography}} (D, G, param\+\_\+file, max\+\_\+depth, US)
\begin{DoxyCompactList}\small\item\em Initialize topography. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacephillips__initialization_ac1b07586a1ded5ee253cba3c67d0249a}\label{namespacephillips__initialization_ac1b07586a1ded5ee253cba3c67d0249a}} 
\index{phillips\_initialization@{phillips\_initialization}!phillips\_initialize\_sponges@{phillips\_initialize\_sponges}}
\index{phillips\_initialize\_sponges@{phillips\_initialize\_sponges}!phillips\_initialization@{phillips\_initialization}}
\doxysubsubsection{\texorpdfstring{phillips\_initialize\_sponges()}{phillips\_initialize\_sponges()}}
{\footnotesize\ttfamily subroutine, public phillips\+\_\+initialization\+::phillips\+\_\+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[{type(sponge\+\_\+cs), pointer}]{C\+Sp,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsd\+: g \%jed, gv \%ke), intent(in)}]{h }\end{DoxyParamCaption})}



Sets up the the inverse restoration time (Idamp), and the values towards which the interface heights and an arbitrary number of tracers should be restored within each sponge for the Phillips model test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & The ocean\textquotesingle{}s grid structure. \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em tv} & A structure containing pointers to any available thermodynamic fields, potential temperature and salinity or mixed layer density. Absent fields have N\+U\+LL ptrs. \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure indicating the open file to parse for model parameter values. \\
\hline
 & {\em csp} & A pointer that is set to point to the control structure for the sponge module. \\
\hline
\mbox{\texttt{ in}}  & {\em h} & Thickness field \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 202 of file Phillips\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{202   \textcolor{keywordtype}{type}(ocean\_grid\_type), \textcolor{keywordtype}{intent(in)} :: G\textcolor{comment}{    !< The ocean's grid structure.}}
\DoxyCodeLine{203   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)} :: GV\textcolor{comment}{ !< Vertical grid structure}}
\DoxyCodeLine{204   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{   !< A dimensional unit scaling type}}
\DoxyCodeLine{205   \textcolor{keywordtype}{type}(thermo\_var\_ptrs), \textcolor{keywordtype}{intent(in)} :: tv\textcolor{comment}{   !< A structure containing pointers}}
\DoxyCodeLine{206 \textcolor{comment}{                                            !! to any available thermodynamic}}
\DoxyCodeLine{207 \textcolor{comment}{                                            !! fields, potential temperature and}}
\DoxyCodeLine{208 \textcolor{comment}{                                            !! salinity or mixed layer density.}}
\DoxyCodeLine{209 \textcolor{comment}{                                            !! Absent fields have NULL ptrs.}}
\DoxyCodeLine{210   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< A structure indicating the}}
\DoxyCodeLine{211 \textcolor{comment}{                                            !! open file to parse for model}}
\DoxyCodeLine{212 \textcolor{comment}{                                            !! parameter values.}}
\DoxyCodeLine{213   \textcolor{keywordtype}{type}(sponge\_CS),   \textcolor{keywordtype}{pointer}    :: CSp\textcolor{comment}{      !< A pointer that is set to point to}}
\DoxyCodeLine{214 \textcolor{comment}{                                            !! the control structure for the}}
\DoxyCodeLine{215 \textcolor{comment}{                                            !! sponge module.}}
\DoxyCodeLine{216 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))} :: h\textcolor{comment}{ !< Thickness field [H ~> m or kg m-\/2].}}
\DoxyCodeLine{217 }
\DoxyCodeLine{218   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{219 \textcolor{keywordtype}{  real} :: eta0(SZK\_(G)+1)   \textcolor{comment}{! The 1-\/d nominal positions of the interfaces.}}
\DoxyCodeLine{220 \textcolor{keywordtype}{  real} :: eta(SZI\_(G),SZJ\_(G),SZK\_(G)+1) \textcolor{comment}{! A temporary array for eta [Z ~> m].}}
\DoxyCodeLine{221 \textcolor{keywordtype}{  real} :: temp(SZI\_(G),SZJ\_(G),SZK\_(G))  \textcolor{comment}{! A temporary array for other variables.}}
\DoxyCodeLine{222 \textcolor{keywordtype}{  real} :: Idamp(SZI\_(G),SZJ\_(G))    \textcolor{comment}{! The inverse damping rate [T-\/1 ~> s-\/1].}}
\DoxyCodeLine{223 \textcolor{keywordtype}{  real} :: eta\_im(SZJ\_(G),SZK\_(G)+1) \textcolor{comment}{! A temporary array for zonal-\/mean eta [Z ~> m].}}
\DoxyCodeLine{224 \textcolor{keywordtype}{  real} :: Idamp\_im(SZJ\_(G))         \textcolor{comment}{! The inverse zonal-\/mean damping rate [T-\/1 ~> s-\/1].}}
\DoxyCodeLine{225 \textcolor{keywordtype}{  real} :: damp\_rate    \textcolor{comment}{! The inverse zonal-\/mean damping rate [T-\/1 ~> s-\/1].}}
\DoxyCodeLine{226 \textcolor{keywordtype}{  real} :: jet\_width    \textcolor{comment}{! The width of the zonal mean jet, in km.}}
\DoxyCodeLine{227 \textcolor{keywordtype}{  real} :: jet\_height   \textcolor{comment}{! The interface height scale associated with the zonal-\/mean jet [Z ~> m].}}
\DoxyCodeLine{228 \textcolor{keywordtype}{  real} :: y\_2          \textcolor{comment}{! The y-\/position relative to the channel center, in km.}}
\DoxyCodeLine{229 \textcolor{keywordtype}{  real} :: half\_strat   \textcolor{comment}{! The fractional depth where the straficiation is centered [nondim].}}
\DoxyCodeLine{230 \textcolor{keywordtype}{  real} :: half\_depth   \textcolor{comment}{! The depth where the stratification is centered [Z ~> m].}}
\DoxyCodeLine{231   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"Phillips\_initialize\_sponges"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{232 }
\DoxyCodeLine{233   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{234   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{save} :: first\_call = .true.}
\DoxyCodeLine{235 }
\DoxyCodeLine{236   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{237   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{238 }
\DoxyCodeLine{239   eta(:,:,:) = 0.0 ; temp(:,:,:) = 0.0 ; idamp(:,:) = 0.0}
\DoxyCodeLine{240   eta\_im(:,:) = 0.0 ; idamp\_im(:) = 0.0}
\DoxyCodeLine{241 }
\DoxyCodeLine{242   \textcolor{keywordflow}{if} (first\_call) \textcolor{keyword}{call }log\_version(param\_file, mdl, version)}
\DoxyCodeLine{243   first\_call = .false.}
\DoxyCodeLine{244   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"HALF\_STRAT\_DEPTH"}, half\_strat, \&}
\DoxyCodeLine{245                  \textcolor{stringliteral}{"The fractional depth where the stratificaiton is centered."}, \&}
\DoxyCodeLine{246                  units=\textcolor{stringliteral}{"nondim"}, default = 0.5)}
\DoxyCodeLine{247   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"SPONGE\_RATE"}, damp\_rate, \&}
\DoxyCodeLine{248                  \textcolor{stringliteral}{"The rate at which the zonal-\/mean sponges damp."}, units=\textcolor{stringliteral}{"s-\/1"}, \&}
\DoxyCodeLine{249                  default = 1.0/(10.0*86400.0), scale=us\%T\_to\_s)}
\DoxyCodeLine{250 }
\DoxyCodeLine{251   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_WIDTH"}, jet\_width, \&}
\DoxyCodeLine{252                  \textcolor{stringliteral}{"The width of the zonal-\/mean jet."}, units=\textcolor{stringliteral}{"km"}, \&}
\DoxyCodeLine{253                  fail\_if\_missing=.true.)}
\DoxyCodeLine{254   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_HEIGHT"}, jet\_height, \&}
\DoxyCodeLine{255                  \textcolor{stringliteral}{"The interface height scale associated with the "}//\&}
\DoxyCodeLine{256                  \textcolor{stringliteral}{"zonal-\/mean jet."}, units=\textcolor{stringliteral}{"m"}, scale=us\%m\_to\_Z, \&}
\DoxyCodeLine{257                  fail\_if\_missing=.true.)}
\DoxyCodeLine{258 }
\DoxyCodeLine{259   half\_depth = g\%max\_depth*half\_strat}
\DoxyCodeLine{260   eta0(1) = 0.0 ; eta0(nz+1) = -\/g\%max\_depth}
\DoxyCodeLine{261   \textcolor{keywordflow}{do} k=2,1+nz/2 ; eta0(k) = -\/half\_depth*(2.0*(k-\/1)/real(nz)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{262   \textcolor{keywordflow}{do} k=2+nz/2,nz+1}
\DoxyCodeLine{263     eta0(k) = -\/g\%max\_depth -\/ 2.0*(g\%max\_depth-\/half\_depth) * ((k-\/(nz+1))/real(nz))}
\DoxyCodeLine{264 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{265 }
\DoxyCodeLine{266   \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{267     idamp\_im(j) = damp\_rate}
\DoxyCodeLine{268     eta\_im(j,1) = 0.0 ; eta\_im(j,nz+1) = -\/g\%max\_depth}
\DoxyCodeLine{269 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{270   \textcolor{keywordflow}{do} k=2,nz ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{271     y\_2 = g\%geoLatT(is,j) -\/ g\%south\_lat -\/ 0.5*g\%len\_lat}
\DoxyCodeLine{272     eta\_im(j,k) = eta0(k) + jet\_height * tanh(y\_2 / jet\_width)}
\DoxyCodeLine{273 \textcolor{comment}{!         jet\_height * atan(y\_2 / jet\_width)}}
\DoxyCodeLine{274     \textcolor{keywordflow}{if} (eta\_im(j,k) > 0.0) eta\_im(j,k) = 0.0}
\DoxyCodeLine{275     \textcolor{keywordflow}{if} (eta\_im(j,k) < -\/g\%max\_depth) eta\_im(j,k) = -\/g\%max\_depth}
\DoxyCodeLine{276 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{277 }
\DoxyCodeLine{278   \textcolor{keyword}{call }initialize\_sponge(idamp, eta, g, param\_file, csp, gv, idamp\_im, eta\_im)}
\DoxyCodeLine{279 }

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



Initialize the thickness field for the Phillips model test case. 


\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 39 of file Phillips\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{39   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{          !< The ocean's grid structure.}}
\DoxyCodeLine{40   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{         !< The ocean's vertical grid structure.}}
\DoxyCodeLine{41   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{         !< A dimensional unit scaling type}}
\DoxyCodeLine{42 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{43                            \textcolor{keywordtype}{intent(out)} :: h\textcolor{comment}{          !< The thickness that is being initialized [H ~> m or kg m-\/2]}}
\DoxyCodeLine{44   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure indicating the open file}}
\DoxyCodeLine{45 \textcolor{comment}{                                                     !! to parse for model parameter values.}}
\DoxyCodeLine{46   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{47 \textcolor{comment}{                                                     !! only read parameters without changing h.}}
\DoxyCodeLine{48 }
\DoxyCodeLine{49 \textcolor{keywordtype}{  real} :: eta0(SZK\_(G)+1)   \textcolor{comment}{! The 1-\/d nominal positions of the interfaces [Z ~> m]}}
\DoxyCodeLine{50 \textcolor{keywordtype}{  real} :: eta\_im(SZJ\_(G),SZK\_(G)+1) \textcolor{comment}{! A temporary array for zonal-\/mean eta [Z ~> m]}}
\DoxyCodeLine{51 \textcolor{keywordtype}{  real} :: eta1D(SZK\_(G)+1)  \textcolor{comment}{! Interface height relative to the sea surface, positive upward [Z ~> m]}}
\DoxyCodeLine{52 \textcolor{keywordtype}{  real} :: jet\_width         \textcolor{comment}{! The width of the zonal-\/mean jet [km]}}
\DoxyCodeLine{53 \textcolor{keywordtype}{  real} :: jet\_height        \textcolor{comment}{! The interface height scale associated with the zonal-\/mean jet [Z ~> m]}}
\DoxyCodeLine{54 \textcolor{keywordtype}{  real} :: y\_2             \textcolor{comment}{! The y-\/position relative to the center of the domain [km]}}
\DoxyCodeLine{55 \textcolor{keywordtype}{  real} :: half\_strat      \textcolor{comment}{! The fractional depth where the stratification is centered [nondim]}}
\DoxyCodeLine{56 \textcolor{keywordtype}{  real} :: half\_depth      \textcolor{comment}{! The depth where the stratification is centered [Z ~> m]}}
\DoxyCodeLine{57   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{58   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"Phillips\_initialize\_thickness"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{59   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, isd, ied, jsd, jed, nz}
\DoxyCodeLine{60 }
\DoxyCodeLine{61   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{62   isd = g\%isd ; ied = g\%ied ; jsd = g\%jsd ; jed = g\%jed}
\DoxyCodeLine{63 }
\DoxyCodeLine{64   eta\_im(:,:) = 0.0}
\DoxyCodeLine{65 }
\DoxyCodeLine{66   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{67 }
\DoxyCodeLine{68   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version)}
\DoxyCodeLine{69   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"HALF\_STRAT\_DEPTH"}, half\_strat, \&}
\DoxyCodeLine{70                  \textcolor{stringliteral}{"The fractional depth where the stratification is centered."}, \&}
\DoxyCodeLine{71                  units=\textcolor{stringliteral}{"nondim"}, default = 0.5, do\_not\_log=just\_read)}
\DoxyCodeLine{72   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_WIDTH"}, jet\_width, \&}
\DoxyCodeLine{73                  \textcolor{stringliteral}{"The width of the zonal-\/mean jet."}, units=\textcolor{stringliteral}{"km"}, \&}
\DoxyCodeLine{74                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{75   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_HEIGHT"}, jet\_height, \&}
\DoxyCodeLine{76                  \textcolor{stringliteral}{"The interface height scale associated with the "}//\&}
\DoxyCodeLine{77                  \textcolor{stringliteral}{"zonal-\/mean jet."}, units=\textcolor{stringliteral}{"m"}, scale=us\%m\_to\_Z, \&}
\DoxyCodeLine{78                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{79 }
\DoxyCodeLine{80   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{81 }
\DoxyCodeLine{82   half\_depth = g\%max\_depth*half\_strat}
\DoxyCodeLine{83   eta0(1) = 0.0 ; eta0(nz+1) = -\/g\%max\_depth}
\DoxyCodeLine{84   \textcolor{keywordflow}{do} k=2,1+nz/2 ; eta0(k) = -\/half\_depth*(2.0*(k-\/1)/real(nz)) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{85   \textcolor{keywordflow}{do} k=2+nz/2,nz+1}
\DoxyCodeLine{86     eta0(k) = -\/g\%max\_depth -\/ 2.0*(g\%max\_depth-\/half\_depth) * ((k-\/(nz+1))/real(nz))}
\DoxyCodeLine{87 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{88 }
\DoxyCodeLine{89   \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{90     eta\_im(j,1) = 0.0 ; eta\_im(j,nz+1) = -\/g\%max\_depth}
\DoxyCodeLine{91 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{92   \textcolor{keywordflow}{do} k=2,nz ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{93     y\_2 = g\%geoLatT(is,j) -\/ g\%south\_lat -\/ 0.5*g\%len\_lat}
\DoxyCodeLine{94     eta\_im(j,k) = eta0(k) + jet\_height * tanh(y\_2 / jet\_width)}
\DoxyCodeLine{95                 \textcolor{comment}{! or  ... + jet\_height * atan(y\_2 / jet\_width)}}
\DoxyCodeLine{96     \textcolor{keywordflow}{if} (eta\_im(j,k) > 0.0) eta\_im(j,k) = 0.0}
\DoxyCodeLine{97     \textcolor{keywordflow}{if} (eta\_im(j,k) < -\/g\%max\_depth) eta\_im(j,k) = -\/g\%max\_depth}
\DoxyCodeLine{98 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{99 }
\DoxyCodeLine{100   \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{101     \textcolor{comment}{!   This sets the initial thickness in [H ~> m or kg m-\/2] of the layers.  The}}
\DoxyCodeLine{102     \textcolor{comment}{! thicknesses are set to insure that: 1. each layer is at least an Angstrom thick, and}}
\DoxyCodeLine{103     \textcolor{comment}{! 2. the interfaces are where they should be based on the resting depths and interface}}
\DoxyCodeLine{104     \textcolor{comment}{!    height perturbations, as long at this doesn't interfere with 1.}}
\DoxyCodeLine{105     eta1d(nz+1) = -\/g\%bathyT(i,j)}
\DoxyCodeLine{106     \textcolor{keywordflow}{do} k=nz,1,-\/1}
\DoxyCodeLine{107       eta1d(k) = eta\_im(j,k)}
\DoxyCodeLine{108       \textcolor{keywordflow}{if} (eta1d(k) < (eta1d(k+1) + gv\%Angstrom\_Z)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{109         eta1d(k) = eta1d(k+1) + gv\%Angstrom\_Z}
\DoxyCodeLine{110         h(i,j,k) = gv\%Angstrom\_H}
\DoxyCodeLine{111       \textcolor{keywordflow}{else}}
\DoxyCodeLine{112         h(i,j,k) = gv\%Z\_to\_H * (eta1d(k) -\/ eta1d(k+1))}
\DoxyCodeLine{113 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{114 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{115 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{116 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacephillips__initialization_a99b5e25a77486b3004be63895ab57b73}\label{namespacephillips__initialization_a99b5e25a77486b3004be63895ab57b73}} 
\index{phillips\_initialization@{phillips\_initialization}!phillips\_initialize\_topography@{phillips\_initialize\_topography}}
\index{phillips\_initialize\_topography@{phillips\_initialize\_topography}!phillips\_initialization@{phillips\_initialization}}
\doxysubsubsection{\texorpdfstring{phillips\_initialize\_topography()}{phillips\_initialize\_topography()}}
{\footnotesize\ttfamily subroutine, public phillips\+\_\+initialization\+::phillips\+\_\+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,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Initialize 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 m or Z if US is present \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
\mbox{\texttt{ in}}  & {\em max\+\_\+depth} & Maximum model depth in the units of D \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


Definition at line 297 of file Phillips\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{297   \textcolor{keywordtype}{type}(dyn\_horgrid\_type),          \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{ !< The dynamic horizontal grid type}}
\DoxyCodeLine{298 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(G\%isd:G\%ied,G\%jsd:G\%jed)}, \&}
\DoxyCodeLine{299                                    \textcolor{keywordtype}{intent(out)} :: D\textcolor{comment}{ !< Ocean bottom depth in m or Z if US is present}}
\DoxyCodeLine{300   \textcolor{keywordtype}{type}(param\_file\_type),           \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{301 \textcolor{keywordtype}{  real},                            \textcolor{keywordtype}{intent(in)}  :: max\_depth\textcolor{comment}{ !< Maximum model depth in the units of D}}
\DoxyCodeLine{302   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{303 }
\DoxyCodeLine{304   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{305 \textcolor{keywordtype}{  real} :: m\_to\_Z  \textcolor{comment}{! A dimensional rescaling factor.}}
\DoxyCodeLine{306 \textcolor{keywordtype}{  real} :: PI, Htop, Wtop, Ltop, offset, dist}
\DoxyCodeLine{307 \textcolor{keywordtype}{  real} :: x1, x2, x3, x4, y1, y2}
\DoxyCodeLine{308   \textcolor{keywordtype}{integer} :: i,j,is,ie,js,je}
\DoxyCodeLine{309   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"Phillips\_initialize\_topography"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{310 }
\DoxyCodeLine{311   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec}
\DoxyCodeLine{312 }
\DoxyCodeLine{313   pi = 4.0*atan(1.0)}
\DoxyCodeLine{314   m\_to\_z = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) m\_to\_z = us\%m\_to\_Z}
\DoxyCodeLine{315 }
\DoxyCodeLine{316   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"PHILLIPS\_HTOP"}, htop, \&}
\DoxyCodeLine{317                  \textcolor{stringliteral}{"The maximum height of the topography."}, units=\textcolor{stringliteral}{"m"}, scale=m\_to\_z, \&}
\DoxyCodeLine{318                  fail\_if\_missing=.true.)}
\DoxyCodeLine{319 \textcolor{comment}{! Htop=0.375*max\_depth     ! max height of topog. above max\_depth}}
\DoxyCodeLine{320   wtop = 0.5*g\%len\_lat     \textcolor{comment}{! meridional width of drake and mount}}
\DoxyCodeLine{321   ltop = 0.25*g\%len\_lon    \textcolor{comment}{! zonal width of topographic features}}
\DoxyCodeLine{322   offset = 0.1*g\%len\_lat   \textcolor{comment}{! meridional offset from center}}
\DoxyCodeLine{323   dist = 0.333*g\%len\_lon   \textcolor{comment}{! distance between drake and mount}}
\DoxyCodeLine{324                            \textcolor{comment}{! should be longer than Ltop/2}}
\DoxyCodeLine{325 }
\DoxyCodeLine{326   y1=g\%south\_lat+0.5*g\%len\_lat+offset-\/0.5*wtop; y2=y1+wtop}
\DoxyCodeLine{327   x1=g\%west\_lon+0.1*g\%len\_lon; x2=x1+ltop; x3=x1+dist; x4=x3+3.0/2.0*ltop}
\DoxyCodeLine{328 }
\DoxyCodeLine{329   \textcolor{keywordflow}{do} i=is,ie ; \textcolor{keywordflow}{do} j=js,je}
\DoxyCodeLine{330     d(i,j)=0.0}
\DoxyCodeLine{331     \textcolor{keywordflow}{if} (g\%geoLonT(i,j)>x1 .and. g\%geoLonT(i,j)<x2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{332       d(i,j) = htop*sin(pi*(g\%geoLonT(i,j)-\/x1)/(x2-\/x1))**2}
\DoxyCodeLine{333       \textcolor{keywordflow}{if} (g\%geoLatT(i,j)>y1 .and. g\%geoLatT(i,j)<y2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{334          d(i,j) = d(i,j)*(1-\/sin(pi*(g\%geoLatT(i,j)-\/y1)/(y2-\/y1))**2)}
\DoxyCodeLine{335 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{336     \textcolor{keywordflow}{elseif} (g\%geoLonT(i,j)>x3 .and. g\%geoLonT(i,j)<x4 .and. \&}
\DoxyCodeLine{337              g\%geoLatT(i,j)>y1 .and. g\%geoLatT(i,j)<y2) \textcolor{keywordflow}{then}}
\DoxyCodeLine{338       d(i,j) = 2.0/3.0*htop*sin(pi*(g\%geoLonT(i,j)-\/x3)/(x4-\/x3))**2 \&}
\DoxyCodeLine{339                    *sin(pi*(g\%geoLatT(i,j)-\/y1)/(y2-\/y1))**2}
\DoxyCodeLine{340 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{341     d(i,j) = max\_depth -\/ d(i,j)}
\DoxyCodeLine{342 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{343 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacephillips__initialization_a328589bb31bd695e9d1a0ed906f0f808}\label{namespacephillips__initialization_a328589bb31bd695e9d1a0ed906f0f808}} 
\index{phillips\_initialization@{phillips\_initialization}!phillips\_initialize\_velocity@{phillips\_initialize\_velocity}}
\index{phillips\_initialize\_velocity@{phillips\_initialize\_velocity}!phillips\_initialization@{phillips\_initialization}}
\doxysubsubsection{\texorpdfstring{phillips\_initialize\_velocity()}{phillips\_initialize\_velocity()}}
{\footnotesize\ttfamily subroutine, public phillips\+\_\+initialization\+::phillips\+\_\+initialize\+\_\+velocity (\begin{DoxyParamCaption}\item[{real, dimension( g \%isdb\+: g \%iedb, g \%jsd\+: g \%jed, gv \%ke), intent(out)}]{u,  }\item[{real, dimension( g \%isd\+: g \%ied, g \%jsdb\+: g \%jedb, gv \%ke), intent(out)}]{v,  }\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 the velocity fields for the Phillips model test case. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em g} & Grid structure \\
\hline
\mbox{\texttt{ in}}  & {\em gv} & Vertical grid structure \\
\hline
\mbox{\texttt{ out}}  & {\em u} & i-\/component of velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em v} & j-\/component of velocity \mbox{[}L T-\/1 $\sim$$>$ m s-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & A structure indicating the open file to parse for modelparameter 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 121 of file Phillips\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{121   \textcolor{keywordtype}{type}(ocean\_grid\_type),   \textcolor{keywordtype}{intent(in)}  :: G\textcolor{comment}{  !< Grid structure}}
\DoxyCodeLine{122   \textcolor{keywordtype}{type}(verticalGrid\_type), \textcolor{keywordtype}{intent(in)}  :: GV\textcolor{comment}{ !< Vertical grid structure}}
\DoxyCodeLine{123 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZIB\_(G),SZJ\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{124                            \textcolor{keywordtype}{intent(out)} :: u\textcolor{comment}{  !< i-\/component of velocity [L T-\/1 ~> m s-\/1]}}
\DoxyCodeLine{125 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(SZI\_(G),SZJB\_(G),SZK\_(GV))}, \&}
\DoxyCodeLine{126                            \textcolor{keywordtype}{intent(out)} :: v\textcolor{comment}{  !< j-\/component of velocity [L T-\/1 ~> m s-\/1]}}
\DoxyCodeLine{127   \textcolor{keywordtype}{type}(unit\_scale\_type),   \textcolor{keywordtype}{intent(in)}  :: US\textcolor{comment}{ !< A dimensional unit scaling type}}
\DoxyCodeLine{128   \textcolor{keywordtype}{type}(param\_file\_type),   \textcolor{keywordtype}{intent(in)}  :: param\_file\textcolor{comment}{ !< A structure indicating the open file to}}
\DoxyCodeLine{129 \textcolor{comment}{                                                     !! parse for modelparameter values.}}
\DoxyCodeLine{130   \textcolor{keywordtype}{logical},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: just\_read\_params\textcolor{comment}{ !< If present and true, this call will}}
\DoxyCodeLine{131 \textcolor{comment}{                                                     !! only read parameters without changing h.}}
\DoxyCodeLine{132 }
\DoxyCodeLine{133 \textcolor{keywordtype}{  real} :: jet\_width       \textcolor{comment}{! The width of the zonal-\/mean jet [km]}}
\DoxyCodeLine{134 \textcolor{keywordtype}{  real} :: jet\_height      \textcolor{comment}{! The interface height scale associated with the zonal-\/mean jet [Z ~> m]}}
\DoxyCodeLine{135 \textcolor{keywordtype}{  real} :: x\_2             \textcolor{comment}{! The x-\/position relative to the center of the domain [nondim]}}
\DoxyCodeLine{136 \textcolor{keywordtype}{  real} :: y\_2             \textcolor{comment}{! The y-\/position relative to the center of the domain [km] or [nondim]}}
\DoxyCodeLine{137 \textcolor{keywordtype}{  real} :: velocity\_amplitude \textcolor{comment}{! The amplitude of velocity perturbations [L T-\/1 ~> m s-\/1]}}
\DoxyCodeLine{138 \textcolor{keywordtype}{  real} :: pi              \textcolor{comment}{! The ratio of the circumference of a circle to its diameter [nondim]}}
\DoxyCodeLine{139   \textcolor{keywordtype}{integer} :: i, j, k, is, ie, js, je, nz, m}
\DoxyCodeLine{140   \textcolor{keywordtype}{logical} :: just\_read    \textcolor{comment}{! If true, just read parameters but set nothing.}}
\DoxyCodeLine{141   \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"Phillips\_initialize\_velocity"} \textcolor{comment}{! This subroutine's name.}}
\DoxyCodeLine{142   is = g\%isc ; ie = g\%iec ; js = g\%jsc ; je = g\%jec ; nz = g\%ke}
\DoxyCodeLine{143 }
\DoxyCodeLine{144   just\_read = .false. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(just\_read\_params)) just\_read = just\_read\_params}
\DoxyCodeLine{145 }
\DoxyCodeLine{146   \textcolor{keywordflow}{if} (.not.just\_read) \textcolor{keyword}{call }log\_version(param\_file, mdl, version)}
\DoxyCodeLine{147   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"VELOCITY\_IC\_PERTURB\_AMP"}, velocity\_amplitude, \&}
\DoxyCodeLine{148                  \textcolor{stringliteral}{"The magnitude of the initial velocity perturbation."}, \&}
\DoxyCodeLine{149                  units=\textcolor{stringliteral}{"m s-\/1"}, default=0.001, scale=us\%m\_s\_to\_L\_T, do\_not\_log=just\_read)}
\DoxyCodeLine{150   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_WIDTH"}, jet\_width, \&}
\DoxyCodeLine{151                  \textcolor{stringliteral}{"The width of the zonal-\/mean jet."}, units=\textcolor{stringliteral}{"km"}, \&}
\DoxyCodeLine{152                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{153   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"JET\_HEIGHT"}, jet\_height, \&}
\DoxyCodeLine{154                  \textcolor{stringliteral}{"The interface height scale associated with the "}//\&}
\DoxyCodeLine{155                  \textcolor{stringliteral}{"zonal-\/mean jet."}, units=\textcolor{stringliteral}{"m"}, scale=us\%m\_to\_Z, \&}
\DoxyCodeLine{156                  fail\_if\_missing=.not.just\_read, do\_not\_log=just\_read)}
\DoxyCodeLine{157 }
\DoxyCodeLine{158   \textcolor{keywordflow}{if} (just\_read) \textcolor{keywordflow}{return} \textcolor{comment}{! All run-\/time parameters have been read, so return.}}
\DoxyCodeLine{159 }
\DoxyCodeLine{160   u(:,:,:) = 0.0}
\DoxyCodeLine{161   v(:,:,:) = 0.0}
\DoxyCodeLine{162 }
\DoxyCodeLine{163   pi = 4.0*atan(1.0)}
\DoxyCodeLine{164 }
\DoxyCodeLine{165   \textcolor{comment}{! Use thermal wind shear to give a geostrophically balanced flow.}}
\DoxyCodeLine{166   \textcolor{keywordflow}{do} k=nz-\/1,1 ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{167     y\_2 = g\%geoLatCu(i,j) -\/ g\%south\_lat -\/ 0.5*g\%len\_lat}
\DoxyCodeLine{168 \textcolor{comment}{! This uses d/d y\_2 atan(y\_2 / jet\_width)}}
\DoxyCodeLine{169 \textcolor{comment}{!    u(I,j,k) = u(I,j,k+1) + ( jet\_height / \&}}
\DoxyCodeLine{170 \textcolor{comment}{!           (1.0e3*US\%m\_to\_L*jet\_width * (1.0 + (y\_2 / jet\_width)**2))) * \&}}
\DoxyCodeLine{171 \textcolor{comment}{!           (2.0 * GV\%g\_prime(K+1) / (G\%CoriolisBu(I,J) + G\%CoriolisBu(I,J-\/1)))}}
\DoxyCodeLine{172 \textcolor{comment}{! This uses d/d y\_2 tanh(y\_2 / jet\_width)}}
\DoxyCodeLine{173     u(i,j,k) = u(i,j,k+1) + (1e-\/3 * (jet\_height / (us\%m\_to\_L*jet\_width)) * \&}
\DoxyCodeLine{174            (sech(y\_2 / jet\_width))**2 ) * \&}
\DoxyCodeLine{175            (2.0 * gv\%g\_prime(k+1) / (g\%CoriolisBu(i,j) + g\%CoriolisBu(i,j-\/1)))}
\DoxyCodeLine{176 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{177 }
\DoxyCodeLine{178   \textcolor{keywordflow}{do} k=1,nz ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=is-\/1,ie}
\DoxyCodeLine{179     y\_2 = (g\%geoLatCu(i,j) -\/ g\%south\_lat -\/ 0.5*g\%len\_lat) / g\%len\_lat}
\DoxyCodeLine{180     x\_2 = (g\%geoLonCu(i,j) -\/ g\%west\_lon -\/ 0.5*g\%len\_lon) / g\%len\_lon}
\DoxyCodeLine{181     \textcolor{keywordflow}{if} (g\%geoLonCu(i,j) == g\%west\_lon) \textcolor{keywordflow}{then}}
\DoxyCodeLine{182       \textcolor{comment}{! This modification is required so that the perturbations are identical for}}
\DoxyCodeLine{183       \textcolor{comment}{! symmetric and non-\/symmetric memory.  It is exactly equivalent to}}
\DoxyCodeLine{184       \textcolor{comment}{! taking the longitude at the eastern edge of the domain, so that x\_2 ~= 0.5.}}
\DoxyCodeLine{185       x\_2 = ((g\%west\_lon + g\%len\_lon*real(g\%ieg-\/(g\%isg-\/1))/real(g\%Domain\%niglobal)) -\/ \&}
\DoxyCodeLine{186              g\%west\_lon -\/ 0.5*g\%len\_lon) / g\%len\_lon}
\DoxyCodeLine{187 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{188     u(i,j,k) = u(i,j,k) + velocity\_amplitude * ((real(k)-\/0.5)/real(nz)) * \&}
\DoxyCodeLine{189            (0.5 -\/ abs(2.0*x\_2) + 0.1*abs(cos(10.0*pi*x\_2)) -\/ abs(sin(5.0*pi*y\_2)))}
\DoxyCodeLine{190     \textcolor{keywordflow}{do} m=1,10}
\DoxyCodeLine{191       u(i,j,k) = u(i,j,k) + 0.2*velocity\_amplitude * ((real(k)-\/0.5)/real(nz)) * \&}
\DoxyCodeLine{192             cos(2.0*m*pi*x\_2 + 2*m) * cos(6.0*pi*y\_2)}
\DoxyCodeLine{193 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{194 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{195 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacephillips__initialization_a88d1be48e4a24bdcefce251a16a0ea10}\label{namespacephillips__initialization_a88d1be48e4a24bdcefce251a16a0ea10}} 
\index{phillips\_initialization@{phillips\_initialization}!sech@{sech}}
\index{sech@{sech}!phillips\_initialization@{phillips\_initialization}}
\doxysubsubsection{\texorpdfstring{sech()}{sech()}}
{\footnotesize\ttfamily real function phillips\+\_\+initialization\+::sech (\begin{DoxyParamCaption}\item[{real, intent(in)}]{x }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



sech calculates the hyperbolic secant. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em x} & Input value. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Result. 
\end{DoxyReturn}


Definition at line 284 of file Phillips\+\_\+initialization.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{284 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)} :: x\textcolor{comment}{    !< Input value.}}
\DoxyCodeLine{285 \textcolor{keywordtype}{  real}             :: sech\textcolor{comment}{ !< Result.}}
\DoxyCodeLine{286 }
\DoxyCodeLine{287   \textcolor{comment}{! This is here to prevent overflows or underflows.}}
\DoxyCodeLine{288   \textcolor{keywordflow}{if} (abs(x) > 228.) \textcolor{keywordflow}{then}}
\DoxyCodeLine{289     sech = 0.0}
\DoxyCodeLine{290   \textcolor{keywordflow}{else}}
\DoxyCodeLine{291     sech = 2.0 / (exp(x) + exp(-\/x))}
\DoxyCodeLine{292 \textcolor{keywordflow}{  endif}}

\end{DoxyCode}
