\hypertarget{interfacemom__eos__wright_1_1calculate__density__wright}{}\section{mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+wright Interface Reference}
\label{interfacemom__eos__wright_1_1calculate__density__wright}\index{mom\_eos\_wright::calculate\_density\_wright@{mom\_eos\_wright::calculate\_density\_wright}}


\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 (in psu), potential temperature (in deg C), and pressure \mbox{[}Pa\mbox{]}, using the expressions from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. 

Definition at line 32 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+Wright.\+F90.

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__eos__wright_1_1calculate__density__wright_a762d3751649104d3820a71780bcfa6ce}{calculate\+\_\+density\+\_\+scalar\+\_\+wright}} (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{]}. It uses the expression from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__eos__wright_1_1calculate__density__wright_a018d5615700bde973da4970d14e6c960}{calculate\+\_\+density\+\_\+array\+\_\+wright}} (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{]}. It uses the expression from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. \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 (in psu), potential temperature (in deg C), and pressure \mbox{[}Pa\mbox{]}, using the expressions from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. 

Definition at line 32 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+Wright.\+F90.



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__eos__wright_1_1calculate__density__wright_a018d5615700bde973da4970d14e6c960}\label{interfacemom__eos__wright_1_1calculate__density__wright_a018d5615700bde973da4970d14e6c960}} 
\index{mom\_eos\_wright::calculate\_density\_wright@{mom\_eos\_wright::calculate\_density\_wright}!calculate\_density\_array\_wright@{calculate\_density\_array\_wright}}
\index{calculate\_density\_array\_wright@{calculate\_density\_array\_wright}!mom\_eos\_wright::calculate\_density\_wright@{mom\_eos\_wright::calculate\_density\_wright}}
\subsubsection{\texorpdfstring{calculate\_density\_array\_wright()}{calculate\_density\_array\_wright()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+wright\+::calculate\+\_\+density\+\_\+array\+\_\+wright (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{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{]}. It uses the expression from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. 


\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{ in,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 111 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+Wright.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{111 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< potential temperature relative to the surface [degC].}}
\DoxyCodeLine{112 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< salinity [PSU].}}
\DoxyCodeLine{113 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{114 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< in situ density [kg m-3].}}
\DoxyCodeLine{115   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{116   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{117 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}}
\DoxyCodeLine{118 }
\DoxyCodeLine{119   \textcolor{comment}{! Original coded by R. Hallberg, 7/00, anomaly coded in 3/18.}}
\DoxyCodeLine{120   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{121 \textcolor{keywordtype}{  real} :: al0, p0, lambda}
\DoxyCodeLine{122 \textcolor{keywordtype}{  real} :: al\_TS, p\_TSp, lam\_TS, pa\_000}
\DoxyCodeLine{123   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{124 }
\DoxyCodeLine{125   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) pa\_000 = (b0*(1.0 - a0*rho\_ref) - rho\_ref*c0)}
\DoxyCodeLine{126   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-1}
\DoxyCodeLine{127     al\_ts = a1*t(j) +a2*s(j)}
\DoxyCodeLine{128     al0 = a0 + al\_ts}
\DoxyCodeLine{129     p\_tsp = pressure(j) + (b4*s(j) + t(j) * (b1 + (t(j)*(b2 + b3*t(j)) + b5*s(j))))}
\DoxyCodeLine{130     lam\_ts = c4*s(j) + t(j) * (c1 + (t(j)*(c2 + c3*t(j)) + c5*s(j)))}
\DoxyCodeLine{131 }
\DoxyCodeLine{132     \textcolor{comment}{! The following two expressions are mathematically equivalent.}}
\DoxyCodeLine{133     \textcolor{comment}{! rho(j) = (b0 + p0\_TSp) / ((c0 + lam\_TS) + al0*(b0 + p0\_TSp)) - rho\_ref}}
\DoxyCodeLine{134     rho(j) = (pa\_000 + (p\_tsp - rho\_ref*(p\_tsp*al0 + (b0*al\_ts + lam\_ts)))) / \&}
\DoxyCodeLine{135              ( (c0 + lam\_ts) + al0*(b0 + p\_tsp) )}
\DoxyCodeLine{136 \textcolor{keywordflow}{  enddo} ; \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{do} j=start,start+npts-1}
\DoxyCodeLine{137     al0 = (a0 + a1*t(j)) +a2*s(j)}
\DoxyCodeLine{138     p0 = (b0 + b4*s(j)) + t(j) * (b1 + t(j)*(b2 + b3*t(j)) + b5*s(j))}
\DoxyCodeLine{139     lambda = (c0 +c4*s(j)) + t(j) * (c1 + t(j)*(c2 + c3*t(j)) + c5*s(j))}
\DoxyCodeLine{140     rho(j) = (pressure(j) + p0) / (lambda + al0*(pressure(j) + p0))}
\DoxyCodeLine{141 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{142 }

\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__eos__wright_1_1calculate__density__wright_a762d3751649104d3820a71780bcfa6ce}\label{interfacemom__eos__wright_1_1calculate__density__wright_a762d3751649104d3820a71780bcfa6ce}} 
\index{mom\_eos\_wright::calculate\_density\_wright@{mom\_eos\_wright::calculate\_density\_wright}!calculate\_density\_scalar\_wright@{calculate\_density\_scalar\_wright}}
\index{calculate\_density\_scalar\_wright@{calculate\_density\_scalar\_wright}!mom\_eos\_wright::calculate\_density\_wright@{mom\_eos\_wright::calculate\_density\_wright}}
\subsubsection{\texorpdfstring{calculate\_density\_scalar\_wright()}{calculate\_density\_scalar\_wright()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+wright\+::calculate\+\_\+density\+\_\+scalar\+\_\+wright (\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{]}. It uses the expression from Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-\/740. 


\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 81 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+\+Wright.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{81 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature relative to the surface [degC].}}
\DoxyCodeLine{82 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{83 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{84 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< In situ density [kg m-3].}}
\DoxyCodeLine{85 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}}
\DoxyCodeLine{86 }
\DoxyCodeLine{87 \textcolor{comment}{! *====================================================================*}}
\DoxyCodeLine{88 \textcolor{comment}{! *  This subroutine computes the in situ density of sea water (rho in *}}
\DoxyCodeLine{89 \textcolor{comment}{! *  [kg m-3]) from salinity (S [PSU]), potential temperature  *}}
\DoxyCodeLine{90 \textcolor{comment}{! *  (T [degC]), and pressure [Pa].  It uses the expression from    *}}
\DoxyCodeLine{91 \textcolor{comment}{! *  Wright, 1997, J. Atmos. Ocean. Tech., 14, 735-740.                *}}
\DoxyCodeLine{92 \textcolor{comment}{! *  Coded by R. Hallberg, 7/00                                        *}}
\DoxyCodeLine{93 \textcolor{comment}{! *====================================================================*}}
\DoxyCodeLine{94 }
\DoxyCodeLine{95 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, pressure0, rho0}
\DoxyCodeLine{96 }
\DoxyCodeLine{97   t0(1) = t}
\DoxyCodeLine{98   s0(1) = s}
\DoxyCodeLine{99   pressure0(1) = pressure}
\DoxyCodeLine{100 }
\DoxyCodeLine{101   \textcolor{keyword}{call }calculate\_density\_array\_wright(t0, s0, pressure0, rho0, 1, 1, rho\_ref)}
\DoxyCodeLine{102   rho = rho0(1)}
\DoxyCodeLine{103 }

\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\+\_\+\+Wright.\+F90\end{DoxyCompactItemize}
