\hypertarget{namespacemom__eos__linear}{}\doxysection{mom\+\_\+eos\+\_\+linear Module Reference}
\label{namespacemom__eos__linear}\index{mom\_eos\_linear@{mom\_eos\_linear}}


\doxysubsection{Detailed Description}
A simple linear equation of state for sea water with constant coefficients. \doxysubsection*{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}
\doxysubsection*{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}


\doxysubsection{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & In situ density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dp} & The partial derivative of density with pressure (also the inverse of the square of sound speed) \mbox{[}s2 m-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & The starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{301 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{         !< Potential temperature relative to the surface}}
\DoxyCodeLine{302 \textcolor{comment}{                                                  !! [degC].}}
\DoxyCodeLine{303 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{         !< Salinity [PSU].}}
\DoxyCodeLine{304 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{  !< pressure [Pa].}}
\DoxyCodeLine{305 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: rho\textcolor{comment}{       !< In situ density [kg m-\/3].}}
\DoxyCodeLine{306 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dp\textcolor{comment}{   !< The partial derivative of density with pressure}}
\DoxyCodeLine{307 \textcolor{comment}{                                                  !! (also the inverse of the square of sound speed)}}
\DoxyCodeLine{308 \textcolor{comment}{                                                  !! [s2 m-\/2].}}
\DoxyCodeLine{309   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{     !< The starting point in the arrays.}}
\DoxyCodeLine{310   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{      !< The number of values to calculate.}}
\DoxyCodeLine{311 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{312 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{   !< The derivative of density with}}
\DoxyCodeLine{313 \textcolor{comment}{                                                  !! temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{314 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{   !< The derivative of density with}}
\DoxyCodeLine{315 \textcolor{comment}{                                                  !! salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{316   \textcolor{comment}{!  Local variables}}
\DoxyCodeLine{317   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{318 }
\DoxyCodeLine{319   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{320     rho(j) = rho\_t0\_s0 + drho\_dt*t(j) + drho\_ds*s(j)}
\DoxyCodeLine{321     drho\_dp(j) = 0.0}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & in situ density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & the starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & the number of values to calculate. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivatives of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{82 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface [degC].}}
\DoxyCodeLine{83 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< salinity [PSU].}}
\DoxyCodeLine{84 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{85 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< in situ density [kg m-\/3].}}
\DoxyCodeLine{86   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{87   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{88 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{89 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature}}
\DoxyCodeLine{90 \textcolor{comment}{                                              !! [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{91 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity}}
\DoxyCodeLine{92 \textcolor{comment}{                                              !! in [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{93 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3].}}
\DoxyCodeLine{94   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{95   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{96 }
\DoxyCodeLine{97   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{98     rho(j) = (rho\_t0\_s0 -\/ rho\_ref) + (drho\_dt*t(j) + drho\_ds*s(j))}
\DoxyCodeLine{99 \textcolor{keywordflow}{  enddo} ; \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{100     rho(j) = rho\_t0\_s0 + drho\_dt*t(j) + drho\_ds*s(j)}
\DoxyCodeLine{101 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+out} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+out} & The partial derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & The starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{165 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{           !< Potential temperature relative to the surface}}
\DoxyCodeLine{166 \textcolor{comment}{                                                    !! [degC].}}
\DoxyCodeLine{167 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{           !< Salinity [PSU].}}
\DoxyCodeLine{168 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{    !< Pressure [Pa].}}
\DoxyCodeLine{169 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dT\_out\textcolor{comment}{ !< The partial derivative of density with}}
\DoxyCodeLine{170 \textcolor{comment}{                                                    !! potential temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{171 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: drho\_dS\_out\textcolor{comment}{ !< The partial derivative of density with}}
\DoxyCodeLine{172 \textcolor{comment}{                                                    !! salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{173 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{   !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{174 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{     !< The derivative of density with temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{175 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{     !< The derivative of density with salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{176   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{       !< The starting point in the arrays.}}
\DoxyCodeLine{177   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{        !< The number of values to calculate.}}
\DoxyCodeLine{178   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{179   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{180 }
\DoxyCodeLine{181   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{182     drho\_dt\_out(j) = drho\_dt}
\DoxyCodeLine{183     drho\_ds\_out(j) = drho\_ds}
\DoxyCodeLine{184 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+out} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+out} & The partial derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivatives of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{192 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface}}
\DoxyCodeLine{193 \textcolor{comment}{                                      !! [degC].}}
\DoxyCodeLine{194 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}}
\DoxyCodeLine{195 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}}
\DoxyCodeLine{196 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)} :: drho\_dT\_out\textcolor{comment}{ !< The partial derivative of density with}}
\DoxyCodeLine{197 \textcolor{comment}{                                      !! potential temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{198 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)} :: drho\_dS\_out\textcolor{comment}{ !< The partial derivative of density with}}
\DoxyCodeLine{199 \textcolor{comment}{                                      !! salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{200 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{   !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{201 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{     !< The derivatives of density with temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{202 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{     !< The derivatives of density with salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{203   drho\_dt\_out = drho\_dt}
\DoxyCodeLine{204   drho\_ds\_out = drho\_ds}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & In situ density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivatives of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{58 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature relative to the surface [degC].}}
\DoxyCodeLine{59 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{60 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< pressure [Pa].}}
\DoxyCodeLine{61 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< In situ density [kg m-\/3].}}
\DoxyCodeLine{62 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{63 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature}}
\DoxyCodeLine{64 \textcolor{comment}{                                          !! [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{65 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity}}
\DoxyCodeLine{66 \textcolor{comment}{                                          !! in [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{67 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3].}}
\DoxyCodeLine{68 }
\DoxyCodeLine{69   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{70     rho = (rho\_t0\_s0 -\/ rho\_ref) + (drho\_dt*t + drho\_ds*s)}
\DoxyCodeLine{71   \textcolor{keywordflow}{else}}
\DoxyCodeLine{72     rho = rho\_t0\_s0 + drho\_dt*t + drho\_ds*s}
\DoxyCodeLine{73 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+ds} & The second derivative of density with salinity \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ 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{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+dt} & The second derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ 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{\texttt{ 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{\texttt{ in}}  & {\em start} & The starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{238 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface [degC].}}
\DoxyCodeLine{239 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}}
\DoxyCodeLine{240 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}}
\DoxyCodeLine{241 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dS\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{242 \textcolor{comment}{                                                 !! salinity [kg m-\/3 PSU-\/2].}}
\DoxyCodeLine{243 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dT\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{244 \textcolor{comment}{                                                 !! temperature and salinity [kg m-\/3 ppt-\/1 degC-\/1].}}
\DoxyCodeLine{245 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dT\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{246 \textcolor{comment}{                                                 !! temperature [kg m-\/3 degC-\/2].}}
\DoxyCodeLine{247 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dP\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{248 \textcolor{comment}{                                                 !! salinity and pressure [kg m-\/3 PSU-\/1 Pa-\/1].}}
\DoxyCodeLine{249 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dP\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{250 \textcolor{comment}{                                                 !! temperature and pressure [kg m-\/3 degC-\/1 Pa-\/1].}}
\DoxyCodeLine{251   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{       !< The starting point in the arrays.}}
\DoxyCodeLine{252   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{        !< The number of values to calculate.}}
\DoxyCodeLine{253   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{254   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{255   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{256     drho\_ds\_ds(j) = 0.}
\DoxyCodeLine{257     drho\_ds\_dt(j) = 0.}
\DoxyCodeLine{258     drho\_dt\_dt(j) = 0.}
\DoxyCodeLine{259     drho\_ds\_dp(j) = 0.}
\DoxyCodeLine{260     drho\_dt\_dp(j) = 0.}
\DoxyCodeLine{261 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+ds} & The second derivative of density with salinity \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ 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{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+dt} & The second derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]}. \\
\hline
\mbox{\texttt{ 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{\texttt{ 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 210 of file M\+O\+M\+\_\+\+E\+O\+S\+\_\+linear.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{212 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{           !< Potential temperature relative to the surface [degC].}}
\DoxyCodeLine{213 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{           !< Salinity [PSU].}}
\DoxyCodeLine{214 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{    !< pressure [Pa].}}
\DoxyCodeLine{215 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dS\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{216 \textcolor{comment}{                                   !! salinity [kg m-\/3 PSU-\/2].}}
\DoxyCodeLine{217 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dT\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{218 \textcolor{comment}{                                   !! temperature and salinity [kg m-\/3 ppt-\/1 degC-\/1].}}
\DoxyCodeLine{219 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dT\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{220 \textcolor{comment}{                                   !! temperature [kg m-\/3 degC-\/2].}}
\DoxyCodeLine{221 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dP\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{222 \textcolor{comment}{                                   !! salinity and pressure [kg m-\/3 PSU-\/1 Pa-\/1].}}
\DoxyCodeLine{223 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dP\textcolor{comment}{  !< The second derivative of density with}}
\DoxyCodeLine{224 \textcolor{comment}{                                   !! temperature and pressure [kg m-\/3 degC-\/1 Pa-\/1].}}
\DoxyCodeLine{225 }
\DoxyCodeLine{226   drho\_ds\_ds = 0.}
\DoxyCodeLine{227   drho\_ds\_dt = 0.}
\DoxyCodeLine{228   drho\_dt\_dt = 0.}
\DoxyCodeLine{229   drho\_ds\_dp = 0.}
\DoxyCodeLine{230   drho\_dt\_dp = 0.}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em specvol} & in situ specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & the starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & the number of values to calculate. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivatives of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{138 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}}
\DoxyCodeLine{139 \textcolor{comment}{                                              !! [degC].}}
\DoxyCodeLine{140 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{141 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa].}}
\DoxyCodeLine{142 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< in situ specific volume [m3 kg-\/1].}}
\DoxyCodeLine{143   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{144   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{145 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{146 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{147 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{148 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1].}}
\DoxyCodeLine{149   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{150   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{151 }
\DoxyCodeLine{152   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{153     specvol(j) = ((1.0 -\/ rho\_t0\_s0*spv\_ref) + spv\_ref*(drho\_dt*t(j) + drho\_ds*s(j))) / \&}
\DoxyCodeLine{154                  ( rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))}
\DoxyCodeLine{155 \textcolor{keywordflow}{  enddo} ; \textcolor{keywordflow}{else} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{156     specvol(j) = 1.0 / ( rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))}
\DoxyCodeLine{157 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em specvol} & In situ specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivatives of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivatives of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{111 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< potential temperature relative to the surface}}
\DoxyCodeLine{112 \textcolor{comment}{                                   !! [degC].}}
\DoxyCodeLine{113 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU].}}
\DoxyCodeLine{114 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa].}}
\DoxyCodeLine{115 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< In situ specific volume [m3 kg-\/1].}}
\DoxyCodeLine{116 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{117 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dT\textcolor{comment}{  !< The derivatives of density with temperature [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{118 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}  :: dRho\_dS\textcolor{comment}{  !< The derivatives of density with salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{119 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1].}}
\DoxyCodeLine{120   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{121   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{122 }
\DoxyCodeLine{123   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{124     specvol = ((1.0 -\/ rho\_t0\_s0*spv\_ref) + spv\_ref*(drho\_dt*t + drho\_ds*s)) / \&}
\DoxyCodeLine{125              ( rho\_t0\_s0 + (drho\_dt*t + drho\_ds*s))}
\DoxyCodeLine{126   \textcolor{keywordflow}{else}}
\DoxyCodeLine{127     specvol = 1.0 / ( rho\_t0\_s0 + (drho\_dt*t + drho\_ds*s))}
\DoxyCodeLine{128 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \mbox{[}degC\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em dsv\+\_\+ds} & The partial derivative of specific volume with salinity \mbox{[}m3 kg-\/1 P\+S\+U-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ out}}  & {\em dsv\+\_\+dt} & The partial derivative of specific volume with potential temperature \mbox{[}m3 kg-\/1 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em start} & The starting point in the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & The density at T=0, S=0 \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & The derivative of density with temperature, \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & The derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]}. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{268 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: T\textcolor{comment}{         !< Potential temperature relative to the surface}}
\DoxyCodeLine{269 \textcolor{comment}{                                                  !! [degC].}}
\DoxyCodeLine{270 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: S\textcolor{comment}{         !< Salinity [PSU].}}
\DoxyCodeLine{271 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)},  \textcolor{keywordtype}{dimension(:)} :: pressure\textcolor{comment}{  !< pressure [Pa].}}
\DoxyCodeLine{272 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: dSV\_dS\textcolor{comment}{    !< The partial derivative of specific volume with}}
\DoxyCodeLine{273 \textcolor{comment}{                                                  !! salinity [m3 kg-\/1 PSU-\/1].}}
\DoxyCodeLine{274 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(out)}, \textcolor{keywordtype}{dimension(:)} :: dSV\_dT\textcolor{comment}{    !< The partial derivative of specific volume with}}
\DoxyCodeLine{275 \textcolor{comment}{                                                  !! potential temperature [m3 kg-\/1 degC-\/1].}}
\DoxyCodeLine{276   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: start\textcolor{comment}{     !< The starting point in the arrays.}}
\DoxyCodeLine{277   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{intent(in)}                :: npts\textcolor{comment}{      !< The number of values to calculate.}}
\DoxyCodeLine{278 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: Rho\_T0\_S0\textcolor{comment}{ !< The density at T=0, S=0 [kg m-\/3].}}
\DoxyCodeLine{279 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dT\textcolor{comment}{   !< The derivative of density with}}
\DoxyCodeLine{280 \textcolor{comment}{                                                  !! temperature, [kg m-\/3 degC-\/1].}}
\DoxyCodeLine{281 \textcolor{keywordtype}{  real},    \textcolor{keywordtype}{intent(in)}                :: dRho\_dS\textcolor{comment}{   !< The derivative of density with}}
\DoxyCodeLine{282 \textcolor{comment}{                                                  !! salinity [kg m-\/3 ppt-\/1].}}
\DoxyCodeLine{283   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{284 \textcolor{keywordtype}{  real} :: I\_rho2}
\DoxyCodeLine{285   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{286 }
\DoxyCodeLine{287   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{288     \textcolor{comment}{! Sv = 1.0 / (Rho\_T0\_S0 + dRho\_dT*T(j) + dRho\_dS*S(j))}}
\DoxyCodeLine{289     i\_rho2 = 1.0 / (rho\_t0\_s0 + (drho\_dt*t(j) + drho\_ds*s(j)))**2}
\DoxyCodeLine{290     dsv\_dt(j) = -\/drho\_dt * i\_rho2}
\DoxyCodeLine{291     dsv\_ds(j) = -\/drho\_ds * i\_rho2}
\DoxyCodeLine{292 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{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}}
\doxysubsubsection{\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(\mbox{\hyperlink{structmom__hor__index_1_1hor__index__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{\texttt{ in}}  & {\em hi} & The horizontal index type for the arrays. \\
\hline
\mbox{\texttt{ in}}  & {\em t} & Potential temperature relative to the surface \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+t} & Height at the top of the layer in depth units \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em z\+\_\+b} & Height at the top of the layer \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\mbox{\texttt{ 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{\texttt{ 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{\texttt{ 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{\texttt{ 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{\texttt{ 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{\texttt{ 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{\texttt{ out}}  & {\em dpa} & The change in the pressure anomaly across the \\
\hline
\mbox{\texttt{ out}}  & {\em intz\+\_\+dpa} & The integral through the thickness of the layer \\
\hline
\mbox{\texttt{ out}}  & {\em intx\+\_\+dpa} & The integral in x of the difference between the \\
\hline
\mbox{\texttt{ out}}  & {\em inty\+\_\+dpa} & The integral in y of the difference between the \\
\hline
\mbox{\texttt{ in}}  & {\em bathyt} & The depth of the bathymetry \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em dz\+\_\+neglect} & A miniscule thickness change \mbox{[}Z $\sim$$>$ m\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em usemasswghtinterp} & If true, uses mass weighting to interpolate T/S for top and bottom integrals. \\
\hline
\end{DoxyParams}


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


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


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


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

\end{DoxyCode}
