\hypertarget{interfacemom__eos__unesco_1_1calculate__density__unesco}{}\section{mom\+\_\+eos\+\_\+unesco\+:\+:calculate\+\_\+density\+\_\+unesco Interface Reference}
\label{interfacemom__eos__unesco_1_1calculate__density__unesco}\index{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco@{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco}}


\subsection{Detailed Description}
Compute the in situ density of sea water (in \mbox{[}kg m-\/3\mbox{]}), or its anomaly with respect to a reference density, from salinity \mbox{[}P\+SU\mbox{]}, potential temperature \mbox{[}degC\mbox{]}, and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. 

Definition at line 22 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__eos__unesco_1_1calculate__density__unesco_ab251eed54ba41abf0c94f5f884717f77}{calculate\+\_\+density\+\_\+scalar\+\_\+unesco}} (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 salinity (S \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__eos__unesco_1_1calculate__density__unesco_a98e81489ce3d72daeebc271f940951ab}{calculate\+\_\+density\+\_\+array\+\_\+unesco}} (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 salinity (S \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Compute the in situ density of sea water (in \mbox{[}kg m-\/3\mbox{]}), or its anomaly with respect to a reference density, from salinity \mbox{[}P\+SU\mbox{]}, potential temperature \mbox{[}degC\mbox{]}, and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. 

Definition at line 22 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__eos__unesco_1_1calculate__density__unesco_a98e81489ce3d72daeebc271f940951ab}\label{interfacemom__eos__unesco_1_1calculate__density__unesco_a98e81489ce3d72daeebc271f940951ab}} 
\index{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco@{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco}!calculate\+\_\+density\+\_\+array\+\_\+unesco@{calculate\+\_\+density\+\_\+array\+\_\+unesco}}
\index{calculate\+\_\+density\+\_\+array\+\_\+unesco@{calculate\+\_\+density\+\_\+array\+\_\+unesco}!mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco@{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+array\+\_\+unesco()}{calculate\_density\_array\_unesco()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco\+::calculate\+\_\+density\+\_\+array\+\_\+unesco (\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 salinity (S \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. 


\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{[}P\+SU\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 83 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.


\begin{DoxyCode}
83   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface [degC].}
84   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< salinity [PSU].}
85   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}
86   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< in situ density [kg m-3].}
87   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}
88   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}
89   \textcolor{keywordtype}{real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}
90 
91   \textcolor{comment}{! Local variables}
92   \textcolor{keywordtype}{real} :: t\_local, t2, t3, t4, t5  \textcolor{comment}{! Temperature to the 1st - 5th power [degC^n].}
93   \textcolor{keywordtype}{real} :: s\_local, s32, s2         \textcolor{comment}{! Salinity to the 1st, 3/2, & 2nd power [PSU^n].}
94   \textcolor{keywordtype}{real} :: p1, p2      \textcolor{comment}{! Pressure (in bars) to the 1st and 2nd power [bar] and [bar2].}
95   \textcolor{keywordtype}{real} :: rho0        \textcolor{comment}{! Density at 1 bar pressure [kg m-3].}
96   \textcolor{keywordtype}{real} :: sig0        \textcolor{comment}{! The anomaly of rho0 from R00 [kg m-3].}
97   \textcolor{keywordtype}{real} :: ks          \textcolor{comment}{! The secant bulk modulus [bar].}
98   \textcolor{keywordtype}{integer} :: j
99 
100   \textcolor{keywordflow}{do} j=start,start+npts-1
101     \textcolor{keywordflow}{if} (s(j) < -1.0e-10) \textcolor{keywordflow}{then} \textcolor{comment}{!Can we assume safely that this is a missing value?}
102       rho(j) = 1000.0
103       cycle
104 \textcolor{keywordflow}{    endif}
105 
106     p1 = pressure(j)*1.0e-5; p2 = p1*p1
107     t\_local = t(j); t2 = t\_local*t\_local; t3 = t\_local*t2; t4 = t2*t2; t5 = t3*t2
108     s\_local = s(j); s2 = s\_local*s\_local; s32 = s\_local*sqrt(s\_local)
109 
110 \textcolor{comment}{!  Compute rho(s,theta,p=0) - (same as rho(s,t\_insitu,p=0) ).}
111 
112     sig0 = r10*t\_local + r20*t2 + r30*t3 + r40*t4 + r50*t5 + &
113            s\_local*(r01 + r11*t\_local + r21*t2 + r31*t3 + r41*t4) + &
114            s32*(r032 + r132*t\_local + r232*t2) + r02*s2
115     rho0 = r00 + sig0
116 
117 \textcolor{comment}{!  Compute rho(s,theta,p), first calculating the secant bulk modulus.}
118 
119     ks = s00 + s10*t\_local + s20*t2 + s30*t3 + s40*t4 + s\_local*(s01 + s11*t\_local + s21*t2 + s31*t3) + &
120          s32*(s032 + s132*t\_local + s232*t2) + &
121          p1*(sp00 + sp10*t\_local + sp20*t2 + sp30*t3 + &
122              s\_local*(sp01 + sp11*t\_local + sp21*t2) + sp032*s32) + &
123          p2*(sp000 + sp010*t\_local + sp020*t2 + s\_local*(sp001 + sp011*t\_local + sp021*t2))
124 
125     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then}
126       rho(j) = ((r00 - rho\_ref)*ks + (sig0*ks + p1*rho\_ref)) / (ks - p1)
127     \textcolor{keywordflow}{else}
128       rho(j) = rho0*ks / (ks - p1)
129 \textcolor{keywordflow}{    endif}
130 \textcolor{keywordflow}{  enddo}
\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__eos__unesco_1_1calculate__density__unesco_ab251eed54ba41abf0c94f5f884717f77}\label{interfacemom__eos__unesco_1_1calculate__density__unesco_ab251eed54ba41abf0c94f5f884717f77}} 
\index{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco@{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco}!calculate\+\_\+density\+\_\+scalar\+\_\+unesco@{calculate\+\_\+density\+\_\+scalar\+\_\+unesco}}
\index{calculate\+\_\+density\+\_\+scalar\+\_\+unesco@{calculate\+\_\+density\+\_\+scalar\+\_\+unesco}!mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco@{mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+scalar\+\_\+unesco()}{calculate\_density\_scalar\_unesco()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+unesco\+::calculate\+\_\+density\+\_\+scalar\+\_\+unesco (\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 salinity (S \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}, using the U\+N\+E\+S\+CO (1981) equation of state. 


\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{[}P\+SU\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 60 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.


\begin{DoxyCode}
60   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature relative to the surface [degC].}
61   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}
62   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}
63   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< In situ density [kg m-3].}
64   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}
65 
66   \textcolor{comment}{! Local variables}
67   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, pressure0
68   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(1)} :: rho0
69 
70   t0(1) = t
71   s0(1) = s
72   pressure0(1) = pressure
73 
74   \textcolor{keyword}{call }calculate\_density\_array\_unesco(t0, s0, pressure0, rho0, 1, 1, rho\_ref)
75   rho = rho0(1)
76 
\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\+\_\+\+U\+N\+E\+S\+C\+O.\+F90\end{DoxyCompactItemize}
