\hypertarget{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright}{}\section{mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+wright Interface Reference}
\label{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright}\index{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright@{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright}}


\subsection{Detailed Description}
For a given thermodynamic state, return the second derivatives of density with various combinations of temperature, salinity, and pressure. 

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

\subsection*{Private functions}
\begin{DoxyCompactItemize}
\item 
subroutine \mbox{\hyperlink{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_a3cbd28af5f550fefbdfff6247a304839}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+wright}} (T, S, P, drho\+\_\+ds\+\_\+ds, drho\+\_\+ds\+\_\+dt, drho\+\_\+dt\+\_\+dt, drho\+\_\+ds\+\_\+dp, drho\+\_\+dt\+\_\+dp)
\begin{DoxyCompactList}\small\item\em Second derivatives of density with respect to temperature, salinity, and pressure for scalar inputs. Inputs promoted to 1-\/element array and output demoted to scalar. \end{DoxyCompactList}\item 
subroutine \mbox{\hyperlink{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_aa37e6361657a2ce09e9f6cd3cd53ff65}{calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+wright}} (T, S, P, drho\+\_\+ds\+\_\+ds, drho\+\_\+ds\+\_\+dt, drho\+\_\+dt\+\_\+dt, drho\+\_\+ds\+\_\+dp, drho\+\_\+dt\+\_\+dp, start, npts)
\begin{DoxyCompactList}\small\item\em Second derivatives of density with respect to temperature, salinity, and pressure. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
For a given thermodynamic state, return the second derivatives of density with various combinations of temperature, salinity, and pressure. 

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



