\hypertarget{namespacemom__eos__linear}{}\section{mom\+\_\+eos\+\_\+linear Module Reference}
\label{namespacemom__eos__linear}\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}


\subsection{Detailed Description}
A simple linear equation of state for sea water with constant coefficients. \subsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\hyperlink{interfacemom__eos__linear_1_1calculate__density__derivs__linear}{calculate\+\_\+density\+\_\+derivs\+\_\+linear}}
\begin{DoxyCompactList}\small\item\em For a given thermodynamic state, return the derivatives of density with temperature and salinity using the simple linear equation of state. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos__linear_1_1calculate__density__linear}{calculate\+\_\+density\+\_\+linear}}
\begin{DoxyCompactList}\small\item\em Compute the density of sea water (in kg/m$^\wedge$3), or its anomaly from a reference density, using a simple linear equation of state from salinity (in psu), potential temperature (in deg C) and pressure \mbox{[}Pa\mbox{]}. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos__linear_1_1calculate__density__second__derivs__linear}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+linear}}
\begin{DoxyCompactList}\small\item\em For a given thermodynamic state, return the second derivatives of density with various combinations of temperature, salinity, and pressure. Note that with a simple linear equation of state these second derivatives are all 0. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos__linear_1_1calculate__spec__vol__linear}{calculate\+\_\+spec\+\_\+vol\+\_\+linear}}
\begin{DoxyCompactList}\small\item\em Compute the specific volume of sea water (in m$^\wedge$3/kg), or its anomaly from a reference value, using a simple linear equation of state from salinity (in psu), potential temperature (in deg C) and pressure \mbox{[}Pa\mbox{]}. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_a39e8258b3b0ddd5d176061b48a151648}{calculate\+\_\+density\+\_\+scalar\+\_\+linear}} (T, S, pressure, rho, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, rho\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the density of sea water with a trivial linear equation of state (in \mbox{[}kg m-\/3\mbox{]}) from salinity (sal \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_ae31468c3395f4bade9a2ca58ccfc83a0}{calculate\+\_\+density\+\_\+array\+\_\+linear}} (T, S, pressure, rho, start, npts, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, rho\+\_\+ref)
\begin{DoxyCompactList}\small\item\em This subroutine computes the density of sea water with a trivial linear equation of state (in kg/m$^\wedge$3) from salinity (sal in psu), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__linear_a64c38d475860e8ae042d221af8d7195a}{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear}} (T, S, pressure, specvol, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, 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 a trivial linear equation of state for density. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__linear_ab3b2951f265e375bd27a2eace7a91a87}{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear}} (T, S, pressure, specvol, start, npts, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, 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 a trivial linear equation of state for density. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__linear_a366576999aae16f01b503a5aca78353e}{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear}} (T, S, pressure, drho\+\_\+d\+T\+\_\+out, drho\+\_\+d\+S\+\_\+out, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, start, npts)
\begin{DoxyCompactList}\small\item\em This subroutine calculates the partial derivatives of density $\ast$ with potential temperature and salinity. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_a1f03feeee904430da4980f23e59a992b}{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear}} (T, S, pressure, drho\+\_\+d\+T\+\_\+out, drho\+\_\+d\+S\+\_\+out, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS)
\begin{DoxyCompactList}\small\item\em This subroutine calculates the partial derivatives of density $\ast$ with potential temperature and salinity for a single point. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__linear_a80a174894f52db0aa1cdb2b267d70e76}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear}} (T, S, pressure, drho\+\_\+d\+S\+\_\+dS, drho\+\_\+d\+S\+\_\+dT, drho\+\_\+d\+T\+\_\+dT, drho\+\_\+d\+S\+\_\+dP, drho\+\_\+d\+T\+\_\+dP)
\begin{DoxyCompactList}\small\item\em This subroutine calculates the five, partial second derivatives of density w.\+r.\+t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos__linear_adb222e7164a10bf7ce8e30d22a58ba46}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear}} (T, S, pressure, drho\+\_\+d\+S\+\_\+dS, drho\+\_\+d\+S\+\_\+dT, drho\+\_\+d\+T\+\_\+dT, drho\+\_\+d\+S\+\_\+dP, drho\+\_\+d\+T\+\_\+dP, start, npts)
\begin{DoxyCompactList}\small\item\em This subroutine calculates the five, partial second derivatives of density w.\+r.\+t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_ac104dedf6f20ab794c2c430462ace217}{calculate\+\_\+specvol\+\_\+derivs\+\_\+linear}} (T, S, pressure, d\+S\+V\+\_\+dT, d\+S\+V\+\_\+dS, start, npts, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS)
\begin{DoxyCompactList}\small\item\em Calculate the derivatives of specific volume with temperature and salinity. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_a2d051ebfb3ee1ef96888c74c09a1a6ca}{calculate\+\_\+compress\+\_\+linear}} (T, S, pressure, rho, drho\+\_\+dp, start, npts, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS)
\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}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_a4da51fc5de5654041e08fb43a8b0283c}{int\+\_\+density\+\_\+dz\+\_\+linear}} (T, S, z\+\_\+t, z\+\_\+b, rho\+\_\+ref, rho\+\_\+0\+\_\+pres, G\+\_\+e, HI, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, dpa, intz\+\_\+dpa, intx\+\_\+dpa, inty\+\_\+dpa, bathyT, dz\+\_\+neglect, use\+Mass\+Wght\+Interp)
\begin{DoxyCompactList}\small\item\em This subroutine calculates analytical and nearly-\/analytical integrals of pressure anomalies across layers, which are required for calculating the finite-\/volume form pressure accelerations in a Boussinesq model. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos__linear_ac9a31e315e6cb02f8f270de7c877f688}{int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear}} (T, S, p\+\_\+t, p\+\_\+b, alpha\+\_\+ref, HI, Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, dza, intp\+\_\+dza, intx\+\_\+dza, inty\+\_\+dza, halo\+\_\+size, bathyP, d\+P\+\_\+neglect, use\+Mass\+Wght\+Interp)
\begin{DoxyCompactList}\small\item\em Calculates analytical and nearly-\/analytical integrals in pressure across layers of geopotential anomalies, which are required for calculating the finite-\/volume form pressure accelerations in a non-\/\+Boussinesq model. Specific volume is assumed to vary linearly between adjacent points. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__eos__linear_a2d051ebfb3ee1ef96888c74c09a1a6ca}\label{namespacemom__eos__linear_a2d051ebfb3ee1ef96888c74c09a1a6ca}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+compress\+\_\+linear@{calculate\+\_\+compress\+\_\+linear}}
\index{calculate\+\_\+compress\+\_\+linear@{calculate\+\_\+compress\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+compress\+\_\+linear()}{calculate\_compress\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+compress\+\_\+linear (\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,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS }\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{\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 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{\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\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 301 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
301   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{         !< Potential temperature relative to the surface}
302 \textcolor{comment}{                                                  !! [degC].}
303   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{         !< Salinity [PSU].}
304   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{  !< pressure [Pa].}
305   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: rho\textcolor{comment}{       !< In situ density [kg m-3].}
306   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dp\textcolor{comment}{   !< The partial derivative of density with pressure}
307 \textcolor{comment}{                                                  !! (also the inverse of the square of sound speed)}
308 \textcolor{comment}{                                                  !! [s2 m-2].}
309   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{     !< The starting point in the arrays.}
310   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{      !< The number of values to calculate.}
311   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
312   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{   !< The derivative of density with}
313 \textcolor{comment}{                                                  !! temperature [kg m-3 degC-1].}
314   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{   !< The derivative of density with}
315 \textcolor{comment}{                                                  !! salinity [kg m-3 ppt-1].}
316   \textcolor{comment}{!  Local variables}
317   \textcolor{keywordtype}{integer} :: j
318 
319   \textcolor{keywordflow}{do} j=start,start+npts-1
320     rho(j) = rho\_t0\_s0 + drho\_dt*t(j) + drho\_ds*s(j)
321     drho\_dp(j) = 0.0
322 \textcolor{keywordflow}{  enddo}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_ae31468c3395f4bade9a2ca58ccfc83a0}\label{namespacemom__eos__linear_ae31468c3395f4bade9a2ca58ccfc83a0}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+array\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+array\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+array\+\_\+linear()}{calculate\_density\_array\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+array\+\_\+linear (\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)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref }\end{DoxyParamCaption})}



