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


\subsection{Detailed Description}
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. 

Definition at line 34 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__derivs__nemo_a4afc12412b6d35d412ff3248a8c733f4}{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 \mbox{\hyperlink{interfacemom__eos__nemo_1_1calculate__density__derivs__nemo_a2e130763fb4694f06898b800cffa9f20}{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}\end{DoxyCompactItemize}


\subsection{Detailed Description}
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. 

Definition at line 34 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__derivs__nemo_a2e130763fb4694f06898b800cffa9f20}\label{interfacemom__eos__nemo_1_1calculate__density__derivs__nemo_a2e130763fb4694f06898b800cffa9f20}} 
\index{mom\_eos\_nemo::calculate\_density\_derivs\_nemo@{mom\_eos\_nemo::calculate\_density\_derivs\_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::calculate\_density\_derivs\_nemo@{mom\_eos\_nemo::calculate\_density\_derivs\_nemo}}
\subsubsection{\texorpdfstring{calculate\_density\_derivs\_array\_nemo()}{calculate\_density\_derivs\_array\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+derivs\+\_\+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 268 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{interfacemom__eos__nemo_1_1calculate__density__derivs__nemo_a4afc12412b6d35d412ff3248a8c733f4}\label{interfacemom__eos__nemo_1_1calculate__density__derivs__nemo_a4afc12412b6d35d412ff3248a8c733f4}} 
\index{mom\_eos\_nemo::calculate\_density\_derivs\_nemo@{mom\_eos\_nemo::calculate\_density\_derivs\_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::calculate\_density\_derivs\_nemo@{mom\_eos\_nemo::calculate\_density\_derivs\_nemo}}
\subsubsection{\texorpdfstring{calculate\_density\_derivs\_scalar\_nemo()}{calculate\_density\_derivs\_scalar\_nemo()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+nemo\+::calculate\+\_\+density\+\_\+derivs\+\_\+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 342 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}


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}
