\hypertarget{namespacemom__eos__unesco}{}\doxysection{mom\+\_\+eos\+\_\+unesco Module Reference}
\label{namespacemom__eos__unesco}\index{mom\_eos\_unesco@{mom\_eos\_unesco}}


\doxysubsection{Detailed Description}
The equation of state using the Jackett and Mc\+Dougall fits to the U\+N\+E\+S\+CO E\+OS. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\hyperlink{interfacemom__eos__unesco_1_1calculate__density__unesco}{calculate\+\_\+density\+\_\+unesco}}
\begin{DoxyCompactList}\small\item\em 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. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos__unesco_1_1calculate__spec__vol__unesco}{calculate\+\_\+spec\+\_\+vol\+\_\+unesco}}
\begin{DoxyCompactList}\small\item\em Compute the in situ specific volume of sea water (in \mbox{[}m3 kg-\/1\mbox{]}), or an anomaly with respect to a reference specific volume, 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. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__unesco_a5b0789ed1bfd40e09ba994b656c14f47}{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, public \mbox{\hyperlink{namespacemom__eos__unesco_a2a6110741c62f2f3a2df31fa88a63ce5}{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}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__unesco_a79b131a4287b138ebf37883d60b334be}{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+unesco}} (T, S, pressure, specvol, spv\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the in situ specific volume of sea water (specvol in \mbox{[}m3 kg-\/1\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. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__unesco_ad8670960a4b8e83186468a7a8cfa860c}{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+unesco}} (T, S, pressure, specvol, start, npts, spv\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the in situ specific volume of sea water (specvol in \mbox{[}m3 kg-\/1\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. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__unesco_af8666837abadea54c016bf59838f96cc}{calculate\+\_\+density\+\_\+derivs\+\_\+unesco}} (T, S, pressure, drho\+\_\+dT, drho\+\_\+dS, start, npts)
\begin{DoxyCompactList}\small\item\em This subroutine calculates the partial derivatives of density with potential temperature and salinity. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__unesco_a4a125f4eb70d4b2517dadd2f9446f261}{calculate\+\_\+compress\+\_\+unesco}} (T, S, pressure, rho, drho\+\_\+dp, start, npts)
\begin{DoxyCompactList}\small\item\em This subroutine computes the in situ density of sea water (rho) and the compressibility (drho/dp == C\+\_\+sound$^\wedge$-\/2) at the given salinity, potential temperature, and pressure. \end{DoxyCompactList}\end{DoxyCompactItemize}


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



This subroutine computes the in situ density of sea water (rho) and the compressibility (drho/dp == C\+\_\+sound$^\wedge$-\/2) at the given salinity, potential temperature, and pressure. 


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


