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