\hypertarget{namespacemom__eos__nemo}{}\doxysection{mom\+\_\+eos\+\_\+nemo Module Reference}
\label{namespacemom__eos__nemo}\index{mom\_eos\_nemo@{mom\_eos\_nemo}}


\doxysubsection{Detailed Description}
The equation of state using the expressions of Roquet et al. that are used in N\+E\+MO. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\hyperlink{interfacemom__eos__nemo_1_1calculate__density__derivs__nemo}{calculate\+\_\+density\+\_\+derivs\+\_\+nemo}}
\begin{DoxyCompactList}\small\item\em For a given thermodynamic state, return the derivatives of density with conservative temperature and absolute salinity, the expressions derived for use with N\+E\+MO. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos__nemo_1_1calculate__density__nemo}{calculate\+\_\+density\+\_\+nemo}}
\begin{DoxyCompactList}\small\item\em 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. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__nemo_a78c3bbb7960ee09a4c0aacb3d9eda912}{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, public \mbox{\hyperlink{namespacemom__eos__nemo_a262e1078592bdb306dc27207c0463648}{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}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__nemo_ac794e7251c8971a0795fc6add423a6d9}{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+nemo}} (T, S, pressure, drho\+\_\+dT, drho\+\_\+dS, start, npts)
\begin{DoxyCompactList}\small\item\em For a given thermodynamic state, calculate the derivatives of density with conservative temperature and absolute salinity, using the expressions derived for use with N\+E\+MO. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__nemo_a07b8b3637c4d692b17a97c1e58dddbf7}{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+nemo}} (T, S, pressure, drho\+\_\+dt, drho\+\_\+ds)
\begin{DoxyCompactList}\small\item\em Wrapper to calculate\+\_\+density\+\_\+derivs\+\_\+array for scalar inputs. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__nemo_ab9441b5fdd50f09a5bac70012def0ea7}{calculate\+\_\+compress\+\_\+nemo}} (T, S, pressure, rho, drho\+\_\+dp, start, npts)
\begin{DoxyCompactList}\small\item\em Compute the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) and the compressibility (drho/dp = C\+\_\+sound$^\wedge$-\/2, stored as drho\+\_\+dp \mbox{[}s2 m-\/2\mbox{]}) from absolute salinity (sal in g/kg), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using the expressions derived for use with N\+E\+MO. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__eos__nemo_a0971df26b4852f72c6a5c365a48c43ca}\label{namespacemom__eos__nemo_a0971df26b4852f72c6a5c365a48c43ca}} 
real, parameter \mbox{\hyperlink{namespacemom__eos__nemo_a0971df26b4852f72c6a5c365a48c43ca}{pa2db}} = 1.e-\/4
\begin{DoxyCompactList}\small\item\em Conversion factor between Pa and dbar. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__eos__nemo_ab9441b5fdd50f09a5bac70012def0ea7}\label{namespacemom__eos__nemo_ab9441b5fdd50f09a5bac70012def0ea7}} 
\index{mom\_eos\_nemo@{mom\_eos\_nemo}!calculate\_compress\_nemo@{calculate\_compress\_nemo}}
\index{calculate\_compress\_nemo@{calculate\_compress\_nemo}!mom\_eos\_nemo@{mom\_eos\_nemo}}
\doxysubsubsection{\texorpdfstring{calculate\_compress\_nemo()}{calculate\_compress\_nemo()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+compress\+\_\+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[{real, dimension(\+:), intent(out)}]{drho\+\_\+dp,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})}