\begin{DoxyCode}{0}
\DoxyCodeLine{284 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{        !< Potential temperature relative to the surface}}
\DoxyCodeLine{285 \textcolor{comment}{                                                 !! [degC].}}
\DoxyCodeLine{286 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{287 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{ !< Pressure [Pa].}}
\DoxyCodeLine{288 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: rho\textcolor{comment}{      !< In situ density [kg m-\/3].}}
\DoxyCodeLine{289 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dp\textcolor{comment}{  !< The partial derivative of density with pressure}}
\DoxyCodeLine{290 \textcolor{comment}{                                                 !! (also the inverse of the square of sound speed)}}
\DoxyCodeLine{291 \textcolor{comment}{                                                 !! [s2 m-\/2].}}
\DoxyCodeLine{292   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{    !< The starting point in the arrays.}}
\DoxyCodeLine{293   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{     !< The number of values to calculate.}}
\DoxyCodeLine{294 }
\DoxyCodeLine{295   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{296 \textcolor{keywordtype}{  real} :: t\_local, t2, t3, t4, t5  \textcolor{comment}{! Temperature to the 1st -\/ 5th power [degC\string^n].}}
\DoxyCodeLine{297 \textcolor{keywordtype}{  real} :: s\_local, s32, s2         \textcolor{comment}{! Salinity to the 1st, 3/2, \& 2nd power [PSU\string^n].}}
\DoxyCodeLine{298 \textcolor{keywordtype}{  real} :: p1, p2          \textcolor{comment}{! Pressure to the 1st \& 2nd power [bar] and [bar2].}}
\DoxyCodeLine{299 \textcolor{keywordtype}{  real} :: rho0            \textcolor{comment}{! Density at 1 bar pressure [kg m-\/3].}}
\DoxyCodeLine{300 \textcolor{keywordtype}{  real} :: ks              \textcolor{comment}{! The secant bulk modulus [bar].}}
\DoxyCodeLine{301 \textcolor{keywordtype}{  real} :: ks\_0, ks\_1, ks\_2}
\DoxyCodeLine{302 \textcolor{keywordtype}{  real} :: dks\_dp       \textcolor{comment}{! The derivative of the secant bulk modulus}}
\DoxyCodeLine{303                        \textcolor{comment}{! with pressure, nondimensional.}}
\DoxyCodeLine{304   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{305 }
\DoxyCodeLine{306   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{307     \textcolor{keywordflow}{if} (s(j) < -\/1.0e-\/10) \textcolor{keywordflow}{then} \textcolor{comment}{!Can we assume safely that this is a missing value?}}
\DoxyCodeLine{308       rho(j) = 1000.0 ; drho\_dp(j) = 0.0}
\DoxyCodeLine{309       cycle}
\DoxyCodeLine{310 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{311 }
\DoxyCodeLine{312     p1 = pressure(j)*1.0e-\/5; p2 = p1*p1}
\DoxyCodeLine{313     t\_local = t(j); t2 = t\_local*t\_local; t3 = t\_local*t2; t4 = t2*t2; t5 = t3*t2}
\DoxyCodeLine{314     s\_local = s(j); s2 = s\_local*s\_local; s32 = s\_local*sqrt(s\_local)}
\DoxyCodeLine{315 }
\DoxyCodeLine{316 \textcolor{comment}{!  Compute rho(s,theta,p=0) -\/ (same as rho(s,t\_insitu,p=0) ).}}
\DoxyCodeLine{317 }
\DoxyCodeLine{318     rho0 = r00 + r10*t\_local + r20*t2 + r30*t3 + r40*t4 + r50*t5 + \&}
\DoxyCodeLine{319            s\_local*(r01 + r11*t\_local + r21*t2 + r31*t3 + r41*t4) + \&}
\DoxyCodeLine{320            s32*(r032 + r132*t\_local + r232*t2) + r02*s2}
\DoxyCodeLine{321 }
\DoxyCodeLine{322 \textcolor{comment}{!  Compute rho(s,theta,p), first calculating the secant bulk modulus.}}
\DoxyCodeLine{323     ks\_0 = s00 + s10*t\_local + s20*t2 + s30*t3 + s40*t4 + \&}
\DoxyCodeLine{324            s\_local*(s01 + s11*t\_local + s21*t2 + s31*t3) + s32*(s032 + s132*t\_local + s232*t2)}
\DoxyCodeLine{325     ks\_1 = sp00 + sp10*t\_local + sp20*t2 + sp30*t3 + \&}
\DoxyCodeLine{326            s\_local*(sp01 + sp11*t\_local + sp21*t2) + sp032*s32}
\DoxyCodeLine{327     ks\_2 = sp000 + sp010*t\_local + sp020*t2 + s\_local*(sp001 + sp011*t\_local + sp021*t2)}
\DoxyCodeLine{328 }
\DoxyCodeLine{329     ks = ks\_0 + p1*ks\_1 + p2*ks\_2}
\DoxyCodeLine{330     dks\_dp = ks\_1 + 2.0*p1*ks\_2}
\DoxyCodeLine{331 }
\DoxyCodeLine{332     rho(j) = rho0*ks / (ks -\/ p1)}
\DoxyCodeLine{333 \textcolor{comment}{! The factor of 1.0e-\/5 is because pressure here is in bars, not Pa.}}
\DoxyCodeLine{334     drho\_dp(j) = 1.0e-\/5 * (rho(j) / (ks -\/ p1)) * (1.0 -\/ dks\_dp*p1/ks)}
\DoxyCodeLine{335 \textcolor{keywordflow}{  enddo}}

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



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{\texttt{ in}}  & {\em t} & potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & salinity \mbox{[}P\+SU\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 82 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.


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

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__unesco_af8666837abadea54c016bf59838f96cc}\label{namespacemom__eos__unesco_af8666837abadea54c016bf59838f96cc}} 
\index{mom\_eos\_unesco@{mom\_eos\_unesco}!calculate\_density\_derivs\_unesco@{calculate\_density\_derivs\_unesco}}
\index{calculate\_density\_derivs\_unesco@{calculate\_density\_derivs\_unesco}!mom\_eos\_unesco@{mom\_eos\_unesco}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_unesco()}{calculate\_density\_derivs\_unesco()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+density\+\_\+derivs\+\_\+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)}]{drho\+\_\+dT,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})}



