\hypertarget{namespacecoord__sigma}{}\doxysection{coord\+\_\+sigma Module Reference}
\label{namespacecoord__sigma}\index{coord\_sigma@{coord\_sigma}}


\doxysubsection{Detailed Description}
Regrid columns for the sigma coordinate. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \mbox{\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}}
\begin{DoxyCompactList}\small\item\em Control structure containing required parameters for the sigma coordinate. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacecoord__sigma_adce9c462a3b61ba3791035534e1d8b2a}{init\+\_\+coord\+\_\+sigma}} (CS, nk, coordinate\+Resolution)
\begin{DoxyCompactList}\small\item\em Initialise a sigma\+\_\+\+CS with pointers to parameters. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacecoord__sigma_ac2489166e8a1e3e891b2e05df3b8d422}{end\+\_\+coord\+\_\+sigma}} (CS)
\begin{DoxyCompactList}\small\item\em This subroutine deallocates memory in the control structure for the \mbox{\hyperlink{namespacecoord__sigma}{coord\+\_\+sigma}} module. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacecoord__sigma_aceccbaf232379cea8182c04130c03f5a}{set\+\_\+sigma\+\_\+params}} (CS, min\+\_\+thickness)
\begin{DoxyCompactList}\small\item\em This subroutine can be used to set the parameters for the \mbox{\hyperlink{namespacecoord__sigma}{coord\+\_\+sigma}} module. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacecoord__sigma_af3954fd955a967aa2ff11c2fc115dc19}{build\+\_\+sigma\+\_\+column}} (CS, depth, total\+Thickness, z\+Interface)
\begin{DoxyCompactList}\small\item\em Build a sigma coordinate column. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacecoord__sigma_af3954fd955a967aa2ff11c2fc115dc19}\label{namespacecoord__sigma_af3954fd955a967aa2ff11c2fc115dc19}} 
\index{coord\_sigma@{coord\_sigma}!build\_sigma\_column@{build\_sigma\_column}}
\index{build\_sigma\_column@{build\_sigma\_column}!coord\_sigma@{coord\_sigma}}
\doxysubsubsection{\texorpdfstring{build\_sigma\_column()}{build\_sigma\_column()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::build\+\_\+sigma\+\_\+column (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}}), intent(in)}]{CS,  }\item[{real, intent(in)}]{depth,  }\item[{real, intent(in)}]{total\+Thickness,  }\item[{real, dimension(cs\%nk+1), intent(inout)}]{z\+Interface }\end{DoxyParamCaption})}