This subroutine computes the density of sea water with a trivial linear equation of state (in kg/m$^\wedge$3) from salinity (sal in psu), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. 


\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\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivatives of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt 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\+\_\+linear.\+F90.


\begin{DoxyCode}
82   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface [degC].}
83   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< salinity [PSU].}
84   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}
85   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< in situ density [kg m-3].}
86   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}
87   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}
88   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
89   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature}
90 \textcolor{comment}{                                              !! [kg m-3 degC-1].}
91   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity}
92 \textcolor{comment}{                                              !! in [kg m-3 ppt-1].}
93   \textcolor{keywordtype}{real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}
94   \textcolor{comment}{! Local variables}
95   \textcolor{keywordtype}{integer} :: j
96 
97   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-1
98     rho(j) = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t(j) + drho\_ds*s(j))
99 \textcolor{keywordflow}{  enddo} ; \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{do} j=start,start+npts-1
100     rho(j) = rho\_t0\_s0 + drho\_dt*t(j) + drho\_ds*s(j)
101 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}
102 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a366576999aae16f01b503a5aca78353e}\label{namespacemom__eos__linear_a366576999aae16f01b503a5aca78353e}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear()}{calculate\_density\_derivs\_array\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+derivs\+\_\+array\+\_\+linear (\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\+\_\+d\+T\+\_\+out,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+d\+S\+\_\+out,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



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


\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 drho\+\_\+dt\+\_\+out} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds\+\_\+out} & The partial derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivative of density with salinity \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 165 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
165   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{           !< Potential temperature relative to the surface}
166 \textcolor{comment}{                                                    !! [degC].}
167   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{           !< Salinity [PSU].}
168   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{    !< Pressure [Pa].}
169   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dT\_out\textcolor{comment}{ !< The partial derivative of density with}
170 \textcolor{comment}{                                                    !! potential temperature [kg m-3 degC-1].}
171   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dS\_out\textcolor{comment}{ !< The partial derivative of density with}
172 \textcolor{comment}{                                                    !! salinity [kg m-3 ppt-1].}
173   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{   !< The density at T=0, S=0 [kg m-3].}
174   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{     !< The derivative of density with temperature [kg m-3
       degC-1].}
175   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{     !< The derivative of density with salinity [kg m-3
       ppt-1].}
176   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{       !< The starting point in the arrays.}
177   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{        !< The number of values to calculate.}
178   \textcolor{comment}{! Local variables}
179   \textcolor{keywordtype}{integer} :: j
180 
181   \textcolor{keywordflow}{do} j=start,start+npts-1
182     drho\_dt\_out(j) = drho\_dt
183     drho\_ds\_out(j) = drho\_ds
184 \textcolor{keywordflow}{  enddo}
185 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a1f03feeee904430da4980f23e59a992b}\label{namespacemom__eos__linear_a1f03feeee904430da4980f23e59a992b}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear()}{calculate\_density\_derivs\_scalar\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+derivs\+\_\+scalar\+\_\+linear (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{drho\+\_\+d\+T\+\_\+out,  }\item[{real, intent(out)}]{drho\+\_\+d\+S\+\_\+out,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS }\end{DoxyParamCaption})}



This subroutine calculates the partial derivatives of density $\ast$ with potential temperature and salinity for a single point. 


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


Definition at line 192 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
192   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface}
193 \textcolor{comment}{                                      !! [degC].}
194   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}
195   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}
196   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)} :: drho\_dT\_out\textcolor{comment}{ !< The partial derivative of density with}
197 \textcolor{comment}{                                      !! potential temperature [kg m-3 degC-1].}
198   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)} :: drho\_dS\_out\textcolor{comment}{ !< The partial derivative of density with}
199 \textcolor{comment}{                                      !! salinity [kg m-3 ppt-1].}
200   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{   !< The density at T=0, S=0 [kg m-3].}
201   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{     !< The derivatives of density with temperature [kg m-3 degC-1].}
202   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{     !< The derivatives of density with salinity [kg m-3 ppt-1].}
203   drho\_dt\_out = drho\_dt
204   drho\_ds\_out = drho\_ds
205 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a39e8258b3b0ddd5d176061b48a151648}\label{namespacemom__eos__linear_a39e8258b3b0ddd5d176061b48a151648}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+scalar\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+scalar\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+scalar\+\_\+linear()}{calculate\_density\_scalar\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+scalar\+\_\+linear (\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)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref }\end{DoxyParamCaption})}



This subroutine computes the density of sea water with a trivial linear equation of state (in \mbox{[}kg m-\/3\mbox{]}) from salinity (sal \mbox{[}P\+SU\mbox{]}), potential temperature (T \mbox{[}degC\mbox{]}), and pressure \mbox{[}Pa\mbox{]}. 