Compute the in situ density of sea water (rho in \mbox{[}kg m-\/3\mbox{]}) and the compressibility (drho/dp = C\+\_\+sound$^\wedge$-\/2, stored as drho\+\_\+dp \mbox{[}s2 m-\/2\mbox{]}) from absolute salinity (sal in g/kg), conservative temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using 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\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{ out}}  & {\em drho\+\_\+dp} & The partial derivative of density with pressure (also the inverse of the square of sound speed) \mbox{[}s2 m-\/2\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
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{369 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{        !< Conservative temperature [degC].}}
\DoxyCodeLine{370 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{        !< Absolute salinity [g/kg].}}
\DoxyCodeLine{371 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{372 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: rho\textcolor{comment}{      !< In situ density [kg m-\/3].}}
\DoxyCodeLine{373 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dp\textcolor{comment}{  !< The partial derivative of density with pressure}}
\DoxyCodeLine{374 \textcolor{comment}{                                                 !! (also the inverse of the square of sound speed)}}
\DoxyCodeLine{375 \textcolor{comment}{                                                 !! [s2 m-\/2].}}
\DoxyCodeLine{376   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{    !< The starting point in the arrays.}}
\DoxyCodeLine{377   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{     !< The number of values to calculate.}}
\DoxyCodeLine{378 }
\DoxyCodeLine{379   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{380 \textcolor{keywordtype}{  real} ::  zs,zt,zp}
\DoxyCodeLine{381   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{382 }
\DoxyCodeLine{383   \textcolor{keyword}{call }calculate\_density\_array\_nemo(t, s, pressure, rho, start, npts)}
\DoxyCodeLine{384   \textcolor{comment}{!}}
\DoxyCodeLine{385   \textcolor{comment}{!NOTE: The following calculates the TEOS10 approximation to compressibility}}
\DoxyCodeLine{386   \textcolor{comment}{!      since the corresponding NEMO approximation is not available yet.}}
\DoxyCodeLine{387   \textcolor{comment}{!}}
\DoxyCodeLine{388   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{389    \textcolor{comment}{!Conversions}}
\DoxyCodeLine{390     zs = s(j) \textcolor{comment}{!gsw\_sr\_from\_sp(S(j))       !Convert practical salinity to absolute salinity}}
\DoxyCodeLine{391     zt = t(j) \textcolor{comment}{!gsw\_ct\_from\_pt(S(j),T(j))  !Convert potantial temp to conservative temp}}
\DoxyCodeLine{392     zp = pressure(j)* pa2db         \textcolor{comment}{!Convert pressure from Pascal to decibar}}
\DoxyCodeLine{393     \textcolor{keyword}{call }gsw\_rho\_first\_derivatives(zs,zt,zp, drho\_dp=drho\_dp(j))}
\DoxyCodeLine{394 \textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__nemo_a262e1078592bdb306dc27207c0463648}\label{namespacemom__eos__nemo_a262e1078592bdb306dc27207c0463648}} 
\index{mom\_eos\_nemo@{mom\_eos\_nemo}!calculate\_density\_array\_nemo@{calculate\_density\_array\_nemo}}
\index{calculate\_density\_array\_nemo@{calculate\_density\_array\_nemo}!mom\_eos\_nemo@{mom\_eos\_nemo}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_array\_nemo()}{calculate\_density\_array\_nemo()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+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})}



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 205 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{namespacemom__eos__nemo_ac794e7251c8971a0795fc6add423a6d9}\label{namespacemom__eos__nemo_ac794e7251c8971a0795fc6add423a6d9}} 
\index{mom\_eos\_nemo@{mom\_eos\_nemo}!calculate\_density\_derivs\_array\_nemo@{calculate\_density\_derivs\_array\_nemo}}
\index{calculate\_density\_derivs\_array\_nemo@{calculate\_density\_derivs\_array\_nemo}!mom\_eos\_nemo@{mom\_eos\_nemo}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_array\_nemo()}{calculate\_density\_derivs\_array\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+derivs\+\_\+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)}]{drho\+\_\+dT,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



For a given thermodynamic state, calculate the derivatives of density with conservative temperature and absolute salinity, using 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 drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity, in \mbox{[}kg m-\/3 ppt-\/1\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
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{268 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{        !< Conservative temperature [degC].}}
\DoxyCodeLine{269 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{        !< Absolute salinity [g kg-\/1].}}
\DoxyCodeLine{270 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{271 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dT\textcolor{comment}{  !< The partial derivative of density with potential}}
\DoxyCodeLine{272 \textcolor{comment}{                                                 !! temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{273 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dS\textcolor{comment}{  !< The partial derivative of density with salinity,}}
\DoxyCodeLine{274 \textcolor{comment}{                                                 !! in [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{275   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{    !< The starting point in the arrays.}}
\DoxyCodeLine{276   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{     !< The number of values to calculate.}}
\DoxyCodeLine{277 }
\DoxyCodeLine{278   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{279 \textcolor{keywordtype}{  real} :: zp,zt , zh , zs , zr0, zn , zn0, zn1, zn2, zn3}
\DoxyCodeLine{280   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{281 }
\DoxyCodeLine{282   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{283     \textcolor{comment}{!Conversions}}
\DoxyCodeLine{284     zs = s(j) \textcolor{comment}{!gsw\_sr\_from\_sp(S(j))       !Convert practical salinity to absolute salinity}}
\DoxyCodeLine{285     zt = t(j) \textcolor{comment}{!gsw\_ct\_from\_pt(S(j),T(j))  !Convert potantial temp to conservative temp}}
\DoxyCodeLine{286     zp = pressure(j)* pa2db         \textcolor{comment}{!Convert pressure from Pascal to decibar}}
\DoxyCodeLine{287 }
\DoxyCodeLine{288     \textcolor{comment}{!The following algorithm was provided by Roquet in a private communication.}}
\DoxyCodeLine{289     \textcolor{comment}{!It is not necessarily the algorithm used in NEMO ocean!}}
\DoxyCodeLine{290     zp  = zp * r1\_p0  \textcolor{comment}{! pressure (first converted to decibar)}}
\DoxyCodeLine{291     zt  = zt * r1\_t0                \textcolor{comment}{! temperature}}
\DoxyCodeLine{292     zs  = sqrt( abs( zs + rdeltas ) * r1\_s0 )   \textcolor{comment}{! square root salinity}}
\DoxyCodeLine{293     \textcolor{comment}{!}}
\DoxyCodeLine{294     \textcolor{comment}{! alpha}}
\DoxyCodeLine{295     zn3 = alp003}
\DoxyCodeLine{296     \textcolor{comment}{!}}
\DoxyCodeLine{297     zn2 = alp012*zt + alp102*zs+alp002}
\DoxyCodeLine{298     \textcolor{comment}{!}}
\DoxyCodeLine{299     zn1 = ((alp031*zt   \&}
\DoxyCodeLine{300        \&   + alp121*zs+alp021)*zt   \&}
\DoxyCodeLine{301        \&   + (alp211*zs+alp111)*zs+alp011)*zt   \&}
\DoxyCodeLine{302        \&   + ((alp301*zs+alp201)*zs+alp101)*zs+alp001}
\DoxyCodeLine{303        \textcolor{comment}{!}}
\DoxyCodeLine{304     zn0 = ((((alp050*zt   \&}
\DoxyCodeLine{305        \&   + alp140*zs+alp040)*zt   \&}
\DoxyCodeLine{306        \&   + (alp230*zs+alp130)*zs+alp030)*zt   \&}
\DoxyCodeLine{307        \&   + ((alp320*zs+alp220)*zs+alp120)*zs+alp020)*zt   \&}
\DoxyCodeLine{308        \&   + (((alp410*zs+alp310)*zs+alp210)*zs+alp110)*zs+alp010)*zt   \&}
\DoxyCodeLine{309        \&   + ((((alp500*zs+alp400)*zs+alp300)*zs+alp200)*zs+alp100)*zs+alp000}
\DoxyCodeLine{310        \textcolor{comment}{!}}
\DoxyCodeLine{311     zn  = ( ( zn3 * zp + zn2 ) * zp + zn1 ) * zp + zn0}
\DoxyCodeLine{312     \textcolor{comment}{!}}
\DoxyCodeLine{313     drho\_dt(j) = -\/zn}
\DoxyCodeLine{314     \textcolor{comment}{!}}
\DoxyCodeLine{315     \textcolor{comment}{! beta}}
\DoxyCodeLine{316     \textcolor{comment}{!}}
\DoxyCodeLine{317     zn3 = bet003}
\DoxyCodeLine{318     \textcolor{comment}{!}}
\DoxyCodeLine{319     zn2 = bet012*zt + bet102*zs+bet002}
\DoxyCodeLine{320     \textcolor{comment}{!}}
\DoxyCodeLine{321     zn1 = ((bet031*zt   \&}
\DoxyCodeLine{322        \&   + bet121*zs+bet021)*zt   \&}
\DoxyCodeLine{323        \&   + (bet211*zs+bet111)*zs+bet011)*zt   \&}
\DoxyCodeLine{324        \&   + ((bet301*zs+bet201)*zs+bet101)*zs+bet001}
\DoxyCodeLine{325        \textcolor{comment}{!}}
\DoxyCodeLine{326     zn0 = ((((bet050*zt   \&}
\DoxyCodeLine{327        \&   + bet140*zs+bet040)*zt   \&}
\DoxyCodeLine{328        \&   + (bet230*zs+bet130)*zs+bet030)*zt   \&}
\DoxyCodeLine{329        \&   + ((bet320*zs+bet220)*zs+bet120)*zs+bet020)*zt   \&}
\DoxyCodeLine{330        \&   + (((bet410*zs+bet310)*zs+bet210)*zs+bet110)*zs+bet010)*zt   \&}
\DoxyCodeLine{331        \&   + ((((bet500*zs+bet400)*zs+bet300)*zs+bet200)*zs+bet100)*zs+bet000}
\DoxyCodeLine{332        \textcolor{comment}{!}}
\DoxyCodeLine{333     zn  = ( ( zn3 * zp + zn2 ) * zp + zn1 ) * zp + zn0}
\DoxyCodeLine{334     \textcolor{comment}{!}}
\DoxyCodeLine{335     drho\_ds(j) = zn / zs}
\DoxyCodeLine{336 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{337 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__nemo_a07b8b3637c4d692b17a97c1e58dddbf7}\label{namespacemom__eos__nemo_a07b8b3637c4d692b17a97c1e58dddbf7}} 
\index{mom\_eos\_nemo@{mom\_eos\_nemo}!calculate\_density\_derivs\_scalar\_nemo@{calculate\_density\_derivs\_scalar\_nemo}}
\index{calculate\_density\_derivs\_scalar\_nemo@{calculate\_density\_derivs\_scalar\_nemo}!mom\_eos\_nemo@{mom\_eos\_nemo}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_scalar\_nemo()}{calculate\_density\_derivs\_scalar\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+nemo (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{drho\+\_\+dt,  }\item[{real, intent(out)}]{drho\+\_\+ds }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Wrapper to calculate\+\_\+density\+\_\+derivs\+\_\+array for scalar inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}g kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity, in \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{342 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature relative to the surface [degC].}}
\DoxyCodeLine{343 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [g kg-\/1].}}
\DoxyCodeLine{344 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa].}}
\DoxyCodeLine{345 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)} :: drho\_dT\textcolor{comment}{  !< The partial derivative of density with potential}}
\DoxyCodeLine{346 \textcolor{comment}{                                   !! temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{347 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)} :: drho\_dS\textcolor{comment}{  !< The partial derivative of density with salinity,}}
\DoxyCodeLine{348 \textcolor{comment}{                                   !! in [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{349   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{350 \textcolor{keywordtype}{  real} :: al0, p0, lambda}
\DoxyCodeLine{351   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{352 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, pressure0}
\DoxyCodeLine{353 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: drdt0, drds0}
\DoxyCodeLine{354 }
\DoxyCodeLine{355   t0(1) = t}
\DoxyCodeLine{356   s0(1) = s}
\DoxyCodeLine{357   pressure0(1) = pressure}
\DoxyCodeLine{358 }
\DoxyCodeLine{359   \textcolor{keyword}{call }calculate\_density\_derivs\_array\_nemo(t0, s0, pressure0, drdt0, drds0, 1, 1)}
\DoxyCodeLine{360   drho\_dt = drdt0(1)}
\DoxyCodeLine{361   drho\_ds = drds0(1)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__nemo_a78c3bbb7960ee09a4c0aacb3d9eda912}\label{namespacemom__eos__nemo_a78c3bbb7960ee09a4c0aacb3d9eda912}} 
\index{mom\_eos\_nemo@{mom\_eos\_nemo}!calculate\_density\_scalar\_nemo@{calculate\_density\_scalar\_nemo}}
\index{calculate\_density\_scalar\_nemo@{calculate\_density\_scalar\_nemo}!mom\_eos\_nemo@{mom\_eos\_nemo}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_scalar\_nemo()}{calculate\_density\_scalar\_nemo()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+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})}



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 180 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}
