MOM6
mom_eos::calculate_density_derivs Interface Reference

Detailed Description

Calculate the derivatives of density with temperature and salinity from T, S, and P.

Definition at line 81 of file MOM_EOS.F90.

Private functions

subroutine calculate_density_derivs_scalar (T, S, pressure, drho_dT, drho_dS, EOS, scale)
 Calls the appropriate subroutines to calculate density derivatives by promoting a scalar to a one-element array. More...
 
subroutine calculate_density_derivs_array (T, S, pressure, drho_dT, drho_dS, start, npts, EOS, scale)
 Calls the appropriate subroutine to calculate density derivatives for 1-D array inputs. More...
 
subroutine calculate_density_derivs_1d (T, S, pressure, drho_dT, drho_dS, EOS, dom, scale)
 Calls the appropriate subroutine to calculate density derivatives for 1-D array inputs. More...
 

Detailed Description

Calculate the derivatives of density with temperature and salinity from T, S, and P.

Definition at line 81 of file MOM_EOS.F90.

Functions and subroutines

◆ calculate_density_derivs_1d()

subroutine mom_eos::calculate_density_derivs::calculate_density_derivs_1d ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(inout)  drho_dT,
real, dimension(:), intent(inout)  drho_dS,
type(eos_type), pointer  EOS,
integer, dimension(2), intent(in), optional  dom,
real, intent(in), optional  scale 
)
private

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

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [ppt]
[in]pressurePressure [R L2 T-2 ~> Pa]
[in,out]drho_dtThe partial derivative of density with potential temperature [R degC-1 ~> kg m-3 degC-1]
[in,out]drho_dsThe partial derivative of density with salinity [R degC-1 ~> kg m-3 ppt-1]
eosEquation of state structure
[in]domThe domain of indices to work on, taking into account that arrays start at 1.
[in]scaleA multiplicative factor by which to scale density in combination with scaling given by US [various]

Definition at line 750 of file MOM_EOS.F90.

751  real, dimension(:), intent(in) :: T !< Potential temperature referenced to the surface [degC]
752  real, dimension(:), intent(in) :: S !< Salinity [ppt]
753  real, dimension(:), intent(in) :: pressure !< Pressure [R L2 T-2 ~> Pa]
754  real, dimension(:), intent(inout) :: drho_dT !< The partial derivative of density with potential
755  !! temperature [R degC-1 ~> kg m-3 degC-1]
756  real, dimension(:), intent(inout) :: drho_dS !< The partial derivative of density with salinity
757  !! [R degC-1 ~> kg m-3 ppt-1]
758  type(EOS_type), pointer :: EOS !< Equation of state structure
759  integer, dimension(2), optional, intent(in) :: dom !< The domain of indices to work on, taking
760  !! into account that arrays start at 1.
761  real, optional, intent(in) :: scale !< A multiplicative factor by which to scale density
762  !! in combination with scaling given by US [various]
763  ! Local variables
764  real, dimension(size(drho_dT)) :: pres ! Pressure converted to [Pa]
765  real :: rho_scale ! A factor to convert density from kg m-3 to the desired units [R m3 kg-1 ~> 1]
766  real :: p_scale ! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]
767  integer :: i, is, ie, npts
768 
769  if (.not.associated(eos)) call mom_error(fatal, &
770  "calculate_density_derivs called with an unassociated EOS_type EOS.")
771 
772  if (present(dom)) then
773  is = dom(1) ; ie = dom(2) ; npts = 1 + ie - is
774  else
775  is = 1 ; ie = size(drho_dt) ; npts = 1 + ie - is
776  endif
777 
778  p_scale = eos%RL2_T2_to_Pa
779 
780  if (p_scale == 1.0) then
781  call calculate_density_derivs_array(t, s, pressure, drho_dt, drho_ds, is, npts, eos)
782  else
783  do i=is,ie ; pres(i) = p_scale * pressure(i) ; enddo
784  call calculate_density_derivs_array(t, s, pres, drho_dt, drho_ds, is, npts, eos)
785  endif
786 
787  rho_scale = eos%kg_m3_to_R
788  if (present(scale)) rho_scale = rho_scale * scale
789  if (rho_scale /= 1.0) then ; do i=is,ie
790  drho_dt(i) = rho_scale * drho_dt(i)
791  drho_ds(i) = rho_scale * drho_ds(i)
792  enddo ; endif
793 

◆ calculate_density_derivs_array()

