\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 \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 \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{\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 drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity, in \mbox{[}kg m-\/3 ppt-\/1\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
\end{DoxyParams}


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


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