\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\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivatives of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 58 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
58   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature relative to the surface [degC].}
59   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}
60   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}
61   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< In situ density [kg m-3].}
62   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
63   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature}
64 \textcolor{comment}{                                          !! [kg m-3 degC-1].}
65   \textcolor{keywordtype}{real},           \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity}
66 \textcolor{comment}{                                          !! in [kg m-3 ppt-1].}
67   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-3].}
68 
69   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then}
70     rho = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t + drho\_ds*s)
71   \textcolor{keywordflow}{else}
72     rho = rho\_t0\_s0 + drho\_dt*t + drho\_ds*s
73 \textcolor{keywordflow}{  endif}
74 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_adb222e7164a10bf7ce8e30d22a58ba46}\label{namespacemom__eos__linear_adb222e7164a10bf7ce8e30d22a58ba46}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear()}{calculate\_density\_second\_derivs\_array\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+linear (\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\+\_\+d\+S\+\_\+dS,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+d\+S\+\_\+dT,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+d\+T\+\_\+dT,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+d\+S\+\_\+dP,  }\item[{real, dimension(\+:), intent(out)}]{drho\+\_\+d\+T\+\_\+dP,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine calculates the five, partial second derivatives of density w.\+r.\+t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. 


\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 drho\+\_\+ds\+\_\+ds} & The second derivative of density with salinity \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds\+\_\+dt} & The second derivative of density with temperature and salinity \mbox{[}kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+dt\+\_\+dt} & The second derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds\+\_\+dp} & The second derivative of density with salinity and pressure \mbox{[}kg m-\/3 P\+S\+U-\/1 Pa-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+dt\+\_\+dp} & The second derivative of density with temperature and pressure \mbox{[}kg m-\/3 deg\+C-\/1 Pa-\/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 238 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
238   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface [degC].}
239   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}
240   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}
241   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dS\textcolor{comment}{  !< The second derivative of density with}
242 \textcolor{comment}{                                                 !! salinity [kg m-3 PSU-2].}
243   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dT\textcolor{comment}{  !< The second derivative of density with}
244 \textcolor{comment}{                                                 !! temperature and salinity [kg m-3 ppt-1 degC-1].}
245   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dT\textcolor{comment}{  !< The second derivative of density with}
246 \textcolor{comment}{                                                 !! temperature [kg m-3 degC-2].}
247   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dP\textcolor{comment}{  !< The second derivative of density with}
248 \textcolor{comment}{                                                 !! salinity and pressure [kg m-3 PSU-1 Pa-1].}
249   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dP\textcolor{comment}{  !< The second derivative of density with}
250 \textcolor{comment}{                                                 !! temperature and pressure [kg m-3 degC-1 Pa-1].}
251   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{       !< The starting point in the arrays.}
252   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{        !< The number of values to calculate.}
253   \textcolor{comment}{! Local variables}
254   \textcolor{keywordtype}{integer} :: j
255   \textcolor{keywordflow}{do} j=start,start+npts-1
256     drho\_ds\_ds(j) = 0.
257     drho\_ds\_dt(j) = 0.
258     drho\_dt\_dt(j) = 0.
259     drho\_ds\_dp(j) = 0.
260     drho\_dt\_dp(j) = 0.
261 \textcolor{keywordflow}{  enddo}
262 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a80a174894f52db0aa1cdb2b267d70e76}\label{namespacemom__eos__linear_a80a174894f52db0aa1cdb2b267d70e76}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear}}
\index{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear()}{calculate\_density\_second\_derivs\_scalar\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+linear (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{drho\+\_\+d\+S\+\_\+dS,  }\item[{real, intent(out)}]{drho\+\_\+d\+S\+\_\+dT,  }\item[{real, intent(out)}]{drho\+\_\+d\+T\+\_\+dT,  }\item[{real, intent(out)}]{drho\+\_\+d\+S\+\_\+dP,  }\item[{real, intent(out)}]{drho\+\_\+d\+T\+\_\+dP }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



This subroutine calculates the five, partial second derivatives of density w.\+r.\+t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. 


\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 drho\+\_\+ds\+\_\+ds} & The second derivative of density with salinity \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds\+\_\+dt} & The second derivative of density with temperature and salinity \mbox{[}kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+dt\+\_\+dt} & The second derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+ds\+\_\+dp} & The second derivative of density with salinity and pressure \mbox{[}kg m-\/3 P\+S\+U-\/1 Pa-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em drho\+\_\+dt\+\_\+dp} & The second derivative of density with temperature and pressure \mbox{[}kg m-\/3 deg\+C-\/1 Pa-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 212 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
212   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface [degC].}
213   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}
214   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}
215   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dS\textcolor{comment}{  !< The second derivative of density with}
216 \textcolor{comment}{                                   !! salinity [kg m-3 PSU-2].}
217   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dT\textcolor{comment}{  !< The second derivative of density with}
218 \textcolor{comment}{                                   !! temperature and salinity [kg m-3 ppt-1 degC-1].}
219   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dT\textcolor{comment}{  !< The second derivative of density with}
220 \textcolor{comment}{                                   !! temperature [kg m-3 degC-2].}
221   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dP\textcolor{comment}{  !< The second derivative of density with}
222 \textcolor{comment}{                                   !! salinity and pressure [kg m-3 PSU-1 Pa-1].}
223   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dP\textcolor{comment}{  !< The second derivative of density with}
224 \textcolor{comment}{                                   !! temperature and pressure [kg m-3 degC-1 Pa-1].}
225 
226   drho\_ds\_ds = 0.
227   drho\_ds\_dt = 0.
228   drho\_dt\_dt = 0.
229   drho\_ds\_dp = 0.
230   drho\_dt\_dp = 0.
231 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_ab3b2951f265e375bd27a2eace7a91a87}\label{namespacemom__eos__linear_ab3b2951f265e375bd27a2eace7a91a87}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear@{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear}}
\index{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear@{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear()}{calculate\_spec\_vol\_array\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+spec\+\_\+vol\+\_\+array\+\_\+linear (\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)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\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 a trivial linear equation of state for density. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. 


\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 specvol} & in situ specific volume \mbox{[}m3 kg-\/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
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivatives of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 138 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
138   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}
139 \textcolor{comment}{                                              !! [degC].}
140   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}
141   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa].}
142   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< in situ specific volume [m3 kg-1].}
143   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}
144   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}
145   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
146   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature [kg m-3
       degC-1].}
147   \textcolor{keywordtype}{real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity [kg m-3 ppt-1].}
148   \textcolor{keywordtype}{real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-1].}
149   \textcolor{comment}{! Local variables}
150   \textcolor{keywordtype}{integer} :: j
151 
152   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-1
153     specvol(j) = ((1.0 - rho\_t0\_s0*spv\_ref) + spv\_ref*(drho\_dt*t(j) + drho\_ds*s(j))) / &
154                  ( rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))
155 \textcolor{keywordflow}{  enddo} ; \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{do} j=start,start+npts-1
156     specvol(j) = 1.0 / ( rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))
157 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}
158 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a64c38d475860e8ae042d221af8d7195a}\label{namespacemom__eos__linear_a64c38d475860e8ae042d221af8d7195a}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear@{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear}}
\index{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear@{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear()}{calculate\_spec\_vol\_scalar\_linear()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+spec\+\_\+vol\+\_\+scalar\+\_\+linear (\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)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\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 a trivial linear equation of state for density. If spv\+\_\+ref is present, specvol is an anomaly from spv\+\_\+ref. 


\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 specvol} & In situ specific volume \mbox{[}m3 kg-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivatives of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


Definition at line 111 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
111   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}
112 \textcolor{comment}{                                   !! [degC].}
113   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}
114   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa].}
115   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< In situ specific volume [m3 kg-1].}
116   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
117   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature [kg m-3 degC-1].}
118   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity [kg m-3 ppt-1].}
119   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-1].}
120   \textcolor{comment}{! Local variables}
121   \textcolor{keywordtype}{integer} :: j
122 
123   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then}
124     specvol = ((1.0 - rho\_t0\_s0*spv\_ref) + spv\_ref*(drho\_dt*t + drho\_ds*s)) / &
125              ( rho\_t0\_s0 + (drho\_dt*t + drho\_ds*s))
126   \textcolor{keywordflow}{else}
127     specvol = 1.0 / ( rho\_t0\_s0 + (drho\_dt*t + drho\_ds*s))
128 \textcolor{keywordflow}{  endif}
129 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_ac104dedf6f20ab794c2c430462ace217}\label{namespacemom__eos__linear_ac104dedf6f20ab794c2c430462ace217}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!calculate\+\_\+specvol\+\_\+derivs\+\_\+linear@{calculate\+\_\+specvol\+\_\+derivs\+\_\+linear}}
\index{calculate\+\_\+specvol\+\_\+derivs\+\_\+linear@{calculate\+\_\+specvol\+\_\+derivs\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{calculate\+\_\+specvol\+\_\+derivs\+\_\+linear()}{calculate\_specvol\_derivs\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::calculate\+\_\+specvol\+\_\+derivs\+\_\+linear (\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)}]{d\+S\+V\+\_\+dT,  }\item[{real, dimension(\+:), intent(out)}]{d\+S\+V\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS }\end{DoxyParamCaption})}



Calculate the derivatives of specific volume with temperature and salinity. 


