MOM6
mom_eos::calculate_compress Interface Reference

Detailed Description

Calculates the compressibility of water from T, S, and P.

Definition at line 103 of file MOM_EOS.F90.

Private functions

subroutine calculate_compress_scalar (T, S, pressure, rho, drho_dp, EOS)
 Calculate density and compressibility for a scalar. This just promotes the scalar to an array with a singleton dimension and calls calculate_compress_array. If US is present, the units of the inputs and outputs are rescaled. More...
 
subroutine calculate_compress_array (T, S, press, rho, drho_dp, start, npts, EOS)
 Calls the appropriate subroutine to calculate the density and compressibility for 1-D array inputs. If US is present, the units of the inputs and outputs are rescaled. More...
 

Detailed Description

Calculates the compressibility of water from T, S, and P.

Definition at line 103 of file MOM_EOS.F90.

Functions and subroutines

◆ calculate_compress_array()

subroutine mom_eos::calculate_compress::calculate_compress_array ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  press,
real, dimension(:), intent(inout)  rho,
real, dimension(:), intent(inout)  drho_dp,
integer, intent(in)  start,
integer, intent(in)  npts,
type(eos_type), pointer  EOS 
)
private

Calls the appropriate subroutine to calculate the density and compressibility for 1-D array inputs. If US is present, the units of the inputs and outputs are rescaled.

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [PSU]
[in]pressPressure [Pa] or [R L2 T-2 ~> Pa]
[in,out]rhoIn situ density [kg m-3] or [R ~> kg m-3]
[in,out]drho_dpThe partial derivative of density with pressure (also the inverse of the square of sound speed) [s2 m-2] or [T2 L-2]
[in]startStarting index within the array
[in]nptsThe number of values to calculate
eosEquation of state structure

Definition at line 1089 of file MOM_EOS.F90.

1089  real, dimension(:), intent(in) :: T !< Potential temperature referenced to the surface [degC]
1090  real, dimension(:), intent(in) :: S !< Salinity [PSU]
1091  real, dimension(:), intent(in) :: press !< Pressure [Pa] or [R L2 T-2 ~> Pa]
1092  real, dimension(:), intent(inout) :: rho !< In situ density [kg m-3] or [R ~> kg m-3]
1093  real, dimension(:), intent(inout) :: drho_dp !< The partial derivative of density with pressure
1094  !! (also the inverse of the square of sound speed)
1095  !! [s2 m-2] or [T2 L-2]
1096  integer, intent(in) :: start !< Starting index within the array
1097  integer, intent(in) :: npts !< The number of values to calculate
1098  type(EOS_type), pointer :: EOS !< Equation of state structure
1099 
1100  ! Local variables
1101  real, dimension(size(press)) :: pressure ! Pressure converted to [Pa]
1102  integer :: i, is, ie
1103 
1104  if (.not.associated(eos)) call mom_error(fatal, &
1105  "calculate_compress called with an unassociated EOS_type EOS.")
1106 
1107  is = start ; ie = is + npts - 1
1108  do i=is,ie ; pressure(i) = eos%RL2_T2_to_Pa * press(i) ; enddo
1109 
1110  select case (eos%form_of_EOS)
1111  case (eos_linear)
1112  call calculate_compress_linear(t, s, pressure, rho, drho_dp, start, npts, &
1113  eos%Rho_T0_S0, eos%dRho_dT, eos%dRho_dS)
1114  case (eos_unesco)
1115  call calculate_compress_unesco(t, s, pressure, rho, drho_dp, start, npts)
1116  case (eos_wright)
1117  call calculate_compress_wright(t, s, pressure, rho, drho_dp, start, npts)
1118  case (eos_teos10)
1119  call calculate_compress_teos10(t, s, pressure, rho, drho_dp, start, npts)
1120  case (eos_nemo)
1121  call calculate_compress_nemo(t, s, pressure, rho, drho_dp, start, npts)
1122  case default
1123  call mom_error(fatal, "calculate_compress: EOS%form_of_EOS is not valid.")
1124  end select
1125 
1126  if (eos%kg_m3_to_R /= 1.0) then ; do i=is,ie
1127  rho(i) = eos%kg_m3_to_R * rho(i)
1128  enddo ; endif
1129  if (eos%L_T_to_m_s /= 1.0) then ; do i=is,ie
1130  drho_dp(i) = eos%L_T_to_m_s**2 * drho_dp(i)
1131  enddo ; endif
1132 

◆ calculate_compress_scalar()

subroutine mom_eos::calculate_compress::calculate_compress_scalar ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
real, intent(out)  rho,
real, intent(out)  drho_dp,
type(eos_type), pointer  EOS 
)
private

Calculate density and compressibility for a scalar. This just promotes the scalar to an array with a singleton dimension and calls calculate_compress_array. If US is present, the units of the inputs and outputs are rescaled.

Parameters
[in]tPotential temperature referenced to the surface [degC]
[in]sSalinity [ppt]
[in]pressurePressure [Pa] or [R L2 T-2 ~> Pa]
[out]rhoIn situ density [kg m-3] or [R ~> kg m-3]
[out]drho_dpThe partial derivative of density with pressure (also the inverse of the square of sound speed) [s2 m-2] or [T2 L-2]
eosEquation of state structure

Definition at line 1139 of file MOM_EOS.F90.

1139  real, intent(in) :: T !< Potential temperature referenced to the surface [degC]
1140  real, intent(in) :: S !< Salinity [ppt]
1141  real, intent(in) :: pressure !< Pressure [Pa] or [R L2 T-2 ~> Pa]
1142  real, intent(out) :: rho !< In situ density [kg m-3] or [R ~> kg m-3]
1143  real, intent(out) :: drho_dp !< The partial derivative of density with pressure (also the
1144  !! inverse of the square of sound speed) [s2 m-2] or [T2 L-2]
1145  type(EOS_type), pointer :: EOS !< Equation of state structure
1146 
1147  ! Local variables
1148  real, dimension(1) :: Ta, Sa, pa, rhoa, drho_dpa
1149 
1150  if (.not.associated(eos)) call mom_error(fatal, &
1151  "calculate_compress called with an unassociated EOS_type EOS.")
1152  ta(1) = t ; sa(1) = s; pa(1) = pressure
1153 
1154  call calculate_compress_array(ta, sa, pa, rhoa, drho_dpa, 1, 1, eos)
1155  rho = rhoa(1) ; drho_dp = drho_dpa(1)
1156 

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