This subroutine calculates the partial derivatives of density with potential temperature and salinity. 


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


\begin{DoxyCode}{0}
\DoxyCodeLine{213 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{        !< Potential temperature relative to the surface}}
\DoxyCodeLine{214 \textcolor{comment}{                                                 !! [degC].}}
\DoxyCodeLine{215 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{216 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{ !< Pressure [Pa].}}
\DoxyCodeLine{217 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dT\textcolor{comment}{  !< The partial derivative of density with potential}}
\DoxyCodeLine{218 \textcolor{comment}{                                                 !! temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{219 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dS\textcolor{comment}{  !< The partial derivative of density with salinity,}}
\DoxyCodeLine{220 \textcolor{comment}{                                                 !! in [kg m-\/3 PSU-\/1].}}
\DoxyCodeLine{221   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{    !< The starting point in the arrays.}}
\DoxyCodeLine{222   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{     !< The number of values to calculate.}}
\DoxyCodeLine{223 }
\DoxyCodeLine{224   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{225 \textcolor{keywordtype}{  real} :: t\_local, t2, t3, t4, t5  \textcolor{comment}{! Temperature to the 1st -\/ 5th power [degC\string^n].}}
\DoxyCodeLine{226 \textcolor{keywordtype}{  real} :: s12, s\_local, s32, s2    \textcolor{comment}{! Salinity to the 1/2 -\/ 2nd powers [PSU\string^n].}}
\DoxyCodeLine{227 \textcolor{keywordtype}{  real} :: p1, p2          \textcolor{comment}{! Pressure to the 1st \& 2nd power [bar] and [bar2].}}
\DoxyCodeLine{228 \textcolor{keywordtype}{  real} :: rho0            \textcolor{comment}{! Density at 1 bar pressure [kg m-\/3].}}
\DoxyCodeLine{229 \textcolor{keywordtype}{  real} :: ks              \textcolor{comment}{! The secant bulk modulus [bar].}}
\DoxyCodeLine{230 \textcolor{keywordtype}{  real} :: drho0\_dT        \textcolor{comment}{! Derivative of rho0 with T [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{231 \textcolor{keywordtype}{  real} :: drho0\_dS        \textcolor{comment}{! Derivative of rho0 with S [kg m-\/3 PSU-\/1].}}
\DoxyCodeLine{232 \textcolor{keywordtype}{  real} :: dks\_dT          \textcolor{comment}{! Derivative of ks with T [bar degC-\/1].}}
\DoxyCodeLine{233 \textcolor{keywordtype}{  real} :: dks\_dS          \textcolor{comment}{! Derivative of ks with S [bar psu-\/1].}}
\DoxyCodeLine{234 \textcolor{keywordtype}{  real} :: denom           \textcolor{comment}{! 1.0 / (ks -\/ p1) [bar-\/1].}}
\DoxyCodeLine{235   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{236 }
\DoxyCodeLine{237   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{238     \textcolor{keywordflow}{if} (s(j) < -\/1.0e-\/10) \textcolor{keywordflow}{then} \textcolor{comment}{!Can we assume safely that this is a missing value?}}
\DoxyCodeLine{239       drho\_dt(j) = 0.0 ; drho\_ds(j) = 0.0}
\DoxyCodeLine{240       cycle}
\DoxyCodeLine{241 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{242 }
\DoxyCodeLine{243     p1 = pressure(j)*1.0e-\/5; p2 = p1*p1}
\DoxyCodeLine{244     t\_local = t(j); t2 = t\_local*t\_local; t3 = t\_local*t2; t4 = t2*t2; t5 = t3*t2}
\DoxyCodeLine{245     s\_local = s(j); s2 = s\_local*s\_local; s12 = sqrt(s\_local); s32 = s\_local*s12}
\DoxyCodeLine{246 }
\DoxyCodeLine{247 \textcolor{comment}{!       compute rho(s,theta,p=0) -\/ (same as rho(s,t\_insitu,p=0) )}}
\DoxyCodeLine{248 }
\DoxyCodeLine{249     rho0 = r00 + r10*t\_local + r20*t2 + r30*t3 + r40*t4 + r50*t5 + \&}
\DoxyCodeLine{250            s\_local*(r01 + r11*t\_local + r21*t2 + r31*t3 + r41*t4) + \&}
\DoxyCodeLine{251            s32*(r032 + r132*t\_local + r232*t2) + r02*s2}
\DoxyCodeLine{252     drho0\_dt = r10 + 2.0*r20*t\_local + 3.0*r30*t2 + 4.0*r40*t3 + 5.0*r50*t4 + \&}
\DoxyCodeLine{253                s\_local*(r11 + 2.0*r21*t\_local + 3.0*r31*t2 + 4.0*r41*t3) + \&}
\DoxyCodeLine{254                s32*(r132 + 2.0*r232*t\_local)}
\DoxyCodeLine{255     drho0\_ds = (r01 + r11*t\_local + r21*t2 + r31*t3 + r41*t4) + \&}
\DoxyCodeLine{256                1.5*s12*(r032 + r132*t\_local + r232*t2) + 2.0*r02*s\_local}
\DoxyCodeLine{257 }
\DoxyCodeLine{258 \textcolor{comment}{!       compute rho(s,theta,p)}}
\DoxyCodeLine{259 }
\DoxyCodeLine{260     ks = s00 + s10*t\_local + s20*t2 + s30*t3 + s40*t4 + s\_local*(s01 + s11*t\_local + s21*t2 + s31*t3) + \&}
\DoxyCodeLine{261          s32*(s032 + s132*t\_local + s232*t2) + \&}
\DoxyCodeLine{262          p1*(sp00 + sp10*t\_local + sp20*t2 + sp30*t3 + \&}
\DoxyCodeLine{263              s\_local*(sp01 + sp11*t\_local + sp21*t2) + sp032*s32) + \&}
\DoxyCodeLine{264          p2*(sp000 + sp010*t\_local + sp020*t2 + s\_local*(sp001 + sp011*t\_local + sp021*t2))}
\DoxyCodeLine{265     dks\_dt = s10 + 2.0*s20*t\_local + 3.0*s30*t2 + 4.0*s40*t3 + \&}
\DoxyCodeLine{266              s\_local*(s11 + 2.0*s21*t\_local + 3.0*s31*t2) + s32*(s132 + 2.0*s232*t\_local) + \&}
\DoxyCodeLine{267              p1*(sp10 + 2.0*sp20*t\_local + 3.0*sp30*t2 + s\_local*(sp11 + 2.0*sp21*t\_local)) + \&}
\DoxyCodeLine{268              p2*(sp010 + 2.0*sp020*t\_local + s\_local*(sp011 + 2.0*sp021*t\_local))}
\DoxyCodeLine{269     dks\_ds = (s01 + s11*t\_local + s21*t2 + s31*t3) + 1.5*s12*(s032 + s132*t\_local + s232*t2) + \&}
\DoxyCodeLine{270              p1*(sp01 + sp11*t\_local + sp21*t2 + 1.5*sp032*s12) + \&}
\DoxyCodeLine{271              p2*(sp001 + sp011*t\_local + sp021*t2)}
\DoxyCodeLine{272 }
\DoxyCodeLine{273     denom = 1.0 / (ks -\/ p1)}
\DoxyCodeLine{274     drho\_dt(j) = denom*(ks*drho0\_dt -\/ rho0*p1*denom*dks\_dt)}
\DoxyCodeLine{275     drho\_ds(j) = denom*(ks*drho0\_ds -\/ rho0*p1*denom*dks\_ds)}
\DoxyCodeLine{276 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{277 }

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



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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\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 59 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+U\+N\+E\+S\+C\+O.\+F90.


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

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__unesco_ad8670960a4b8e83186468a7a8cfa860c}\label{namespacemom__eos__unesco_ad8670960a4b8e83186468a7a8cfa860c}} 
\index{mom\_eos\_unesco@{mom\_eos\_unesco}!calculate\_spec\_vol\_array\_unesco@{calculate\_spec\_vol\_array\_unesco}}
\index{calculate\_spec\_vol\_array\_unesco@{calculate\_spec\_vol\_array\_unesco}!mom\_eos\_unesco@{mom\_eos\_unesco}}
\doxysubsubsection{\texorpdfstring{calculate\_spec\_vol\_array\_unesco()}{calculate\_spec\_vol\_array\_unesco()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+spec\+\_\+vol\+\_\+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)}]{specvol,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{real, intent(in), optional}]{spv\+\_\+ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine computes the in situ specific volume of sea water (specvol in \mbox{[}m3 kg-\/1\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. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. 


\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{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em specvol} & in situ specific volume \mbox{[}m3 kg-\/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
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{159 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}}
\DoxyCodeLine{160 \textcolor{comment}{                                              !! [degC].}}
\DoxyCodeLine{161 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< salinity [PSU].}}
\DoxyCodeLine{162 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{163 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< in situ specific volume [m3 kg-\/1].}}
\DoxyCodeLine{164   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{165   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{166 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1].}}
\DoxyCodeLine{167 }
\DoxyCodeLine{168   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{169 \textcolor{keywordtype}{  real} :: t\_local, t2, t3, t4, t5  \textcolor{comment}{! Temperature to the 1st -\/ 5th power [degC\string^n].}}
\DoxyCodeLine{170 \textcolor{keywordtype}{  real} :: s\_local, s32, s2         \textcolor{comment}{! Salinity to the 1st, 3/2, \& 2nd power [PSU\string^n].}}
\DoxyCodeLine{171 \textcolor{keywordtype}{  real} :: p1, p2       \textcolor{comment}{! Pressure (in bars) to the 1st and 2nd power [bar] and [bar2].}}
\DoxyCodeLine{172 \textcolor{keywordtype}{  real} :: rho0         \textcolor{comment}{! Density at 1 bar pressure [kg m-\/3].}}
\DoxyCodeLine{173 \textcolor{keywordtype}{  real} :: ks           \textcolor{comment}{! The secant bulk modulus [bar].}}
\DoxyCodeLine{174   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{175 }
\DoxyCodeLine{176   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{177     \textcolor{keywordflow}{if} (s(j) < -\/1.0e-\/10) \textcolor{keywordflow}{then} \textcolor{comment}{!Can we assume safely that this is a missing value?}}
\DoxyCodeLine{178       specvol(j) = 0.001}
\DoxyCodeLine{179       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) specvol(j) = 0.001 -\/ spv\_ref}
\DoxyCodeLine{180       cycle}
\DoxyCodeLine{181 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{182 }
\DoxyCodeLine{183     p1 = pressure(j)*1.0e-\/5; p2 = p1*p1}
\DoxyCodeLine{184     t\_local = t(j); t2 = t\_local*t\_local; t3 = t\_local*t2; t4 = t2*t2; t5 = t3*t2}
\DoxyCodeLine{185     s\_local = s(j); s2 = s\_local*s\_local; s32 = s\_local*sqrt(s\_local)}
\DoxyCodeLine{186 }
\DoxyCodeLine{187 \textcolor{comment}{!  Compute rho(s,theta,p=0) -\/ (same as rho(s,t\_insitu,p=0) ).}}
\DoxyCodeLine{188 }
\DoxyCodeLine{189     rho0 = r00 + r10*t\_local + r20*t2 + r30*t3 + r40*t4 + r50*t5 + \&}
\DoxyCodeLine{190            s\_local*(r01 + r11*t\_local + r21*t2 + r31*t3 + r41*t4) + \&}
\DoxyCodeLine{191            s32*(r032 + r132*t\_local + r232*t2) + r02*s2}
\DoxyCodeLine{192 }
\DoxyCodeLine{193 \textcolor{comment}{!  Compute rho(s,theta,p), first calculating the secant bulk modulus.}}
\DoxyCodeLine{194 }
\DoxyCodeLine{195     ks = s00 + s10*t\_local + s20*t2 + s30*t3 + s40*t4 + s\_local*(s01 + s11*t\_local + s21*t2 + s31*t3) + \&}
\DoxyCodeLine{196          s32*(s032 + s132*t\_local + s232*t2) + \&}
\DoxyCodeLine{197          p1*(sp00 + sp10*t\_local + sp20*t2 + sp30*t3 + \&}
\DoxyCodeLine{198              s\_local*(sp01 + sp11*t\_local + sp21*t2) + sp032*s32) + \&}
\DoxyCodeLine{199          p2*(sp000 + sp010*t\_local + sp020*t2 + s\_local*(sp001 + sp011*t\_local + sp021*t2))}
\DoxyCodeLine{200 }
\DoxyCodeLine{201     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{202       specvol(j) = (ks*(1.0 -\/ (rho0*spv\_ref)) -\/ p1) / (rho0*ks)}
\DoxyCodeLine{203     \textcolor{keywordflow}{else}}
\DoxyCodeLine{204       specvol(j) = (ks -\/ p1) / (rho0*ks)}
\DoxyCodeLine{205 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{206 \textcolor{keywordflow}{  enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__unesco_a79b131a4287b138ebf37883d60b334be}\label{namespacemom__eos__unesco_a79b131a4287b138ebf37883d60b334be}} 
\index{mom\_eos\_unesco@{mom\_eos\_unesco}!calculate\_spec\_vol\_scalar\_unesco@{calculate\_spec\_vol\_scalar\_unesco}}
\index{calculate\_spec\_vol\_scalar\_unesco@{calculate\_spec\_vol\_scalar\_unesco}!mom\_eos\_unesco@{mom\_eos\_unesco}}
\doxysubsubsection{\texorpdfstring{calculate\_spec\_vol\_scalar\_unesco()}{calculate\_spec\_vol\_scalar\_unesco()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+unesco\+::calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+unesco (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{specvol,  }\item[{real, intent(in), optional}]{spv\+\_\+ref }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine computes the in situ specific volume of sea water (specvol in \mbox{[}m3 kg-\/1\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. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. 


\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{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em specvol} & in situ specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{138 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}}
\DoxyCodeLine{139 \textcolor{comment}{                                          !! [degC].}}
\DoxyCodeLine{140 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< salinity [PSU].}}
\DoxyCodeLine{141 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{142 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< in situ specific volume [m3 kg-\/1].}}
\DoxyCodeLine{143 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1].}}
\DoxyCodeLine{144 }
\DoxyCodeLine{145   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{146 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, pressure0, spv0}
\DoxyCodeLine{147 }
\DoxyCodeLine{148   t0(1) = t ; s0(1) = s ; pressure0(1) = pressure}
\DoxyCodeLine{149 }
\DoxyCodeLine{150   \textcolor{keyword}{call }calculate\_spec\_vol\_array\_unesco(t0, s0, pressure0, spv0, 1, 1, spv\_ref)}
\DoxyCodeLine{151   specvol = spv0(1)}

\end{DoxyCode}