\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 dsv\+\_\+ds} & The partial derivative of specific volume with salinity \mbox{[}m3 kg-\/1 P\+S\+U-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em dsv\+\_\+dt} & The partial derivative of specific volume with potential temperature \mbox{[}m3 kg-\/1 deg\+C-\/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
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivative of density with temperature, \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}
268   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{         !< Potential temperature relative to the surface}
269 \textcolor{comment}{                                                  !! [degC].}
270   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{         !< Salinity [PSU].}
271   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{  !< pressure [Pa].}
272   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: dSV\_dS\textcolor{comment}{    !< The partial derivative of specific volume with}
273 \textcolor{comment}{                                                  !! salinity [m3 kg-1 PSU-1].}
274   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: dSV\_dT\textcolor{comment}{    !< The partial derivative of specific volume with}
275 \textcolor{comment}{                                                  !! potential temperature [m3 kg-1 degC-1].}
276   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{     !< The starting point in the arrays.}
277   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{      !< The number of values to calculate.}
278   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-3].}
279   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{   !< The derivative of density with}
280 \textcolor{comment}{                                                  !! temperature, [kg m-3 degC-1].}
281   \textcolor{keywordtype}{real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{   !< The derivative of density with}
282 \textcolor{comment}{                                                  !! salinity [kg m-3 ppt-1].}
283   \textcolor{comment}{! Local variables}
284   \textcolor{keywordtype}{real} :: I\_rho2
285   \textcolor{keywordtype}{integer} :: j
286 
287   \textcolor{keywordflow}{do} j=start,start+npts-1
288     \textcolor{comment}{! Sv = 1.0 / (Rho\_T0\_S0 + dRho\_dT*T(j) + dRho\_dS*S(j))}
289     i\_rho2 = 1.0 / (rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))**2
290     dsv\_dt(j) = -drho\_dt * i\_rho2
291     dsv\_ds(j) = -drho\_ds * i\_rho2
292 \textcolor{keywordflow}{  enddo}
293 
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_a4da51fc5de5654041e08fb43a8b0283c}\label{namespacemom__eos__linear_a4da51fc5de5654041e08fb43a8b0283c}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!int\+\_\+density\+\_\+dz\+\_\+linear@{int\+\_\+density\+\_\+dz\+\_\+linear}}
\index{int\+\_\+density\+\_\+dz\+\_\+linear@{int\+\_\+density\+\_\+dz\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{int\+\_\+density\+\_\+dz\+\_\+linear()}{int\_density\_dz\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::int\+\_\+density\+\_\+dz\+\_\+linear (\begin{DoxyParamCaption}\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{T,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{S,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{z\+\_\+t,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{z\+\_\+b,  }\item[{real, intent(in)}]{rho\+\_\+ref,  }\item[{real, intent(in)}]{rho\+\_\+0\+\_\+pres,  }\item[{real, intent(in)}]{G\+\_\+e,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(out)}]{dpa,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(out), optional}]{intz\+\_\+dpa,  }\item[{real, dimension(hi\%isdb\+:hi\%iedb,hi\%jsd\+:hi\%jed), intent(out), optional}]{intx\+\_\+dpa,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsdb\+:hi\%jedb), intent(out), optional}]{inty\+\_\+dpa,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in), optional}]{bathyT,  }\item[{real, intent(in), optional}]{dz\+\_\+neglect,  }\item[{logical, intent(in), optional}]{use\+Mass\+Wght\+Interp }\end{DoxyParamCaption})}



This subroutine calculates analytical and nearly-\/analytical integrals of pressure anomalies across layers, which are required for calculating the finite-\/volume form pressure accelerations in a Boussinesq model. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em hi} & The horizontal index type for the arrays.\\
\hline
\mbox{\tt in}  & {\em t} & Potential temperature relative to the surface\\
\hline
\mbox{\tt in}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em z\+\_\+t} & Height at the top of the layer in depth units \mbox{[}Z $\sim$$>$ m\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em z\+\_\+b} & Height at the top of the layer \mbox{[}Z $\sim$$>$ m\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+ref} & A mean density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} or \mbox{[}kg m-\/3\mbox{]}, that is subtracted out to reduce the magnitude of each of the integrals.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+0\+\_\+pres} & A density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]}, used to calculate the pressure (as p$\sim$=-\/z$\ast$rho\+\_\+0\+\_\+pres$\ast$\+G\+\_\+e) used in the equation of state. rho\+\_\+0\+\_\+pres is not used.\\
\hline
\mbox{\tt in}  & {\em g\+\_\+e} & The Earth\textquotesingle{}s gravitational acceleration \mbox{[}L2 Z-\/1 T-\/2 $\sim$$>$ m s-\/2\mbox{]} or \mbox{[}m2 Z-\/1 s-\/2 $\sim$$>$ m s-\/2\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} or \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivative of density with temperature, \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1\mbox{]} or \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivative of density with salinity, in \mbox{[}R ppt-\/1 $\sim$$>$ kg m-\/3 ppt-\/1\mbox{]} or \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em dpa} & The change in the pressure anomaly across the\\
\hline
\mbox{\tt out}  & {\em intz\+\_\+dpa} & The integral through the thickness of the layer\\
\hline
\mbox{\tt out}  & {\em intx\+\_\+dpa} & The integral in x of the difference between the\\
\hline
\mbox{\tt out}  & {\em inty\+\_\+dpa} & The integral in y of the difference between the\\
\hline
\mbox{\tt in}  & {\em bathyt} & The depth of the bathymetry \mbox{[}Z $\sim$$>$ m\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em dz\+\_\+neglect} & A miniscule thickness change \mbox{[}Z $\sim$$>$ m\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em usemasswghtinterp} & If true, uses mass weighting to interpolate T/S for top and bottom integrals. \\
\hline
\end{DoxyParams}


Definition at line 331 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
331   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{intent(in)}  :: HI\textcolor{comment}{        !< The horizontal index type for the arrays.}
332   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
333                         \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{         !< Potential temperature relative to the surface}
334 \textcolor{comment}{                                                 !! [degC].}
335   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
336                         \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{         !< Salinity [PSU].}
337   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
338                         \textcolor{keywordtype}{intent(in)}  :: z\_t\textcolor{comment}{       !< Height at the top of the layer in depth units [Z ~> m].}
339   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
340                         \textcolor{keywordtype}{intent(in)}  :: z\_b\textcolor{comment}{       !< Height at the top of the layer [Z ~> m].}
341   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{   !< A mean density [R ~> kg m-3] or [kg m-3], that}
342 \textcolor{comment}{                                                 !! is subtracted out to reduce the magnitude of}
343 \textcolor{comment}{                                                 !! each of the integrals.}
344   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: rho\_0\_pres\textcolor{comment}{ !< A density [R ~> kg m-3], used to calculate}
345 \textcolor{comment}{                                                 !! the pressure (as p~=-z*rho\_0\_pres*G\_e) used in}
346 \textcolor{comment}{                                                 !! the equation of state. rho\_0\_pres is not used.}
347   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: G\_e\textcolor{comment}{       !< The Earth's gravitational acceleration}
348 \textcolor{comment}{                                                 !! [L2 Z-1 T-2 ~> m s-2] or [m2 Z-1 s-2 ~> m s-2].}
349   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [R ~> kg m-3] or [kg m-3].}
350   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{   !< The derivative of density with temperature,}
351 \textcolor{comment}{                                                 !! [R degC-1 ~> kg m-3 degC-1] or [kg m-3 degC-1].}
352   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{   !< The derivative of density with salinity,}
353 \textcolor{comment}{                                                 !! in [R ppt-1 ~> kg m-3 ppt-1] or [kg m-3 ppt-1].}
354   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
355                         \textcolor{keywordtype}{intent(out)} :: dpa\textcolor{comment}{       !< The change in the pressure anomaly across the}
356 \textcolor{comment}{                                                 !! layer [R L2 T-2 ~> Pa] or [Pa].}
357   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
358               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: intz\_dpa\textcolor{comment}{  !< The integral through the thickness of the layer}
359 \textcolor{comment}{                                                 !! of the pressure anomaly relative to the anomaly}
360 \textcolor{comment}{                                                 !! at the top of the layer [R L2 Z T-2 ~> Pa Z] or [Pa Z].}
361   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%IsdB:HI%IedB,HI%jsd:HI%jed)},  &
362               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: intx\_dpa\textcolor{comment}{  !< The integral in x of the difference between the}
363 \textcolor{comment}{                                                 !! pressure anomaly at the top and bottom of the}
364 \textcolor{comment}{                                                 !! layer divided by the x grid spacing [R L2 T-2 ~> Pa] or
       [Pa].}