subroutine mom_eos::calculate_density_derivs::calculate_density_derivs_array ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(inout)  drho_dT,
real, dimension(:), intent(inout)  drho_dS,
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 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_dtThe partial derivative of density with potential temperature [kg m-3 degC-1] or [R degC-1 ~> kg m-3 degC-1]
[in,out]drho_dsThe partial derivative of density with salinity, in [kg m-3 ppt-1] or [R degC-1 ~> kg m-3 ppt-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 705 of file MOM_EOS.F90.

706  real, dimension(:), intent(in) :: T !< Potential temperature referenced to the surface [degC]
707  real, dimension(:), intent(in) :: S !< Salinity [ppt]
708  real, dimension(:), intent(in) :: pressure !< Pressure [Pa] or [R L2 T-2 ~> Pa]
709  real, dimension(:), intent(inout) :: drho_dT !< The partial derivative of density with potential
710  !! temperature [kg m-3 degC-1] or [R degC-1 ~> kg m-3 degC-1]
711  real, dimension(:), intent(inout) :: drho_dS !< The partial derivative of density with salinity,
712  !! in [kg m-3 ppt-1] or [R degC-1 ~> kg m-3 ppt-1]
713  integer, intent(in) :: start !< Starting index within the array
714  integer, intent(in) :: npts !< The number of values to calculate
715  type(EOS_type), pointer :: EOS !< Equation of state structure
716  real, optional, intent(in) :: scale !< A multiplicative factor by which to scale density
717  !! in combination with scaling given by US [various]
718 
719  ! Local variables
720  integer :: j
721 
722  if (.not.associated(eos)) call mom_error(fatal, &
723  "calculate_density_derivs called with an unassociated EOS_type EOS.")
724 
725  select case (eos%form_of_EOS)
726  case (eos_linear)
727  call calculate_density_derivs_linear(t, s, pressure, drho_dt, drho_ds, eos%Rho_T0_S0, &
728  eos%dRho_dT, eos%dRho_dS, start, npts)
729  case (eos_unesco)
730  call calculate_density_derivs_unesco(t, s, pressure, drho_dt, drho_ds, start, npts)
731  case (eos_wright)
732  call calculate_density_derivs_wright(t, s, pressure, drho_dt, drho_ds, start, npts)
733  case (eos_teos10)
734  call calculate_density_derivs_teos10(t, s, pressure, drho_dt, drho_ds, start, npts)
735  case (eos_nemo)
736  call calculate_density_derivs_nemo(t, s, pressure, drho_dt, drho_ds, start, npts)
737  case default
738  call mom_error(fatal, "calculate_density_derivs_array: EOS%form_of_EOS is not valid.")
739  end select
740 
741  if (present(scale)) then ; if (scale /= 1.0) then ; do j=start,start+npts-1
742  drho_dt(j) = scale * drho_dt(j)
743  drho_ds(j) = scale * drho_ds(j)
744  enddo ; endif ; endif
745 

◆ calculate_density_derivs_scalar()

subroutine mom_eos::calculate_density_derivs::calculate_density_derivs_scalar ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
real, intent(out)  drho_dT,
real, intent(out)  drho_dS,
type(eos_type), pointer  EOS,
real, intent(in), optional  scale 
)
private

Calls the appropriate subroutines to calculate density derivatives by promoting a scalar to a one-element array.

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [ppt]
[in]pressurePressure [Pa] or [R L2 T-2 ~> Pa]
[out]drho_dtThe partial derivative of density with potential temperature [kg m-3 degC-1] or [R degC-1 ~> kg m-3 degC-1]
[out]drho_dsThe partial derivative of density with salinity, in [kg m-3 ppt-1] or [R ppt-1 ~> kg m-3 ppt-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 799 of file MOM_EOS.F90.

800  real, intent(in) :: T !< Potential temperature referenced to the surface [degC]
801  real, intent(in) :: S !< Salinity [ppt]
802  real, intent(in) :: pressure !< Pressure [Pa] or [R L2 T-2 ~> Pa]
803  real, intent(out) :: drho_dT !< The partial derivative of density with potential
804  !! temperature [kg m-3 degC-1] or [R degC-1 ~> kg m-3 degC-1]
805  real, intent(out) :: drho_dS !< The partial derivative of density with salinity,
806  !! in [kg m-3 ppt-1] or [R ppt-1 ~> kg m-3 ppt-1]
807  type(EOS_type), pointer :: EOS !< Equation of state structure
808  real, optional, intent(in) :: scale !< A multiplicative factor by which to scale density
809  !! in combination with scaling given by US [various]
810  ! Local variables
811  real :: rho_scale ! A factor to convert density from kg m-3 to the desired units [R m3 kg-1 ~> 1]
812  real :: p_scale ! A factor to convert pressure to units of Pa [Pa T2 R-1 L-2 ~> 1]
813  integer :: j
814 
815  if (.not.associated(eos)) call mom_error(fatal, &
816  "calculate_density_derivs called with an unassociated EOS_type EOS.")
817 
818  p_scale = eos%RL2_T2_to_Pa
819 
820  select case (eos%form_of_EOS)
821  case (eos_linear)
822  call calculate_density_derivs_linear(t, s, p_scale*pressure, drho_dt, drho_ds, &
823  eos%Rho_T0_S0, eos%dRho_dT, eos%dRho_dS)
824  case (eos_wright)
825  call calculate_density_derivs_wright(t, s, p_scale*pressure, drho_dt, drho_ds)
826  case (eos_teos10)
827  call calculate_density_derivs_teos10(t, s, p_scale*pressure, drho_dt, drho_ds)
828  case default
829  call mom_error(fatal, "calculate_density_derivs_scalar: EOS%form_of_EOS is not valid.")
830  end select
831 
832  rho_scale = eos%kg_m3_to_R
833  if (present(scale)) rho_scale = rho_scale * scale
834  if (rho_scale /= 1.0) then
835  drho_dt = rho_scale * drho_dt
836  drho_ds = rho_scale * drho_ds
837  endif
838 

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