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


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


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