MOM6
mom_eos::calculate_density_second_derivs Interface Reference

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

Private functions

subroutine calculate_density_second_derivs_scalar (T, S, pressure, drho_dS_dS, drho_dS_dT, drho_dT_dT, drho_dS_dP, drho_dT_dP, EOS, scale)
 Calls the appropriate subroutine to calculate density second derivatives for scalar nputs. More...
 
subroutine calculate_density_second_derivs_array (T, S, pressure, drho_dS_dS, drho_dS_dT, drho_dT_dT, drho_dS_dP, drho_dT_dP, start, npts, EOS, scale)
 Calls the appropriate subroutine to calculate density second derivatives for 1-D array inputs. More...
 

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

Functions and subroutines

◆ calculate_density_second_derivs_array()

subroutine mom_eos::calculate_density_second_derivs::calculate_density_second_derivs_array ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(inout)  drho_dS_dS,
real, dimension(:), intent(inout)  drho_dS_dT,
real, dimension(:), intent(inout)  drho_dT_dT,
real, dimension(:), intent(inout)  drho_dS_dP,
real, dimension(:), intent(inout)  drho_dT_dP,
integer, intent(in)  start,
integer, intent(in)  npts,
type(eos_type), pointer  EOS,
real, intent(in), optional  scale 
)
private

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

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [ppt]
[in]pressurePressure [Pa] or [R L2 T-2 ~> Pa]
[in,out]drho_ds_dsPartial derivative of beta with respect to S [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]
[in,out]drho_ds_dtPartial derivative of beta with respect to T [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3 ppt-1 degC-1]
[in,out]drho_dt_dtPartial derivative of alpha with respect to T [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]
[in,out]drho_ds_dpPartial derivative of beta with respect to pressure [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1 Pa-1]
[in,out]drho_dt_dpPartial derivative of alpha with respect to pressure [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3 degC-1 Pa-1]
[in]startStarting index within the array
[in]nptsThe number of values to calculate
eosEquation of state structure
[in]scaleA multiplicative factor by which to scale density in combination with scaling given by US [various]

Definition at line 844 of file MOM_EOS.F90.

844  real, dimension(:), intent(in) :: t !< Potential temperature referenced to the surface [degC]
845  real, dimension(:), intent(in) :: s !< Salinity [ppt]
846  real, dimension(:), intent(in) :: pressure !< Pressure [Pa] or [R L2 T-2 ~> Pa]
847  real, dimension(:), intent(inout) :: drho_ds_ds !< Partial derivative of beta with respect to S
848  !! [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]
849  real, dimension(:), intent(inout) :: drho_ds_dt !< Partial derivative of beta with respect to T
850  !! [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3 ppt-1 degC-1]
851  real, dimension(:), intent(inout) :: drho_dt_dt !< Partial derivative of alpha with respect to T
852  !! [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]
853  real, dimension(:), intent(inout) :: drho_ds_dp !< Partial derivative of beta with respect to pressure
854  !! [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1 Pa-1]
855  real, dimension(:), intent(inout) :: drho_dt_dp !< Partial derivative of alpha with respect to pressure
856  !! [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3 degC-1 Pa-1]
857  integer, intent(in) :: start !< Starting index within the array
858  integer, intent(in) :: npts !< The number of values to calculate
859  type(eos_type), pointer :: eos !< Equation of state structure
860  real, optional, intent(in) :: scale !< A multiplicative factor by which to scale density
861  !! in combination with scaling given by US [various]
862  ! Local variables
863  real, dimension(size(pressure)) :: pres ! Pressure converted to [Pa]
864  real :: rho_scale ! A factor to convert density from kg m-3 to the desired units [R m3 kg-1 ~> 1]
865  real :: p_scale ! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]
866  real :: i_p_scale ! The inverse of the factor to convert pressure to units of Pa [R L2 T-2 Pa-1 ~> 1]
867  integer :: j
868 
869  if (.not.associated(eos)) call mom_error(fatal, &
870  "calculate_density_derivs called with an unassociated EOS_type EOS.")
871 
872  p_scale = eos%RL2_T2_to_Pa
873 
874  if (p_scale == 1.0) then
875  select case (eos%form_of_EOS)
876  case (eos_linear)
877  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  case (eos_wright)
880  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  case (eos_teos10)
883  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  case default
886  call mom_error(fatal, "calculate_density_derivs: EOS%form_of_EOS is not valid.")
887  end select
888  else
889  do j=start,start+npts-1 ; pres(j) = p_scale * pressure(j) ; enddo
890  select case (eos%form_of_EOS)
891  case (eos_linear)
892  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  case (eos_wright)
895  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  case (eos_teos10)
898  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  case default
901  call mom_error(fatal, "calculate_density_derivs: EOS%form_of_EOS is not valid.")
902  end select
903  endif
904 
905  rho_scale = eos%kg_m3_to_R
906  if (present(scale)) rho_scale = rho_scale * scale
907  if (rho_scale /= 1.0) then ; 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  enddo ; endif
914 
915  if (p_scale /= 1.0) then
916  i_p_scale = 1.0 / p_scale
917  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  enddo
921  endif
922 