Build a sigma coordinate column. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em cs} & Coordinate control structure \\
\hline
\mbox{\texttt{ in}}  & {\em depth} & Depth of ocean bottom (positive \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}) \\
\hline
\mbox{\texttt{ in}}  & {\em totalthickness} & Column thickness (positive \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]}) \\
\hline
\mbox{\texttt{ in,out}}  & {\em zinterface} & Absolute positions of interfaces \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 64 of file coord\+\_\+sigma.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{64   \textcolor{keywordtype}{type}(sigma\_CS),           \textcolor{keywordtype}{intent(in)}    :: CS\textcolor{comment}{ !< Coordinate control structure}}
\DoxyCodeLine{65 \textcolor{keywordtype}{  real},                     \textcolor{keywordtype}{intent(in)}    :: depth\textcolor{comment}{ !< Depth of ocean bottom (positive [H \string~> m or kg m-\/2])}}
\DoxyCodeLine{66 \textcolor{keywordtype}{  real},                     \textcolor{keywordtype}{intent(in)}    :: totalThickness\textcolor{comment}{ !< Column thickness (positive [H \string~> m or kg m-\/2])}}
\DoxyCodeLine{67 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(CS\%nk+1)}, \textcolor{keywordtype}{intent(inout)} :: zInterface\textcolor{comment}{ !< Absolute positions of interfaces [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{68 }
\DoxyCodeLine{69   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{70   \textcolor{keywordtype}{integer} :: k}
\DoxyCodeLine{71 }
\DoxyCodeLine{72   zinterface(cs\%nk+1) = -\/depth}
\DoxyCodeLine{73   \textcolor{keywordflow}{do} k = cs\%nk,1,-\/1}
\DoxyCodeLine{74     zinterface(k) = zinterface(k+1) + (totalthickness * cs\%coordinateResolution(k))}
\DoxyCodeLine{75     \textcolor{comment}{! Adjust interface position to accommodate inflating layers}}
\DoxyCodeLine{76     \textcolor{comment}{! without disturbing the interface above}}
\DoxyCodeLine{77     \textcolor{keywordflow}{if} (zinterface(k) < (zinterface(k+1) + cs\%min\_thickness)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{78       zinterface(k) = zinterface(k+1) + cs\%min\_thickness}
\DoxyCodeLine{79 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{80 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacecoord__sigma_ac2489166e8a1e3e891b2e05df3b8d422}\label{namespacecoord__sigma_ac2489166e8a1e3e891b2e05df3b8d422}} 
\index{coord\_sigma@{coord\_sigma}!end\_coord\_sigma@{end\_coord\_sigma}}
\index{end\_coord\_sigma@{end\_coord\_sigma}!coord\_sigma@{coord\_sigma}}
\doxysubsubsection{\texorpdfstring{end\_coord\_sigma()}{end\_coord\_sigma()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::end\+\_\+coord\+\_\+sigma (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine deallocates memory in the control structure for the \mbox{\hyperlink{namespacecoord__sigma}{coord\+\_\+sigma}} module. 


\begin{DoxyParams}{Parameters}
{\em cs} & Coordinate control structure \\
\hline
\end{DoxyParams}


Definition at line 43 of file coord\+\_\+sigma.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{43   \textcolor{keywordtype}{type}(sigma\_CS), \textcolor{keywordtype}{pointer} :: CS\textcolor{comment}{ !< Coordinate control structure}}
\DoxyCodeLine{44 }
\DoxyCodeLine{45   \textcolor{comment}{! nothing to do}}
\DoxyCodeLine{46   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{47   \textcolor{keyword}{deallocate}(cs\%coordinateResolution)}
\DoxyCodeLine{48   \textcolor{keyword}{deallocate}(cs)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacecoord__sigma_adce9c462a3b61ba3791035534e1d8b2a}\label{namespacecoord__sigma_adce9c462a3b61ba3791035534e1d8b2a}} 
\index{coord\_sigma@{coord\_sigma}!init\_coord\_sigma@{init\_coord\_sigma}}
\index{init\_coord\_sigma@{init\_coord\_sigma}!coord\_sigma@{coord\_sigma}}
\doxysubsubsection{\texorpdfstring{init\_coord\_sigma()}{init\_coord\_sigma()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::init\+\_\+coord\+\_\+sigma (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}}), pointer}]{CS,  }\item[{integer, intent(in)}]{nk,  }\item[{real, dimension(\+:), intent(in)}]{coordinate\+Resolution }\end{DoxyParamCaption})}



Initialise a sigma\+\_\+\+CS with pointers to parameters. 


\begin{DoxyParams}[1]{Parameters}
 & {\em cs} & Unassociated pointer to hold the control structure \\
\hline
\mbox{\texttt{ in}}  & {\em nk} & Number of layers in the grid \\
\hline
\mbox{\texttt{ in}}  & {\em coordinateresolution} & Nominal coordinate resolution \mbox{[}nondim\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 29 of file coord\+\_\+sigma.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{29   \textcolor{keywordtype}{type}(sigma\_CS),     \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< Unassociated pointer to hold the control structure}}
\DoxyCodeLine{30   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: nk\textcolor{comment}{ !< Number of layers in the grid}}
\DoxyCodeLine{31 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: coordinateResolution\textcolor{comment}{ !< Nominal coordinate resolution [nondim]}}
\DoxyCodeLine{32 }
\DoxyCodeLine{33   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"init\_coord\_sigma: CS already associated!"})}
\DoxyCodeLine{34   \textcolor{keyword}{allocate}(cs)}
\DoxyCodeLine{35   \textcolor{keyword}{allocate}(cs\%coordinateResolution(nk))}
\DoxyCodeLine{36 }
\DoxyCodeLine{37   cs\%nk                   = nk}
\DoxyCodeLine{38   cs\%coordinateResolution = coordinateresolution}

\end{DoxyCode}
\mbox{\Hypertarget{namespacecoord__sigma_aceccbaf232379cea8182c04130c03f5a}\label{namespacecoord__sigma_aceccbaf232379cea8182c04130c03f5a}} 
\index{coord\_sigma@{coord\_sigma}!set\_sigma\_params@{set\_sigma\_params}}
\index{set\_sigma\_params@{set\_sigma\_params}!coord\_sigma@{coord\_sigma}}
\doxysubsubsection{\texorpdfstring{set\_sigma\_params()}{set\_sigma\_params()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::set\+\_\+sigma\+\_\+params (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}}), pointer}]{CS,  }\item[{real, intent(in), optional}]{min\+\_\+thickness }\end{DoxyParamCaption})}



This subroutine can be used to set the parameters for the \mbox{\hyperlink{namespacecoord__sigma}{coord\+\_\+sigma}} module. 


\begin{DoxyParams}[1]{Parameters}
 & {\em cs} & Coordinate control structure \\
\hline
\mbox{\texttt{ in}}  & {\em min\+\_\+thickness} & Minimum allowed thickness \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]} \\
\hline
\end{DoxyParams}


Definition at line 53 of file coord\+\_\+sigma.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{53   \textcolor{keywordtype}{type}(sigma\_CS), \textcolor{keywordtype}{pointer}    :: CS\textcolor{comment}{ !< Coordinate control structure}}
\DoxyCodeLine{54 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: min\_thickness\textcolor{comment}{ !< Minimum allowed thickness [H \string~> m or kg m-\/2]}}
\DoxyCodeLine{55 }
\DoxyCodeLine{56   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"set\_sigma\_params: CS not associated"})}
\DoxyCodeLine{57 }
\DoxyCodeLine{58   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(min\_thickness)) cs\%min\_thickness = min\_thickness}

\end{DoxyCode}
