\hypertarget{namespacemom__eos}{}\doxysection{mom\+\_\+eos Module Reference}
\label{namespacemom__eos}\index{mom\_eos@{mom\_eos}}


\doxysubsection{Detailed Description}
Provides subroutines for quantities specific to the equation of state. 

The M\+O\+M\+\_\+\+E\+OS module is a wrapper for various equations of state (e.\+g. Linear, Wright, U\+N\+E\+S\+CO) and provides a uniform interface to the rest of the model independent of which equation of state is being used. \doxysubsection*{Data Types}
\begin{DoxyCompactItemize}
\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__compress}{calculate\+\_\+compress}}
\begin{DoxyCompactList}\small\item\em Calculates the compressibility of water from T, S, and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__density}{calculate\+\_\+density}}
\begin{DoxyCompactList}\small\item\em Calculates density of sea water from T, S and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__density__derivs}{calculate\+\_\+density\+\_\+derivs}}
\begin{DoxyCompactList}\small\item\em Calculate the derivatives of density with temperature and salinity from T, S, and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__density__second__derivs}{calculate\+\_\+density\+\_\+second\+\_\+derivs}}
\begin{DoxyCompactList}\small\item\em Calculates the second derivatives of density with various combinations of temperature, salinity, and pressure from T, S and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__spec__vol}{calculate\+\_\+spec\+\_\+vol}}
\begin{DoxyCompactList}\small\item\em Calculates specific volume of sea water from T, S and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__specific__vol__derivs}{calculate\+\_\+specific\+\_\+vol\+\_\+derivs}}
\begin{DoxyCompactList}\small\item\em Calculate the derivatives of specific volume with temperature and salinity from T, S, and P. \end{DoxyCompactList}\item 
interface \mbox{\hyperlink{interfacemom__eos_1_1calculate__tfreeze}{calculate\+\_\+tfreeze}}
\begin{DoxyCompactList}\small\item\em Calculates the freezing point of sea water from T, S and P. \end{DoxyCompactList}\item 
type \mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}
\begin{DoxyCompactList}\small\item\em A control structure for the equation of state. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{namespacemom__eos_ac3bdab784e3535d661c47d1ec8a624fd}{calculate\+\_\+density\+\_\+scalar}} (T, S, pressure, rho, E\+OS, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density of sea water for scalar inputs. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. The pressure and density can be rescaled with the US. If both the US and scale arguments are present the density scaling uses the product of the two scaling factors. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a66d40148737ef1a3b1ae44917c7fe0c3}{calculate\+\_\+stanley\+\_\+density\+\_\+scalar}} (T, S, pressure, Tvar, T\+Scov, Svar, rho, E\+OS, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density of sea water for scalar inputs including the variance of T, S and covariance of T-\/S. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. The density can be rescaled using rho\+\_\+ref. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a3be8289c391088bdd3af78d272b92521}{calculate\+\_\+density\+\_\+array}} (T, S, pressure, rho, start, npts, E\+OS, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a102df91898d116a6b4346f00dc818612}{calculate\+\_\+stanley\+\_\+density\+\_\+array}} (T, S, pressure, Tvar, T\+Scov, Svar, rho, start, npts, E\+OS, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs including the variance of T, S and covariance of T-\/S. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a2e78ade3bcba817406479cbbe3941a5f}{calculate\+\_\+density\+\_\+1d}} (T, S, pressure, rho, E\+OS, dom, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs, potentially limiting the domain of indices that are worked on. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a58b52a452d779c53e6421aaa3eac6e8b}{calculate\+\_\+stanley\+\_\+density\+\_\+1d}} (T, S, pressure, Tvar, T\+Scov, Svar, rho, E\+OS, dom, rho\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs including the variance of T, S and covariance of T-\/S, potentially limiting the domain of indices that are worked on. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a43d417da1636adb2cd184f76223afded}{calculate\+\_\+spec\+\_\+vol\+\_\+array}} (T, S, pressure, specvol, start, npts, E\+OS, spv\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the specific volume of sea water for 1-\/D array inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a246056e557a08ce1c697256cd718d99a}{calc\+\_\+spec\+\_\+vol\+\_\+scalar}} (T, S, pressure, specvol, E\+OS, spv\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate specific volume of sea water for scalar inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_afbb6a11d3b826308ddb1ffe0c5cf32d1}{calc\+\_\+spec\+\_\+vol\+\_\+1d}} (T, S, pressure, specvol, E\+OS, dom, spv\+\_\+ref, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the specific volume of sea water for 1-\/D array inputs, potentially limiting the domain of indices that are worked on. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_ad46af8402aba49dbdd73817d33e83270}{calculate\+\_\+tfreeze\+\_\+scalar}} (S, pressure, T\+\_\+fr, E\+OS, pres\+\_\+scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the freezing point for scalar inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_ab9669ca4a2e4f3507be7efe047c18ab7}{calculate\+\_\+tfreeze\+\_\+array}} (S, pressure, T\+\_\+fr, start, npts, E\+OS, pres\+\_\+scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the freezing point for a 1-\/D array. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a27ec57cbbd2e673d542ba2c8dd44053a}{calculate\+\_\+density\+\_\+derivs\+\_\+array}} (T, S, pressure, drho\+\_\+dT, drho\+\_\+dS, start, npts, E\+OS, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density derivatives for 1-\/D array inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_aed3bb20f32c038dbe84bc44442c6e724}{calculate\+\_\+density\+\_\+derivs\+\_\+1d}} (T, S, pressure, drho\+\_\+dT, drho\+\_\+dS, E\+OS, dom, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density derivatives for 1-\/D array inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a06d9d6680e838b965666986e63c980e7}{calculate\+\_\+density\+\_\+derivs\+\_\+scalar}} (T, S, pressure, drho\+\_\+dT, drho\+\_\+dS, E\+OS, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutines to calculate density derivatives by promoting a scalar to a one-\/element array. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a8c0fa67a7a4911eb5fa33c5d17b997f9}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array}} (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, E\+OS, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density second derivatives for 1-\/D array inputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a2d7a984ed1c48d9e0ea1046de3eac886}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar}} (T, S, pressure, drho\+\_\+d\+S\+\_\+dS, drho\+\_\+d\+S\+\_\+dT, drho\+\_\+d\+T\+\_\+dT, drho\+\_\+d\+S\+\_\+dP, drho\+\_\+d\+T\+\_\+dP, E\+OS, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate density second derivatives for scalar nputs. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a35f9c33d1aeffbf9986349463bab3b9c}{calculate\+\_\+spec\+\_\+vol\+\_\+derivs\+\_\+array}} (T, S, pressure, d\+S\+V\+\_\+dT, d\+S\+V\+\_\+dS, start, npts, E\+OS)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate specific volume derivatives for an array. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a640c3b2292afd3266caa11243549bbf0}{calc\+\_\+spec\+\_\+vol\+\_\+derivs\+\_\+1d}} (T, S, pressure, d\+S\+V\+\_\+dT, d\+S\+V\+\_\+dS, E\+OS, dom, scale)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate specific volume derivatives for 1-\/d array inputs, potentially limiting the domain of indices that are worked on. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_a3296609bd60bfe7ed2c5eac1170d07a3}{calculate\+\_\+compress\+\_\+array}} (T, S, press, rho, drho\+\_\+dp, start, npts, E\+OS)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate the density and compressibility for 1-\/D array inputs. If US is present, the units of the inputs and outputs are rescaled. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{namespacemom__eos_ad0986d800c26414dbd19d2b3a541e613}{calculate\+\_\+compress\+\_\+scalar}} (T, S, pressure, rho, drho\+\_\+dp, E\+OS)
\begin{DoxyCompactList}\small\item\em Calculate density and compressibility for a scalar. This just promotes the scalar to an array with a singleton dimension and calls calculate\+\_\+compress\+\_\+array. If US is present, the units of the inputs and outputs are rescaled. \end{DoxyCompactList}\item 
integer function, dimension(2), public \mbox{\hyperlink{namespacemom__eos_a782d326108e390902e520efc078e8296}{eos\+\_\+domain}} (HI, halo)
\begin{DoxyCompactList}\small\item\em This subroutine returns a two point integer array indicating the domain of i-\/indices to work on in E\+OS calls based on information from a hor\+\_\+index type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a09b6cb637246b8aa287ef7cdb482aaea}{analytic\+\_\+int\+\_\+specific\+\_\+vol\+\_\+dp}} (T, S, p\+\_\+t, p\+\_\+b, alpha\+\_\+ref, HI, E\+OS, dza, intp\+\_\+dza, intx\+\_\+dza, inty\+\_\+dza, halo\+\_\+size, bathyP, d\+P\+\_\+tiny, use\+Mass\+Wght\+Interp)
\begin{DoxyCompactList}\small\item\em Calls the appropriate subroutine to calculate 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. There are essentially no free assumptions, apart from the use of Boole\textquotesingle{}s rule to do the horizontal integrals, and from a truncation in the series for log(1-\/eps/1+eps) that assumes that $\vert$eps$\vert$ $<$ 0.\+34. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a2787233a5f7a0935206ba2cf4c278aab}{analytic\+\_\+int\+\_\+density\+\_\+dz}} (T, S, z\+\_\+t, z\+\_\+b, rho\+\_\+ref, rho\+\_\+0, G\+\_\+e, HI, E\+OS, 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 
logical function, public \mbox{\hyperlink{namespacemom__eos_aee169aee0e4cbed420782d772282bb69}{query\+\_\+compressible}} (E\+OS)
\begin{DoxyCompactList}\small\item\em Returns true if the equation of state is compressible (i.\+e. has pressure dependence) \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a3ab220b9c98dac3b8f6b7c1606b811cf}{eos\+\_\+init}} (param\+\_\+file, E\+OS, US)
\begin{DoxyCompactList}\small\item\em Initializes E\+O\+S\+\_\+type by allocating and reading parameters. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a949f5bb0744c827bf11cca01316ceed4}{eos\+\_\+manual\+\_\+init}} (E\+OS, form\+\_\+of\+\_\+\+E\+OS, form\+\_\+of\+\_\+\+T\+Freeze, E\+O\+S\+\_\+quadrature, Compressible, Rho\+\_\+\+T0\+\_\+\+S0, drho\+\_\+dT, d\+Rho\+\_\+dS, T\+Fr\+\_\+\+S0\+\_\+\+P0, d\+T\+Fr\+\_\+dS, d\+T\+Fr\+\_\+dp)
\begin{DoxyCompactList}\small\item\em Manually initialized an E\+OS type (intended for unit testing of routines which need a specific E\+OS) \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a1108fb5de7a69d01746df3995f7e3f0d}{eos\+\_\+allocate}} (E\+OS)
\begin{DoxyCompactList}\small\item\em Allocates E\+O\+S\+\_\+type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_acab6a23bef0a98f15f0a479bdd1ec63c}{eos\+\_\+end}} (E\+OS)
\begin{DoxyCompactList}\small\item\em Deallocates E\+O\+S\+\_\+type. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_ae608600501a98f8f317d8f27a054327e}{eos\+\_\+use\+\_\+linear}} (Rho\+\_\+\+T0\+\_\+\+S0, d\+Rho\+\_\+dT, d\+Rho\+\_\+dS, E\+OS, use\+\_\+quadrature)
\begin{DoxyCompactList}\small\item\em Set equation of state structure (E\+OS) to linear with given coefficients. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a5b1ff89023e9d7da4074c7c1a71c9a85}{convert\+\_\+temp\+\_\+salt\+\_\+for\+\_\+teos10}} (T, S, HI, kd, mask\+\_\+z, E\+OS)
\begin{DoxyCompactList}\small\item\em Convert T\&S to Absolute Salinity and Conservative Temperature if using T\+E\+O\+S10. \end{DoxyCompactList}\item 
logical function, public \mbox{\hyperlink{namespacemom__eos_aad531f2540628368c33198bb31d51201}{eos\+\_\+quadrature}} (E\+OS)
\begin{DoxyCompactList}\small\item\em Return value of E\+O\+S\+\_\+quadrature. \end{DoxyCompactList}\item 
subroutine, public \mbox{\hyperlink{namespacemom__eos_a5e15d4f5b758ab149421c33145b0444c}{extract\+\_\+member\+\_\+eos}} (E\+OS, form\+\_\+of\+\_\+\+E\+OS, form\+\_\+of\+\_\+\+T\+Freeze, E\+O\+S\+\_\+quadrature, Compressible, Rho\+\_\+\+T0\+\_\+\+S0, drho\+\_\+dT, d\+Rho\+\_\+dS, T\+Fr\+\_\+\+S0\+\_\+\+P0, d\+T\+Fr\+\_\+dS, d\+T\+Fr\+\_\+dp)
\begin{DoxyCompactList}\small\item\em Extractor routine for the E\+OS type if the members need to be accessed outside this module. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{namespacemom__eos_a230a2f280b1e27ee913e1b3cf4c412b8}\label{namespacemom__eos_a230a2f280b1e27ee913e1b3cf4c412b8}} 
integer, parameter, public \mbox{\hyperlink{namespacemom__eos_a230a2f280b1e27ee913e1b3cf4c412b8}{eos\+\_\+linear}} = 1
\begin{DoxyCompactList}\small\item\em A named integer specifying an equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a9eacc16ba79dc66131b54bf31114f35a}\label{namespacemom__eos_a9eacc16ba79dc66131b54bf31114f35a}} 
integer, parameter, public \mbox{\hyperlink{namespacemom__eos_a9eacc16ba79dc66131b54bf31114f35a}{eos\+\_\+unesco}} = 2
\begin{DoxyCompactList}\small\item\em A named integer specifying an equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a4bbd0f276fe3878bd01b3ff180fb41c5}\label{namespacemom__eos_a4bbd0f276fe3878bd01b3ff180fb41c5}} 
integer, parameter, public \mbox{\hyperlink{namespacemom__eos_a4bbd0f276fe3878bd01b3ff180fb41c5}{eos\+\_\+wright}} = 3
\begin{DoxyCompactList}\small\item\em A named integer specifying an equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_afcd60f98ea35c6044d38eb4409b0a083}\label{namespacemom__eos_afcd60f98ea35c6044d38eb4409b0a083}} 
integer, parameter, public \mbox{\hyperlink{namespacemom__eos_afcd60f98ea35c6044d38eb4409b0a083}{eos\+\_\+teos10}} = 4
\begin{DoxyCompactList}\small\item\em A named integer specifying an equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_ac37477f774acf511e88e96c036fa8292}\label{namespacemom__eos_ac37477f774acf511e88e96c036fa8292}} 
integer, parameter, public \mbox{\hyperlink{namespacemom__eos_ac37477f774acf511e88e96c036fa8292}{eos\+\_\+nemo}} = 5
\begin{DoxyCompactList}\small\item\em A named integer specifying an equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_adba0a32cc2c8f110e58447a29bf885d3}\label{namespacemom__eos_adba0a32cc2c8f110e58447a29bf885d3}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_adba0a32cc2c8f110e58447a29bf885d3}{eos\+\_\+linear\+\_\+string}} = \char`\"{}L\+I\+N\+E\+AR\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_aa725e4d064e1dd5cb0c6208096ad05fe}\label{namespacemom__eos_aa725e4d064e1dd5cb0c6208096ad05fe}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_aa725e4d064e1dd5cb0c6208096ad05fe}{eos\+\_\+unesco\+\_\+string}} = \char`\"{}U\+N\+E\+S\+CO\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_acacee5907ae295a83b1a9b65175d5a1e}\label{namespacemom__eos_acacee5907ae295a83b1a9b65175d5a1e}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_acacee5907ae295a83b1a9b65175d5a1e}{eos\+\_\+wright\+\_\+string}} = \char`\"{}W\+R\+I\+G\+HT\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a9dc2b7c2c67a47b336de4db21b0c9cf5}\label{namespacemom__eos_a9dc2b7c2c67a47b336de4db21b0c9cf5}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_a9dc2b7c2c67a47b336de4db21b0c9cf5}{eos\+\_\+teos10\+\_\+string}} = \char`\"{}T\+E\+O\+S10\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a9348dc6c296a8dad0fe5cf27e47119a5}\label{namespacemom__eos_a9348dc6c296a8dad0fe5cf27e47119a5}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_a9348dc6c296a8dad0fe5cf27e47119a5}{eos\+\_\+nemo\+\_\+string}} = \char`\"{}N\+E\+MO\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a3d4e14a920e46cac8cec72c79690de7c}\label{namespacemom__eos_a3d4e14a920e46cac8cec72c79690de7c}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_a3d4e14a920e46cac8cec72c79690de7c}{eos\+\_\+default}} = E\+O\+S\+\_\+\+W\+R\+I\+G\+H\+T\+\_\+\+S\+T\+R\+I\+NG
\begin{DoxyCompactList}\small\item\em The default equation of state. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_adcc45ec5c82aaef0aa4d330fa8cbc5c5}\label{namespacemom__eos_adcc45ec5c82aaef0aa4d330fa8cbc5c5}} 
integer, parameter \mbox{\hyperlink{namespacemom__eos_adcc45ec5c82aaef0aa4d330fa8cbc5c5}{tfreeze\+\_\+linear}} = 1
\begin{DoxyCompactList}\small\item\em A named integer specifying a freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a7f361d35806d25ac361fea713b7f0b6f}\label{namespacemom__eos_a7f361d35806d25ac361fea713b7f0b6f}} 
integer, parameter \mbox{\hyperlink{namespacemom__eos_a7f361d35806d25ac361fea713b7f0b6f}{tfreeze\+\_\+millero}} = 2
\begin{DoxyCompactList}\small\item\em A named integer specifying a freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_abf1f6edc79b67730c9f47e5645069eda}\label{namespacemom__eos_abf1f6edc79b67730c9f47e5645069eda}} 
integer, parameter \mbox{\hyperlink{namespacemom__eos_abf1f6edc79b67730c9f47e5645069eda}{tfreeze\+\_\+teos10}} = 3
\begin{DoxyCompactList}\small\item\em A named integer specifying a freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_ae3ee69a3e4a38b6925b121e3f34d8a15}\label{namespacemom__eos_ae3ee69a3e4a38b6925b121e3f34d8a15}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_ae3ee69a3e4a38b6925b121e3f34d8a15}{tfreeze\+\_\+linear\+\_\+string}} = \char`\"{}L\+I\+N\+E\+AR\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a3922b6088618d34983c6125e0aa553ad}\label{namespacemom__eos_a3922b6088618d34983c6125e0aa553ad}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_a3922b6088618d34983c6125e0aa553ad}{tfreeze\+\_\+millero\+\_\+string}} = \char`\"{}M\+I\+L\+L\+E\+R\+O\+\_\+78\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_ad96b484fe337e2c37b2b11bcd3cbd7af}\label{namespacemom__eos_ad96b484fe337e2c37b2b11bcd3cbd7af}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_ad96b484fe337e2c37b2b11bcd3cbd7af}{tfreeze\+\_\+teos10\+\_\+string}} = \char`\"{}T\+E\+O\+S10\char`\"{}
\begin{DoxyCompactList}\small\item\em A string for specifying the freezing point expression. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{namespacemom__eos_a26afc0610c00badaeedddf818c0dc48c}\label{namespacemom__eos_a26afc0610c00badaeedddf818c0dc48c}} 
character $\ast$(10), parameter \mbox{\hyperlink{namespacemom__eos_a26afc0610c00badaeedddf818c0dc48c}{tfreeze\+\_\+default}} = T\+F\+R\+E\+E\+Z\+E\+\_\+\+L\+I\+N\+E\+A\+R\+\_\+\+S\+T\+R\+I\+NG
\begin{DoxyCompactList}\small\item\em The default freezing point expression. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacemom__eos_a2787233a5f7a0935206ba2cf4c278aab}\label{namespacemom__eos_a2787233a5f7a0935206ba2cf4c278aab}} 
\index{mom\_eos@{mom\_eos}!analytic\_int\_density\_dz@{analytic\_int\_density\_dz}}
\index{analytic\_int\_density\_dz@{analytic\_int\_density\_dz}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{analytic\_int\_density\_dz()}{analytic\_int\_density\_dz()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::analytic\+\_\+int\+\_\+density\+\_\+dz (\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,  }\item[{real, intent(in)}]{G\+\_\+e,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(inout)}]{dpa,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(inout), optional}]{intz\+\_\+dpa,  }\item[{real, dimension(hi\%isdb\+:hi\%iedb,hi\%jsd\+:hi\%jed), intent(inout), optional}]{intx\+\_\+dpa,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsdb\+:hi\%jedb), intent(inout), 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} & Ocean horizontal index structure \\
\hline
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\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 bottom 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} & A density \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} or \mbox{[}kg m-\/3\mbox{]}, that is used to calculate the pressure (as p$\sim$=-\/z$\ast$rho\+\_\+0$\ast$\+G\+\_\+e) used in the equation of state. \\
\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
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em dpa} & The change in the pressure anomaly \\
\hline
\mbox{\texttt{ in,out}}  & {\em intz\+\_\+dpa} & The integral through the thickness of the \\
\hline
\mbox{\texttt{ in,out}}  & {\em intx\+\_\+dpa} & The integral in x of the difference between \\
\hline
\mbox{\texttt{ in,out}}  & {\em inty\+\_\+dpa} & The integral in y of the difference between \\
\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 1257 of file M\+O\+M\+\_\+\+E\+O\+S.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1257   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{intent(in)}  :: HI\textcolor{comment}{ !< Ocean horizontal index structure}}
\DoxyCodeLine{1258 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1259                         \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{   !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1260 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1261                         \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{   !< Salinity [ppt]}}
\DoxyCodeLine{1262 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1263                         \textcolor{keywordtype}{intent(in)}  :: z\_t\textcolor{comment}{ !< Height at the top of the layer in depth units [Z \string~> m]}}
\DoxyCodeLine{1264 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1265                         \textcolor{keywordtype}{intent(in)}  :: z\_b\textcolor{comment}{ !< Height at the bottom of the layer [Z \string~> m]}}
\DoxyCodeLine{1266 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{ !< A mean density [R \string~> kg m-\/3] or [kg m-\/3], that is}}
\DoxyCodeLine{1267 \textcolor{comment}{                                           !! subtracted out to reduce the magnitude of each of the}}
\DoxyCodeLine{1268 \textcolor{comment}{                                           !! integrals.}}
\DoxyCodeLine{1269 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{intent(in)}  :: rho\_0\textcolor{comment}{ !< A density [R \string~> kg m-\/3] or [kg m-\/3], that is used}}
\DoxyCodeLine{1270 \textcolor{comment}{                                           !! to calculate the pressure (as p\string~=-\/z*rho\_0*G\_e)}}
\DoxyCodeLine{1271 \textcolor{comment}{                                           !! used in the equation of state.}}
\DoxyCodeLine{1272 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{intent(in)}  :: G\_e\textcolor{comment}{ !< The Earth's gravitational acceleration}}
\DoxyCodeLine{1273 \textcolor{comment}{                                           !! [L2 Z-\/1 T-\/2 \string~> m s-\/2] or [m2 Z-\/1 s-\/2 \string~> m s-\/2]}}
\DoxyCodeLine{1274   \textcolor{keywordtype}{type}(EOS\_type),       \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1275 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1276                       \textcolor{keywordtype}{intent(inout)} :: dpa\textcolor{comment}{ !< The change in the pressure anomaly}}
\DoxyCodeLine{1277 \textcolor{comment}{                                           !! across the layer [R L2 T-\/2 \string~> Pa] or [Pa]}}
\DoxyCodeLine{1278 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1279             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: intz\_dpa\textcolor{comment}{ !< The integral through the thickness of the}}
\DoxyCodeLine{1280 \textcolor{comment}{                                           !! layer of the pressure anomaly relative to the}}
\DoxyCodeLine{1281 \textcolor{comment}{                                           !! anomaly at the top of the layer [R L2 Z T-\/2 \string~> Pa m]}}
\DoxyCodeLine{1282 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%IsdB:HI\%IedB,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1283             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: intx\_dpa\textcolor{comment}{ !< The integral in x of the difference between}}
\DoxyCodeLine{1284 \textcolor{comment}{                                          !! the pressure anomaly at the top and bottom of the}}
\DoxyCodeLine{1285 \textcolor{comment}{                                          !! layer divided by the x grid spacing [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{1286 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%JsdB:HI\%JedB)}, \&}
\DoxyCodeLine{1287             \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: inty\_dpa\textcolor{comment}{ !< The integral in y of the difference between}}
\DoxyCodeLine{1288 \textcolor{comment}{                                          !! the pressure anomaly at the top and bottom of the}}
\DoxyCodeLine{1289 \textcolor{comment}{                                          !! layer divided by the y grid spacing [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{1290 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1291               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: bathyT\textcolor{comment}{ !< The depth of the bathymetry [Z \string~> m]}}
\DoxyCodeLine{1292 \textcolor{keywordtype}{  real},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: dz\_neglect\textcolor{comment}{ !< A miniscule thickness change [Z \string~> m]}}
\DoxyCodeLine{1293   \textcolor{keywordtype}{logical},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: useMassWghtInterp\textcolor{comment}{ !< If true, uses mass weighting to}}
\DoxyCodeLine{1294 \textcolor{comment}{                                           !! interpolate T/S for top and bottom integrals.}}
\DoxyCodeLine{1295   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1296 \textcolor{keywordtype}{  real} :: rho\_scale  \textcolor{comment}{! A multiplicative factor by which to scale density from kg m-\/3 to the}}
\DoxyCodeLine{1297                      \textcolor{comment}{! desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{1298 \textcolor{keywordtype}{  real} :: pres\_scale \textcolor{comment}{! A multiplicative factor to convert pressure into Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{1299 }
\DoxyCodeLine{1300   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1301     \textcolor{stringliteral}{"int\_density\_dz called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1302 }
\DoxyCodeLine{1303   \textcolor{comment}{! We should never reach this point with quadrature. EOS\_quadrature indicates that numerical}}
\DoxyCodeLine{1304   \textcolor{comment}{! integration be used instead of analytic. This is a safety check.}}
\DoxyCodeLine{1305   \textcolor{keywordflow}{if} (eos\%EOS\_quadrature) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"EOS\_quadrature is set!"})}
\DoxyCodeLine{1306 }
\DoxyCodeLine{1307   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{1308     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{1309       rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{1310       \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1311         \textcolor{keyword}{call }int\_density\_dz\_linear(t, s, z\_t, z\_b, rho\_ref, rho\_0, g\_e, hi, \&}
\DoxyCodeLine{1312                          rho\_scale*eos\%Rho\_T0\_S0, rho\_scale*eos\%dRho\_dT, rho\_scale*eos\%dRho\_dS, \&}
\DoxyCodeLine{1313                          dpa, intz\_dpa, intx\_dpa, inty\_dpa, bathyt, dz\_neglect, usemasswghtinterp)}
\DoxyCodeLine{1314       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1315         \textcolor{keyword}{call }int\_density\_dz\_linear(t, s, z\_t, z\_b, rho\_ref, rho\_0, g\_e, hi, \&}
\DoxyCodeLine{1316                          eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, \&}
\DoxyCodeLine{1317                          dpa, intz\_dpa, intx\_dpa, inty\_dpa, bathyt, dz\_neglect, usemasswghtinterp)}
\DoxyCodeLine{1318 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1319     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{1320       rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{1321       pres\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{1322       \textcolor{keywordflow}{if} ((rho\_scale /= 1.0) .or. (pres\_scale /= 1.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1323         \textcolor{keyword}{call }int\_density\_dz\_wright(t, s, z\_t, z\_b, rho\_ref, rho\_0, g\_e, hi, \&}
\DoxyCodeLine{1324                                    dpa, intz\_dpa, intx\_dpa, inty\_dpa, bathyt, \&}
\DoxyCodeLine{1325                                    dz\_neglect, usemasswghtinterp, rho\_scale, pres\_scale)}
\DoxyCodeLine{1326       \textcolor{keywordflow}{else}}
\DoxyCodeLine{1327         \textcolor{keyword}{call }int\_density\_dz\_wright(t, s, z\_t, z\_b, rho\_ref, rho\_0, g\_e, hi, \&}
\DoxyCodeLine{1328                                    dpa, intz\_dpa, intx\_dpa, inty\_dpa, bathyt, \&}
\DoxyCodeLine{1329                                    dz\_neglect, usemasswghtinterp)}
\DoxyCodeLine{1330 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{1331 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1332       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"No analytic integration option is available with this EOS!"})}
\DoxyCodeLine{1333 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1334 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a09b6cb637246b8aa287ef7cdb482aaea}\label{namespacemom__eos_a09b6cb637246b8aa287ef7cdb482aaea}} 
\index{mom\_eos@{mom\_eos}!analytic\_int\_specific\_vol\_dp@{analytic\_int\_specific\_vol\_dp}}
\index{analytic\_int\_specific\_vol\_dp@{analytic\_int\_specific\_vol\_dp}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{analytic\_int\_specific\_vol\_dp()}{analytic\_int\_specific\_vol\_dp()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::analytic\+\_\+int\+\_\+specific\+\_\+vol\+\_\+dp (\begin{DoxyParamCaption}\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{T,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{S,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{p\+\_\+t,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(in)}]{p\+\_\+b,  }\item[{real, intent(in)}]{alpha\+\_\+ref,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(inout)}]{dza,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed), intent(inout), optional}]{intp\+\_\+dza,  }\item[{real, dimension(hi\%isdb\+:hi\%iedb,hi\%jsd\+:hi\%jed), intent(inout), optional}]{intx\+\_\+dza,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsdb\+:hi\%jedb), intent(inout), 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\+\_\+tiny,  }\item[{logical, intent(in), optional}]{use\+Mass\+Wght\+Interp }\end{DoxyParamCaption})}



Calls the appropriate subroutine to calculate 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. There are essentially no free assumptions, apart from the use of Boole\textquotesingle{}s rule to do the horizontal integrals, and from a truncation in the series for log(1-\/eps/1+eps) that assumes that $\vert$eps$\vert$ $<$ 0.\+34. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em hi} & The horizontal index structure \\
\hline
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\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 bottom 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
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em dza} & The change in the geopotential anomaly across \\
\hline
\mbox{\texttt{ in,out}}  & {\em intp\+\_\+dza} & The integral in pressure through the layer of the \\
\hline
\mbox{\texttt{ in,out}}  & {\em intx\+\_\+dza} & The integral in x of the difference between the \\
\hline
\mbox{\texttt{ in,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\+\_\+tiny} & 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 1188 of file M\+O\+M\+\_\+\+E\+O\+S.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{1188   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{intent(in)}  :: HI\textcolor{comment}{  !< The horizontal index structure}}
\DoxyCodeLine{1189 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1190                         \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{   !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1191 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1192                         \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{   !< Salinity [ppt]}}
\DoxyCodeLine{1193 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1194                         \textcolor{keywordtype}{intent(in)}  :: p\_t\textcolor{comment}{ !< Pressure at the top of the layer [R L2 T-\/2 \string~> Pa] or [Pa]}}
\DoxyCodeLine{1195 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1196                         \textcolor{keywordtype}{intent(in)}  :: p\_b\textcolor{comment}{ !< Pressure at the bottom of the layer [R L2 T-\/2 \string~> Pa] or [Pa]}}
\DoxyCodeLine{1197 \textcolor{keywordtype}{  real},                 \textcolor{keywordtype}{intent(in)}  :: alpha\_ref\textcolor{comment}{ !< A mean specific volume that is subtracted out}}
\DoxyCodeLine{1198 \textcolor{comment}{                            !! to reduce the magnitude of each of the integrals [R-\/1 \string~> m3 kg-\/1]}}
\DoxyCodeLine{1199 \textcolor{comment}{                            !! The calculation is mathematically identical with different values of}}
\DoxyCodeLine{1200 \textcolor{comment}{                            !! alpha\_ref, but this reduces the effects of roundoff.}}
\DoxyCodeLine{1201   \textcolor{keywordtype}{type}(EOS\_type),       \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1202 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1203                         \textcolor{keywordtype}{intent(inout)} :: dza\textcolor{comment}{ !< The change in the geopotential anomaly across}}
\DoxyCodeLine{1204 \textcolor{comment}{                            !! the layer [L2 T-\/2 \string~> m2 s-\/2] or [m2 s-\/2]}}
\DoxyCodeLine{1205 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1206               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: intp\_dza\textcolor{comment}{ !< The integral in pressure through the layer of the}}
\DoxyCodeLine{1207 \textcolor{comment}{                            !! geopotential anomaly relative to the anomaly at the bottom of the}}
\DoxyCodeLine{1208 \textcolor{comment}{                            !! layer [R L4 T-\/4 \string~> Pa m2 s-\/2] or [Pa m2 s-\/2]}}
\DoxyCodeLine{1209 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%IsdB:HI\%IedB,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1210               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: intx\_dza\textcolor{comment}{ !< The integral in x of the difference between the}}
\DoxyCodeLine{1211 \textcolor{comment}{                            !! geopotential anomaly at the top and bottom of the layer divided by}}
\DoxyCodeLine{1212 \textcolor{comment}{                            !! the x grid spacing [L2 T-\/2 \string~> m2 s-\/2] or [m2 s-\/2]}}
\DoxyCodeLine{1213 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%JsdB:HI\%JedB)}, \&}
\DoxyCodeLine{1214               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(inout)} :: inty\_dza\textcolor{comment}{ !< The integral in y of the difference between the}}
\DoxyCodeLine{1215 \textcolor{comment}{                            !! geopotential anomaly at the top and bottom of the layer divided by}}
\DoxyCodeLine{1216 \textcolor{comment}{                            !! the y grid spacing [L2 T-\/2 \string~> m2 s-\/2] or [m2 s-\/2]}}
\DoxyCodeLine{1217   \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{1218 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed)}, \&}
\DoxyCodeLine{1219               \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: bathyP\textcolor{comment}{  !< The pressure at the bathymetry [R L2 T-\/2 \string~> Pa] or [Pa]}}
\DoxyCodeLine{1220 \textcolor{keywordtype}{  real},       \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: dP\_tiny\textcolor{comment}{ !< A miniscule pressure change with}}
\DoxyCodeLine{1221 \textcolor{comment}{                            !! the same units as p\_t [R L2 T-\/2 \string~> Pa] or [Pa]}}
\DoxyCodeLine{1222   \textcolor{keywordtype}{logical},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: useMassWghtInterp\textcolor{comment}{ !< If true, uses mass weighting}}
\DoxyCodeLine{1223 \textcolor{comment}{                            !! to interpolate T/S for top and bottom integrals.}}
\DoxyCodeLine{1224   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1225 \textcolor{keywordtype}{  real} :: pres\_scale    \textcolor{comment}{! A unit conversion factor from the rescaled units of pressure to Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{1226 \textcolor{keywordtype}{  real} :: SV\_scale      \textcolor{comment}{! A multiplicative factor by which to scale specific}}
\DoxyCodeLine{1227                         \textcolor{comment}{! volume from m3 kg-\/1 to the desired units [kg m-\/3 R-\/1 \string~> 1]}}
\DoxyCodeLine{1228 }
\DoxyCodeLine{1229   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1230     \textcolor{stringliteral}{"int\_specific\_vol\_dp called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1231 }
\DoxyCodeLine{1232   \textcolor{comment}{! We should never reach this point with quadrature. EOS\_quadrature indicates that numerical}}
\DoxyCodeLine{1233   \textcolor{comment}{! integration be used instead of analytic. This is a safety check.}}
\DoxyCodeLine{1234   \textcolor{keywordflow}{if} (eos\%EOS\_quadrature) \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"EOS\_quadrature is set!"})}
\DoxyCodeLine{1235 }
\DoxyCodeLine{1236   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{1237     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{1238       \textcolor{keyword}{call }int\_spec\_vol\_dp\_linear(t, s, p\_t, p\_b, alpha\_ref, hi, eos\%kg\_m3\_to\_R*eos\%Rho\_T0\_S0, \&}
\DoxyCodeLine{1239                                 eos\%kg\_m3\_to\_R*eos\%dRho\_dT, eos\%kg\_m3\_to\_R*eos\%dRho\_dS, dza, \&}
\DoxyCodeLine{1240                                 intp\_dza, intx\_dza, inty\_dza, halo\_size, \&}
\DoxyCodeLine{1241                                 bathyp, dp\_tiny, usemasswghtinterp)}
\DoxyCodeLine{1242     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{1243       \textcolor{keyword}{call }int\_spec\_vol\_dp\_wright(t, s, p\_t, p\_b, alpha\_ref, hi, dza, intp\_dza, intx\_dza, \&}
\DoxyCodeLine{1244                                   inty\_dza, halo\_size, bathyp, dp\_tiny, usemasswghtinterp, \&}
\DoxyCodeLine{1245                                   sv\_scale=eos\%R\_to\_kg\_m3, pres\_scale=eos\%RL2\_T2\_to\_Pa)}
\DoxyCodeLine{1246 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1247       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"No analytic integration option is available with this EOS!"})}
\DoxyCodeLine{1248 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1249 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_afbb6a11d3b826308ddb1ffe0c5cf32d1}\label{namespacemom__eos_afbb6a11d3b826308ddb1ffe0c5cf32d1}} 
\index{mom\_eos@{mom\_eos}!calc\_spec\_vol\_1d@{calc\_spec\_vol\_1d}}
\index{calc\_spec\_vol\_1d@{calc\_spec\_vol\_1d}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calc\_spec\_vol\_1d()}{calc\_spec\_vol\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calc\+\_\+spec\+\_\+vol\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{specvol,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, dimension(2), intent(in), optional}]{dom,  }\item[{real, intent(in), optional}]{spv\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the specific volume of sea water for 1-\/D array inputs, potentially limiting the domain of indices that are worked on. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em specvol} & In situ specific volume \mbox{[}R-\/1 $\sim$$>$ m3 kg-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em dom} & The domain of indices to work on, taking into account that arrays start at 1. \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}R-\/1 $\sim$$>$ m3 kg-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale output specific volume in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{571 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{572 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{573 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{574 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(inout)} :: specvol\textcolor{comment}{  !< In situ specific volume [R-\/1 \string~> m3 kg-\/1]}}
\DoxyCodeLine{575   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{576   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dom\textcolor{comment}{   !< The domain of indices to work on, taking}}
\DoxyCodeLine{577 \textcolor{comment}{                                                       !! into account that arrays start at 1.}}
\DoxyCodeLine{578 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: spv\_ref\textcolor{comment}{ !< A reference specific volume [R-\/1 \string~> m3 kg-\/1]}}
\DoxyCodeLine{579 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale}}
\DoxyCodeLine{580 \textcolor{comment}{                                                       !! output specific volume in combination with}}
\DoxyCodeLine{581 \textcolor{comment}{                                                       !! scaling given by US [various]}}
\DoxyCodeLine{582   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{583 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(specvol))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{584 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{585 \textcolor{keywordtype}{  real} :: spv\_unscale \textcolor{comment}{! A factor to convert specific volume from R-\/1 to m3 kg-\/1 [m3 kg-\/1 R \string~> 1]}}
\DoxyCodeLine{586 \textcolor{keywordtype}{  real} :: spv\_scale \textcolor{comment}{! A factor to convert specific volume from m3 kg-\/1 to the desired units [kg m-\/3 R-\/1 \string~> 1]}}
\DoxyCodeLine{587 \textcolor{keywordtype}{  real} :: spv\_reference \textcolor{comment}{! spv\_ref converted to [m3 kg-\/1]}}
\DoxyCodeLine{588   \textcolor{keywordtype}{integer} :: i, is, ie, npts}
\DoxyCodeLine{589 }
\DoxyCodeLine{590   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{591     \textcolor{stringliteral}{"calc\_spec\_vol\_1d called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{592 }
\DoxyCodeLine{593   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dom)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{594     is = dom(1) ; ie = dom(2) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{595   \textcolor{keywordflow}{else}}
\DoxyCodeLine{596     is = 1 ; ie = \textcolor{keyword}{size}(specvol) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{597 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{598 }
\DoxyCodeLine{599   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{600   spv\_unscale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{601 }
\DoxyCodeLine{602   \textcolor{keywordflow}{if} ((p\_scale == 1.0) .and. (spv\_unscale == 1.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{603     \textcolor{keyword}{call }calculate\_spec\_vol\_array(t, s, pressure, specvol, is, npts, eos, spv\_ref)}
\DoxyCodeLine{604   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then} \textcolor{comment}{! This is the same as above, but with some extra work to rescale variables.}}
\DoxyCodeLine{605     \textcolor{keywordflow}{do} i=is,ie ; pres(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{606     spv\_reference = spv\_unscale*spv\_ref}
\DoxyCodeLine{607     \textcolor{keyword}{call }calculate\_spec\_vol\_array(t, s, pres, specvol, is, npts, eos, spv\_reference)}
\DoxyCodeLine{608   \textcolor{keywordflow}{else}  \textcolor{comment}{! There is rescaling of variables, but spv\_ref is not present. Passing a 0 value of spv\_ref}}
\DoxyCodeLine{609         \textcolor{comment}{! changes answers at roundoff for some equations of state, like Wright and UNESCO.}}
\DoxyCodeLine{610     \textcolor{keywordflow}{do} i=is,ie ; pres(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{611     \textcolor{keyword}{call }calculate\_spec\_vol\_array(t, s, pres, specvol, is, npts, eos)}
\DoxyCodeLine{612 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{613 }
\DoxyCodeLine{614   spv\_scale = eos\%R\_to\_kg\_m3}
\DoxyCodeLine{615   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) spv\_scale = spv\_scale * scale}
\DoxyCodeLine{616   \textcolor{keywordflow}{if} (spv\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{617     specvol(i) = spv\_scale * specvol(i)}
\DoxyCodeLine{618 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{619 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a640c3b2292afd3266caa11243549bbf0}\label{namespacemom__eos_a640c3b2292afd3266caa11243549bbf0}} 
\index{mom\_eos@{mom\_eos}!calc\_spec\_vol\_derivs\_1d@{calc\_spec\_vol\_derivs\_1d}}
\index{calc\_spec\_vol\_derivs\_1d@{calc\_spec\_vol\_derivs\_1d}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calc\_spec\_vol\_derivs\_1d()}{calc\_spec\_vol\_derivs\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calc\+\_\+spec\+\_\+vol\+\_\+derivs\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{d\+S\+V\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{d\+S\+V\+\_\+dS,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, dimension(2), intent(in), optional}]{dom,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate specific volume derivatives for 1-\/d array inputs, potentially limiting the domain of indices that are worked on. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em dsv\+\_\+dt} & The partial derivative of specific volume with potential temperature \mbox{[}R-\/1 deg\+C-\/1 $\sim$$>$ m3 kg-\/1 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em dsv\+\_\+ds} & The partial derivative of specific volume with salinity \mbox{[}R-\/1 ppt-\/1 $\sim$$>$ m3 kg-\/1 ppt-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em dom} & The domain of indices to work on, taking into account that arrays start at 1. \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale specific volume in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1040 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1041 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{1042 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{1043 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: dSV\_dT\textcolor{comment}{   !< The partial derivative of specific volume with potential}}
\DoxyCodeLine{1044 \textcolor{comment}{                                                !! temperature [R-\/1 degC-\/1 \string~> m3 kg-\/1 degC-\/1]}}
\DoxyCodeLine{1045 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: dSV\_dS\textcolor{comment}{   !< The partial derivative of specific volume with salinity}}
\DoxyCodeLine{1046 \textcolor{comment}{                                                !! [R-\/1 ppt-\/1 \string~> m3 kg-\/1 ppt-\/1]}}
\DoxyCodeLine{1047   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{1048   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dom\textcolor{comment}{   !< The domain of indices to work on, taking}}
\DoxyCodeLine{1049 \textcolor{comment}{                                                       !! into account that arrays start at 1.}}
\DoxyCodeLine{1050 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale specific}}
\DoxyCodeLine{1051 \textcolor{comment}{                                                !! volume in combination with scaling given by US [various]}}
\DoxyCodeLine{1052 }
\DoxyCodeLine{1053   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1054 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(dSV\_dT))} :: press   \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{1055 \textcolor{keywordtype}{  real} :: spv\_scale \textcolor{comment}{! A factor to convert specific volume from m3 kg-\/1 to the desired units [kg R-\/1 m-\/3 \string~> 1]}}
\DoxyCodeLine{1056 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{1057   \textcolor{keywordtype}{integer} :: i, is, ie, npts}
\DoxyCodeLine{1058 }
\DoxyCodeLine{1059   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1060     \textcolor{stringliteral}{"calculate\_spec\_vol\_derivs\_1d called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1061 }
\DoxyCodeLine{1062   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dom)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1063     is = dom(1) ; ie = dom(2) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{1064   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1065     is = 1 ; ie = \textcolor{keyword}{size}(dsv\_dt) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{1066 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1067   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{1068 }
\DoxyCodeLine{1069   \textcolor{keywordflow}{if} (p\_scale == 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1070     \textcolor{keyword}{call }calculate\_spec\_vol\_derivs\_array(t, s, pressure, dsv\_dt, dsv\_ds, is, npts, eos)}
\DoxyCodeLine{1071   \textcolor{keywordflow}{else}}
\DoxyCodeLine{1072     \textcolor{keywordflow}{do} i=is,ie ; press(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1073     \textcolor{keyword}{call }calculate\_spec\_vol\_derivs\_array(t, s, press, dsv\_dt, dsv\_ds, is, npts, eos)}
\DoxyCodeLine{1074 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1075 }
\DoxyCodeLine{1076   spv\_scale = eos\%R\_to\_kg\_m3}
\DoxyCodeLine{1077   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) spv\_scale = spv\_scale * scale}
\DoxyCodeLine{1078   \textcolor{keywordflow}{if} (spv\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1079     dsv\_dt(i) = spv\_scale * dsv\_dt(i)}
\DoxyCodeLine{1080     dsv\_ds(i) = spv\_scale * dsv\_ds(i)}
\DoxyCodeLine{1081 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{1082 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a246056e557a08ce1c697256cd718d99a}\label{namespacemom__eos_a246056e557a08ce1c697256cd718d99a}} 
\index{mom\_eos@{mom\_eos}!calc\_spec\_vol\_scalar@{calc\_spec\_vol\_scalar}}
\index{calc\_spec\_vol\_scalar@{calc\_spec\_vol\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calc\_spec\_vol\_scalar()}{calc\_spec\_vol\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calc\+\_\+spec\+\_\+vol\+\_\+scalar (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{specvol,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{spv\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate specific volume of sea water for scalar inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em specvol} & In situ? specific volume \mbox{[}m3 kg-\/1\mbox{]} or \mbox{[}R-\/1 $\sim$$>$ m3 kg-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]} or \mbox{[}R-\/1 m3 kg-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale specific volume in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{533 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{534 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{535 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{536 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: specvol\textcolor{comment}{  !< In situ? specific volume [m3 kg-\/1] or [R-\/1 \string~> m3 kg-\/1]}}
\DoxyCodeLine{537   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{538 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1] or [R-\/1 m3 kg-\/1]}}
\DoxyCodeLine{539 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale specific}}
\DoxyCodeLine{540 \textcolor{comment}{                                          !! volume in combination with scaling given by US [various]}}
\DoxyCodeLine{541 }
\DoxyCodeLine{542 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: Ta, Sa, pres, spv  \textcolor{comment}{! Rescaled single element array versions of the arguments.}}
\DoxyCodeLine{543 \textcolor{keywordtype}{  real} :: spv\_reference \textcolor{comment}{! spv\_ref converted to [m3 kg-\/1]}}
\DoxyCodeLine{544 \textcolor{keywordtype}{  real} :: spv\_scale \textcolor{comment}{! A factor to convert specific volume from m3 kg-\/1 to the desired units [kg R-\/1 m-\/3 \string~> 1]}}
\DoxyCodeLine{545 }
\DoxyCodeLine{546   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{547     \textcolor{stringliteral}{"calc\_spec\_vol\_scalar called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{548 }
\DoxyCodeLine{549   pres(1) = eos\%RL2\_T2\_to\_Pa*pressure}
\DoxyCodeLine{550   ta(1) = t ; sa(1) = s}
\DoxyCodeLine{551 }
\DoxyCodeLine{552   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{553     spv\_reference = eos\%kg\_m3\_to\_R*spv\_ref}
\DoxyCodeLine{554     \textcolor{keyword}{call }calculate\_spec\_vol\_array(ta, sa, pres, spv, 1, 1, eos, spv\_reference)}
\DoxyCodeLine{555   \textcolor{keywordflow}{else}}
\DoxyCodeLine{556     \textcolor{keyword}{call }calculate\_spec\_vol\_array(ta, sa, pres, spv, 1, 1, eos)}
\DoxyCodeLine{557 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{558   specvol = spv(1)}
\DoxyCodeLine{559 }
\DoxyCodeLine{560   spv\_scale = eos\%R\_to\_kg\_m3}
\DoxyCodeLine{561   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) spv\_scale = spv\_scale * scale}
\DoxyCodeLine{562   \textcolor{keywordflow}{if} (spv\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{563     specvol = spv\_scale * specvol}
\DoxyCodeLine{564 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{565 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a3296609bd60bfe7ed2c5eac1170d07a3}\label{namespacemom__eos_a3296609bd60bfe7ed2c5eac1170d07a3}} 
\index{mom\_eos@{mom\_eos}!calculate\_compress\_array@{calculate\_compress\_array}}
\index{calculate\_compress\_array@{calculate\_compress\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_compress\_array()}{calculate\_compress\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+compress\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{press,  }\item[{real, dimension(\+:), intent(inout)}]{rho,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dp,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the density and compressibility for 1-\/D array inputs. If US is present, the units of the inputs and outputs are rescaled. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em press} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em rho} & In situ density \mbox{[}kg m-\/3\mbox{]} or \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in,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{]} or \mbox{[}T2 L-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index within the array \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1089 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1090 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [PSU]}}
\DoxyCodeLine{1091 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: press\textcolor{comment}{    !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{1092 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< In situ density [kg m-\/3] or [R \string~> kg m-\/3]}}
\DoxyCodeLine{1093 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dp\textcolor{comment}{  !< The partial derivative of density with pressure}}
\DoxyCodeLine{1094 \textcolor{comment}{                                                !! (also the inverse of the square of sound speed)}}
\DoxyCodeLine{1095 \textcolor{comment}{                                                !! [s2 m-\/2] or [T2 L-\/2]}}
\DoxyCodeLine{1096   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{    !< Starting index within the array}}
\DoxyCodeLine{1097   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{     !< The number of values to calculate}}
\DoxyCodeLine{1098   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{1099 }
\DoxyCodeLine{1100   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1101 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(press))} :: pressure  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{1102   \textcolor{keywordtype}{integer} :: i, is, ie}
\DoxyCodeLine{1103 }
\DoxyCodeLine{1104   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1105     \textcolor{stringliteral}{"calculate\_compress called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1106 }
\DoxyCodeLine{1107   is = start ; ie = is + npts -\/ 1}
\DoxyCodeLine{1108   \textcolor{keywordflow}{do} i=is,ie ; pressure(i) = eos\%RL2\_T2\_to\_Pa * press(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{1109 }
\DoxyCodeLine{1110   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{1111     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{1112       \textcolor{keyword}{call }calculate\_compress\_linear(t, s, pressure, rho, drho\_dp, start, npts, \&}
\DoxyCodeLine{1113                                      eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS)}
\DoxyCodeLine{1114     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{1115       \textcolor{keyword}{call }calculate\_compress\_unesco(t, s, pressure, rho, drho\_dp, start, npts)}
\DoxyCodeLine{1116     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{1117       \textcolor{keyword}{call }calculate\_compress\_wright(t, s, pressure, rho, drho\_dp, start, npts)}
\DoxyCodeLine{1118     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{1119       \textcolor{keyword}{call }calculate\_compress\_teos10(t, s, pressure, rho, drho\_dp, start, npts)}
\DoxyCodeLine{1120     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{1121       \textcolor{keyword}{call }calculate\_compress\_nemo(t, s, pressure, rho, drho\_dp, start, npts)}
\DoxyCodeLine{1122 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1123       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_compress: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{1124 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1125 }
\DoxyCodeLine{1126   \textcolor{keywordflow}{if} (eos\%kg\_m3\_to\_R /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1127     rho(i) = eos\%kg\_m3\_to\_R * rho(i)}
\DoxyCodeLine{1128 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{1129   \textcolor{keywordflow}{if} (eos\%L\_T\_to\_m\_s /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{1130     drho\_dp(i) = eos\%L\_T\_to\_m\_s**2 * drho\_dp(i)}
\DoxyCodeLine{1131 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{1132 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_ad0986d800c26414dbd19d2b3a541e613}\label{namespacemom__eos_ad0986d800c26414dbd19d2b3a541e613}} 
\index{mom\_eos@{mom\_eos}!calculate\_compress\_scalar@{calculate\_compress\_scalar}}
\index{calculate\_compress\_scalar@{calculate\_compress\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_compress\_scalar()}{calculate\_compress\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+compress\+\_\+scalar (\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(out)}]{drho\+\_\+dp,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calculate density and compressibility for a scalar. This just promotes the scalar to an array with a singleton dimension and calls calculate\+\_\+compress\+\_\+array. If US is present, the units of the inputs and outputs are rescaled. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & In situ density \mbox{[}kg m-\/3\mbox{]} or \mbox{[}R $\sim$$>$ 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{]} or \mbox{[}T2 L-\/2\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1139 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}        :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1140 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}        :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{1141 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}        :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{1142 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)}       :: rho\textcolor{comment}{      !< In situ density [kg m-\/3] or [R \string~> kg m-\/3]}}
\DoxyCodeLine{1143 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)}       :: drho\_dp\textcolor{comment}{  !< The partial derivative of density with pressure (also the}}
\DoxyCodeLine{1144 \textcolor{comment}{                                      !! inverse of the square of sound speed) [s2 m-\/2] or [T2 L-\/2]}}
\DoxyCodeLine{1145   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer} :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{1146 }
\DoxyCodeLine{1147   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1148 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: Ta, Sa, pa, rhoa, drho\_dpa}
\DoxyCodeLine{1149 }
\DoxyCodeLine{1150   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1151     \textcolor{stringliteral}{"calculate\_compress called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1152   ta(1) = t ; sa(1) = s; pa(1) = pressure}
\DoxyCodeLine{1153 }
\DoxyCodeLine{1154   \textcolor{keyword}{call }calculate\_compress\_array(ta, sa, pa, rhoa, drho\_dpa, 1, 1, eos)}
\DoxyCodeLine{1155   rho = rhoa(1) ; drho\_dp = drho\_dpa(1)}
\DoxyCodeLine{1156 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a2e78ade3bcba817406479cbbe3941a5f}\label{namespacemom__eos_a2e78ade3bcba817406479cbbe3941a5f}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_1d@{calculate\_density\_1d}}
\index{calculate\_density\_1d@{calculate\_density\_1d}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_1d()}{calculate\_density\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{rho,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, dimension(2), intent(in), optional}]{dom,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs, potentially limiting the domain of indices that are worked on. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em dom} & The domain of indices to work on, taking into account that arrays start at 1. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{360 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{361 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{362 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{363 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [R \string~> kg m-\/3]}}
\DoxyCodeLine{364   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{365   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dom\textcolor{comment}{   !< The domain of indices to work on, taking}}
\DoxyCodeLine{366 \textcolor{comment}{                                                       !! into account that arrays start at 1.}}
\DoxyCodeLine{367 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: rho\_ref\textcolor{comment}{ !< A reference density [kg m-\/3]}}
\DoxyCodeLine{368 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{369 \textcolor{comment}{                                                   !! in combination with scaling given by US [various]}}
\DoxyCodeLine{370   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{371 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{372 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{373 \textcolor{keywordtype}{  real} :: rho\_unscale \textcolor{comment}{! A factor to convert density from R to kg m-\/3 [kg m-\/3 R-\/1 \string~> 1]}}
\DoxyCodeLine{374 \textcolor{keywordtype}{  real} :: rho\_reference \textcolor{comment}{! rho\_ref converted to [kg m-\/3]}}
\DoxyCodeLine{375 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(rho))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{376   \textcolor{keywordtype}{integer} :: i, is, ie, npts}
\DoxyCodeLine{377 }
\DoxyCodeLine{378   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{379     \textcolor{stringliteral}{"calculate\_density\_1d called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{380 }
\DoxyCodeLine{381   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dom)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{382     is = dom(1) ; ie = dom(2) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{383   \textcolor{keywordflow}{else}}
\DoxyCodeLine{384     is = 1 ; ie = \textcolor{keyword}{size}(rho) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{385 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{386 }
\DoxyCodeLine{387   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{388   rho\_unscale = eos\%R\_to\_kg\_m3}
\DoxyCodeLine{389 }
\DoxyCodeLine{390   \textcolor{keywordflow}{if} ((p\_scale == 1.0) .and. (rho\_unscale == 1.0)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{391     \textcolor{keyword}{call }calculate\_density\_array(t, s, pressure, rho, is, npts, eos, rho\_ref=rho\_ref)}
\DoxyCodeLine{392   \textcolor{keywordflow}{elseif} (\textcolor{keyword}{present}(rho\_ref)) \textcolor{keywordflow}{then} \textcolor{comment}{! This is the same as above, but with some extra work to rescale variables.}}
\DoxyCodeLine{393     \textcolor{keywordflow}{do} i=is,ie ; pres(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{394     rho\_reference = rho\_unscale*rho\_ref}
\DoxyCodeLine{395     \textcolor{keyword}{call }calculate\_density\_array(t, s, pres, rho, is, npts, eos, rho\_ref=rho\_reference)}
\DoxyCodeLine{396   \textcolor{keywordflow}{else}  \textcolor{comment}{! There is rescaling of variables, but rho\_ref is not present. Passing a 0 value of rho\_ref}}
\DoxyCodeLine{397         \textcolor{comment}{! changes answers at roundoff for some equations of state, like Wright and UNESCO.}}
\DoxyCodeLine{398     \textcolor{keywordflow}{do} i=is,ie ; pres(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{399     \textcolor{keyword}{call }calculate\_density\_array(t, s, pres, rho, is, npts, eos)}
\DoxyCodeLine{400 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{401 }
\DoxyCodeLine{402   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{403   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{404   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{405     rho(i) = rho\_scale * rho(i)}
\DoxyCodeLine{406 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{407 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a3be8289c391088bdd3af78d272b92521}\label{namespacemom__eos_a3be8289c391088bdd3af78d272b92521}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_array@{calculate\_density\_array}}
\index{calculate\_density\_array@{calculate\_density\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_array()}{calculate\_density\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{rho,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}kg m-\/3\mbox{]} or \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Start index for computation \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & Number of point to compute \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{263 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{264 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{265 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{266 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [kg m-\/3] or [R \string~> kg m-\/3]}}
\DoxyCodeLine{267   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< Start index for computation}}
\DoxyCodeLine{268   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< Number of point to compute}}
\DoxyCodeLine{269   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{270 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3]}}
\DoxyCodeLine{271 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{272 \textcolor{comment}{                                                !! in combination with scaling given by US [various]}}
\DoxyCodeLine{273   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{274 }
\DoxyCodeLine{275   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{276     \textcolor{stringliteral}{"calculate\_density\_array called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{277 }
\DoxyCodeLine{278   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{279     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{280       \textcolor{keyword}{call }calculate\_density\_linear(t, s, pressure, rho, start, npts, \&}
\DoxyCodeLine{281                                     eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, rho\_ref)}
\DoxyCodeLine{282     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{283       \textcolor{keyword}{call }calculate\_density\_unesco(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{284     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{285       \textcolor{keyword}{call }calculate\_density\_wright(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{286     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{287       \textcolor{keyword}{call }calculate\_density\_teos10(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{288     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{289     \textcolor{keyword}{call }calculate\_density\_nemo(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{290 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{291       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_array: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{292 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{293 }
\DoxyCodeLine{294   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{295     rho(j) = scale * rho(j)}
\DoxyCodeLine{296 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{297 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_aed3bb20f32c038dbe84bc44442c6e724}\label{namespacemom__eos_aed3bb20f32c038dbe84bc44442c6e724}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_derivs\_1d@{calculate\_density\_derivs\_1d}}
\index{calculate\_density\_derivs\_1d@{calculate\_density\_derivs\_1d}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_1d()}{calculate\_density\_derivs\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+derivs\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dS,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, dimension(2), intent(in), optional}]{dom,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density derivatives for 1-\/D array inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 ppt-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em dom} & The domain of indices to work on, taking into account that arrays start at 1. \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{751 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{752 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{753 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{754 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(inout)} :: drho\_dT\textcolor{comment}{  !< The partial derivative of density with potential}}
\DoxyCodeLine{755 \textcolor{comment}{                                                   !! temperature [R degC-\/1 \string~> kg m-\/3 degC-\/1]}}
\DoxyCodeLine{756 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(inout)} :: drho\_dS\textcolor{comment}{  !< The partial derivative of density with salinity}}
\DoxyCodeLine{757 \textcolor{comment}{                                                   !! [R degC-\/1 \string~> kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{758   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{759   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dom\textcolor{comment}{   !< The domain of indices to work on, taking}}
\DoxyCodeLine{760 \textcolor{comment}{                                                       !! into account that arrays start at 1.}}
\DoxyCodeLine{761 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{762 \textcolor{comment}{                                                       !! in combination with scaling given by US [various]}}
\DoxyCodeLine{763   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{764 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(drho\_dT))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{765 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{766 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{767   \textcolor{keywordtype}{integer} :: i, is, ie, npts}
\DoxyCodeLine{768 }
\DoxyCodeLine{769   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{770     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{771 }
\DoxyCodeLine{772   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dom)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{773     is = dom(1) ; ie = dom(2) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{774   \textcolor{keywordflow}{else}}
\DoxyCodeLine{775     is = 1 ; ie = \textcolor{keyword}{size}(drho\_dt) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{776 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{777 }
\DoxyCodeLine{778   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{779 }
\DoxyCodeLine{780   \textcolor{keywordflow}{if} (p\_scale == 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{781     \textcolor{keyword}{call }calculate\_density\_derivs\_array(t, s, pressure, drho\_dt, drho\_ds, is, npts, eos)}
\DoxyCodeLine{782   \textcolor{keywordflow}{else}}
\DoxyCodeLine{783     \textcolor{keywordflow}{do} i=is,ie ; pres(i) = p\_scale * pressure(i) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{784     \textcolor{keyword}{call }calculate\_density\_derivs\_array(t, s, pres, drho\_dt, drho\_ds, is, npts, eos)}
\DoxyCodeLine{785 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{786 }
\DoxyCodeLine{787   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{788   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{789   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{790     drho\_dt(i) = rho\_scale * drho\_dt(i)}
\DoxyCodeLine{791     drho\_ds(i) = rho\_scale * drho\_ds(i)}
\DoxyCodeLine{792 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{793 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a27ec57cbbd2e673d542ba2c8dd44053a}\label{namespacemom__eos_a27ec57cbbd2e673d542ba2c8dd44053a}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_derivs\_array@{calculate\_density\_derivs\_array}}
\index{calculate\_density\_derivs\_array@{calculate\_density\_derivs\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_array()}{calculate\_density\_derivs\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+derivs\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density derivatives for 1-\/D array inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]} or \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity, in \mbox{[}kg m-\/3 ppt-\/1\mbox{]} or \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index within the array \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{706 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{707 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{708 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{709 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dT\textcolor{comment}{  !< The partial derivative of density with potential}}
\DoxyCodeLine{710 \textcolor{comment}{                                                !! temperature [kg m-\/3 degC-\/1] or [R degC-\/1 \string~> kg m-\/3 degC-\/1]}}
\DoxyCodeLine{711 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dS\textcolor{comment}{  !< The partial derivative of density with salinity,}}
\DoxyCodeLine{712 \textcolor{comment}{                                                !! in [kg m-\/3 ppt-\/1] or [R degC-\/1 \string~> kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{713   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< Starting index within the array}}
\DoxyCodeLine{714   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< The number of values to calculate}}
\DoxyCodeLine{715   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{716 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{717 \textcolor{comment}{                                                !! in combination with scaling given by US [various]}}
\DoxyCodeLine{718 }
\DoxyCodeLine{719   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{720   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{721 }
\DoxyCodeLine{722   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{723     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{724 }
\DoxyCodeLine{725   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{726     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{727       \textcolor{keyword}{call }calculate\_density\_derivs\_linear(t, s, pressure, drho\_dt, drho\_ds, eos\%Rho\_T0\_S0, \&}
\DoxyCodeLine{728                                            eos\%dRho\_dT, eos\%dRho\_dS, start, npts)}
\DoxyCodeLine{729     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{730       \textcolor{keyword}{call }calculate\_density\_derivs\_unesco(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{731     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{732       \textcolor{keyword}{call }calculate\_density\_derivs\_wright(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{733     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{734       \textcolor{keyword}{call }calculate\_density\_derivs\_teos10(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{735     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{736       \textcolor{keyword}{call }calculate\_density\_derivs\_nemo(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{737 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{738       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs\_array: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{739 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{740 }
\DoxyCodeLine{741   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{742     drho\_dt(j) = scale * drho\_dt(j)}
\DoxyCodeLine{743     drho\_ds(j) = scale * drho\_ds(j)}
\DoxyCodeLine{744 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{745 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a06d9d6680e838b965666986e63c980e7}\label{namespacemom__eos_a06d9d6680e838b965666986e63c980e7}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_derivs\_scalar@{calculate\_density\_derivs\_scalar}}
\index{calculate\_density\_derivs\_scalar@{calculate\_density\_derivs\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_derivs\_scalar()}{calculate\_density\_derivs\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+derivs\+\_\+scalar (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{drho\+\_\+dT,  }\item[{real, intent(out)}]{drho\+\_\+dS,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutines to calculate density derivatives by promoting a scalar to a one-\/element array. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt} & The partial derivative of density with potential temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]} or \mbox{[}R deg\+C-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds} & The partial derivative of density with salinity, in \mbox{[}kg m-\/3 ppt-\/1\mbox{]} or \mbox{[}R ppt-\/1 $\sim$$>$ kg m-\/3 ppt-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{800 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{801 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{802 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{803 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: drho\_dT\textcolor{comment}{ !< The partial derivative of density with potential}}
\DoxyCodeLine{804 \textcolor{comment}{                                         !! temperature [kg m-\/3 degC-\/1] or [R degC-\/1 \string~> kg m-\/3 degC-\/1]}}
\DoxyCodeLine{805 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: drho\_dS\textcolor{comment}{ !< The partial derivative of density with salinity,}}
\DoxyCodeLine{806 \textcolor{comment}{                                         !! in [kg m-\/3 ppt-\/1] or [R ppt-\/1 \string~> kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{807   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{     !< Equation of state structure}}
\DoxyCodeLine{808 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: scale\textcolor{comment}{   !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{809 \textcolor{comment}{                                         !! in combination with scaling given by US [various]}}
\DoxyCodeLine{810   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{811 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{812 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{813   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{814 }
\DoxyCodeLine{815   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{816     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{817 }
\DoxyCodeLine{818   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{819 }
\DoxyCodeLine{820   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{821     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{822       \textcolor{keyword}{call }calculate\_density\_derivs\_linear(t, s, p\_scale*pressure, drho\_dt, drho\_ds, \&}
\DoxyCodeLine{823                                            eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS)}
\DoxyCodeLine{824     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{825       \textcolor{keyword}{call }calculate\_density\_derivs\_wright(t, s, p\_scale*pressure, drho\_dt, drho\_ds)}
\DoxyCodeLine{826     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{827       \textcolor{keyword}{call }calculate\_density\_derivs\_teos10(t, s, p\_scale*pressure, drho\_dt, drho\_ds)}
\DoxyCodeLine{828 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{829       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs\_scalar: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{830 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{831 }
\DoxyCodeLine{832   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{833   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{834   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{835     drho\_dt = rho\_scale * drho\_dt}
\DoxyCodeLine{836     drho\_ds = rho\_scale * drho\_ds}
\DoxyCodeLine{837 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{838 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_ac3bdab784e3535d661c47d1ec8a624fd}\label{namespacemom__eos_ac3bdab784e3535d661c47d1ec8a624fd}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_scalar@{calculate\_density\_scalar}}
\index{calculate\_density\_scalar@{calculate\_density\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_scalar()}{calculate\_density\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+scalar (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{rho,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density of sea water for scalar inputs. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. The pressure and density can be rescaled with the US. If both the US and scale arguments are present the density scaling uses the product of the two scaling factors. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}kg m-\/3\mbox{]} or \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{166 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{167 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{168 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{169 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [kg m-\/3] or [R \string~> kg m-\/3]}}
\DoxyCodeLine{170   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{171 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3]}}
\DoxyCodeLine{172 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale density in}}
\DoxyCodeLine{173 \textcolor{comment}{                                          !! combination with scaling given by US [various]}}
\DoxyCodeLine{174 }
\DoxyCodeLine{175 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{176 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{177 }
\DoxyCodeLine{178   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{179     \textcolor{stringliteral}{"calculate\_density\_scalar called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{180 }
\DoxyCodeLine{181   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{182 }
\DoxyCodeLine{183   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{184     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{185       \textcolor{keyword}{call }calculate\_density\_linear(t, s, p\_scale*pressure, rho, \&}
\DoxyCodeLine{186                                     eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, rho\_ref)}
\DoxyCodeLine{187     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{188       \textcolor{keyword}{call }calculate\_density\_unesco(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{189     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{190       \textcolor{keyword}{call }calculate\_density\_wright(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{191     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{192       \textcolor{keyword}{call }calculate\_density\_teos10(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{193     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{194       \textcolor{keyword}{call }calculate\_density\_nemo(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{195 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{196       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_scalar: EOS is not valid."})}
\DoxyCodeLine{197 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{198 }
\DoxyCodeLine{199   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{200   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{201   rho = rho\_scale * rho}
\DoxyCodeLine{202 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a8c0fa67a7a4911eb5fa33c5d17b997f9}\label{namespacemom__eos_a8c0fa67a7a4911eb5fa33c5d17b997f9}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_second\_derivs\_array@{calculate\_density\_second\_derivs\_array}}
\index{calculate\_density\_second\_derivs\_array@{calculate\_density\_second\_derivs\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_second\_derivs\_array()}{calculate\_density\_second\_derivs\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+d\+S\+\_\+dS,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+d\+S\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+d\+T\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+d\+S\+\_\+dP,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+d\+T\+\_\+dP,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density second derivatives for 1-\/D array inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+ds} & Partial derivative of beta with respect to S \mbox{[}kg m-\/3 ppt-\/2\mbox{]} or \mbox{[}R ppt-\/2 $\sim$$>$ kg m-\/3 ppt-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+dt} & Partial derivative of beta with respect to T \mbox{[}kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]} or \mbox{[}R ppt-\/1 deg\+C-\/1 $\sim$$>$ kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+dt\+\_\+dt} & Partial derivative of alpha with respect to T \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]} or \mbox{[}R deg\+C-\/2 $\sim$$>$ kg m-\/3 deg\+C-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+dp} & Partial derivative of beta with respect to pressure \mbox{[}kg m-\/3 ppt-\/1 Pa-\/1\mbox{]} or \mbox{[}R ppt-\/1 Pa-\/1 $\sim$$>$ kg m-\/3 ppt-\/1 Pa-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+dt\+\_\+dp} & Partial derivative of alpha with respect to pressure \mbox{[}kg m-\/3 deg\+C-\/1 Pa-\/1\mbox{]} or \mbox{[}R deg\+C-\/1 Pa-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1 Pa-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index within the array \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{844 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{845 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{846 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{   !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{847 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dS\_dS\textcolor{comment}{ !< Partial derivative of beta with respect to S}}
\DoxyCodeLine{848 \textcolor{comment}{                                                  !!  [kg m-\/3 ppt-\/2] or [R ppt-\/2 \string~> kg m-\/3 ppt-\/2]}}
\DoxyCodeLine{849 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dS\_dT\textcolor{comment}{ !< Partial derivative of beta with respect to T}}
\DoxyCodeLine{850 \textcolor{comment}{                                                  !! [kg m-\/3 ppt-\/1 degC-\/1] or [R ppt-\/1 degC-\/1 \string~> kg m-\/3 ppt-\/1 degC-\/1]}}
\DoxyCodeLine{851 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dT\_dT\textcolor{comment}{ !< Partial derivative of alpha with respect to T}}
\DoxyCodeLine{852 \textcolor{comment}{                                                  !! [kg m-\/3 degC-\/2] or [R degC-\/2 \string~> kg m-\/3 degC-\/2]}}
\DoxyCodeLine{853 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dS\_dP\textcolor{comment}{ !< Partial derivative of beta with respect to pressure}}
\DoxyCodeLine{854 \textcolor{comment}{                                                  !! [kg m-\/3 ppt-\/1 Pa-\/1] or [R ppt-\/1 Pa-\/1 \string~> kg m-\/3 ppt-\/1 Pa-\/1]}}
\DoxyCodeLine{855 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dT\_dP\textcolor{comment}{ !< Partial derivative of alpha with respect to pressure}}
\DoxyCodeLine{856 \textcolor{comment}{                                                  !! [kg m-\/3 degC-\/1 Pa-\/1] or [R degC-\/1 Pa-\/1 \string~> kg m-\/3 degC-\/1 Pa-\/1]}}
\DoxyCodeLine{857   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{ !< Starting index within the array}}
\DoxyCodeLine{858   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{  !< The number of values to calculate}}
\DoxyCodeLine{859   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{   !< Equation of state structure}}
\DoxyCodeLine{860 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{861 \textcolor{comment}{                                                  !! in combination with scaling given by US [various]}}
\DoxyCodeLine{862   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{863 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(pressure))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{864 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{865 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{866 \textcolor{keywordtype}{  real} :: I\_p\_scale \textcolor{comment}{! The inverse of the factor to convert pressure to units of Pa [R L2 T-\/2 Pa-\/1 \string~> 1]}}
\DoxyCodeLine{867   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{868 }
\DoxyCodeLine{869   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{870     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{871 }
\DoxyCodeLine{872   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{873 }
\DoxyCodeLine{874   \textcolor{keywordflow}{if} (p\_scale == 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{875     \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{876       \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{877         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{878                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{879       \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{880         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{881                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{882       \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{883         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{884                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{885 \textcolor{keywordflow}{      case default}}
\DoxyCodeLine{886         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{887 \textcolor{keywordflow}{    end select}}
\DoxyCodeLine{888   \textcolor{keywordflow}{else}}
\DoxyCodeLine{889     \textcolor{keywordflow}{do} j=start,start+npts-\/1 ; pres(j) = p\_scale * pressure(j) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{890     \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{891       \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{892         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{893                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{894       \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{895         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{896                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{897       \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{898         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{899                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)}
\DoxyCodeLine{900 \textcolor{keywordflow}{      case default}}
\DoxyCodeLine{901         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{902 \textcolor{keywordflow}{    end select}}
\DoxyCodeLine{903 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{904 }
\DoxyCodeLine{905   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{906   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{907   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{908     drho\_ds\_ds(j) = rho\_scale * drho\_ds\_ds(j)}
\DoxyCodeLine{909     drho\_ds\_dt(j) = rho\_scale * drho\_ds\_dt(j)}
\DoxyCodeLine{910     drho\_dt\_dt(j) = rho\_scale * drho\_dt\_dt(j)}
\DoxyCodeLine{911     drho\_ds\_dp(j) = rho\_scale * drho\_ds\_dp(j)}
\DoxyCodeLine{912     drho\_dt\_dp(j) = rho\_scale * drho\_dt\_dp(j)}
\DoxyCodeLine{913 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{914 }
\DoxyCodeLine{915   \textcolor{keywordflow}{if} (p\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{916     i\_p\_scale = 1.0 / p\_scale}
\DoxyCodeLine{917     \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{918       drho\_ds\_dp(j) = i\_p\_scale * drho\_ds\_dp(j)}
\DoxyCodeLine{919       drho\_dt\_dp(j) = i\_p\_scale * drho\_dt\_dp(j)}
\DoxyCodeLine{920 \textcolor{keywordflow}{    enddo}}
\DoxyCodeLine{921 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{922 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a2d7a984ed1c48d9e0ea1046de3eac886}\label{namespacemom__eos_a2d7a984ed1c48d9e0ea1046de3eac886}} 
\index{mom\_eos@{mom\_eos}!calculate\_density\_second\_derivs\_scalar@{calculate\_density\_second\_derivs\_scalar}}
\index{calculate\_density\_second\_derivs\_scalar@{calculate\_density\_second\_derivs\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_density\_second\_derivs\_scalar()}{calculate\_density\_second\_derivs\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar (\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,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density second derivatives for scalar nputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+ds} & Partial derivative of beta with respect to S \mbox{[}kg m-\/3 ppt-\/2\mbox{]} or \mbox{[}R ppt-\/2 $\sim$$>$ kg m-\/3 ppt-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+dt} & Partial derivative of beta with respect to T \mbox{[}kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]} or \mbox{[}R ppt-\/1 deg\+C-\/1 $\sim$$>$ kg m-\/3 ppt-\/1 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+dt} & Partial derivative of alpha with respect to T \mbox{[}kg m-\/3 deg\+C-\/2\mbox{]} or \mbox{[}R deg\+C-\/2 $\sim$$>$ kg m-\/3 deg\+C-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+dp} & Partial derivative of beta with respect to pressure \mbox{[}kg m-\/3 ppt-\/1 Pa-\/1\mbox{]} or \mbox{[}R ppt-\/1 Pa-\/1 $\sim$$>$ kg m-\/3 ppt-\/1 Pa-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt\+\_\+dp} & Partial derivative of alpha with respect to pressure \mbox{[}kg m-\/3 deg\+C-\/1 Pa-\/1\mbox{]} or \mbox{[}R deg\+C-\/1 Pa-\/1 $\sim$$>$ kg m-\/3 deg\+C-\/1 Pa-\/1\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{928 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{929 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{930 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{   !< Pressure [Pa] or [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{931 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dS\textcolor{comment}{ !< Partial derivative of beta with respect to S}}
\DoxyCodeLine{932 \textcolor{comment}{                                  !! [kg m-\/3 ppt-\/2] or [R ppt-\/2 \string~> kg m-\/3 ppt-\/2]}}
\DoxyCodeLine{933 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dT\textcolor{comment}{ !< Partial derivative of beta with respect to T}}
\DoxyCodeLine{934 \textcolor{comment}{                                  !! [kg m-\/3 ppt-\/1 degC-\/1] or [R ppt-\/1 degC-\/1 \string~> kg m-\/3 ppt-\/1 degC-\/1]}}
\DoxyCodeLine{935 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dT\textcolor{comment}{ !< Partial derivative of alpha with respect to T}}
\DoxyCodeLine{936 \textcolor{comment}{                                  !! [kg m-\/3 degC-\/2] or [R degC-\/2 \string~> kg m-\/3 degC-\/2]}}
\DoxyCodeLine{937 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dS\_dP\textcolor{comment}{ !< Partial derivative of beta with respect to pressure}}
\DoxyCodeLine{938 \textcolor{comment}{                                  !! [kg m-\/3 ppt-\/1 Pa-\/1] or [R ppt-\/1 Pa-\/1 \string~> kg m-\/3 ppt-\/1 Pa-\/1]}}
\DoxyCodeLine{939 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\_dP\textcolor{comment}{ !< Partial derivative of alpha with respect to pressure}}
\DoxyCodeLine{940 \textcolor{comment}{                                  !! [kg m-\/3 degC-\/1 Pa-\/1] or [R degC-\/1 Pa-\/1 \string~> kg m-\/3 degC-\/1 Pa-\/1]}}
\DoxyCodeLine{941   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}    :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{942 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{943 \textcolor{comment}{                                  !! in combination with scaling given by US [various]}}
\DoxyCodeLine{944   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{945 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{946 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{947 \textcolor{keywordtype}{  real} :: I\_p\_scale \textcolor{comment}{! The inverse of the factor to convert pressure to units of Pa [R L2 T-\/2 Pa-\/1 \string~> 1]}}
\DoxyCodeLine{948 }
\DoxyCodeLine{949   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{950     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{951 }
\DoxyCodeLine{952   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{953 }
\DoxyCodeLine{954   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{955     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{956       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{957                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)}
\DoxyCodeLine{958     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{959       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{960                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)}
\DoxyCodeLine{961     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{962       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, \&}
\DoxyCodeLine{963                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)}
\DoxyCodeLine{964 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{965       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{966 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{967 }
\DoxyCodeLine{968   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{969   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{970   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{971     drho\_ds\_ds = rho\_scale * drho\_ds\_ds}
\DoxyCodeLine{972     drho\_ds\_dt = rho\_scale * drho\_ds\_dt}
\DoxyCodeLine{973     drho\_dt\_dt = rho\_scale * drho\_dt\_dt}
\DoxyCodeLine{974     drho\_ds\_dp = rho\_scale * drho\_ds\_dp}
\DoxyCodeLine{975     drho\_dt\_dp = rho\_scale * drho\_dt\_dp}
\DoxyCodeLine{976 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{977 }
\DoxyCodeLine{978   \textcolor{keywordflow}{if} (p\_scale /= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{979     i\_p\_scale = 1.0 / p\_scale}
\DoxyCodeLine{980     drho\_ds\_dp = i\_p\_scale * drho\_ds\_dp}
\DoxyCodeLine{981     drho\_dt\_dp = i\_p\_scale * drho\_dt\_dp}
\DoxyCodeLine{982 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{983 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a43d417da1636adb2cd184f76223afded}\label{namespacemom__eos_a43d417da1636adb2cd184f76223afded}} 
\index{mom\_eos@{mom\_eos}!calculate\_spec\_vol\_array@{calculate\_spec\_vol\_array}}
\index{calculate\_spec\_vol\_array@{calculate\_spec\_vol\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_spec\_vol\_array()}{calculate\_spec\_vol\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+spec\+\_\+vol\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{specvol,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{spv\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the specific volume of sea water for 1-\/D array inputs. 


\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{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em specvol} & in situ specific volume \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
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em spv\+\_\+ref} & A reference specific volume \mbox{[}m3 kg-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale specific volume in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{486 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< potential temperature relative to the surface [degC]}}
\DoxyCodeLine{487 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< salinity [ppt]}}
\DoxyCodeLine{488 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< pressure [Pa]}}
\DoxyCodeLine{489 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: specvol\textcolor{comment}{  !< in situ specific volume [kg m-\/3]}}
\DoxyCodeLine{490   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< the starting point in the arrays.}}
\DoxyCodeLine{491   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< the number of values to calculate.}}
\DoxyCodeLine{492   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{493 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: spv\_ref\textcolor{comment}{  !< A reference specific volume [m3 kg-\/1]}}
\DoxyCodeLine{494 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale specific}}
\DoxyCodeLine{495 \textcolor{comment}{                                                !! volume in combination with scaling given by US [various]}}
\DoxyCodeLine{496 }
\DoxyCodeLine{497 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(specvol))}  :: rho   \textcolor{comment}{! Density [kg m-\/3]}}
\DoxyCodeLine{498   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{499 }
\DoxyCodeLine{500   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{501     \textcolor{stringliteral}{"calculate\_spec\_vol\_array called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{502 }
\DoxyCodeLine{503   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{504     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{505       \textcolor{keyword}{call }calculate\_spec\_vol\_linear(t, s, pressure, specvol, start, npts, \&}
\DoxyCodeLine{506                eos\%rho\_T0\_S0, eos\%drho\_dT, eos\%drho\_dS, spv\_ref)}
\DoxyCodeLine{507     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{508       \textcolor{keyword}{call }calculate\_spec\_vol\_unesco(t, s, pressure, specvol, start, npts, spv\_ref)}
\DoxyCodeLine{509     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{510       \textcolor{keyword}{call }calculate\_spec\_vol\_wright(t, s, pressure, specvol, start, npts, spv\_ref)}
\DoxyCodeLine{511     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{512       \textcolor{keyword}{call }calculate\_spec\_vol\_teos10(t, s, pressure, specvol, start, npts, spv\_ref)}
\DoxyCodeLine{513     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{514       \textcolor{keyword}{call }calculate\_density\_nemo(t, s, pressure, rho, start, npts)}
\DoxyCodeLine{515       \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(spv\_ref)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{516         specvol(:) = 1.0 / rho(:) -\/ spv\_ref}
\DoxyCodeLine{517       \textcolor{keywordflow}{else}}
\DoxyCodeLine{518         specvol(:) = 1.0 / rho(:)}
\DoxyCodeLine{519 \textcolor{keywordflow}{      endif}}
\DoxyCodeLine{520 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{521       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_spec\_vol\_array: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{522 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{523 }
\DoxyCodeLine{524   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{525     specvol(j) = scale * specvol(j)}
\DoxyCodeLine{526 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{527 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a35f9c33d1aeffbf9986349463bab3b9c}\label{namespacemom__eos_a35f9c33d1aeffbf9986349463bab3b9c}} 
\index{mom\_eos@{mom\_eos}!calculate\_spec\_vol\_derivs\_array@{calculate\_spec\_vol\_derivs\_array}}
\index{calculate\_spec\_vol\_derivs\_array@{calculate\_spec\_vol\_derivs\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_spec\_vol\_derivs\_array()}{calculate\_spec\_vol\_derivs\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+spec\+\_\+vol\+\_\+derivs\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{d\+S\+V\+\_\+dT,  }\item[{real, dimension(\+:), intent(inout)}]{d\+S\+V\+\_\+dS,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate specific volume derivatives for an array. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,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,out}}  & {\em dsv\+\_\+ds} & The partial derivative of specific volume with salinity \mbox{[}m3 kg-\/1 ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index within the array \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{988 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{989 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{990 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa]}}
\DoxyCodeLine{991 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: dSV\_dT\textcolor{comment}{ !< The partial derivative of specific volume with potential}}
\DoxyCodeLine{992 \textcolor{comment}{                                              !! temperature [m3 kg-\/1 degC-\/1]}}
\DoxyCodeLine{993 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: dSV\_dS\textcolor{comment}{ !< The partial derivative of specific volume with salinity}}
\DoxyCodeLine{994 \textcolor{comment}{                                              !! [m3 kg-\/1 ppt-\/1]}}
\DoxyCodeLine{995   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{  !< Starting index within the array}}
\DoxyCodeLine{996   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{   !< The number of values to calculate}}
\DoxyCodeLine{997   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{    !< Equation of state structure}}
\DoxyCodeLine{998 }
\DoxyCodeLine{999   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1000 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: press   \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{1001 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: rho     \textcolor{comment}{! In situ density [kg m-\/3]}}
\DoxyCodeLine{1002 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: dRho\_dT \textcolor{comment}{! Derivative of density with temperature [kg m-\/3 degC-\/1]}}
\DoxyCodeLine{1003 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: dRho\_dS \textcolor{comment}{! Derivative of density with salinity [kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{1004   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{1005 }
\DoxyCodeLine{1006   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1007     \textcolor{stringliteral}{"calculate\_spec\_vol\_derivs\_array called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1008 }
\DoxyCodeLine{1009   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{1010     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{1011       \textcolor{keyword}{call }calculate\_specvol\_derivs\_linear(t, s, pressure, dsv\_dt, dsv\_ds, start, \&}
\DoxyCodeLine{1012                                            npts, eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS)}
\DoxyCodeLine{1013     \textcolor{keywordflow}{case} (eos\_unesco)}
\DoxyCodeLine{1014       \textcolor{keyword}{call }calculate\_density\_unesco(t, s, pressure, rho, start, npts)}
\DoxyCodeLine{1015       \textcolor{keyword}{call }calculate\_density\_derivs\_unesco(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{1016       \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{1017         dsv\_dt(j) = -\/drho\_dt(j)/(rho(j)**2)}
\DoxyCodeLine{1018         dsv\_ds(j) = -\/drho\_ds(j)/(rho(j)**2)}
\DoxyCodeLine{1019 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{1020     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{1021       \textcolor{keyword}{call }calculate\_specvol\_derivs\_wright(t, s, pressure, dsv\_dt, dsv\_ds, start, npts)}
\DoxyCodeLine{1022     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{1023       \textcolor{keyword}{call }calculate\_specvol\_derivs\_teos10(t, s, pressure, dsv\_dt, dsv\_ds, start, npts)}
\DoxyCodeLine{1024     \textcolor{keywordflow}{case} (eos\_nemo)}
\DoxyCodeLine{1025       \textcolor{keyword}{call }calculate\_density\_nemo(t, s, pressure, rho, start, npts)}
\DoxyCodeLine{1026       \textcolor{keyword}{call }calculate\_density\_derivs\_nemo(t, s, pressure, drho\_dt, drho\_ds, start, npts)}
\DoxyCodeLine{1027       \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{1028         dsv\_dt(j) = -\/drho\_dt(j)/(rho(j)**2)}
\DoxyCodeLine{1029         dsv\_ds(j) = -\/drho\_ds(j)/(rho(j)**2)}
\DoxyCodeLine{1030 \textcolor{keywordflow}{      enddo}}
\DoxyCodeLine{1031 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1032       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_spec\_vol\_derivs\_array: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{1033 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1034 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a58b52a452d779c53e6421aaa3eac6e8b}\label{namespacemom__eos_a58b52a452d779c53e6421aaa3eac6e8b}} 
\index{mom\_eos@{mom\_eos}!calculate\_stanley\_density\_1d@{calculate\_stanley\_density\_1d}}
\index{calculate\_stanley\_density\_1d@{calculate\_stanley\_density\_1d}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_stanley\_density\_1d()}{calculate\_stanley\_density\_1d()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+stanley\+\_\+density\+\_\+1d (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(in)}]{Tvar,  }\item[{real, dimension(\+:), intent(in)}]{T\+Scov,  }\item[{real, dimension(\+:), intent(in)}]{Svar,  }\item[{real, dimension(\+:), intent(inout)}]{rho,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, dimension(2), intent(in), optional}]{dom,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs including the variance of T, S and covariance of T-\/S, potentially limiting the domain of indices that are worked on. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tvar} & Variance of potential temperature \mbox{[}deg\+C2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tscov} & Covariance of potential temperature and salinity \mbox{[}degC ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em svar} & Variance of salinity \mbox{[}ppt2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em dom} & The domain of indices to work on, taking into account that arrays start at 1. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density in combination with scaling given by US \mbox{[}various\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{417 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{418 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{419 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [R L2 T-\/2 \string~> Pa]}}
\DoxyCodeLine{420 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: Tvar\textcolor{comment}{     !< Variance of potential temperature [degC2]}}
\DoxyCodeLine{421 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: TScov\textcolor{comment}{    !< Covariance of potential temperature and salinity [degC ppt]}}
\DoxyCodeLine{422 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(in)}    :: Svar\textcolor{comment}{     !< Variance of salinity [ppt2]}}
\DoxyCodeLine{423 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)},    \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [R \string~> kg m-\/3]}}
\DoxyCodeLine{424   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{425   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dom\textcolor{comment}{   !< The domain of indices to work on, taking}}
\DoxyCodeLine{426 \textcolor{comment}{                                                       !! into account that arrays start at 1.}}
\DoxyCodeLine{427 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: rho\_ref\textcolor{comment}{ !< A reference density [kg m-\/3]}}
\DoxyCodeLine{428 \textcolor{keywordtype}{  real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{429 \textcolor{comment}{                                                   !! in combination with scaling given by US [various]}}
\DoxyCodeLine{430   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{431 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{432 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{433 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(rho))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{434 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: d2RdTT, d2RdST, d2RdSS, d2RdSp, d2RdTp \textcolor{comment}{! Second derivatives of density wrt T,S,p}}
\DoxyCodeLine{435   \textcolor{keywordtype}{integer} :: i, is, ie, npts}
\DoxyCodeLine{436 }
\DoxyCodeLine{437   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{438     \textcolor{stringliteral}{"calculate\_density\_1d called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{439 }
\DoxyCodeLine{440   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dom)) \textcolor{keywordflow}{then}}
\DoxyCodeLine{441     is = dom(1) ; ie = dom(2) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{442   \textcolor{keywordflow}{else}}
\DoxyCodeLine{443     is = 1 ; ie = \textcolor{keyword}{size}(rho) ; npts = 1 + ie -\/ is}
\DoxyCodeLine{444 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{445 }
\DoxyCodeLine{446   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{447   \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{448     pres(i) = p\_scale * pressure(i)}
\DoxyCodeLine{449 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{450 }
\DoxyCodeLine{451   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{452     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{453       \textcolor{keyword}{call }calculate\_density\_linear(t, s, pres, rho, 1, npts, \&}
\DoxyCodeLine{454                                     eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, rho\_ref)}
\DoxyCodeLine{455       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pres, d2rdss, d2rdst, \&}
\DoxyCodeLine{456                                                   d2rdtt, d2rdsp, d2rdtp, 1, npts)}
\DoxyCodeLine{457     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{458       \textcolor{keyword}{call }calculate\_density\_wright(t, s, pres, rho, 1, npts, rho\_ref)}
\DoxyCodeLine{459       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pres, d2rdss, d2rdst, \&}
\DoxyCodeLine{460                                                   d2rdtt, d2rdsp, d2rdtp, 1, npts)}
\DoxyCodeLine{461     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{462       \textcolor{keyword}{call }calculate\_density\_teos10(t, s, pres, rho, 1, npts, rho\_ref)}
\DoxyCodeLine{463       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pres, d2rdss, d2rdst, \&}
\DoxyCodeLine{464                                                   d2rdtt, d2rdsp, d2rdtp, 1, npts)}
\DoxyCodeLine{465 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{466       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_stanley\_density\_scalar: EOS is not valid."})}
\DoxyCodeLine{467 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{468 }
\DoxyCodeLine{469   \textcolor{comment}{! Equation 25 of Stanley et al., 2020.}}
\DoxyCodeLine{470   \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{471     rho(i) = rho(i) \&}
\DoxyCodeLine{472              + ( 0.5 * d2rdtt(i) * tvar(i) + ( d2rdst(i) * tscov(i) + 0.5 * d2rdss(i) * svar(i) ) )}
\DoxyCodeLine{473 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{474 }
\DoxyCodeLine{475   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{476   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{477   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} i=is,ie}
\DoxyCodeLine{478     rho(i) = rho\_scale * rho(i)}
\DoxyCodeLine{479 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{480 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a102df91898d116a6b4346f00dc818612}\label{namespacemom__eos_a102df91898d116a6b4346f00dc818612}} 
\index{mom\_eos@{mom\_eos}!calculate\_stanley\_density\_array@{calculate\_stanley\_density\_array}}
\index{calculate\_stanley\_density\_array@{calculate\_stanley\_density\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_stanley\_density\_array()}{calculate\_stanley\_density\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+stanley\+\_\+density\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(in)}]{Tvar,  }\item[{real, dimension(\+:), intent(in)}]{T\+Scov,  }\item[{real, dimension(\+:), intent(in)}]{Svar,  }\item[{real, dimension(\+:), intent(inout)}]{rho,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the density of sea water for 1-\/D array inputs including the variance of T, S and covariance of T-\/S. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tvar} & Variance of potential temperature referenced to the surface \mbox{[}deg\+C2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tscov} & Covariance of potential temperature and salinity \mbox{[}degC ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em svar} & Variance of salinity \mbox{[}ppt2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Start index for computation \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & Number of point to compute \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density from kg m-\/3 to the desired units \mbox{[}R m3 kg-\/1\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{306 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{307 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{308 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [Pa]}}
\DoxyCodeLine{309 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: Tvar\textcolor{comment}{     !< Variance of potential temperature referenced to the surface [degC2]}}
\DoxyCodeLine{310 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: TScov\textcolor{comment}{    !< Covariance of potential temperature and salinity [degC ppt]}}
\DoxyCodeLine{311 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: Svar\textcolor{comment}{     !< Variance of salinity [ppt2]}}
\DoxyCodeLine{312 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [kg m-\/3]}}
\DoxyCodeLine{313   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< Start index for computation}}
\DoxyCodeLine{314   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< Number of point to compute}}
\DoxyCodeLine{315   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{316 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3].}}
\DoxyCodeLine{317 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{318 \textcolor{comment}{                                                !! from kg m-\/3 to the desired units [R m3 kg-\/1]}}
\DoxyCodeLine{319   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{320 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(T))} :: d2RdTT, d2RdST, d2RdSS, d2RdSp, d2RdTp \textcolor{comment}{! Second derivatives of density wrt T,S,p}}
\DoxyCodeLine{321   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{322 }
\DoxyCodeLine{323   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{324     \textcolor{stringliteral}{"calculate\_density\_array called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{325 }
\DoxyCodeLine{326   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{327     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{328       \textcolor{keyword}{call }calculate\_density\_linear(t, s, pressure, rho, start, npts, \&}
\DoxyCodeLine{329                                     eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, rho\_ref)}
\DoxyCodeLine{330       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{331                                                   d2rdtt, d2rdsp, d2rdtp, start, npts)}
\DoxyCodeLine{332     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{333       \textcolor{keyword}{call }calculate\_density\_wright(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{334       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{335                                                   d2rdtt, d2rdsp, d2rdtp, start, npts)}
\DoxyCodeLine{336     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{337       \textcolor{keyword}{call }calculate\_density\_teos10(t, s, pressure, rho, start, npts, rho\_ref)}
\DoxyCodeLine{338       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{339                                                   d2rdtt, d2rdsp, d2rdtp, start, npts)}
\DoxyCodeLine{340 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{341       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_stanley\_density\_array: EOS\%form\_of\_EOS is not valid."})}
\DoxyCodeLine{342 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{343 }
\DoxyCodeLine{344   \textcolor{comment}{! Equation 25 of Stanley et al., 2020.}}
\DoxyCodeLine{345   \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{346     rho(j) = rho(j) \&}
\DoxyCodeLine{347              + ( 0.5 * d2rdtt(j) * tvar(j) + ( d2rdst(j) * tscov(j) + 0.5 * d2rdss(j) * svar(j) ) )}
\DoxyCodeLine{348 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{349 }
\DoxyCodeLine{350   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{if} (scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-\/1}
\DoxyCodeLine{351     rho(j) = scale * rho(j)}
\DoxyCodeLine{352 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif} ;\textcolor{keywordflow}{ endif}}
\DoxyCodeLine{353 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a66d40148737ef1a3b1ae44917c7fe0c3}\label{namespacemom__eos_a66d40148737ef1a3b1ae44917c7fe0c3}} 
\index{mom\_eos@{mom\_eos}!calculate\_stanley\_density\_scalar@{calculate\_stanley\_density\_scalar}}
\index{calculate\_stanley\_density\_scalar@{calculate\_stanley\_density\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_stanley\_density\_scalar()}{calculate\_stanley\_density\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+stanley\+\_\+density\+\_\+scalar (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(in)}]{Tvar,  }\item[{real, intent(in)}]{T\+Scov,  }\item[{real, intent(in)}]{Svar,  }\item[{real, intent(out)}]{rho,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{rho\+\_\+ref,  }\item[{real, intent(in), optional}]{scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate density of sea water for scalar inputs including the variance of T, S and covariance of T-\/S. The calculation uses only the second order correction in a series as discussed in Stanley et al., 2020. If rho\+\_\+ref is present, the anomaly with respect to rho\+\_\+ref is returned. The density can be rescaled using rho\+\_\+ref. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tvar} & Variance of potential temperature referenced to the surface \mbox{[}deg\+C2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tscov} & Covariance of potential temperature and salinity \mbox{[}degC ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em svar} & Variance of salinity \mbox{[}ppt2\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em rho} & Density (in-\/situ if pressure is local) \mbox{[}kg m-\/3\mbox{]} or \mbox{[}R $\sim$$>$ kg m-\/3\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+ref} & A reference density \mbox{[}kg m-\/3\mbox{]}. \\
\hline
\mbox{\texttt{ in}}  & {\em scale} & A multiplicative factor by which to scale density from kg m-\/3 to the desired units \mbox{[}R m3 kg-\/1\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{212 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: T\textcolor{comment}{        !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{213 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{214 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: Tvar\textcolor{comment}{     !< Variance of potential temperature referenced to the surface [degC2]}}
\DoxyCodeLine{215 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: TScov\textcolor{comment}{    !< Covariance of potential temperature and salinity [degC ppt]}}
\DoxyCodeLine{216 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: Svar\textcolor{comment}{     !< Variance of salinity [ppt2]}}
\DoxyCodeLine{217 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa]}}
\DoxyCodeLine{218 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: rho\textcolor{comment}{      !< Density (in-\/situ if pressure is local) [kg m-\/3] or [R \string~> kg m-\/3]}}
\DoxyCodeLine{219   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{220 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: rho\_ref\textcolor{comment}{  !< A reference density [kg m-\/3].}}
\DoxyCodeLine{221 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: scale\textcolor{comment}{    !< A multiplicative factor by which to scale density}}
\DoxyCodeLine{222 \textcolor{comment}{                                          !! from kg m-\/3 to the desired units [R m3 kg-\/1]}}
\DoxyCodeLine{223   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{224 \textcolor{keywordtype}{  real} :: d2RdTT, d2RdST, d2RdSS, d2RdSp, d2RdTp \textcolor{comment}{! Second derivatives of density wrt T,S,p}}
\DoxyCodeLine{225 \textcolor{keywordtype}{  real} :: rho\_scale \textcolor{comment}{! A factor to convert density from kg m-\/3 to the desired units [R m3 kg-\/1 \string~> 1]}}
\DoxyCodeLine{226 \textcolor{keywordtype}{  real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-\/1 L-\/2 \string~> 1]}}
\DoxyCodeLine{227 }
\DoxyCodeLine{228   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{229     \textcolor{stringliteral}{"calculate\_stanley\_density\_scalar called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{230 }
\DoxyCodeLine{231   p\_scale = eos\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{232 }
\DoxyCodeLine{233   \textcolor{keywordflow}{select case} (eos\%form\_of\_EOS)}
\DoxyCodeLine{234     \textcolor{keywordflow}{case} (eos\_linear)}
\DoxyCodeLine{235       \textcolor{keyword}{call }calculate\_density\_linear(t, s, p\_scale*pressure, rho, \&}
\DoxyCodeLine{236                                     eos\%Rho\_T0\_S0, eos\%dRho\_dT, eos\%dRho\_dS, rho\_ref)}
\DoxyCodeLine{237       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{238                                                   d2rdtt, d2rdsp, d2rdtp)}
\DoxyCodeLine{239     \textcolor{keywordflow}{case} (eos\_wright)}
\DoxyCodeLine{240       \textcolor{keyword}{call }calculate\_density\_wright(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{241       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{242                                                   d2rdtt, d2rdsp, d2rdtp)}
\DoxyCodeLine{243     \textcolor{keywordflow}{case} (eos\_teos10)}
\DoxyCodeLine{244       \textcolor{keyword}{call }calculate\_density\_teos10(t, s, p\_scale*pressure, rho, rho\_ref)}
\DoxyCodeLine{245       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pressure, d2rdss, d2rdst, \&}
\DoxyCodeLine{246                                                   d2rdtt, d2rdsp, d2rdtp)}
\DoxyCodeLine{247 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{248       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_stanley\_density\_scalar: EOS is not valid."})}
\DoxyCodeLine{249 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{250 }
\DoxyCodeLine{251   \textcolor{comment}{! Equation 25 of Stanley et al., 2020.}}
\DoxyCodeLine{252   rho = rho + ( 0.5 * d2rdtt * tvar + ( d2rdst * tscov + 0.5 * d2rdss * svar ) )}
\DoxyCodeLine{253 }
\DoxyCodeLine{254   rho\_scale = eos\%kg\_m3\_to\_R}
\DoxyCodeLine{255   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale}
\DoxyCodeLine{256   rho = rho\_scale * rho}
\DoxyCodeLine{257 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_ab9669ca4a2e4f3507be7efe047c18ab7}\label{namespacemom__eos_ab9669ca4a2e4f3507be7efe047c18ab7}} 
\index{mom\_eos@{mom\_eos}!calculate\_tfreeze\_array@{calculate\_tfreeze\_array}}
\index{calculate\_tfreeze\_array@{calculate\_tfreeze\_array}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_tfreeze\_array()}{calculate\_tfreeze\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+tfreeze\+\_\+array (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{pressure,  }\item[{real, dimension(\+:), intent(inout)}]{T\+\_\+fr,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{pres\+\_\+scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the freezing point for a 1-\/D array. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}other\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em t\+\_\+fr} & Freezing point potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index within the array \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & The number of values to calculate \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em pres\+\_\+scale} & A multiplicative factor to convert pressure into Pa. \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{656 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: S\textcolor{comment}{        !< Salinity [ppt]}}
\DoxyCodeLine{657 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}    :: pressure\textcolor{comment}{ !< Pressure [Pa] or [other]}}
\DoxyCodeLine{658 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: T\_fr\textcolor{comment}{     !< Freezing point potential temperature referenced}}
\DoxyCodeLine{659 \textcolor{comment}{                                                !! to the surface [degC]}}
\DoxyCodeLine{660   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: start\textcolor{comment}{    !< Starting index within the array}}
\DoxyCodeLine{661   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}    :: npts\textcolor{comment}{     !< The number of values to calculate}}
\DoxyCodeLine{662   \textcolor{keywordtype}{type}(EOS\_type),     \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{      !< Equation of state structure}}
\DoxyCodeLine{663 \textcolor{keywordtype}{  real},     \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}    :: pres\_scale\textcolor{comment}{ !< A multiplicative factor to convert pressure into Pa.}}
\DoxyCodeLine{664 }
\DoxyCodeLine{665   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{666 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(size(pressure))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}}
\DoxyCodeLine{667 \textcolor{keywordtype}{  real} :: p\_scale \textcolor{comment}{! A factor to convert pressure to units of Pa.}}
\DoxyCodeLine{668   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{669 }
\DoxyCodeLine{670   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{671     \textcolor{stringliteral}{"calculate\_TFreeze\_scalar called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{672 }
\DoxyCodeLine{673   p\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(pres\_scale)) p\_scale = pres\_scale}
\DoxyCodeLine{674 }
\DoxyCodeLine{675   \textcolor{keywordflow}{if} (p\_scale == 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{676     \textcolor{keywordflow}{select case} (eos\%form\_of\_TFreeze)}
\DoxyCodeLine{677       \textcolor{keywordflow}{case} (tfreeze\_linear)}
\DoxyCodeLine{678         \textcolor{keyword}{call }calculate\_tfreeze\_linear(s, pressure, t\_fr, start, npts, \&}
\DoxyCodeLine{679                                       eos\%TFr\_S0\_P0, eos\%dTFr\_dS, eos\%dTFr\_dp)}
\DoxyCodeLine{680       \textcolor{keywordflow}{case} (tfreeze\_millero)}
\DoxyCodeLine{681         \textcolor{keyword}{call }calculate\_tfreeze\_millero(s, pressure, t\_fr, start, npts)}
\DoxyCodeLine{682       \textcolor{keywordflow}{case} (tfreeze\_teos10)}
\DoxyCodeLine{683         \textcolor{keyword}{call }calculate\_tfreeze\_teos10(s, pressure, t\_fr, start, npts)}
\DoxyCodeLine{684 \textcolor{keywordflow}{      case default}}
\DoxyCodeLine{685         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_TFreeze\_scalar: form\_of\_TFreeze is not valid."})}
\DoxyCodeLine{686 \textcolor{keywordflow}{    end select}}
\DoxyCodeLine{687   \textcolor{keywordflow}{else}}
\DoxyCodeLine{688     \textcolor{keywordflow}{do} j=start,start+npts-\/1 ; pres(j) = p\_scale * pressure(j) ;\textcolor{keywordflow}{ enddo}}
\DoxyCodeLine{689     \textcolor{keywordflow}{select case} (eos\%form\_of\_TFreeze)}
\DoxyCodeLine{690       \textcolor{keywordflow}{case} (tfreeze\_linear)}
\DoxyCodeLine{691         \textcolor{keyword}{call }calculate\_tfreeze\_linear(s, pres, t\_fr, start, npts, \&}
\DoxyCodeLine{692                                       eos\%TFr\_S0\_P0, eos\%dTFr\_dS, eos\%dTFr\_dp)}
\DoxyCodeLine{693       \textcolor{keywordflow}{case} (tfreeze\_millero)}
\DoxyCodeLine{694         \textcolor{keyword}{call }calculate\_tfreeze\_millero(s, pres, t\_fr, start, npts)}
\DoxyCodeLine{695       \textcolor{keywordflow}{case} (tfreeze\_teos10)}
\DoxyCodeLine{696         \textcolor{keyword}{call }calculate\_tfreeze\_teos10(s, pres, t\_fr, start, npts)}
\DoxyCodeLine{697 \textcolor{keywordflow}{      case default}}
\DoxyCodeLine{698         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_TFreeze\_scalar: form\_of\_TFreeze is not valid."})}
\DoxyCodeLine{699 \textcolor{keywordflow}{    end select}}
\DoxyCodeLine{700 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{701 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_ad46af8402aba49dbdd73817d33e83270}\label{namespacemom__eos_ad46af8402aba49dbdd73817d33e83270}} 
\index{mom\_eos@{mom\_eos}!calculate\_tfreeze\_scalar@{calculate\_tfreeze\_scalar}}
\index{calculate\_tfreeze\_scalar@{calculate\_tfreeze\_scalar}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{calculate\_tfreeze\_scalar()}{calculate\_tfreeze\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+tfreeze\+\_\+scalar (\begin{DoxyParamCaption}\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{pressure,  }\item[{real, intent(out)}]{T\+\_\+fr,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{real, intent(in), optional}]{pres\+\_\+scale }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Calls the appropriate subroutine to calculate the freezing point for scalar inputs. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}other\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em t\+\_\+fr} & Freezing point potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em pres\+\_\+scale} & A multiplicative factor to convert pressure into Pa \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{625 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: S\textcolor{comment}{ !< Salinity [ppt]}}
\DoxyCodeLine{626 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{ !< Pressure [Pa] or [other]}}
\DoxyCodeLine{627 \textcolor{keywordtype}{  real},           \textcolor{keywordtype}{intent(out)} :: T\_fr\textcolor{comment}{ !< Freezing point potential temperature referenced}}
\DoxyCodeLine{628 \textcolor{comment}{                                      !! to the surface [degC]}}
\DoxyCodeLine{629   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{630 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: pres\_scale\textcolor{comment}{ !< A multiplicative factor to convert pressure into Pa}}
\DoxyCodeLine{631 }
\DoxyCodeLine{632   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{633 \textcolor{keywordtype}{  real} :: p\_scale \textcolor{comment}{! A factor to convert pressure to units of Pa.}}
\DoxyCodeLine{634 }
\DoxyCodeLine{635   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{636     \textcolor{stringliteral}{"calculate\_TFreeze\_scalar called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{637 }
\DoxyCodeLine{638   p\_scale = 1.0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(pres\_scale)) p\_scale = pres\_scale}
\DoxyCodeLine{639 }
\DoxyCodeLine{640   \textcolor{keywordflow}{select case} (eos\%form\_of\_TFreeze)}
\DoxyCodeLine{641     \textcolor{keywordflow}{case} (tfreeze\_linear)}
\DoxyCodeLine{642       \textcolor{keyword}{call }calculate\_tfreeze\_linear(s, p\_scale*pressure, t\_fr, eos\%TFr\_S0\_P0, \&}
\DoxyCodeLine{643                                     eos\%dTFr\_dS, eos\%dTFr\_dp)}
\DoxyCodeLine{644     \textcolor{keywordflow}{case} (tfreeze\_millero)}
\DoxyCodeLine{645       \textcolor{keyword}{call }calculate\_tfreeze\_millero(s, p\_scale*pressure, t\_fr)}
\DoxyCodeLine{646     \textcolor{keywordflow}{case} (tfreeze\_teos10)}
\DoxyCodeLine{647       \textcolor{keyword}{call }calculate\_tfreeze\_teos10(s, p\_scale*pressure, t\_fr)}
\DoxyCodeLine{648 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{649       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_TFreeze\_scalar: form\_of\_TFreeze is not valid."})}
\DoxyCodeLine{650 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{651 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a5b1ff89023e9d7da4074c7c1a71c9a85}\label{namespacemom__eos_a5b1ff89023e9d7da4074c7c1a71c9a85}} 
\index{mom\_eos@{mom\_eos}!convert\_temp\_salt\_for\_teos10@{convert\_temp\_salt\_for\_teos10}}
\index{convert\_temp\_salt\_for\_teos10@{convert\_temp\_salt\_for\_teos10}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{convert\_temp\_salt\_for\_teos10()}{convert\_temp\_salt\_for\_teos10()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::convert\+\_\+temp\+\_\+salt\+\_\+for\+\_\+teos10 (\begin{DoxyParamCaption}\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed,kd), intent(inout)}]{T,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed,kd), intent(inout)}]{S,  }\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{integer, intent(in)}]{kd,  }\item[{real, dimension(hi\%isd\+:hi\%ied,hi\%jsd\+:hi\%jed,kd), intent(in)}]{mask\+\_\+z,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})}



Convert T\&S to Absolute Salinity and Conservative Temperature if using T\+E\+O\+S10. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em kd} & The number of layers to work on \\
\hline
\mbox{\texttt{ in}}  & {\em hi} & The horizontal index structure \\
\hline
\mbox{\texttt{ in,out}}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em s} & Salinity \mbox{[}ppt\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em mask\+\_\+z} & 3d mask regulating which points to convert. \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1532   \textcolor{keywordtype}{integer},               \textcolor{keywordtype}{intent(in)}    :: kd\textcolor{comment}{  !< The number of layers to work on}}
\DoxyCodeLine{1533   \textcolor{keywordtype}{type}(hor\_index\_type),  \textcolor{keywordtype}{intent(in)}    :: HI\textcolor{comment}{       !< The horizontal index structure}}
\DoxyCodeLine{1534 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed,kd)}, \&}
\DoxyCodeLine{1535                          \textcolor{keywordtype}{intent(inout)} :: T\textcolor{comment}{   !< Potential temperature referenced to the surface [degC]}}
\DoxyCodeLine{1536 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed,kd)}, \&}
\DoxyCodeLine{1537                          \textcolor{keywordtype}{intent(inout)} :: S\textcolor{comment}{   !< Salinity [ppt]}}
\DoxyCodeLine{1538 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(HI\%isd:HI\%ied,HI\%jsd:HI\%jed,kd)}, \&}
\DoxyCodeLine{1539                          \textcolor{keywordtype}{intent(in)}    :: mask\_z\textcolor{comment}{ !< 3d mask regulating which points to convert.}}
\DoxyCodeLine{1540   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}       :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1541 }
\DoxyCodeLine{1542   \textcolor{keywordtype}{integer} :: i, j, k}
\DoxyCodeLine{1543 \textcolor{keywordtype}{  real} :: gsw\_sr\_from\_sp, gsw\_ct\_from\_pt, gsw\_sa\_from\_sp}
\DoxyCodeLine{1544 \textcolor{keywordtype}{  real} :: p}
\DoxyCodeLine{1545 }
\DoxyCodeLine{1546   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1547     \textcolor{stringliteral}{"convert\_temp\_salt\_to\_TEOS10 called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1548 }
\DoxyCodeLine{1549   \textcolor{keywordflow}{if} ((eos\%form\_of\_EOS /= eos\_teos10) .and. (eos\%form\_of\_EOS /= eos\_nemo)) \textcolor{keywordflow}{return}}
\DoxyCodeLine{1550 }
\DoxyCodeLine{1551   \textcolor{keywordflow}{do} k=1,kd ; \textcolor{keywordflow}{do} j=hi\%jsc,hi\%jec ; \textcolor{keywordflow}{do} i=hi\%isc,hi\%iec}
\DoxyCodeLine{1552     \textcolor{keywordflow}{if} (mask\_z(i,j,k) >= 1.0) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1553      s(i,j,k) = gsw\_sr\_from\_sp(s(i,j,k))}
\DoxyCodeLine{1554 \textcolor{comment}{!     Get absolute salinity from practical salinity, converting pressures from Pascal to dbar.}}
\DoxyCodeLine{1555 \textcolor{comment}{!     If this option is activated, pressure will need to be added as an argument, and it should be}}
\DoxyCodeLine{1556 \textcolor{comment}{!     moved out into module that is not shared between components, where the ocean\_grid can be used.}}
\DoxyCodeLine{1557 \textcolor{comment}{!     S(i,j,k) = gsw\_sa\_from\_sp(S(i,j,k),pres(i,j,k)*1.0e-\/4,G\%geoLonT(i,j),G\%geoLatT(i,j))}}
\DoxyCodeLine{1558      t(i,j,k) = gsw\_ct\_from\_pt(s(i,j,k), t(i,j,k))}
\DoxyCodeLine{1559 \textcolor{keywordflow}{    endif}}
\DoxyCodeLine{1560 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ enddo} ;\textcolor{keywordflow}{ enddo}}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a1108fb5de7a69d01746df3995f7e3f0d}\label{namespacemom__eos_a1108fb5de7a69d01746df3995f7e3f0d}} 
\index{mom\_eos@{mom\_eos}!eos\_allocate@{eos\_allocate}}
\index{eos\_allocate@{eos\_allocate}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_allocate()}{eos\_allocate()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::eos\+\_\+allocate (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})}



Allocates E\+O\+S\+\_\+type. 


\begin{DoxyParams}{Parameters}
{\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1491   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer} :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1492 }
\DoxyCodeLine{1493   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{allocate}(eos)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a782d326108e390902e520efc078e8296}\label{namespacemom__eos_a782d326108e390902e520efc078e8296}} 
\index{mom\_eos@{mom\_eos}!eos\_domain@{eos\_domain}}
\index{eos\_domain@{eos\_domain}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_domain()}{eos\_domain()}}
{\footnotesize\ttfamily integer function, dimension(2), public mom\+\_\+eos\+::eos\+\_\+domain (\begin{DoxyParamCaption}\item[{type(hor\+\_\+index\+\_\+type), intent(in)}]{HI,  }\item[{integer, intent(in), optional}]{halo }\end{DoxyParamCaption})}



This subroutine returns a two point integer array indicating the domain of i-\/indices to work on in E\+OS calls based on information from a hor\+\_\+index type. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em hi} & The horizontal index structure \\
\hline
\mbox{\texttt{ in}}  & {\em halo} & The halo size to work on; missing is equivalent to 0. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The index domain that the E\+OS will work on, taking into account that the arrays inside the E\+OS routines will start at 1. 
\end{DoxyReturn}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1163   \textcolor{keywordtype}{type}(hor\_index\_type), \textcolor{keywordtype}{intent(in)}  :: HI\textcolor{comment}{    !< The horizontal index structure}}
\DoxyCodeLine{1164   \textcolor{keywordtype}{integer},    \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)}  :: halo\textcolor{comment}{  !< The halo size to work on; missing is equivalent to 0.}}
\DoxyCodeLine{1165   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{dimension(2)} :: EOSdom\textcolor{comment}{   !< The index domain that the EOS will work on, taking into account}}
\DoxyCodeLine{1166 \textcolor{comment}{                                    !! that the arrays inside the EOS routines will start at 1.}}
\DoxyCodeLine{1167 }
\DoxyCodeLine{1168   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1169   \textcolor{keywordtype}{integer} :: halo\_sz}
\DoxyCodeLine{1170 }
\DoxyCodeLine{1171   halo\_sz = 0 ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(halo)) halo\_sz = halo}
\DoxyCodeLine{1172 }
\DoxyCodeLine{1173   eosdom(1) = hi\%isc -\/ (hi\%isd-\/1) -\/ halo\_sz}
\DoxyCodeLine{1174   eosdom(2) = hi\%iec -\/ (hi\%isd-\/1) + halo\_sz}
\DoxyCodeLine{1175 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_acab6a23bef0a98f15f0a479bdd1ec63c}\label{namespacemom__eos_acab6a23bef0a98f15f0a479bdd1ec63c}} 
\index{mom\_eos@{mom\_eos}!eos\_end@{eos\_end}}
\index{eos\_end@{eos\_end}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_end()}{eos\_end()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::eos\+\_\+end (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})}



Deallocates E\+O\+S\+\_\+type. 


\begin{DoxyParams}{Parameters}
{\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1498   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer} :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1499 }
\DoxyCodeLine{1500   \textcolor{keywordflow}{if} (\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{deallocate}(eos)}

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a3ab220b9c98dac3b8f6b7c1606b811cf}\label{namespacemom__eos_a3ab220b9c98dac3b8f6b7c1606b811cf}} 
\index{mom\_eos@{mom\_eos}!eos\_init@{eos\_init}}
\index{eos\_init@{eos\_init}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_init()}{eos\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::eos\+\_\+init (\begin{DoxyParamCaption}\item[{type(param\+\_\+file\+\_\+type), intent(in)}]{param\+\_\+file,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{type(unit\+\_\+scale\+\_\+type), intent(in), optional}]{US }\end{DoxyParamCaption})}



Initializes E\+O\+S\+\_\+type by allocating and reading parameters. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em param\+\_\+file} & Parameter file structure \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em us} & A dimensional unit scaling type \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1349   \textcolor{keywordtype}{type}(param\_file\_type), \textcolor{keywordtype}{intent(in)} :: param\_file\textcolor{comment}{ !< Parameter file structure}}
\DoxyCodeLine{1350   \textcolor{keywordtype}{type}(EOS\_type),        \textcolor{keywordtype}{pointer}    :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1351   \textcolor{keywordtype}{type}(unit\_scale\_type), \textcolor{keywordtype}{intent(in)} :: US\textcolor{comment}{  !< A dimensional unit scaling type}}
\DoxyCodeLine{1352   \textcolor{keywordtype}{optional} :: us}
\DoxyCodeLine{1353   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{1354 \textcolor{preprocessor}{\#include "version\_variable.h"}}
\DoxyCodeLine{1355 \textcolor{preprocessor}{}  \textcolor{keywordtype}{character(len=40)}  :: mdl = \textcolor{stringliteral}{"MOM\_EOS"} \textcolor{comment}{! This module's name.}}
\DoxyCodeLine{1356   \textcolor{keywordtype}{character(len=40)}  :: tmpstr}
\DoxyCodeLine{1357 }
\DoxyCodeLine{1358   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }eos\_allocate(eos)}
\DoxyCodeLine{1359 }
\DoxyCodeLine{1360   \textcolor{comment}{! Read all relevant parameters and write them to the model log.}}
\DoxyCodeLine{1361   \textcolor{keyword}{call }log\_version(param\_file, mdl, version, \textcolor{stringliteral}{""})}
\DoxyCodeLine{1362 }
\DoxyCodeLine{1363   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"EQN\_OF\_STATE"}, tmpstr, \&}
\DoxyCodeLine{1364                  \textcolor{stringliteral}{"EQN\_OF\_STATE determines which ocean equation of state "}//\&}
\DoxyCodeLine{1365                  \textcolor{stringliteral}{"should be used.  Currently, the valid choices are "}//\&}
\DoxyCodeLine{1366                  \textcolor{stringliteral}{'"LINEAR", "UNESCO", "WRIGHT", "NEMO" and "TEOS10". '}//\&}
\DoxyCodeLine{1367                  \textcolor{stringliteral}{"This is only used if USE\_EOS is true."}, default=eos\_default)}
\DoxyCodeLine{1368   \textcolor{keywordflow}{select case} (uppercase(tmpstr))}
\DoxyCodeLine{1369     \textcolor{keywordflow}{case} (eos\_linear\_string)}
\DoxyCodeLine{1370       eos\%form\_of\_EOS = eos\_linear}
\DoxyCodeLine{1371     \textcolor{keywordflow}{case} (eos\_unesco\_string)}
\DoxyCodeLine{1372       eos\%form\_of\_EOS = eos\_unesco}
\DoxyCodeLine{1373     \textcolor{keywordflow}{case} (eos\_wright\_string)}
\DoxyCodeLine{1374       eos\%form\_of\_EOS = eos\_wright}
\DoxyCodeLine{1375     \textcolor{keywordflow}{case} (eos\_teos10\_string)}
\DoxyCodeLine{1376       eos\%form\_of\_EOS = eos\_teos10}
\DoxyCodeLine{1377     \textcolor{keywordflow}{case} (eos\_nemo\_string)}
\DoxyCodeLine{1378       eos\%form\_of\_EOS = eos\_nemo}
\DoxyCodeLine{1379 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1380       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"interpret\_eos\_selection: EQN\_OF\_STATE "}//\&}
\DoxyCodeLine{1381                               trim(tmpstr) // \textcolor{stringliteral}{"in input file is invalid."})}
\DoxyCodeLine{1382 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1383   \textcolor{keyword}{call }mom\_mesg(\textcolor{stringliteral}{'interpret\_eos\_selection: equation of state set to "'} // \&}
\DoxyCodeLine{1384                 trim(tmpstr)//\textcolor{stringliteral}{'"'}, 5)}
\DoxyCodeLine{1385 }
\DoxyCodeLine{1386   \textcolor{keywordflow}{if} (eos\%form\_of\_EOS == eos\_linear) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1387     eos\%Compressible = .false.}
\DoxyCodeLine{1388     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"RHO\_T0\_S0"}, eos\%Rho\_T0\_S0, \&}
\DoxyCodeLine{1389                  \textcolor{stringliteral}{"When EQN\_OF\_STATE="}//trim(eos\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1390                  \textcolor{stringliteral}{"this is the density at T=0, S=0."}, units=\textcolor{stringliteral}{"kg m-\/3"}, \&}
\DoxyCodeLine{1391                  default=1000.0)}
\DoxyCodeLine{1392     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DRHO\_DT"}, eos\%dRho\_dT, \&}
\DoxyCodeLine{1393                  \textcolor{stringliteral}{"When EQN\_OF\_STATE="}//trim(eos\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1394                  \textcolor{stringliteral}{"this is the partial derivative of density with "}//\&}
\DoxyCodeLine{1395                  \textcolor{stringliteral}{"temperature."}, units=\textcolor{stringliteral}{"kg m-\/3 K-\/1"}, default=-\/0.2)}
\DoxyCodeLine{1396     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DRHO\_DS"}, eos\%dRho\_dS, \&}
\DoxyCodeLine{1397                  \textcolor{stringliteral}{"When EQN\_OF\_STATE="}//trim(eos\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1398                  \textcolor{stringliteral}{"this is the partial derivative of density with "}//\&}
\DoxyCodeLine{1399                  \textcolor{stringliteral}{"salinity."}, units=\textcolor{stringliteral}{"kg m-\/3 PSU-\/1"}, default=0.8)}
\DoxyCodeLine{1400 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1401 }
\DoxyCodeLine{1402   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"EOS\_QUADRATURE"}, eos\%EOS\_quadrature, \&}
\DoxyCodeLine{1403                  \textcolor{stringliteral}{"If true, always use the generic (quadrature) code "}//\&}
\DoxyCodeLine{1404                  \textcolor{stringliteral}{"code for the integrals of density."}, default=.false.)}
\DoxyCodeLine{1405 }
\DoxyCodeLine{1406   \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TFREEZE\_FORM"}, tmpstr, \&}
\DoxyCodeLine{1407                  \textcolor{stringliteral}{"TFREEZE\_FORM determines which expression should be "}//\&}
\DoxyCodeLine{1408                  \textcolor{stringliteral}{"used for the freezing point.  Currently, the valid "}//\&}
\DoxyCodeLine{1409                  \textcolor{stringliteral}{'choices are "LINEAR", "MILLERO\_78", "TEOS10"'}, \&}
\DoxyCodeLine{1410                  default=tfreeze\_default)}
\DoxyCodeLine{1411   \textcolor{keywordflow}{select case} (uppercase(tmpstr))}
\DoxyCodeLine{1412     \textcolor{keywordflow}{case} (tfreeze\_linear\_string)}
\DoxyCodeLine{1413       eos\%form\_of\_TFreeze = tfreeze\_linear}
\DoxyCodeLine{1414     \textcolor{keywordflow}{case} (tfreeze\_millero\_string)}
\DoxyCodeLine{1415       eos\%form\_of\_TFreeze = tfreeze\_millero}
\DoxyCodeLine{1416     \textcolor{keywordflow}{case} (tfreeze\_teos10\_string)}
\DoxyCodeLine{1417       eos\%form\_of\_TFreeze = tfreeze\_teos10}
\DoxyCodeLine{1418 \textcolor{keywordflow}{    case default}}
\DoxyCodeLine{1419       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"interpret\_eos\_selection:  TFREEZE\_FORM "}//\&}
\DoxyCodeLine{1420                               trim(tmpstr) // \textcolor{stringliteral}{"in input file is invalid."})}
\DoxyCodeLine{1421 \textcolor{keywordflow}{  end select}}
\DoxyCodeLine{1422 }
\DoxyCodeLine{1423   \textcolor{keywordflow}{if} (eos\%form\_of\_TFreeze == tfreeze\_linear) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1424     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"TFREEZE\_S0\_P0"},eos\%TFr\_S0\_P0, \&}
\DoxyCodeLine{1425                  \textcolor{stringliteral}{"When TFREEZE\_FORM="}//trim(tfreeze\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1426                  \textcolor{stringliteral}{"this is the freezing potential temperature at "}//\&}
\DoxyCodeLine{1427                  \textcolor{stringliteral}{"S=0, P=0."}, units=\textcolor{stringliteral}{"deg C"}, default=0.0)}
\DoxyCodeLine{1428     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DTFREEZE\_DS"},eos\%dTFr\_dS, \&}
\DoxyCodeLine{1429                  \textcolor{stringliteral}{"When TFREEZE\_FORM="}//trim(tfreeze\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1430                  \textcolor{stringliteral}{"this is the derivative of the freezing potential "}//\&}
\DoxyCodeLine{1431                  \textcolor{stringliteral}{"temperature with salinity."}, \&}
\DoxyCodeLine{1432                  units=\textcolor{stringliteral}{"deg C PSU-\/1"}, default=-\/0.054)}
\DoxyCodeLine{1433     \textcolor{keyword}{call }get\_param(param\_file, mdl, \textcolor{stringliteral}{"DTFREEZE\_DP"},eos\%dTFr\_dP, \&}
\DoxyCodeLine{1434                  \textcolor{stringliteral}{"When TFREEZE\_FORM="}//trim(tfreeze\_linear\_string)//\textcolor{stringliteral}{", "}//\&}
\DoxyCodeLine{1435                  \textcolor{stringliteral}{"this is the derivative of the freezing potential "}//\&}
\DoxyCodeLine{1436                  \textcolor{stringliteral}{"temperature with pressure."}, \&}
\DoxyCodeLine{1437                  units=\textcolor{stringliteral}{"deg C Pa-\/1"}, default=0.0)}
\DoxyCodeLine{1438 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1439 }
\DoxyCodeLine{1440   \textcolor{keywordflow}{if} ((eos\%form\_of\_EOS == eos\_teos10 .OR. eos\%form\_of\_EOS == eos\_nemo) .AND. \&}
\DoxyCodeLine{1441       eos\%form\_of\_TFreeze /= tfreeze\_teos10) \textcolor{keywordflow}{then}}
\DoxyCodeLine{1442       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"interpret\_eos\_selection:  EOS\_TEOS10 or EOS\_NEMO \(\backslash\)n"} //\&}
\DoxyCodeLine{1443       \textcolor{stringliteral}{"should only be used along with TFREEZE\_FORM = TFREEZE\_TEOS10 ."})}
\DoxyCodeLine{1444 \textcolor{keywordflow}{  endif}}
\DoxyCodeLine{1445 }
\DoxyCodeLine{1446   \textcolor{comment}{! Unit conversions}}
\DoxyCodeLine{1447   eos\%m\_to\_Z = 1. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) eos\%m\_to\_Z = us\%m\_to\_Z}
\DoxyCodeLine{1448   eos\%kg\_m3\_to\_R = 1. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) eos\%kg\_m3\_to\_R = us\%kg\_m3\_to\_R}
\DoxyCodeLine{1449   eos\%R\_to\_kg\_m3 = 1. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) eos\%R\_to\_kg\_m3 = us\%R\_to\_kg\_m3}
\DoxyCodeLine{1450   eos\%RL2\_T2\_to\_Pa = 1. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) eos\%RL2\_T2\_to\_Pa = us\%RL2\_T2\_to\_Pa}
\DoxyCodeLine{1451   eos\%L\_T\_to\_m\_s = 1. ; \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(us)) eos\%L\_T\_to\_m\_s = us\%L\_T\_to\_m\_s}
\DoxyCodeLine{1452 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a949f5bb0744c827bf11cca01316ceed4}\label{namespacemom__eos_a949f5bb0744c827bf11cca01316ceed4}} 
\index{mom\_eos@{mom\_eos}!eos\_manual\_init@{eos\_manual\_init}}
\index{eos\_manual\_init@{eos\_manual\_init}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_manual\_init()}{eos\_manual\_init()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::eos\+\_\+manual\+\_\+init (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, intent(in), optional}]{form\+\_\+of\+\_\+\+E\+OS,  }\item[{integer, intent(in), optional}]{form\+\_\+of\+\_\+\+T\+Freeze,  }\item[{logical, intent(in), optional}]{E\+O\+S\+\_\+quadrature,  }\item[{logical, intent(in), optional}]{Compressible,  }\item[{real, intent(in), optional}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in), optional}]{drho\+\_\+dT,  }\item[{real, intent(in), optional}]{d\+Rho\+\_\+dS,  }\item[{real, intent(in), optional}]{T\+Fr\+\_\+\+S0\+\_\+\+P0,  }\item[{real, intent(in), optional}]{d\+T\+Fr\+\_\+dS,  }\item[{real, intent(in), optional}]{d\+T\+Fr\+\_\+dp }\end{DoxyParamCaption})}



Manually initialized an E\+OS type (intended for unit testing of routines which need a specific E\+OS) 


\begin{DoxyParams}[1]{Parameters}
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ in}}  & {\em form\+\_\+of\+\_\+eos} & A coded integer indicating the equation of state to use. \\
\hline
\mbox{\texttt{ in}}  & {\em form\+\_\+of\+\_\+tfreeze} & A coded integer indicating the expression for the potential temperature of the freezing point. \\
\hline
\mbox{\texttt{ in}}  & {\em eos\+\_\+quadrature} & If true, always use the generic (quadrature) code for the integrals of density. \\
\hline
\mbox{\texttt{ in}}  & {\em compressible} & If true, in situ density is a function of pressure. \\
\hline
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & Density at T=0 degC and S=0 ppt \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & Partial derivative of density with temperature in \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & Partial derivative of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em tfr\+\_\+s0\+\_\+p0} & The freezing potential temperature at S=0, P=0 \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em dtfr\+\_\+ds} & The derivative of freezing point with salinity in \mbox{[}degC ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em dtfr\+\_\+dp} & The derivative of freezing point with pressure in \mbox{[}degC Pa-\/1\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1458   \textcolor{keywordtype}{type}(EOS\_type),    \textcolor{keywordtype}{pointer}    :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1459   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: form\_of\_EOS\textcolor{comment}{ !< A coded integer indicating the equation of state to use.}}
\DoxyCodeLine{1460   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: form\_of\_TFreeze\textcolor{comment}{ !< A coded integer indicating the expression for}}
\DoxyCodeLine{1461 \textcolor{comment}{                                       !! the potential temperature of the freezing point.}}
\DoxyCodeLine{1462   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: EOS\_quadrature\textcolor{comment}{ !< If true, always use the generic (quadrature)}}
\DoxyCodeLine{1463 \textcolor{comment}{                                       !! code for the integrals of density.}}
\DoxyCodeLine{1464   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: Compressible\textcolor{comment}{  !< If true, in situ density is a function of pressure.}}
\DoxyCodeLine{1465 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: Rho\_T0\_S0\textcolor{comment}{ !< Density at T=0 degC and S=0 ppt [kg m-\/3]}}
\DoxyCodeLine{1466 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: drho\_dT\textcolor{comment}{   !< Partial derivative of density with temperature}}
\DoxyCodeLine{1467 \textcolor{comment}{                                             !! in [kg m-\/3 degC-\/1]}}
\DoxyCodeLine{1468 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dRho\_dS\textcolor{comment}{   !< Partial derivative of density with salinity}}
\DoxyCodeLine{1469 \textcolor{comment}{                                             !! in [kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{1470 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: TFr\_S0\_P0\textcolor{comment}{ !< The freezing potential temperature at S=0, P=0 [degC]}}
\DoxyCodeLine{1471 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dTFr\_dS\textcolor{comment}{   !< The derivative of freezing point with salinity}}
\DoxyCodeLine{1472 \textcolor{comment}{                                             !! in [degC ppt-\/1]}}
\DoxyCodeLine{1473 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: dTFr\_dp\textcolor{comment}{   !< The derivative of freezing point with pressure}}
\DoxyCodeLine{1474 \textcolor{comment}{                                             !! in [degC Pa-\/1]}}
\DoxyCodeLine{1475 }
\DoxyCodeLine{1476   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(form\_of\_eos    ))  eos\%form\_of\_EOS     = form\_of\_eos}
\DoxyCodeLine{1477   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(form\_of\_tfreeze))  eos\%form\_of\_TFreeze = form\_of\_tfreeze}
\DoxyCodeLine{1478   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(eos\_quadrature ))  eos\%EOS\_quadrature  = eos\_quadrature}
\DoxyCodeLine{1479   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(compressible   ))  eos\%Compressible    = compressible}
\DoxyCodeLine{1480   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_t0\_s0      ))  eos\%Rho\_T0\_S0       = rho\_t0\_s0}
\DoxyCodeLine{1481   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(drho\_dt        ))  eos\%drho\_dT         = drho\_dt}
\DoxyCodeLine{1482   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(drho\_ds        ))  eos\%dRho\_dS         = drho\_ds}
\DoxyCodeLine{1483   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tfr\_s0\_p0      ))  eos\%TFr\_S0\_P0       = tfr\_s0\_p0}
\DoxyCodeLine{1484   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dtfr\_ds        ))  eos\%dTFr\_dS         = dtfr\_ds}
\DoxyCodeLine{1485   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dtfr\_dp        ))  eos\%dTFr\_dp         = dtfr\_dp}
\DoxyCodeLine{1486 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_aad531f2540628368c33198bb31d51201}\label{namespacemom__eos_aad531f2540628368c33198bb31d51201}} 
\index{mom\_eos@{mom\_eos}!eos\_quadrature@{eos\_quadrature}}
\index{eos\_quadrature@{eos\_quadrature}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_quadrature()}{eos\_quadrature()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+eos\+::eos\+\_\+quadrature (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})}



Return value of E\+O\+S\+\_\+quadrature. 


\begin{DoxyParams}{Parameters}
{\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1565   \textcolor{keywordtype}{type}(EOS\_type),    \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1566 }
\DoxyCodeLine{1567   eos\_quadrature  = eos\%EOS\_quadrature}
\DoxyCodeLine{1568 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_ae608600501a98f8f317d8f27a054327e}\label{namespacemom__eos_ae608600501a98f8f317d8f27a054327e}} 
\index{mom\_eos@{mom\_eos}!eos\_use\_linear@{eos\_use\_linear}}
\index{eos\_use\_linear@{eos\_use\_linear}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{eos\_use\_linear()}{eos\_use\_linear()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::eos\+\_\+use\+\_\+linear (\begin{DoxyParamCaption}\item[{real, intent(in)}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dT,  }\item[{real, intent(in)}]{d\+Rho\+\_\+dS,  }\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{logical, intent(in), optional}]{use\+\_\+quadrature }\end{DoxyParamCaption})}



Set equation of state structure (E\+OS) to linear with given coefficients. 

\begin{DoxyNote}{Note}
This routine is primarily for testing and allows a local copy of the E\+O\+S\+\_\+type (E\+OS argument) to be set to use the linear equation of state independent from the rest of the model. 
\end{DoxyNote}

\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em rho\+\_\+t0\+\_\+s0} & Density at T=0 degC and S=0 ppt \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+dt} & Partial derivative of density with temperature \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em drho\+\_\+ds} & Partial derivative of density with salinity \mbox{[}kg m-\/3 ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em use\+\_\+quadrature} & If true, always use the generic (quadrature) code for the integrals of density. \\
\hline
 & {\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1509 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: Rho\_T0\_S0\textcolor{comment}{ !< Density at T=0 degC and S=0 ppt [kg m-\/3]}}
\DoxyCodeLine{1510 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: dRho\_dT\textcolor{comment}{   !< Partial derivative of density with temperature [kg m-\/3 degC-\/1]}}
\DoxyCodeLine{1511 \textcolor{keywordtype}{  real},              \textcolor{keywordtype}{intent(in)} :: dRho\_dS\textcolor{comment}{   !< Partial derivative of density with salinity [kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{1512   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: use\_quadrature\textcolor{comment}{ !< If true, always use the generic (quadrature)}}
\DoxyCodeLine{1513 \textcolor{comment}{                                             !! code for the integrals of density.}}
\DoxyCodeLine{1514   \textcolor{keywordtype}{type}(EOS\_type),    \textcolor{keywordtype}{pointer}    :: EOS\textcolor{comment}{       !< Equation of state structure}}
\DoxyCodeLine{1515 }
\DoxyCodeLine{1516   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1517     \textcolor{stringliteral}{"MOM\_EOS.F90: EOS\_use\_linear() called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1518 }
\DoxyCodeLine{1519   eos\%form\_of\_EOS = eos\_linear}
\DoxyCodeLine{1520   eos\%Compressible = .false.}
\DoxyCodeLine{1521   eos\%Rho\_T0\_S0 = rho\_t0\_s0}
\DoxyCodeLine{1522   eos\%dRho\_dT = drho\_dt}
\DoxyCodeLine{1523   eos\%dRho\_dS = drho\_ds}
\DoxyCodeLine{1524   eos\%EOS\_quadrature = .false.}
\DoxyCodeLine{1525   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(use\_quadrature)) eos\%EOS\_quadrature = use\_quadrature}
\DoxyCodeLine{1526 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_a5e15d4f5b758ab149421c33145b0444c}\label{namespacemom__eos_a5e15d4f5b758ab149421c33145b0444c}} 
\index{mom\_eos@{mom\_eos}!extract\_member\_eos@{extract\_member\_eos}}
\index{extract\_member\_eos@{extract\_member\_eos}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{extract\_member\_eos()}{extract\_member\_eos()}}
{\footnotesize\ttfamily subroutine, public mom\+\_\+eos\+::extract\+\_\+member\+\_\+eos (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS,  }\item[{integer, intent(out), optional}]{form\+\_\+of\+\_\+\+E\+OS,  }\item[{integer, intent(out), optional}]{form\+\_\+of\+\_\+\+T\+Freeze,  }\item[{logical, intent(out), optional}]{E\+O\+S\+\_\+quadrature,  }\item[{logical, intent(out), optional}]{Compressible,  }\item[{real, intent(out), optional}]{Rho\+\_\+\+T0\+\_\+\+S0,  }\item[{real, intent(out), optional}]{drho\+\_\+dT,  }\item[{real, intent(out), optional}]{d\+Rho\+\_\+dS,  }\item[{real, intent(out), optional}]{T\+Fr\+\_\+\+S0\+\_\+\+P0,  }\item[{real, intent(out), optional}]{d\+T\+Fr\+\_\+dS,  }\item[{real, intent(out), optional}]{d\+T\+Fr\+\_\+dp }\end{DoxyParamCaption})}



Extractor routine for the E\+OS type if the members need to be accessed outside this module. 


\begin{DoxyParams}[1]{Parameters}
 & {\em eos} & Equation of state structure \\
\hline
\mbox{\texttt{ out}}  & {\em form\+\_\+of\+\_\+eos} & A coded integer indicating the equation of state to use. \\
\hline
\mbox{\texttt{ out}}  & {\em form\+\_\+of\+\_\+tfreeze} & A coded integer indicating the expression for the potential temperature of the freezing point. \\
\hline
\mbox{\texttt{ out}}  & {\em eos\+\_\+quadrature} & If true, always use the generic (quadrature) code for the integrals of density. \\
\hline
\mbox{\texttt{ out}}  & {\em compressible} & If true, in situ density is a function of pressure. \\
\hline
\mbox{\texttt{ out}}  & {\em rho\+\_\+t0\+\_\+s0} & Density at T=0 degC and S=0 ppt \mbox{[}kg m-\/3\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+dt} & Partial derivative of density with temperature in \mbox{[}kg m-\/3 deg\+C-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds} & Partial derivative of density with salinity in \mbox{[}kg m-\/3 ppt-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em tfr\+\_\+s0\+\_\+p0} & The freezing potential temperature at S=0, P=0 \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em dtfr\+\_\+ds} & The derivative of freezing point with salinity \mbox{[}degC P\+S\+U-\/1\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em dtfr\+\_\+dp} & The derivative of freezing point with pressure \mbox{[}degC Pa-\/1\mbox{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1574   \textcolor{keywordtype}{type}(EOS\_type),    \textcolor{keywordtype}{pointer}     :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1575   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: form\_of\_EOS\textcolor{comment}{ !< A coded integer indicating the equation of state to use.}}
\DoxyCodeLine{1576   \textcolor{keywordtype}{integer}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: form\_of\_TFreeze\textcolor{comment}{ !< A coded integer indicating the expression for}}
\DoxyCodeLine{1577 \textcolor{comment}{                                       !! the potential temperature of the freezing point.}}
\DoxyCodeLine{1578   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: EOS\_quadrature\textcolor{comment}{ !< If true, always use the generic (quadrature)}}
\DoxyCodeLine{1579 \textcolor{comment}{                                       !! code for the integrals of density.}}
\DoxyCodeLine{1580   \textcolor{keywordtype}{logical}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: Compressible\textcolor{comment}{ !< If true, in situ density is a function of pressure.}}
\DoxyCodeLine{1581 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: Rho\_T0\_S0\textcolor{comment}{ !< Density at T=0 degC and S=0 ppt [kg m-\/3]}}
\DoxyCodeLine{1582 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: drho\_dT\textcolor{comment}{   !< Partial derivative of density with temperature}}
\DoxyCodeLine{1583 \textcolor{comment}{                                              !! in [kg m-\/3 degC-\/1]}}
\DoxyCodeLine{1584 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: dRho\_dS\textcolor{comment}{   !< Partial derivative of density with salinity}}
\DoxyCodeLine{1585 \textcolor{comment}{                                              !! in [kg m-\/3 ppt-\/1]}}
\DoxyCodeLine{1586 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: TFr\_S0\_P0\textcolor{comment}{ !< The freezing potential temperature at S=0, P=0 [degC]}}
\DoxyCodeLine{1587 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: dTFr\_dS\textcolor{comment}{   !< The derivative of freezing point with salinity}}
\DoxyCodeLine{1588 \textcolor{comment}{                                              !! [degC PSU-\/1]}}
\DoxyCodeLine{1589 \textcolor{keywordtype}{  real}   , \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(out)} :: dTFr\_dp\textcolor{comment}{   !< The derivative of freezing point with pressure}}
\DoxyCodeLine{1590 \textcolor{comment}{                                              !! [degC Pa-\/1]}}
\DoxyCodeLine{1591 }
\DoxyCodeLine{1592   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(form\_of\_eos    ))  form\_of\_eos     = eos\%form\_of\_EOS}
\DoxyCodeLine{1593   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(form\_of\_tfreeze))  form\_of\_tfreeze = eos\%form\_of\_TFreeze}
\DoxyCodeLine{1594   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(eos\_quadrature ))  eos\_quadrature  = eos\%EOS\_quadrature}
\DoxyCodeLine{1595   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(compressible   ))  compressible    = eos\%Compressible}
\DoxyCodeLine{1596   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(rho\_t0\_s0      ))  rho\_t0\_s0       = eos\%Rho\_T0\_S0}
\DoxyCodeLine{1597   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(drho\_dt        ))  drho\_dt         = eos\%drho\_dT}
\DoxyCodeLine{1598   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(drho\_ds        ))  drho\_ds         = eos\%dRho\_dS}
\DoxyCodeLine{1599   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(tfr\_s0\_p0      ))  tfr\_s0\_p0       = eos\%TFr\_S0\_P0}
\DoxyCodeLine{1600   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dtfr\_ds        ))  dtfr\_ds         = eos\%dTFr\_dS}
\DoxyCodeLine{1601   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(dtfr\_dp        ))  dtfr\_dp         = eos\%dTFr\_dp}
\DoxyCodeLine{1602 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacemom__eos_aee169aee0e4cbed420782d772282bb69}\label{namespacemom__eos_aee169aee0e4cbed420782d772282bb69}} 
\index{mom\_eos@{mom\_eos}!query\_compressible@{query\_compressible}}
\index{query\_compressible@{query\_compressible}!mom\_eos@{mom\_eos}}
\doxysubsubsection{\texorpdfstring{query\_compressible()}{query\_compressible()}}
{\footnotesize\ttfamily logical function, public mom\+\_\+eos\+::query\+\_\+compressible (\begin{DoxyParamCaption}\item[{type(\mbox{\hyperlink{structmom__eos_1_1eos__type}{eos\+\_\+type}}), pointer}]{E\+OS }\end{DoxyParamCaption})}



Returns true if the equation of state is compressible (i.\+e. has pressure dependence) 


\begin{DoxyParams}{Parameters}
{\em eos} & Equation of state structure \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{1339   \textcolor{keywordtype}{type}(EOS\_type), \textcolor{keywordtype}{pointer} :: EOS\textcolor{comment}{ !< Equation of state structure}}
\DoxyCodeLine{1340 }
\DoxyCodeLine{1341   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, \&}
\DoxyCodeLine{1342     \textcolor{stringliteral}{"query\_compressible called with an unassociated EOS\_type EOS."})}
\DoxyCodeLine{1343 }
\DoxyCodeLine{1344   query\_compressible = eos\%compressible}

\end{DoxyCode}