365   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%JsdB:HI%JedB)},  &
366               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: inty\_dpa\textcolor{comment}{  !< The integral in y of the difference between the}
367 \textcolor{comment}{                                                 !! pressure anomaly at the top and bottom of the}
368 \textcolor{comment}{                                                 !! layer divided by the y grid spacing [R L2 T-2 ~> Pa] or
       [Pa].}
369   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
370               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: bathyT\textcolor{comment}{    !< The depth of the bathymetry [Z ~> m].}
371   \textcolor{keywordtype}{real},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: dz\_neglect\textcolor{comment}{ !< A miniscule thickness change [Z ~> m].}
372   \textcolor{keywordtype}{logical},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: useMassWghtInterp\textcolor{comment}{ !< If true, uses mass weighting to}
373 \textcolor{comment}{                                                 !! interpolate T/S for top and bottom integrals.}
374 
375   \textcolor{comment}{! Local variables}
376   \textcolor{keywordtype}{real} :: rho\_anom      \textcolor{comment}{! The density anomaly from rho\_ref [R ~> kg m-3].}
377   \textcolor{keywordtype}{real} :: raL, raR      \textcolor{comment}{! rho\_anom to the left and right [R ~> kg m-3].}
378   \textcolor{keywordtype}{real} :: dz, dzL, dzR  \textcolor{comment}{! Layer thicknesses [Z ~> m].}
379   \textcolor{keywordtype}{real} :: hWght      \textcolor{comment}{! A pressure-thickness below topography [Z ~> m].}
380   \textcolor{keywordtype}{real} :: hL, hR     \textcolor{comment}{! Pressure-thicknesses of the columns to the left and right [Z ~> m].}
381   \textcolor{keywordtype}{real} :: iDenom     \textcolor{comment}{! The inverse of the denominator in the weights [Z-2 ~> m-2].}
382   \textcolor{keywordtype}{real} :: hWt\_LL, hWt\_LR \textcolor{comment}{! hWt\_LA is the weighted influence of A on the left column [nondim].}
383   \textcolor{keywordtype}{real} :: hWt\_RL, hWt\_RR \textcolor{comment}{! hWt\_RA is the weighted influence of A on the right column [nondim].}
384   \textcolor{keywordtype}{real} :: wt\_L, wt\_R \textcolor{comment}{! The linear weights of the left and right columns [nondim].}
385   \textcolor{keywordtype}{real} :: wtT\_L, wtT\_R \textcolor{comment}{! The weights for tracers from the left and right columns [nondim].}
386   \textcolor{keywordtype}{real} :: intz(5)    \textcolor{comment}{! The integrals of density with height at the}
387                      \textcolor{comment}{! 5 sub-column locations [R L2 T-2 ~> Pa] or [Pa].}
388   \textcolor{keywordtype}{logical} :: do\_massWeight \textcolor{comment}{! Indicates whether to do mass weighting.}
389   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{parameter} :: C1\_6 = 1.0/6.0, c1\_90 = 1.0/90.0  \textcolor{comment}{! Rational constants.}
390   \textcolor{keywordtype}{integer} :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, i, j, m
391 
392   \textcolor{comment}{! These array bounds work for the indexing convention of the input arrays, but}
393   \textcolor{comment}{! on the computational domain defined for the output arrays.}
394   isq = hi%IscB ; ieq = hi%IecB
395   jsq = hi%JscB ; jeq = hi%JecB
396   is = hi%isc ; ie = hi%iec
397   js = hi%jsc ; je = hi%jec
398 
399   do\_massweight = .false.
400   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(usemasswghtinterp)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (usemasswghtinterp) \textcolor{keywordflow}{then}
401     do\_massweight = .true.
402   \textcolor{comment}{! if (.not.present(bathyT)) call MOM\_error(FATAL, "int\_density\_dz\_generic: "//&}
403   \textcolor{comment}{!     "bathyT must be present if useMassWghtInterp is present and true.")}
404   \textcolor{comment}{! if (.not.present(dz\_neglect)) call MOM\_error(FATAL, "int\_density\_dz\_generic: "//&}
405   \textcolor{comment}{!     "dz\_neglect must be present if useMassWghtInterp is present and true.")}
406 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}
407 
408   \textcolor{keywordflow}{do} j=jsq,jeq+1 ; \textcolor{keywordflow}{do} i=isq,ieq+1
409     dz = z\_t(i,j) - z\_b(i,j)
410     rho\_anom = (rho\_t0\_s0 - rho\_ref) + drho\_dt*t(i,j) + drho\_ds*s(i,j)
411     dpa(i,j) = g\_e*rho\_anom*dz
412     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(intz\_dpa)) intz\_dpa(i,j) = 0.5*g\_e*rho\_anom*dz**2
413 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
414 
415   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(intx\_dpa)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=js,je ; \textcolor{keywordflow}{do} i=isq,ieq
416     \textcolor{comment}{! hWght is the distance measure by which the cell is violation of}
417     \textcolor{comment}{! hydrostatic consistency. For large hWght we bias the interpolation of}
418     \textcolor{comment}{! T & S along the top and bottom integrals, akin to thickness weighting.}
419     hwght = 0.0
420     \textcolor{keywordflow}{if} (do\_massweight) &
421       hwght = max(0., -bathyt(i,j)-z\_t(i+1,j), -bathyt(i+1,j)-z\_t(i,j))
422 
423     \textcolor{keywordflow}{if} (hwght <= 0.0) \textcolor{keywordflow}{then}
424       dzl = z\_t(i,j) - z\_b(i,j) ; dzr = z\_t(i+1,j) - z\_b(i+1,j)
425       ral = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t(i,j) + drho\_ds*s(i,j))
426       rar = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t(i+1,j) + drho\_ds*s(i+1,j))
427 
428       intx\_dpa(i,j) = g\_e*c1\_6 * (dzl*(2.0*ral + rar) + dzr*(2.0*rar + ral))
429     \textcolor{keywordflow}{else}
430       hl = (z\_t(i,j) - z\_b(i,j)) + dz\_neglect
431       hr = (z\_t(i+1,j) - z\_b(i+1,j)) + dz\_neglect
432       hwght = hwght * ( (hl-hr)/(hl+hr) )**2
433       idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
434       hwt\_ll = (hwght*hl + hr*hl) * idenom ; hwt\_lr = (hwght*hr) * idenom
435       hwt\_rr = (hwght*hr + hr*hl) * idenom ; hwt\_rl = (hwght*hl) * idenom
436 
437       intz(1) = dpa(i,j) ; intz(5) = dpa(i+1,j)
438       \textcolor{keywordflow}{do} m=2,4
439         wt\_l = 0.25*\textcolor{keywordtype}{real(5-m)} ; wt\_R = 1.0-wt\_l
440         wtt\_l = wt\_l*hwt\_ll + wt\_r*hwt\_rl ; wtt\_r = wt\_l*hwt\_lr + wt\_r*hwt\_rr
441 
442         dz = wt\_l*(z\_t(i,j) - z\_b(i,j)) + wt\_r*(z\_t(i+1,j) - z\_b(i+1,j))
443         rho\_anom = (rho\_t0\_s0 - rho\_ref) + &
444                    (drho\_dt * (wtt\_l*t(i,j) + wtt\_r*t(i+1,j)) + &
445                     drho\_ds * (wtt\_l*s(i,j) + wtt\_r*s(i+1,j)))
446         intz(m) = g\_e*rho\_anom*dz
447 \textcolor{keywordflow}{      enddo}
448       \textcolor{comment}{! Use Boole's rule to integrate the values.}
449       intx\_dpa(i,j) = c1\_90*(7.0*(intz(1)+intz(5)) + 32.0*(intz(2)+intz(4)) + &
450                              12.0*intz(3))
451 \textcolor{keywordflow}{    endif}
452 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
453 
454   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(inty\_dpa)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=is,ie
455     \textcolor{comment}{! hWght is the distance measure by which the cell is violation of}
456     \textcolor{comment}{! hydrostatic consistency. For large hWght we bias the interpolation of}
457     \textcolor{comment}{! T & S along the top and bottom integrals, akin to thickness weighting.}
458     hwght = 0.0
459     \textcolor{keywordflow}{if} (do\_massweight) &
460       hwght = max(0., -bathyt(i,j)-z\_t(i,j+1), -bathyt(i,j+1)-z\_t(i,j))
461 
462     \textcolor{keywordflow}{if} (hwght <= 0.0) \textcolor{keywordflow}{then}
463       dzl = z\_t(i,j) - z\_b(i,j) ; dzr = z\_t(i,j+1) - z\_b(i,j+1)
464       ral = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t(i,j) + drho\_ds*s(i,j))
465       rar = (rho\_t0\_s0 - rho\_ref) + (drho\_dt*t(i,j+1) + drho\_ds*s(i,j+1))
466 
467       inty\_dpa(i,j) = g\_e*c1\_6 * (dzl*(2.0*ral + rar) + dzr*(2.0*rar + ral))
468     \textcolor{keywordflow}{else}
469       hl = (z\_t(i,j) - z\_b(i,j)) + dz\_neglect
470       hr = (z\_t(i,j+1) - z\_b(i,j+1)) + dz\_neglect
471       hwght = hwght * ( (hl-hr)/(hl+hr) )**2
472       idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
473       hwt\_ll = (hwght*hl + hr*hl) * idenom ; hwt\_lr = (hwght*hr) * idenom
474       hwt\_rr = (hwght*hr + hr*hl) * idenom ; hwt\_rl = (hwght*hl) * idenom
475 
476       intz(1) = dpa(i,j) ; intz(5) = dpa(i,j+1)
477       \textcolor{keywordflow}{do} m=2,4
478         wt\_l = 0.25*\textcolor{keywordtype}{real(5-m)} ; wt\_R = 1.0-wt\_l
479         wtt\_l = wt\_l*hwt\_ll + wt\_r*hwt\_rl ; wtt\_r = wt\_l*hwt\_lr + wt\_r*hwt\_rr
480 
481         dz = wt\_l*(z\_t(i,j) - z\_b(i,j)) + wt\_r*(z\_t(i,j+1) - z\_b(i,j+1))
482         rho\_anom = (rho\_t0\_s0 - rho\_ref) + &
483                    (drho\_dt * (wtt\_l*t(i,j) + wtt\_r*t(i,j+1)) + &
484                     drho\_ds * (wtt\_l*s(i,j) + wtt\_r*s(i,j+1)))
485         intz(m) = g\_e*rho\_anom*dz
486 \textcolor{keywordflow}{      enddo}
487       \textcolor{comment}{! Use Boole's rule to integrate the values.}
488       inty\_dpa(i,j) = c1\_90*(7.0*(intz(1)+intz(5)) + 32.0*(intz(2)+intz(4)) + &
489                              12.0*intz(3))
490 \textcolor{keywordflow}{    endif}
491 
492 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos__linear_ac9a31e315e6cb02f8f270de7c877f688}\label{namespacemom__eos__linear_ac9a31e315e6cb02f8f270de7c877f688}} 
\index{mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}!int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear@{int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear}}
\index{int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear@{int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear}!mom\+\_\+eos\+\_\+linear@{mom\+\_\+eos\+\_\+linear}}
\subsubsection{\texorpdfstring{int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear()}{int\_spec\_vol\_dp\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+\_\+linear\+::int\+\_\+spec\+\_\+vol\+\_\+dp\+\_\+linear (\begin{DoxyParamCaption}\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{T,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{S,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{p\+\_\+t,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{p\+\_\+b,  }\item[{real, intent(in)}]{alpha\+\_\+ref,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(out)}]{dza,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(out), optional}]{intp\+\_\+dza,  }\item[{real, dimension(hi\%isdb\+:hi\%iedb,hi\%jsd\+:hi\%jed), intent(out), optional}]{intx\+\_\+dza,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsdb\+:hi\%jedb), intent(out), optional}]{inty\+\_\+dza,  }\item[{integer, intent(in), optional}]{halo\+\_\+size,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in), optional}]{bathyP,  }\item[{real, intent(in), optional}]{d\+P\+\_\+neglect,  }\item[{logical, intent(in), optional}]{use\+Mass\+Wght\+Interp }\end{DoxyParamCaption})}



