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


\subsection{Detailed Description}
Regrid columns for the sigma coordinate. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
type \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}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \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 \hyperlink{namespacecoord__sigma_ac2489166e8a1e3e891b2e05df3b8d422}{end\+\_\+coord\+\_\+sigma} (CS)
\begin{DoxyCompactList}\small\item\em This subroutine deallocates memory in the control structure for the \hyperlink{namespacecoord__sigma}{coord\+\_\+sigma} module. \end{DoxyCompactList}\item 
subroutine, public \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 \hyperlink{namespacecoord__sigma}{coord\+\_\+sigma} module. \end{DoxyCompactList}\item 
subroutine, public \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}


\subsection{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}}
\subsubsection{\texorpdfstring{build\+\_\+sigma\+\_\+column()}{build\_sigma\_column()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::build\+\_\+sigma\+\_\+column (\begin{DoxyParamCaption}\item[{type(\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{\tt in}  & {\em cs} & Coordinate control structure\\
\hline
\mbox{\tt in}  & {\em depth} & Depth of ocean bottom (positive \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]})\\
\hline
\mbox{\tt in}  & {\em totalthickness} & Column thickness (positive \mbox{[}H $\sim$$>$ m or kg m-\/2\mbox{]})\\
\hline
\mbox{\tt 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}
64   \textcolor{keywordtype}{type}(sigma\_cs),           \textcolor{keywordtype}{intent(in)}    :: cs\textcolor{comment}{ !< Coordinate control structure}
65   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}    :: depth\textcolor{comment}{ !< Depth of ocean bottom (positive [H ~> m or kg m-2])}
66   \textcolor{keywordtype}{real},                     \textcolor{keywordtype}{intent(in)}    :: totalthickness\textcolor{comment}{ !< Column thickness (positive [H ~> m or kg
       m-2])}
67   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(CS%nk+1)}, \textcolor{keywordtype}{intent(inout)} :: zinterface\textcolor{comment}{ !< Absolute positions of interfaces [H ~> m or kg
       m-2]}
68 
69   \textcolor{comment}{! Local variables}
70   \textcolor{keywordtype}{integer} :: k
71 
72   zinterface(cs%nk+1) = -depth
73   \textcolor{keywordflow}{do} k = cs%nk,1,-1
74     zinterface(k) = zinterface(k+1) + (totalthickness * cs%coordinateResolution(k))
75     \textcolor{comment}{! Adjust interface position to accommodate inflating layers}
76     \textcolor{comment}{! without disturbing the interface above}
77     \textcolor{keywordflow}{if} (zinterface(k) < (zinterface(k+1) + cs%min\_thickness)) \textcolor{keywordflow}{then}
78       zinterface(k) = zinterface(k+1) + cs%min\_thickness
79 \textcolor{keywordflow}{    endif}
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}}
\subsubsection{\texorpdfstring{end\+\_\+coord\+\_\+sigma()}{end\_coord\_sigma()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::end\+\_\+coord\+\_\+sigma (\begin{DoxyParamCaption}\item[{type(\hyperlink{structcoord__sigma_1_1sigma__cs}{sigma\+\_\+cs}), pointer}]{CS }\end{DoxyParamCaption})}



This subroutine deallocates memory in the control structure for the \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}
43   \textcolor{keywordtype}{type}(sigma\_cs), \textcolor{keywordtype}{pointer} :: cs\textcolor{comment}{ !< Coordinate control structure}
44 
45   \textcolor{comment}{! nothing to do}
46   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keywordflow}{return}
47   \textcolor{keyword}{deallocate}(cs%coordinateResolution)
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}}
\subsubsection{\texorpdfstring{init\+\_\+coord\+\_\+sigma()}{init\_coord\_sigma()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::init\+\_\+coord\+\_\+sigma (\begin{DoxyParamCaption}\item[{type(\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{\tt in}  & {\em nk} & Number of layers in the grid\\
\hline
\mbox{\tt in}  & {\em coordinateresolution} & Nominal coordinate resolution \mbox{[}nondim\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
29   \textcolor{keywordtype}{type}(sigma\_cs),     \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< Unassociated pointer to hold the control structure}
30   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: nk\textcolor{comment}{ !< Number of layers in the grid}
31   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: coordinateresolution\textcolor{comment}{ !< Nominal coordinate resolution [nondim]}
32 
33   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"init\_coord\_sigma: CS already associated!"})
34   \textcolor{keyword}{allocate}(cs)
35   \textcolor{keyword}{allocate}(cs%coordinateResolution(nk))
36 
37   cs%nk                   = nk
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}}
\subsubsection{\texorpdfstring{set\+\_\+sigma\+\_\+params()}{set\_sigma\_params()}}
{\footnotesize\ttfamily subroutine, public coord\+\_\+sigma\+::set\+\_\+sigma\+\_\+params (\begin{DoxyParamCaption}\item[{type(\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 \hyperlink{namespacecoord__sigma}{coord\+\_\+sigma} module. 


\begin{DoxyParams}[1]{Parameters}
 & {\em cs} & Coordinate control structure\\
\hline
\mbox{\tt 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}
53   \textcolor{keywordtype}{type}(sigma\_cs), \textcolor{keywordtype}{pointer}    :: cs\textcolor{comment}{ !< Coordinate control structure}
54   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: min\_thickness\textcolor{comment}{ !< Minimum allowed thickness [H ~> m or kg m-2]}
55 
56   \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{associated}(cs)) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"set\_sigma\_params: CS not associated"})
57 
58   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(min\_thickness)) cs%min\_thickness = min\_thickness
\end{DoxyCode}