\subsection{Functions and subroutines}
\mbox{\Hypertarget{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_aa37e6361657a2ce09e9f6cd3cd53ff65}\label{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_aa37e6361657a2ce09e9f6cd3cd53ff65}} 
\index{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright@{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright}!calculate\_density\_second\_derivs\_array\_wright@{calculate\_density\_second\_derivs\_array\_wright}}
\index{calculate\_density\_second\_derivs\_array\_wright@{calculate\_density\_second\_derivs\_array\_wright}!mom\_eos\_wright::calculate\_density\_second\_derivs\_wright@{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright}}
\subsubsection{\texorpdfstring{calculate\_density\_second\_derivs\_array\_wright()}{calculate\_density\_second\_derivs\_array\_wright()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+wright\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+array\+\_\+wright (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{T,  }\item[{real, dimension(\+:), intent(in)}]{S,  }\item[{real, dimension(\+:), intent(in)}]{P,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+ds\+\_\+ds,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+ds\+\_\+dt,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dt\+\_\+dt,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+ds\+\_\+dp,  }\item[{real, dimension(\+:), intent(inout)}]{drho\+\_\+dt\+\_\+dp,  }\item[{integer, intent(in)}]{start,  }\item[{integer, intent(in)}]{npts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Second derivatives of density with respect to temperature, salinity, and pressure. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to 0 dbar \mbox{[}degC\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em p} & Pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+ds} & Partial derivative of beta with respect to S \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+dt} & Partial derivative of beta with respcct to T \mbox{[}kg m-\/3 P\+S\+U-\/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{]} \\
\hline
\mbox{\texttt{ in,out}}  & {\em drho\+\_\+ds\+\_\+dp} & Partial derivative of beta with respect to pressure \mbox{[}kg m-\/3 P\+S\+U-\/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{]} \\
\hline
\mbox{\texttt{ in}}  & {\em start} & Starting index in T,S,P \\
\hline
\mbox{\texttt{ in}}  & {\em npts} & Number of points to loop over \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{259 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in   )} :: T\textcolor{comment}{ !< Potential temperature referenced to 0 dbar [degC]}}
\DoxyCodeLine{260 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in   )} :: S\textcolor{comment}{ !< Salinity [PSU]}}
\DoxyCodeLine{261 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in   )} :: P\textcolor{comment}{ !< Pressure [Pa]}}
\DoxyCodeLine{262 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_ds\textcolor{comment}{ !< Partial derivative of beta with respect}}
\DoxyCodeLine{263 \textcolor{comment}{                                                  !! to S [kg m-3 PSU-2]}}
\DoxyCodeLine{264 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_dt\textcolor{comment}{ !< Partial derivative of beta with respcct}}
\DoxyCodeLine{265 \textcolor{comment}{                                                  !! to T [kg m-3 PSU-1 degC-1]}}
\DoxyCodeLine{266 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dt\_dt\textcolor{comment}{ !< Partial derivative of alpha with respect}}
\DoxyCodeLine{267 \textcolor{comment}{                                                  !! to T [kg m-3 degC-2]}}
\DoxyCodeLine{268 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_ds\_dp\textcolor{comment}{ !< Partial derivative of beta with respect}}
\DoxyCodeLine{269 \textcolor{comment}{                                                  !! to pressure [kg m-3 PSU-1 Pa-1]}}
\DoxyCodeLine{270 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(inout)} :: drho\_dt\_dp\textcolor{comment}{ !< Partial derivative of alpha with respect}}
\DoxyCodeLine{271 \textcolor{comment}{                                                  !! to pressure [kg m-3 degC-1 Pa-1]}}
\DoxyCodeLine{272   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in   )} :: start\textcolor{comment}{ !< Starting index in T,S,P}}
\DoxyCodeLine{273   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in   )} :: npts\textcolor{comment}{  !< Number of points to loop over}}
\DoxyCodeLine{274 }
\DoxyCodeLine{275   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{276 \textcolor{keywordtype}{  real} :: z0, z1, z2, z3, z4, z5, z6 ,z7, z8, z9, z10, z11, z2\_2, z2\_3}
\DoxyCodeLine{277   \textcolor{keywordtype}{integer} :: j}
\DoxyCodeLine{278   \textcolor{comment}{! Based on the above expression with common terms factored, there probably exists a more numerically stable}}
\DoxyCodeLine{279   \textcolor{comment}{! and/or efficient expression}}
\DoxyCodeLine{280 }
\DoxyCodeLine{281   \textcolor{keywordflow}{do} j = start,start+npts-1}
\DoxyCodeLine{282     z0 = t(j)*(b1 + b5*s(j) + t(j)*(b2 + b3*t(j)))}
\DoxyCodeLine{283     z1 = (b0 + p(j) + b4*s(j) + z0)}
\DoxyCodeLine{284     z3 = (b1 + b5*s(j) + t(j)*(2.*b2 + 2.*b3*t(j)))}
\DoxyCodeLine{285     z4 = (c0 + c4*s(j) + t(j)*(c1 + c5*s(j) + t(j)*(c2 + c3*t(j))))}
\DoxyCodeLine{286     z5 = (b1 + b5*s(j) + t(j)*(b2 + b3*t(j)) + t(j)*(b2 + 2.*b3*t(j)))}
\DoxyCodeLine{287     z6 = c1 + c5*s(j) + t(j)*(c2 + c3*t(j)) + t(j)*(c2 + 2.*c3*t(j))}
\DoxyCodeLine{288     z7 = (c4 + c5*t(j) + a2*z1)}
\DoxyCodeLine{289     z8 = (c1 + c5*s(j) + t(j)*(2.*c2 + 3.*c3*t(j)) + a1*z1)}
\DoxyCodeLine{290     z9 = (a0 + a2*s(j) + a1*t(j))}
\DoxyCodeLine{291     z10 = (b4 + b5*t(j))}
\DoxyCodeLine{292     z11 = (z10*z4 - z1*z7)}
\DoxyCodeLine{293     z2 = (c0 + c4*s(j) + t(j)*(c1 + c5*s(j) + t(j)*(c2 + c3*t(j))) + z9*z1)}
\DoxyCodeLine{294     z2\_2 = z2*z2}
\DoxyCodeLine{295     z2\_3 = z2\_2*z2}
\DoxyCodeLine{296 }
\DoxyCodeLine{297     drho\_ds\_ds(j) = (z10*(c4 + c5*t(j)) - a2*z10*z1 - z10*z7)/z2\_2 - (2.*(c4 + c5*t(j) + z9*z10 + a2*z1)*z11)/z2\_3}
\DoxyCodeLine{298     drho\_ds\_dt(j) = (z10*z6 - z1*(c5 + a2*z5) + b5*z4 - z5*z7)/z2\_2 - (2.*(z6 + z9*z5 + a1*z1)*z11)/z2\_3}
\DoxyCodeLine{299     drho\_dt\_dt(j) = (z3*z6 - z1*(2.*c2 + 6.*c3*t(j) + a1*z5) + (2.*b2 + 4.*b3*t(j))*z4 - z5*z8)/z2\_2 - \&}
\DoxyCodeLine{300                     (2.*(z6 + z9*z5 + a1*z1)*(z3*z4 - z1*z8))/z2\_3}
\DoxyCodeLine{301     drho\_ds\_dp(j) = (-c4 - c5*t(j) - 2.*a2*z1)/z2\_2 - (2.*z9*z11)/z2\_3}
\DoxyCodeLine{302     drho\_dt\_dp(j) = (-c1 - c5*s(j) - t(j)*(2.*c2 + 3.*c3*t(j)) - 2.*a1*z1)/z2\_2 - (2.*z9*(z3*z4 - z1*z8))/z2\_3}
\DoxyCodeLine{303 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{304 }

\end{DoxyCode}
\mbox{\Hypertarget{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_a3cbd28af5f550fefbdfff6247a304839}\label{interfacemom__eos__wright_1_1calculate__density__second__derivs__wright_a3cbd28af5f550fefbdfff6247a304839}} 
\index{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright@{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright}!calculate\_density\_second\_derivs\_scalar\_wright@{calculate\_density\_second\_derivs\_scalar\_wright}}
\index{calculate\_density\_second\_derivs\_scalar\_wright@{calculate\_density\_second\_derivs\_scalar\_wright}!mom\_eos\_wright::calculate\_density\_second\_derivs\_wright@{mom\_eos\_wright::calculate\_density\_second\_derivs\_wright}}
\subsubsection{\texorpdfstring{calculate\_density\_second\_derivs\_scalar\_wright()}{calculate\_density\_second\_derivs\_scalar\_wright()}}
{\footnotesize\ttfamily subroutine mom\+\_\+eos\+\_\+wright\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+wright\+::calculate\+\_\+density\+\_\+second\+\_\+derivs\+\_\+scalar\+\_\+wright (\begin{DoxyParamCaption}\item[{real, intent(in)}]{T,  }\item[{real, intent(in)}]{S,  }\item[{real, intent(in)}]{P,  }\item[{real, intent(out)}]{drho\+\_\+ds\+\_\+ds,  }\item[{real, intent(out)}]{drho\+\_\+ds\+\_\+dt,  }\item[{real, intent(out)}]{drho\+\_\+dt\+\_\+dt,  }\item[{real, intent(out)}]{drho\+\_\+ds\+\_\+dp,  }\item[{real, intent(out)}]{drho\+\_\+dt\+\_\+dp }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [private]}}



Second derivatives of density with respect to temperature, salinity, and pressure for scalar inputs. Inputs promoted to 1-\/element array and output demoted to scalar. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em t} & Potential temperature referenced to 0 dbar \\
\hline
\mbox{\texttt{ in}}  & {\em s} & Salinity \mbox{[}P\+SU\mbox{]} \\
\hline
\mbox{\texttt{ in}}  & {\em p} & pressure \mbox{[}Pa\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+ds} & Partial derivative of beta with respect to S \mbox{[}kg m-\/3 P\+S\+U-\/2\mbox{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+dt} & Partial derivative of beta with respcct to T \mbox{[}kg m-\/3 P\+S\+U-\/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{]} \\
\hline
\mbox{\texttt{ out}}  & {\em drho\+\_\+ds\+\_\+dp} & Partial derivative of beta with respect to pressure \mbox{[}kg m-\/3 P\+S\+U-\/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{]} \\
\hline
\end{DoxyParams}


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


\begin{DoxyCode}{0}
\DoxyCodeLine{311 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in   )} :: T\textcolor{comment}{          !< Potential temperature referenced to 0 dbar}}
\DoxyCodeLine{312 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in   )} :: S\textcolor{comment}{          !< Salinity [PSU]}}
\DoxyCodeLine{313 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in   )} :: P\textcolor{comment}{          !< pressure [Pa]}}
\DoxyCodeLine{314 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(  out)} :: drho\_ds\_ds\textcolor{comment}{ !< Partial derivative of beta with respect}}
\DoxyCodeLine{315 \textcolor{comment}{                                    !! to S [kg m-3 PSU-2]}}
\DoxyCodeLine{316 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(  out)} :: drho\_ds\_dt\textcolor{comment}{ !< Partial derivative of beta with respcct}}
\DoxyCodeLine{317 \textcolor{comment}{                                    !! to T [kg m-3 PSU-1 degC-1]}}
\DoxyCodeLine{318 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(  out)} :: drho\_dt\_dt\textcolor{comment}{ !< Partial derivative of alpha with respect}}
\DoxyCodeLine{319 \textcolor{comment}{                                    !! to T [kg m-3 degC-2]}}
\DoxyCodeLine{320 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(  out)} :: drho\_ds\_dp\textcolor{comment}{ !< Partial derivative of beta with respect}}
\DoxyCodeLine{321 \textcolor{comment}{                                    !! to pressure [kg m-3 PSU-1 Pa-1]}}
\DoxyCodeLine{322 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(  out)} :: drho\_dt\_dp\textcolor{comment}{ !< Partial derivative of alpha with respect}}
\DoxyCodeLine{323 \textcolor{comment}{                                    !! to pressure [kg m-3 degC-1 Pa-1]}}
\DoxyCodeLine{324   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{325 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: T0, S0, P0}
\DoxyCodeLine{326 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(1)} :: drdsds, drdsdt, drdtdt, drdsdp, drdtdp}
\DoxyCodeLine{327 }
\DoxyCodeLine{328   t0(1) = t}
\DoxyCodeLine{329   s0(1) = s}
\DoxyCodeLine{330   p0(1) = p}
\DoxyCodeLine{331   \textcolor{keyword}{call }calculate\_density\_second\_derivs\_array\_wright(t0, s0, p0, drdsds, drdsdt, drdtdt, drdsdp, drdtdp, 1, 1)}
\DoxyCodeLine{332   drho\_ds\_ds = drdsds(1)}
\DoxyCodeLine{333   drho\_ds\_dt = drdsdt(1)}
\DoxyCodeLine{334   drho\_dt\_dt = drdtdt(1)}
\DoxyCodeLine{335   drho\_ds\_dp = drdsdp(1)}
\DoxyCodeLine{336   drho\_dt\_dp = drdtdp(1)}
\DoxyCodeLine{337 }

\end{DoxyCode}


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