MOM6
mom_eos_wright::calculate_density_second_derivs_wright Interface Reference

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 MOM_EOS_Wright.F90.

Private functions

subroutine calculate_density_second_derivs_scalar_wright (T, S, P, drho_ds_ds, drho_ds_dt, drho_dt_dt, drho_ds_dp, drho_dt_dp)
 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. More...
 
subroutine 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)
 Second derivatives of density with respect to temperature, salinity, and pressure. More...
 

Functions and subroutines

◆ calculate_density_second_derivs_array_wright()

subroutine mom_eos_wright::calculate_density_second_derivs_wright::calculate_density_second_derivs_array_wright ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  P,
real, dimension(:), intent(out)  drho_ds_ds,
real, dimension(:), intent(out)  drho_ds_dt,
real, dimension(:), intent(out)  drho_dt_dt,
real, dimension(:), intent(out)  drho_ds_dp,
real, dimension(:), intent(out)  drho_dt_dp,
integer, intent(in)  start,
integer, intent(in)  npts 
)
private

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

Parameters
[in]tPotential temperature referenced to 0 dbar [degC]
[in]sSalinity [PSU]
[in]pPressure [Pa]
[out]drho_ds_dsPartial derivative of beta with respect to S [kg m-3 PSU-2]
[out]drho_ds_dtPartial derivative of beta with respcct to T [kg m-3 PSU-1 degC-1]
[out]drho_dt_dtPartial derivative of alpha with respect to T [kg m-3 degC-2]
[out]drho_ds_dpPartial derivative of beta with respect to pressure [kg m-3 PSU-1 Pa-1]
[out]drho_dt_dpPartial derivative of alpha with respect to pressure [kg m-3 degC-1 Pa-1]
[in]startStarting index in T,S,P
[in]nptsNumber of points to loop over

Definition at line 259 of file MOM_EOS_Wright.F90.

259  real, dimension(:), intent(in ) :: T !< Potential temperature referenced to 0 dbar [degC]
260  real, dimension(:), intent(in ) :: S !< Salinity [PSU]
261  real, dimension(:), intent(in ) :: P !< Pressure [Pa]
262  real, dimension(:), intent( out) :: drho_ds_ds !< Partial derivative of beta with respect
263  !! to S [kg m-3 PSU-2]
264  real, dimension(:), intent( out) :: drho_ds_dt !< Partial derivative of beta with respcct
265  !! to T [kg m-3 PSU-1 degC-1]
266  real, dimension(:), intent( out) :: drho_dt_dt !< Partial derivative of alpha with respect
267  !! to T [kg m-3 degC-2]
268  real, dimension(:), intent( out) :: drho_ds_dp !< Partial derivative of beta with respect
269  !! to pressure [kg m-3 PSU-1 Pa-1]
270  real, dimension(:), intent( out) :: drho_dt_dp !< Partial derivative of alpha with respect
271  !! to pressure [kg m-3 degC-1 Pa-1]
272  integer, intent(in ) :: start !< Starting index in T,S,P
273  integer, intent(in ) :: npts !< Number of points to loop over
274 
275  ! Local variables
276  real :: z0, z1, z2, z3, z4, z5, z6 ,z7, z8, z9, z10, z11, z2_2, z2_3
277  integer :: j
278  ! Based on the above expression with common terms factored, there probably exists a more numerically stable
279  ! and/or efficient expression
280 
281  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  enddo
304 

◆ calculate_density_second_derivs_scalar_wright()

subroutine mom_eos_wright::calculate_density_second_derivs_wright::calculate_density_second_derivs_scalar_wright ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  P,
real, intent(out)  drho_ds_ds,
real, intent(out)  drho_ds_dt,
real, intent(out)  drho_dt_dt,
real, intent(out)  drho_ds_dp,
real, intent(out)  drho_dt_dp 
)
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.

Parameters
[in]tPotential temperature referenced to 0 dbar
[in]sSalinity [PSU]
[in]ppressure [Pa]
[out]drho_ds_dsPartial derivative of beta with respect to S [kg m-3 PSU-2]
[out]drho_ds_dtPartial derivative of beta with respcct to T [kg m-3 PSU-1 degC-1]
[out]drho_dt_dtPartial derivative of alpha with respect to T [kg m-3 degC-2]
[out]drho_ds_dpPartial derivative of beta with respect to pressure [kg m-3 PSU-1 Pa-1]
[out]drho_dt_dpPartial derivative of alpha with respect to pressure [kg m-3 degC-1 Pa-1]

Definition at line 311 of file MOM_EOS_Wright.F90.

311  real, intent(in ) :: T !< Potential temperature referenced to 0 dbar
312  real, intent(in ) :: S !< Salinity [PSU]
313  real, intent(in ) :: P !< pressure [Pa]
314  real, intent( out) :: drho_ds_ds !< Partial derivative of beta with respect
315  !! to S [kg m-3 PSU-2]
316  real, intent( out) :: drho_ds_dt !< Partial derivative of beta with respcct
317  !! to T [kg m-3 PSU-1 degC-1]
318  real, intent( out) :: drho_dt_dt !< Partial derivative of alpha with respect
319  !! to T [kg m-3 degC-2]
320  real, intent( out) :: drho_ds_dp !< Partial derivative of beta with respect
321  !! to pressure [kg m-3 PSU-1 Pa-1]
322  real, intent( out) :: drho_dt_dp !< Partial derivative of alpha with respect
323  !! to pressure [kg m-3 degC-1 Pa-1]
324  ! Local variables
325  real, dimension(1) :: T0, S0, P0
326  real, dimension(1) :: drdsds, drdsdt, drdtdt, drdsdp, drdtdp
327 
328  t0(1) = t
329  s0(1) = s
330  p0(1) = p
331  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 

The documentation for this interface was generated from the following file: