\hypertarget{interfacemom__eos__nemo_1_1calculate__density__nemo}{}\section{mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+nemo Interface Reference}
\label{interfacemom__eos__nemo_1_1calculate__density__nemo}\index{mom\_eos\_nemo::calculate\_density\_nemo@{mom\_eos\_nemo::calculate\_density\_nemo}}


\subsection{Detailed Description}
Compute the in situ density of sea water (\mbox{[}kg m-\/3\mbox{]}), or its anomaly with respect to a reference density, from absolute salinity (g/kg), conservative temperature (in deg C), and pressure \mbox{[}Pa\mbox{]}, using the expressions derived for use with N\+E\+MO. 

Definition at line 28 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+N\+E\+M\+O.\+F90.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__eos__nemo_1_1calculate__density__nemo_a81f13140ec6b351988f96cf085ff94ba}{calculate\+\_\+density\+\_\+scalar\+\_\+nemo}} (T, S, pressure, rho, rho\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) from absolute salinity (S \mbox{[}g kg-\/1\mbox{]}), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. It uses the expressions derived for use with N\+E\+MO. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__eos__nemo_1_1calculate__density__nemo_ac9aa07dc4f53a3ba133dc70fb949171d}{calculate\+\_\+density\+\_\+array\+\_\+nemo}} (T, S, pressure, rho, start, npts, rho\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) from absolute salinity (S \mbox{[}g kg-\/1\mbox{]}), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. It uses the expressions derived for use with N\+E\+MO. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Compute the in situ density of sea water (\mbox{[}kg m-\/3\mbox{]}), or its anomaly with respect to a reference density, from absolute salinity (g/kg), conservative temperature (in deg C), and pressure \mbox{[}Pa\mbox{]}, using the expressions derived for use with N\+E\+MO. 

