\hypertarget{interfacemom__eos_1_1calculate__density__second__derivs}{}\section{mom\+\_\+eos\+:\+:calculate\+\_\+density\+\_\+second\+\_\+derivs Interface Reference}
\label{interfacemom__eos_1_1calculate__density__second__derivs}\index{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs@{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs}}


\subsection{Detailed Description}
Calculates the second derivatives of density with various combinations of temperature, salinity, and pressure from T, S and P. 

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

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{interfacemom__eos_1_1calculate__density__second__derivs_a033e590d1cd2e6864421247f04b0b32d}{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 \hyperlink{interfacemom__eos_1_1calculate__density__second__derivs_aa3a38bb75bf60ecc125a00613fa7471a}{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}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Calculates the second derivatives of density with various combinations of temperature, salinity, and pressure from T, S and P. 

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



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__eos_1_1calculate__density__second__derivs_aa3a38bb75bf60ecc125a00613fa7471a}\label{interfacemom__eos_1_1calculate__density__second__derivs_aa3a38bb75bf60ecc125a00613fa7471a}} 
\index{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs@{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs}!calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array}}
\index{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array}!mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs@{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array()}{calculate\_density\_second\_derivs\_array()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+::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(\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{\tt in}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt in}  & {\em s} & Salinity \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt in}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}\\
\hline
\mbox{\tt 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{\tt 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{\tt 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{\tt 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{\tt 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{\tt in}  & {\em start} & Starting index within the array\\
\hline
\mbox{\tt in}  & {\em npts} & The number of values to calculate\\
\hline
 & {\em eos} & Equation of state structure\\
\hline
\mbox{\tt 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}
844   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: t\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}
845   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: s\textcolor{comment}{ !< Salinity [ppt]}
846   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{   !< Pressure [Pa] or [R L2 T-2 ~> Pa]}
847   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_ds\textcolor{comment}{ !< Partial derivative of beta with respect to S}
848 \textcolor{comment}{                                                  !!  [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]}
849   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_dt\textcolor{comment}{ !< Partial derivative of beta with respect to T}
850 \textcolor{comment}{                                                  !! [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3
       ppt-1 degC-1]}
851   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dt\_dt\textcolor{comment}{ !< Partial derivative of alpha with respect to T}
852 \textcolor{comment}{                                                  !! [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]}
853   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_dp\textcolor{comment}{ !< Partial derivative of beta with respect to pressure}
854 \textcolor{comment}{                                                  !! [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1
       Pa-1]}
855   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dt\_dp\textcolor{comment}{ !< Partial derivative of alpha with respect to pressure}
856 \textcolor{comment}{                                                  !! [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3
       degC-1 Pa-1]}
857   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: start\textcolor{comment}{ !< Starting index within the array}
858   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)}  :: npts\textcolor{comment}{  !< The number of values to calculate}
859   \textcolor{keywordtype}{type}(eos\_type),     \textcolor{keywordtype}{pointer}     :: eos\textcolor{comment}{   !< Equation of state structure}
860   \textcolor{keywordtype}{real},                  \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}
861 \textcolor{comment}{                                                  !! in combination with scaling given by US [various]}
862   \textcolor{comment}{! Local variables}
863   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{dimension(size(pressure))} :: pres  \textcolor{comment}{! Pressure converted to [Pa]}
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 ~> 1]}
865   \textcolor{keywordtype}{real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]}
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 ~> 1]}
867   \textcolor{keywordtype}{integer} :: j
868 
869   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, &
870     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})
871 
872   p\_scale = eos%RL2\_T2\_to\_Pa
873 
874   \textcolor{keywordflow}{if} (p\_scale == 1.0) \textcolor{keywordflow}{then}
875     \textcolor{keywordflow}{select case} (eos%form\_of\_EOS)
876       \textcolor{keywordflow}{case} (eos\_linear)
877         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, &
878                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
879       \textcolor{keywordflow}{case} (eos\_wright)
880         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, &
881                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
882       \textcolor{keywordflow}{case} (eos\_teos10)
883         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pressure, drho\_ds\_ds, drho\_ds\_dt, &
884                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
885 \textcolor{keywordflow}{      case default}
886         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS%form\_of\_EOS is not valid."})
887 \textcolor{keywordflow}{    end select}
888   \textcolor{keywordflow}{else}
889     \textcolor{keywordflow}{do} j=start,start+npts-1 ; pres(j) = p\_scale * pressure(j) ;\textcolor{keywordflow}{ enddo}
890     \textcolor{keywordflow}{select case} (eos%form\_of\_EOS)
891       \textcolor{keywordflow}{case} (eos\_linear)
892         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, &
893                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
894       \textcolor{keywordflow}{case} (eos\_wright)
895         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, &
896                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
897       \textcolor{keywordflow}{case} (eos\_teos10)
898         \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, pres, drho\_ds\_ds, drho\_ds\_dt, &
899                                                     drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp, start, npts)
900 \textcolor{keywordflow}{      case default}
901         \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS%form\_of\_EOS is not valid."})
902 \textcolor{keywordflow}{    end select}
903 \textcolor{keywordflow}{  endif}
904 
905   rho\_scale = eos%kg\_m3\_to\_R
906   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale
907   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then} ; \textcolor{keywordflow}{do} j=start,start+npts-1
908     drho\_ds\_ds(j) = rho\_scale * drho\_ds\_ds(j)
909     drho\_ds\_dt(j) = rho\_scale * drho\_ds\_dt(j)
910     drho\_dt\_dt(j) = rho\_scale * drho\_dt\_dt(j)
911     drho\_ds\_dp(j) = rho\_scale * drho\_ds\_dp(j)
912     drho\_dt\_dp(j) = rho\_scale * drho\_dt\_dp(j)
913 \textcolor{keywordflow}{  enddo} ;\textcolor{keywordflow}{ endif}
914 
915   \textcolor{keywordflow}{if} (p\_scale /= 1.0) \textcolor{keywordflow}{then}
916     i\_p\_scale = 1.0 / p\_scale
917     \textcolor{keywordflow}{do} j=start,start+npts-1
918       drho\_ds\_dp(j) = i\_p\_scale * drho\_ds\_dp(j)
919       drho\_dt\_dp(j) = i\_p\_scale * drho\_dt\_dp(j)
920 \textcolor{keywordflow}{    enddo}
921 \textcolor{keywordflow}{  endif}
922 
\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__eos_1_1calculate__density__second__derivs_a033e590d1cd2e6864421247f04b0b32d}\label{interfacemom__eos_1_1calculate__density__second__derivs_a033e590d1cd2e6864421247f04b0b32d}} 
\index{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs@{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs}!calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar}}
\index{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar@{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar}!mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs@{mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs}}
\subsubsection{\texorpdfstring{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar()}{calculate\_density\_second\_derivs\_scalar()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+::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(\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{\tt in}  & {\em t} & Potential temperature referenced to the surface \mbox{[}degC\mbox{]}\\
\hline
\mbox{\tt in}  & {\em s} & Salinity \mbox{[}ppt\mbox{]}\\
\hline
\mbox{\tt in}  & {\em pressure} & Pressure \mbox{[}Pa\mbox{]} or \mbox{[}R L2 T-\/2 $\sim$$>$ Pa\mbox{]}\\
\hline
\mbox{\tt 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{\tt 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{\tt 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{\tt 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{\tt 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{\tt 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}
928   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: t\textcolor{comment}{ !< Potential temperature referenced to the surface [degC]}
929   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: s\textcolor{comment}{ !< Salinity [ppt]}
930   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(in)}  :: pressure\textcolor{comment}{   !< Pressure [Pa] or [R L2 T-2 ~> Pa]}
931   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_ds\_ds\textcolor{comment}{ !< Partial derivative of beta with respect to S}
932 \textcolor{comment}{                                  !! [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]}
933   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_ds\_dt\textcolor{comment}{ !< Partial derivative of beta with respect to T}
934 \textcolor{comment}{                                  !! [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3 ppt-1 degC-1]}
935   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dt\_dt\textcolor{comment}{ !< Partial derivative of alpha with respect to T}
936 \textcolor{comment}{                                  !! [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]}
937   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_ds\_dp\textcolor{comment}{ !< Partial derivative of beta with respect to pressure}
938 \textcolor{comment}{                                  !! [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1 Pa-1]}
939   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{intent(out)} :: drho\_dt\_dp\textcolor{comment}{ !< Partial derivative of alpha with respect to pressure}
940 \textcolor{comment}{                                  !! [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3 degC-1 Pa-1]}
941   \textcolor{keywordtype}{type}(eos\_type), \textcolor{keywordtype}{pointer}    :: eos\textcolor{comment}{ !< Equation of state structure}
942   \textcolor{keywordtype}{real}, \textcolor{keywordtype}{optional}, \textcolor{keywordtype}{intent(in)} :: scale\textcolor{comment}{ !< A multiplicative factor by which to scale density}
943 \textcolor{comment}{                                  !! in combination with scaling given by US [various]}
944   \textcolor{comment}{! Local variables}
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 ~> 1]}
946   \textcolor{keywordtype}{real} :: p\_scale   \textcolor{comment}{! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]}
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 ~> 1]}
948 
949   \textcolor{keywordflow}{if} (.not.\textcolor{keyword}{associated}(eos)) \textcolor{keyword}{call }mom\_error(fatal, &
950     \textcolor{stringliteral}{"calculate\_density\_derivs called with an unassociated EOS\_type EOS."})
951 
952   p\_scale = eos%RL2\_T2\_to\_Pa
953 
954   \textcolor{keywordflow}{select case} (eos%form\_of\_EOS)
955     \textcolor{keywordflow}{case} (eos\_linear)
956       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_linear(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, &
957                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)
958     \textcolor{keywordflow}{case} (eos\_wright)
959       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_wright(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, &
960                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)
961     \textcolor{keywordflow}{case} (eos\_teos10)
962       \textcolor{keyword}{call }calculate\_density\_second\_derivs\_teos10(t, s, p\_scale*pressure, drho\_ds\_ds, drho\_ds\_dt, &
963                                                   drho\_dt\_dt, drho\_ds\_dp, drho\_dt\_dp)
964 \textcolor{keywordflow}{    case default}
965       \textcolor{keyword}{call }mom\_error(fatal, \textcolor{stringliteral}{"calculate\_density\_derivs: EOS%form\_of\_EOS is not valid."})
966 \textcolor{keywordflow}{  end select}
967 
968   rho\_scale = eos%kg\_m3\_to\_R
969   \textcolor{keywordflow}{if} (\textcolor{keyword}{present}(scale)) rho\_scale = rho\_scale * scale
970   \textcolor{keywordflow}{if} (rho\_scale /= 1.0) \textcolor{keywordflow}{then}
971     drho\_ds\_ds = rho\_scale * drho\_ds\_ds
972     drho\_ds\_dt = rho\_scale * drho\_ds\_dt
973     drho\_dt\_dt = rho\_scale * drho\_dt\_dt
974     drho\_ds\_dp = rho\_scale * drho\_ds\_dp
975     drho\_dt\_dp = rho\_scale * drho\_dt\_dp
976 \textcolor{keywordflow}{  endif}
977 
978   \textcolor{keywordflow}{if} (p\_scale /= 1.0) \textcolor{keywordflow}{then}
979     i\_p\_scale = 1.0 / p\_scale
980     drho\_ds\_dp = i\_p\_scale * drho\_ds\_dp
981     drho\_dt\_dp = i\_p\_scale * drho\_dt\_dp
982 \textcolor{keywordflow}{  endif}
983 
\end{DoxyCode}


The documentation for this interface was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/home/cermak/src/\+M\+O\+M6.\+devrob/src/equation\+\_\+of\+\_\+state/M\+O\+M\+\_\+\+E\+O\+S.\+F90\end{DoxyCompactItemize}
