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


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


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