Definition at line 28 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+N\+E\+M\+O.\+F90.



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__eos__nemo_1_1calculate__density__nemo_ac9aa07dc4f53a3ba133dc70fb949171d}\label{interfacemom__eos__nemo_1_1calculate__density__nemo_ac9aa07dc4f53a3ba133dc70fb949171d}} 
\index{mom\_eos\_nemo::calculate\_density\_nemo@{mom\_eos\_nemo::calculate\_density\_nemo}!calculate\_density\_array\_nemo@{calculate\_density\_array\_nemo}}
\index{calculate\_density\_array\_nemo@{calculate\_density\_array\_nemo}!mom\_eos\_nemo::calculate\_density\_nemo@{mom\_eos\_nemo::calculate\_density\_nemo}}
\subsubsection{\texorpdfstring{calculate\_density\_array\_nemo()}{calculate\_density\_array\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+nemo\+::calculate\+\_\+density\+\_\+array\+\_\+nemo (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(out)}]{rho,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{real, intent(in), optional}]{rho\+\_\+ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine computes the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) from absolute salinity (S \mbox{[}g kg-\/1\mbox{]}), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. It uses the expressions derived for use with N\+E\+MO. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Conservative temperature \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Absolute salinity \mbox{[}g kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & in situ density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & the starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & the number of values to calculate. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 206 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+N\+E\+M\+O.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{206 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Conservative temperature [degC].}}
\DoxyCodeLine{207 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Absolute salinity [g kg-1].}}
\DoxyCodeLine{208 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{209 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< in situ density [kg m-3].}}
\DoxyCodeLine{210   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{211   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{212 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}}
\DoxyCodeLine{213 }
\DoxyCodeLine{214   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{215 \textcolor{keywordtype}{  real} :: zp, zt, zh, zs, zr0, zn, zn0, zn1, zn2, zn3, zs0}
\DoxyCodeLine{216   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{217 }
\DoxyCodeLine{218   \textcolor{keywordflow}{do} j=start,start+npts-1}
\DoxyCodeLine{219     \textcolor{comment}{!Conversions}}
\DoxyCodeLine{220     zs = s(j) \textcolor{comment}{!gsw\_sr\_from\_sp(S(j))       !Convert practical salinity to absolute salinity}}
\DoxyCodeLine{221     zt = t(j) \textcolor{comment}{!gsw\_ct\_from\_pt(S(j),T(j))  !Convert potential temp to conservative temp}}
\DoxyCodeLine{222     zp = pressure(j)* pa2db         \textcolor{comment}{!Convert pressure from Pascal to decibar}}
\DoxyCodeLine{223 }
\DoxyCodeLine{224     \textcolor{comment}{!The following algorithm was provided by Roquet in a private communication.}}
\DoxyCodeLine{225     \textcolor{comment}{!It is not necessarily the algorithm used in NEMO ocean!}}
\DoxyCodeLine{226     zp  = zp * r1\_p0 \textcolor{comment}{!pressure}}
\DoxyCodeLine{227     zt  = zt * r1\_t0 \textcolor{comment}{!temperature}}
\DoxyCodeLine{228     zs  = sqrt( abs( zs + rdeltas ) * r1\_s0 )   \textcolor{comment}{! square root salinity}}
\DoxyCodeLine{229 }
\DoxyCodeLine{230     zn3 = eos013*zt   \&}
\DoxyCodeLine{231        \&   + eos103*zs+eos003}
\DoxyCodeLine{232 }
\DoxyCodeLine{233     zn2 = (eos022*zt   \&}
\DoxyCodeLine{234        \&   + eos112*zs+eos012)*zt   \&}
\DoxyCodeLine{235        \&   + (eos202*zs+eos102)*zs+eos002}
\DoxyCodeLine{236 }
\DoxyCodeLine{237     zn1 = (((eos041*zt   \&}
\DoxyCodeLine{238        \&   + eos131*zs+eos031)*zt   \&}
\DoxyCodeLine{239        \&   + (eos221*zs+eos121)*zs+eos021)*zt   \&}
\DoxyCodeLine{240        \&   + ((eos311*zs+eos211)*zs+eos111)*zs+eos011)*zt   \&}
\DoxyCodeLine{241        \&   + (((eos401*zs+eos301)*zs+eos201)*zs+eos101)*zs+eos001}
\DoxyCodeLine{242 }
\DoxyCodeLine{243     zn0 = (((((eos060*zt   \&}
\DoxyCodeLine{244        \&   + eos150*zs+eos050)*zt   \&}
\DoxyCodeLine{245        \&   + (eos240*zs+eos140)*zs+eos040)*zt   \&}
\DoxyCodeLine{246        \&   + ((eos330*zs+eos230)*zs+eos130)*zs+eos030)*zt   \&}
\DoxyCodeLine{247        \&   + (((eos420*zs+eos320)*zs+eos220)*zs+eos120)*zs+eos020)*zt   \&}
\DoxyCodeLine{248        \&   + ((((eos510*zs+eos410)*zs+eos310)*zs+eos210)*zs+eos110)*zs+eos010)*zt}
\DoxyCodeLine{249 }
\DoxyCodeLine{250     zs0 = (((((eos600*zs+eos500)*zs+eos400)*zs+eos300)*zs+eos200)*zs+eos100)*zs + eos000}
\DoxyCodeLine{251 }
\DoxyCodeLine{252     zr0 = (((((r05 * zp+r04) * zp+r03 ) * zp+r02 ) * zp+r01) * zp+r00) * zp}
\DoxyCodeLine{253 }
\DoxyCodeLine{254     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{255       zn  = ( ( zn3 * zp + zn2 ) * zp + zn1 ) * zp + (zn0 + (zs0 - rho\_ref))}
\DoxyCodeLine{256       rho(j) =  ( zn + zr0 ) \textcolor{comment}{! density}}
\DoxyCodeLine{257     \textcolor{keywordflow}{else}}
\DoxyCodeLine{258       zn  = ( ( zn3 * zp + zn2 ) * zp + zn1 ) * zp + (zn0 + zs0)}
\DoxyCodeLine{259       rho(j) =  ( zn + zr0 ) \textcolor{comment}{! density}}
\DoxyCodeLine{260 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{261 }
\DoxyCodeLine{262 \textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__eos__nemo_1_1calculate__density__nemo_a81f13140ec6b351988f96cf085ff94ba}\label{interfacemom__eos__nemo_1_1calculate__density__nemo_a81f13140ec6b351988f96cf085ff94ba}} 
\index{mom\_eos\_nemo::calculate\_density\_nemo@{mom\_eos\_nemo::calculate\_density\_nemo}!calculate\_density\_scalar\_nemo@{calculate\_density\_scalar\_nemo}}
\index{calculate\_density\_scalar\_nemo@{calculate\_density\_scalar\_nemo}!mom\_eos\_nemo::calculate\_density\_nemo@{mom\_eos\_nemo::calculate\_density\_nemo}}
\subsubsection{\texorpdfstring{calculate\_density\_scalar\_nemo()}{calculate\_density\_scalar\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+nemo\+::calculate\+\_\+density\+\_\+scalar\+\_\+nemo (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{rho,  }\item[{real, intent(in), optional}]{rho\+\_\+ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine computes the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) from absolute salinity (S \mbox{[}g kg-\/1\mbox{]}), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. It uses the expressions derived for use with N\+E\+MO. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Conservative temperature \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Absolute salinity \mbox{[}g kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & In situ density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 181 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+N\+E\+M\+O.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{181 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Conservative temperature [degC].}}
\DoxyCodeLine{182 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Absolute salinity [g kg-1].}}
\DoxyCodeLine{183 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{184 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< In situ density [kg m-3].}}
\DoxyCodeLine{185 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}}
\DoxyCodeLine{186 }
\DoxyCodeLine{187 \textcolor{keywordtype}{  real} :: al0, p0, lambda}
\DoxyCodeLine{188   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{189 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, pressure0}
\DoxyCodeLine{190 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: rho0}
\DoxyCodeLine{191 }
\DoxyCodeLine{192   t0(1) = t}
\DoxyCodeLine{193   s0(1) = s}
\DoxyCodeLine{194   pressure0(1) = pressure}
\DoxyCodeLine{195 }
\DoxyCodeLine{196   \textcolor{keyword}{call }calculate\_density\_array\_nemo(t0, s0, pressure0, rho0, 1, 1, rho\_ref)}
\DoxyCodeLine{197   rho = rho0(1)}
\DoxyCodeLine{198 }

\end{DoxyCode}


The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/home/cermak/src/\+M\+O\+M6.\+devrob/src/equation\+\_\+of\+\_\+state/M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+N\+E\+M\+O.\+F90\end{DoxyCompactItemize}