Calculates analytical and nearly-\/analytical integrals in pressure across layers of geopotential anomalies, which are required for calculating the finite-\/volume form pressure accelerations in a non-\/\+Boussinesq model. Specific volume is assumed to vary linearly between adjacent points. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em hi} & The ocean\textquotesingle{}s horizontal index type.\\
\hline
\mbox{\tt in}  & {\em t} & Potential temperature relative to the surface\\
\hline
\mbox{\tt in}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em p\+\_\+t} & Pressure at the top of the layer \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} or \mbox{[}Pa\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em p\+\_\+b} & Pressure at the top of the layer \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} or \mbox{[}Pa\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em alpha\+\_\+ref} & A mean specific volume that is subtracted out to reduce the magnitude of each of the integrals \mbox{[}R-\/1 $\sim$$>$ m3 kg-\/1\mbox{]}. The calculation is mathematically identical with different values of alpha\+\_\+ref, but this reduces the effects of roundoff.\\
\hline
\mbox{\tt in}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} or \mbox{[}kg m-\/3\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+dt} & The derivative of density with temperature \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1\mbox{]} or \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}.\\
\hline
\mbox{\tt in}  & {\em drho\+\_\+ds} & The derivative of density with salinity, in \mbox{[}R ppt-\/1 $\sim$$>$ kg m-\/3 ppt-\/1\mbox{]} or \mbox{[}kg m-\/3 ppt-\/1\mbox{]}.\\
\hline
\mbox{\tt out}  & {\em dza} & The change in the geopotential anomaly across\\
\hline
\mbox{\tt out}  & {\em intp\+\_\+dza} & The integral in pressure through the layer of the\\
\hline
\mbox{\tt out}  & {\em intx\+\_\+dza} & The integral in x of the difference between the\\
\hline
\mbox{\tt out}  & {\em inty\+\_\+dza} & The integral in y of the difference between the\\
\hline
\mbox{\tt in}  & {\em halo\+\_\+size} & The width of halo points on which to calculate dza.\\
\hline
\mbox{\tt in}  & {\em bathyp} & The pressure at the bathymetry \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} or \mbox{[}Pa\mbox{]}\\
\hline
\mbox{\tt in}  & {\em dp\+\_\+neglect} & A miniscule pressure change with the same units as p\+\_\+t \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} or \mbox{[}Pa\mbox{]}\\
\hline
\mbox{\tt in}  & {\em usemasswghtinterp} & If true, uses mass weighting to interpolate T/S for top and bottom integrals. \\
\hline
\end{DoxyParams}


Definition at line 502 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}
502   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{intent(in)}  :: HI\textcolor{comment}{        !< The ocean's horizontal index type.}
503   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)},  &
504                         \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{         !< Potential temperature relative to the surface}
505 \textcolor{comment}{                                                 !! [degC].}
506   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)},  &
507                         \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{         !< Salinity [PSU].}
508   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)},  &
509                         \textcolor{keywordtype}{intent(in)}  :: p\_t\textcolor{comment}{       !< Pressure at the top of the layer [R L2 T-2 ~> Pa] or
       [Pa].}
510   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)},  &
511                         \textcolor{keywordtype}{intent(in)}  :: p\_b\textcolor{comment}{       !< Pressure at the top of the layer [R L2 T-2 ~> Pa] or
       [Pa].}