◆ calculate_density_second_derivs_scalar()

subroutine mom_eos::calculate_density_second_derivs::calculate_density_second_derivs_scalar ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
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,
type(eos_type), pointer  EOS,
real, intent(in), optional  scale 
)
private

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

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [ppt]
[in]pressurePressure [Pa] or [R L2 T-2 ~> Pa]
[out]drho_ds_dsPartial derivative of beta with respect to S [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]
[out]drho_ds_dtPartial derivative of beta with respect to T [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3 ppt-1 degC-1]
[out]drho_dt_dtPartial derivative of alpha with respect to T [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]
[out]drho_ds_dpPartial derivative of beta with respect to pressure [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1 Pa-1]
[out]drho_dt_dpPartial derivative of alpha with respect to pressure [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3 degC-1 Pa-1]
eosEquation of state structure
[in]scaleA multiplicative factor by which to scale density in combination with scaling given by US [various]

Definition at line 928 of file MOM_EOS.F90.

928  real, intent(in) :: t !< Potential temperature referenced to the surface [degC]
929  real, intent(in) :: s !< Salinity [ppt]
930  real, intent(in) :: pressure !< Pressure [Pa] or [R L2 T-2 ~> Pa]
931  real, intent(out) :: drho_ds_ds !< Partial derivative of beta with respect to S
932  !! [kg m-3 ppt-2] or [R ppt-2 ~> kg m-3 ppt-2]
933  real, intent(out) :: drho_ds_dt !< Partial derivative of beta with respect to T
934  !! [kg m-3 ppt-1 degC-1] or [R ppt-1 degC-1 ~> kg m-3 ppt-1 degC-1]
935  real, intent(out) :: drho_dt_dt !< Partial derivative of alpha with respect to T
936  !! [kg m-3 degC-2] or [R degC-2 ~> kg m-3 degC-2]
937  real, intent(out) :: drho_ds_dp !< Partial derivative of beta with respect to pressure
938  !! [kg m-3 ppt-1 Pa-1] or [R ppt-1 Pa-1 ~> kg m-3 ppt-1 Pa-1]
939  real, intent(out) :: drho_dt_dp !< Partial derivative of alpha with respect to pressure
940  !! [kg m-3 degC-1 Pa-1] or [R degC-1 Pa-1 ~> kg m-3 degC-1 Pa-1]
941  type(eos_type), pointer :: eos !< Equation of state structure
942  real, optional, intent(in) :: scale !< A multiplicative factor by which to scale density
943  !! in combination with scaling given by US [various]
944  ! Local variables
945  real :: rho_scale ! A factor to convert density from kg m-3 to the desired units [R m3 kg-1 ~> 1]
946  real :: p_scale ! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]
947  real :: i_p_scale ! The inverse of the factor to convert pressure to units of Pa [R L2 T-2 Pa-1 ~> 1]
948 
949  if (.not.associated(eos)) call mom_error(fatal, &
950  "calculate_density_derivs called with an unassociated EOS_type EOS.")
951 
952  p_scale = eos%RL2_T2_to_Pa
953 
954  select case (eos%form_of_EOS)
955  case (eos_linear)
956  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  case (eos_wright)
959  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  case (eos_teos10)
962  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  case default
965  call mom_error(fatal, "calculate_density_derivs: EOS%form_of_EOS is not valid.")
966  end select
967 
968  rho_scale = eos%kg_m3_to_R
969  if (present(scale)) rho_scale = rho_scale * scale
970  if (rho_scale /= 1.0) 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  endif
977 
978  if (p_scale /= 1.0) 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  endif
983 

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