512   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: alpha\_ref\textcolor{comment}{   !< A mean specific volume that is subtracted out}
513 \textcolor{comment}{                            !! to reduce the magnitude of each of the integrals [R-1 ~> m3 kg-1].}
514 \textcolor{comment}{                            !! The calculation is mathematically identical with different values of}
515 \textcolor{comment}{                            !! alpha\_ref, but this reduces the effects of roundoff.}
516   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [R ~> kg m-3] or [kg m-3].}
517   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{   !< The derivative of density with temperature}
518 \textcolor{comment}{                                                 !! [R degC-1 ~> kg m-3 degC-1] or [kg m-3 degC-1].}
519   \textcolor{keywordtype}{real},                 \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{   !< The derivative of density with salinity,}
520 \textcolor{comment}{                                                 !! in [R ppt-1 ~> kg m-3 ppt-1] or [kg m-3 ppt-1].}
521   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
522                         \textcolor{keywordtype}{intent(out)} :: dza\textcolor{comment}{       !< The change in the geopotential anomaly across}
523 \textcolor{comment}{                                                 !! the layer [L2 T-2 ~> m2 s-2] or [m2 s-2].}
524   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
525               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: intp\_dza\textcolor{comment}{  !< The integral in pressure through the layer of the}
526 \textcolor{comment}{                                                 !! geopotential anomaly relative to the anomaly at the}
527 \textcolor{comment}{                                                 !! bottom of the layer [R L4 T-4 ~> Pa m2 s-2] or [Pa m2
       s-2].}
528   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%IsdB:HI%IedB,HI%jsd:HI%jed)}, &
529               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: intx\_dza\textcolor{comment}{  !< The integral in x of the difference between the}
530 \textcolor{comment}{                                                 !! geopotential anomaly at the top and bottom of}
531 \textcolor{comment}{                                                 !! the layer divided by the x grid spacing}
532 \textcolor{comment}{                                                 !! [L2 T-2 ~> m2 s-2] or [m2 s-2].}
533   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%JsdB:HI%JedB)}, &
534               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: inty\_dza\textcolor{comment}{  !< The integral in y of the difference between the}
535 \textcolor{comment}{                                                 !! geopotential anomaly at the top and bottom of}
536 \textcolor{comment}{                                                 !! the layer divided by the y grid spacing}
537 \textcolor{comment}{                                                 !! [L2 T-2 ~> m2 s-2] or [m2 s-2].}
538   \textcolor{keywordtype}{integer},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: halo\_size\textcolor{comment}{ !< The width of halo points on which to calculate dza.}
539   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(HI%isd:HI%ied,HI%jsd:HI%jed)}, &
540               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: bathyP\textcolor{comment}{    !< The pressure at the bathymetry [R L2 T-2 ~> Pa] or [Pa]}
541   \textcolor{keywordtype}{real},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: dP\_neglect\textcolor{comment}{ !< A miniscule pressure change with}
542 \textcolor{comment}{                                                 !! the same units as p\_t [R L2 T-2 ~> Pa] or [Pa]}
543   \textcolor{keywordtype}{logical},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: useMassWghtInterp\textcolor{comment}{ !< If true, uses mass weighting}
544 \textcolor{comment}{                            !! to interpolate T/S for top and bottom integrals.}
545   \textcolor{comment}{! Local variables}
546   \textcolor{keywordtype}{real} :: dRho\_TS       \textcolor{comment}{! The density anomaly due to T and S [R ~> kg m-3] or [kg m-3].}
547   \textcolor{keywordtype}{real} :: alpha\_anom    \textcolor{comment}{! The specific volume anomaly from 1/rho\_ref [R-1 ~> m3 kg-1] or [m3 kg-1].}
548   \textcolor{keywordtype}{real} :: aaL, aaR      \textcolor{comment}{! The specific volume anomaly to the left and right [R-1 ~> m3 kg-1] or [m3 kg-1].}
549   \textcolor{keywordtype}{real} :: dp, dpL, dpR  \textcolor{comment}{! Layer pressure thicknesses [R L2 T-2 ~> Pa] or [Pa].}
550   \textcolor{keywordtype}{real} :: hWght      \textcolor{comment}{! A pressure-thickness below topography [R L2 T-2 ~> Pa] or [Pa].}
551   \textcolor{keywordtype}{real} :: hL, hR     \textcolor{comment}{! Pressure-thicknesses of the columns to the left and right [R L2 T-2 ~> Pa] or [Pa].}
552   \textcolor{keywordtype}{real} :: iDenom     \textcolor{comment}{! The inverse of the denominator in the weights [T4 R-2 L-2 ~> Pa-2] or [Pa-2].}
553   \textcolor{keywordtype}{real} :: hWt\_LL, hWt\_LR \textcolor{comment}{! hWt\_LA is the weighted influence of A on the left column [nondim].}
554   \textcolor{keywordtype}{real} :: hWt\_RL, hWt\_RR \textcolor{comment}{! hWt\_RA is the weighted influence of A on the right column [nondim].}
555   \textcolor{keywordtype}{real} :: wt\_L, wt\_R \textcolor{comment}{! The linear weights of the left and right columns [nondim].}
556   \textcolor{keywordtype}{real} :: wtT\_L, wtT\_R \textcolor{comment}{! The weights for tracers from the left and right columns [nondim].}
557   \textcolor{keywordtype}{real} :: intp(5)    \textcolor{comment}{! The integrals of specific volume with pressure at the}
558                      \textcolor{comment}{! 5 sub-column locations [L2 T-2 ~> m2 s-2] or [m2 s-2].}
559   \textcolor{keywordtype}{logical} :: do\_massWeight \textcolor{comment}{! Indicates whether to do mass weighting.}
560   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{parameter} :: C1\_6 = 1.0/6.0, c1\_90 = 1.0/90.0  \textcolor{comment}{! Rational constants.}
561   \textcolor{keywordtype}{integer} :: Isq, Ieq, Jsq, Jeq, ish, ieh, jsh, jeh, i, j, m, halo
562 
563   isq = hi%IscB ; ieq = hi%IecB ; jsq = hi%JscB ; jeq = hi%JecB
564   halo = 0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(halo\_size)) halo = max(halo\_size,0)
565   ish = hi%isc-halo ; ieh = hi%iec+halo ; jsh = hi%jsc-halo ; jeh = hi%jec+halo
566   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(intx\_dza)) \textcolor{keywordflow}{then} ; ish = min(isq,ish) ; ieh = max(ieq+1,ieh);\textcolor{keywordflow}{ endif}
567   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(inty\_dza)) \textcolor{keywordflow}{then} ; jsh = min(jsq,jsh) ; jeh = max(jeq+1,jeh);\textcolor{keywordflow}{ endif}
568 
569   do\_massweight = .false.
570   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(usemasswghtinterp)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (usemasswghtinterp) \textcolor{keywordflow}{then}
571     do\_massweight = .true.
572 \textcolor{comment}{!    if (.not.present(bathyP)) call MOM\_error(FATAL, "int\_spec\_vol\_dp\_generic: "//&}
573 \textcolor{comment}{!        "bathyP must be present if useMassWghtInterp is present and true.")}
574 \textcolor{comment}{!    if (.not.present(dP\_neglect)) call MOM\_error(FATAL, "int\_spec\_vol\_dp\_generic: "//&}
575 \textcolor{comment}{!        "dP\_neglect must be present if useMassWghtInterp is present and true.")}
576 \textcolor{keywordflow}{  endif} ;\textcolor{keywordflow}{ endif}
577 
578   \textcolor{keywordflow}{do} j=jsh,jeh ; \textcolor{keywordflow}{do} i=ish,ieh
579     dp = p\_b(i,j) - p\_t(i,j)
580     drho\_ts = drho\_dt*t(i,j) + drho\_ds*s(i,j)
581     \textcolor{comment}{! alpha\_anom = 1.0/(Rho\_T0\_S0  + dRho\_TS)) - alpha\_ref}
582     alpha\_anom = ((1.0-rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
583     dza(i,j) = alpha\_anom*dp
584     \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(intp\_dza)) intp\_dza(i,j) = 0.5*alpha\_anom*dp**2
585 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo}
586 
587   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(intx\_dza)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=hi%jsc,hi%jec ; \textcolor{keywordflow}{do} i=isq,ieq
588     \textcolor{comment}{! hWght is the distance measure by which the cell is violation of}
589     \textcolor{comment}{! hydrostatic consistency. For large hWght we bias the interpolation of}
590     \textcolor{comment}{! T & S along the top and bottom integrals, akin to thickness weighting.}
591     hwght = 0.0
592     \textcolor{keywordflow}{if} (do\_massweight) &
593       hwght = max(0., bathyp(i,j)-p\_t(i+1,j), bathyp(i+1,j)-p\_t(i,j))
594 
595     \textcolor{keywordflow}{if} (hwght <= 0.0) \textcolor{keywordflow}{then}
596       dpl = p\_b(i,j) - p\_t(i,j) ; dpr = p\_b(i+1,j) - p\_t(i+1,j)
597       drho\_ts = drho\_dt*t(i,j) + drho\_ds*s(i,j)
598       aal = ((1.0 - rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
599       drho\_ts = drho\_dt*t(i+1,j) + drho\_ds*s(i+1,j)
600       aar = ((1.0 - rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
601 
602       intx\_dza(i,j) = c1\_6 * (2.0*(dpl*aal + dpr*aar) + (dpl*aar + dpr*aal))
603     \textcolor{keywordflow}{else}
604       hl = (p\_b(i,j) - p\_t(i,j)) + dp\_neglect
605       hr = (p\_b(i+1,j) - p\_t(i+1,j)) + dp\_neglect
606       hwght = hwght * ( (hl-hr)/(hl+hr) )**2
607       idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
608       hwt\_ll = (hwght*hl + hr*hl) * idenom ; hwt\_lr = (hwght*hr) * idenom
609       hwt\_rr = (hwght*hr + hr*hl) * idenom ; hwt\_rl = (hwght*hl) * idenom
610 
611       intp(1) = dza(i,j) ; intp(5) = dza(i+1,j)
612       \textcolor{keywordflow}{do} m=2,4
613         wt\_l = 0.25*\textcolor{keywordtype}{real(5-m)} ; wt\_R = 1.0-wt\_l
614         wtt\_l = wt\_l*hwt\_ll + wt\_r*hwt\_rl ; wtt\_r = wt\_l*hwt\_lr + wt\_r*hwt\_rr
615 
616         \textcolor{comment}{! T, S, and p are interpolated in the horizontal.  The p interpolation}
617         \textcolor{comment}{! is linear, but for T and S it may be thickness wekghted.}
618         dp = wt\_l*(p\_b(i,j) - p\_t(i,j)) + wt\_r*(p\_b(i+1,j) - p\_t(i+1,j))
619 
620         drho\_ts = drho\_dt*(wtt\_l*t(i,j) + wtt\_r*t(i+1,j)) + &
621                   drho\_ds*(wtt\_l*s(i,j) + wtt\_r*s(i+1,j))
622         \textcolor{comment}{! alpha\_anom = 1.0/(Rho\_T0\_S0  + dRho\_TS)) - alpha\_ref}
623         alpha\_anom = ((1.0-rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
624         intp(m) = alpha\_anom*dp
625 \textcolor{keywordflow}{      enddo}
626       \textcolor{comment}{! Use Boole's rule to integrate the interface height anomaly values in y.}
627       intx\_dza(i,j) = c1\_90*(7.0*(intp(1)+intp(5)) + 32.0*(intp(2)+intp(4)) + &
628                              12.0*intp(3))
629 \textcolor{keywordflow}{    endif}
630 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
631 
632   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(inty\_dza)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=jsq,jeq ; \textcolor{keywordflow}{do} i=hi%isc,hi%iec
633     \textcolor{comment}{! hWght is the distance measure by which the cell is violation of}
634     \textcolor{comment}{! hydrostatic consistency. For large hWght we bias the interpolation of}
635     \textcolor{comment}{! T & S along the top and bottom integrals, akin to thickness weighting.}
636     hwght = 0.0
637     \textcolor{keywordflow}{if} (do\_massweight) &
638       hwght = max(0., bathyp(i,j)-p\_t(i,j+1), bathyp(i,j+1)-p\_t(i,j))
639 
640     \textcolor{keywordflow}{if} (hwght <= 0.0) \textcolor{keywordflow}{then}
641       dpl = p\_b(i,j) - p\_t(i,j) ; dpr = p\_b(i,j+1) - p\_t(i,j+1)
642       drho\_ts = drho\_dt*t(i,j) + drho\_ds*s(i,j)
643       aal = ((1.0 - rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
644       drho\_ts = drho\_dt*t(i,j+1) + drho\_ds*s(i,j+1)
645       aar = ((1.0 - rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
646 
647       inty\_dza(i,j) = c1\_6 * (2.0*(dpl*aal + dpr*aar) + (dpl*aar + dpr*aal))
648     \textcolor{keywordflow}{else}
649       hl = (p\_b(i,j) - p\_t(i,j)) + dp\_neglect
650       hr = (p\_b(i,j+1) - p\_t(i,j+1)) + dp\_neglect
651       hwght = hwght * ( (hl-hr)/(hl+hr) )**2
652       idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
653       hwt\_ll = (hwght*hl + hr*hl) * idenom ; hwt\_lr = (hwght*hr) * idenom
654       hwt\_rr = (hwght*hr + hr*hl) * idenom ; hwt\_rl = (hwght*hl) * idenom
655 
656       intp(1) = dza(i,j) ; intp(5) = dza(i,j+1)
657       \textcolor{keywordflow}{do} m=2,4
658         wt\_l = 0.25*\textcolor{keywordtype}{real(5-m)} ; wt\_R = 1.0-wt\_l
659         wtt\_l = wt\_l*hwt\_ll + wt\_r*hwt\_rl ; wtt\_r = wt\_l*hwt\_lr + wt\_r*hwt\_rr
660 
661         \textcolor{comment}{! T, S, and p are interpolated in the horizontal.  The p interpolation}
662         \textcolor{comment}{! is linear, but for T and S it may be thickness wekghted.}
663         dp = wt\_l*(p\_b(i,j) - p\_t(i,j)) + wt\_r*(p\_b(i,j+1) - p\_t(i,j+1))
664 
665         drho\_ts = drho\_dt*(wtt\_l*t(i,j) + wtt\_r*t(i,j+1)) + &
666                   drho\_ds*(wtt\_l*s(i,j) + wtt\_r*s(i,j+1))
667         \textcolor{comment}{! alpha\_anom = 1.0/(Rho\_T0\_S0  + dRho\_TS)) - alpha\_ref}
668         alpha\_anom = ((1.0-rho\_t0\_s0*alpha\_ref) - drho\_ts*alpha\_ref) / (rho\_t0\_s0 + drho\_ts)
669         intp(m) = alpha\_anom*dp
670 \textcolor{keywordflow}{      enddo}
671       \textcolor{comment}{! Use Boole's rule to integrate the interface height anomaly values in y.}
672       inty\_dza(i,j) = c1\_90*(7.0*(intp(1)+intp(5)) + 32.0*(intp(2)+intp(4)) + &
673                              12.0*intp(3))
674 \textcolor{keywordflow}{    endif}
675 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ endif}
\end{DoxyCode}
