mom_eos_wright module reference

The equation of state using a poor implementation (missing parenthesis and bugs) of the reduced range Wright 1997 expressions.

More…

Data Types

buggy_wright_eos

The EOS_base implementation of the Wright 1997 equation of state with some bugs.

Functions/Subroutines

density_elem_buggy_wright()

In situ density of sea water using a buggy implementation of Wright, 1997 [kg m-3].

density_anomaly_elem_buggy_wright()

In situ density anomaly of sea water using a buggy implementation of Wright, 1997 [kg m-3].

spec_vol_elem_buggy_wright()

In situ specific volume of sea water using a buggy implementation of Wright, 1997 [kg m-3].

spec_vol_anomaly_elem_buggy_wright()

In situ specific volume anomaly of sea water using a buggy implementation of Wright, 1997 [kg m-3].

calculate_density_derivs_elem_buggy_wright()

Calculate the partial derivatives of density with potential temperature and salinity using the buggy implementation of the equation of state, as fit by Wright, 1997.

calculate_density_second_derivs_elem_buggy_wright()

Second derivatives of density with respect to temperature, salinity, and pressure, using the poor implementation of the equation of state, as fit by Wright, 1997.

calculate_specvol_derivs_elem_buggy_wright()

Calculate the partial derivatives of specific volume with temperature and salinity using the poor implementation of the equation of state, as fit by Wright, 1997.

calculate_compress_elem_buggy_wright()

Compute the in situ density of sea water (rho) and the compressibility (drho/dp == C_sound^-2) at the given salinity, potential temperature and pressure using the poor implementation of the equation of state, as fit by Wright, 1997.

avg_spec_vol_buggy_wright()

Calculates analytical and nearly-analytical integrals, in pressure across layers, to determine the layer-average specific volumes.

eos_fit_range_buggy_wright()

Return the range of temperatures, salinities and pressures for which the reduced-range equation of state from Wright (1997) has been fitted to observations.

int_density_dz_wright()

Calculates analytical and nearly-analytical integrals, in geopotential across layers, of pressure anomalies, which are required for calculating the finite-volume form pressure accelerations in a Boussinesq model.

int_spec_vol_dp_wright()

Calculates analytical and nearly-analytical integrals, in pressure across layers, of geopotential anomalies, which are required for calculating the finite-volume form pressure accelerations in a non-Boussinesq model.

calculate_density_array_buggy_wright()

Calculate the in-situ density for 1D arraya inputs and outputs.

calculate_spec_vol_array_buggy_wright()

Calculate the in-situ specific volume for 1D array inputs and outputs.

Detailed Description

Wright equation of state

Wright, 1997, provide an approximation for the in situ density as a function of potential temperature, salinity and pressure. The formula follow the Tumlirz equation of state which are easier to evaluate and make efficient.

Two ranges are provided by Wright: a “full” range and “reduced” range. The version in this module uses the reduced range.

Originally coded in 2000 by R. Hallberg. Anomaly form coded in 3/18.

References

Wright, D., 1997: An Equation of State for Use in Ocean Models: Eckart’s Formula Revisited. J. Ocean. Atmosph. Tech., 14 (3), 735-740. https://journals.ametsoc.org/doi/abs/10.1175/1520-0426%281997%29014%3C0735%3AAEOSFU%3E2.0.CO%3B2

Type Documentation

type mom_eos_wright/buggy_wright_eos

The EOS_base implementation of the Wright 1997 equation of state with some bugs.

Type fields:
  • % density_elem [procedure,private] :: Implementation of the in-situ density as an elemental function [kg m-3].

  • % density_anomaly_elem [procedure,private] :: Implementation of the in-situ density anomaly as an elemental function [kg m-3].

  • % spec_vol_elem [procedure,private] :: Implementation of the in-situ specific volume as an elemental function [m3 kg-1].

  • % spec_vol_anomaly_elem [procedure,private] :: Implementation of the in-situ specific volume anomaly as an elemental function [m3 kg-1].

  • % calculate_density_derivs_elem [procedure,private] :: Implementation of the calculation of derivatives of density.

  • % calculate_density_second_derivs_elem [procedure,private] :: Implementation of the calculation of second derivatives of density.

  • % calculate_specvol_derivs_elem [procedure,private] :: Implementation of the calculation of derivatives of specific volume.

  • % calculate_compress_elem [procedure,private] :: Implementation of the calculation of compressibility.

  • % eos_fit_range [procedure,private] :: Implementation of the range query function.

  • % calculate_density_array [procedure,private] :: Local implementation of generic calculate_density_array for efficiency.

  • % calculate_spec_vol_array [procedure,private] :: Local implementation of generic calculate_spec_vol_array for efficiency.

Function/Subroutine Documentation

function mom_eos_wright/density_elem_buggy_wright(this, T, S, pressure) [elemental]

In situ density of sea water using a buggy implementation of Wright, 1997 [kg m-3].

This is an elemental function that can be applied to any combination of scalar and array inputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] potential temperature relative to the surface [degC].

  • s :: [in] salinity [PSU].

  • pressure :: [in] pressure [Pa].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

Called from:

calculate_density_array_buggy_wright

function mom_eos_wright/density_anomaly_elem_buggy_wright(this, T, S, pressure, rho_ref) [elemental]

In situ density anomaly of sea water using a buggy implementation of Wright, 1997 [kg m-3].

This is an elemental function that can be applied to any combination of scalar and array inputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] potential temperature relative to the surface [degC].

  • s :: [in] salinity [PSU].

  • pressure :: [in] pressure [Pa].

  • rho_ref :: [in] A reference density [kg m-3].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

Called from:

calculate_density_array_buggy_wright

function mom_eos_wright/spec_vol_elem_buggy_wright(this, T, S, pressure) [elemental]

In situ specific volume of sea water using a buggy implementation of Wright, 1997 [kg m-3].

This is an elemental function that can be applied to any combination of scalar and array inputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] potential temperature relative to the surface [degC].

  • s :: [in] salinity [PSU].

  • pressure :: [in] pressure [Pa].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

Called from:

calculate_spec_vol_array_buggy_wright

function mom_eos_wright/spec_vol_anomaly_elem_buggy_wright(this, T, S, pressure, spv_ref) [elemental]

In situ specific volume anomaly of sea water using a buggy implementation of Wright, 1997 [kg m-3].

This is an elemental function that can be applied to any combination of scalar and array inputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] potential temperature relative to the surface [degC].

  • s :: [in] salinity [PSU].

  • pressure :: [in] pressure [Pa].

  • spv_ref :: [in] A reference specific volume [m3 kg-1].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

Called from:

calculate_spec_vol_array_buggy_wright

subroutine mom_eos_wright/calculate_density_derivs_elem_buggy_wright(this, T, S, pressure, drho_dT, drho_dS)

Calculate the partial derivatives of density with potential temperature and salinity using the buggy implementation of the equation of state, as fit by Wright, 1997.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature relative to the surface [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • drho_dt :: [out] The partial derivative of density with potential temperature [kg m-3 degC-1]

  • drho_ds :: [out] The partial derivative of density with salinity, in [kg m-3 PSU-1]

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/calculate_density_second_derivs_elem_buggy_wright(this, T, S, pressure, 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, using the poor implementation of the equation of state, as fit by Wright, 1997.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature referenced to 0 dbar [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • drho_ds_ds :: [inout] Partial derivative of beta with respect to S [kg m-3 PSU-2]

  • drho_ds_dt :: [inout] Partial derivative of beta with respect to T [kg m-3 PSU-1 degC-1]

  • drho_dt_dt :: [inout] Partial derivative of alpha with respect to T [kg m-3 degC-2]

  • drho_ds_dp :: [inout] Partial derivative of beta with respect to pressure [kg m-3 PSU-1 Pa-1] = [s2 m-2 PSU-1]

  • drho_dt_dp :: [inout] Partial derivative of alpha with respect to pressure [kg m-3 degC-1 Pa-1] = [s2 m-2 degC-1]

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/calculate_specvol_derivs_elem_buggy_wright(this, T, S, pressure, dSV_dT, dSV_dS)

Calculate the partial derivatives of specific volume with temperature and salinity using the poor implementation of the equation of state, as fit by Wright, 1997.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • dsv_dt :: [inout] The partial derivative of specific volume with potential temperature [m3 kg-1 degC-1]

  • dsv_ds :: [inout] The partial derivative of specific volume with salinity [m3 kg-1 PSU-1]

Call to:

a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/calculate_compress_elem_buggy_wright(this, T, S, pressure, rho, drho_dp)

Compute the in situ density of sea water (rho) and the compressibility (drho/dp == C_sound^-2) at the given salinity, potential temperature and pressure using the poor implementation of the equation of state, as fit by Wright, 1997.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature relative to the surface [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • rho :: [out] In situ density [kg m-3]

  • drho_dp :: [out] The partial derivative of density with pressure (also the inverse of the square of sound speed) [s2 m-2].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/avg_spec_vol_buggy_wright(T, S, p_t, dp, SpV_avg, start, npts)

Calculates analytical and nearly-analytical integrals, in pressure across layers, to determine the layer-average specific volumes. There are essentially no free assumptions, apart from a truncation in the series for log(1-eps/1+eps) that assumes that |eps| < 0.34.

Parameters:
  • t :: [in] Potential temperature relative to the surface [degC].

  • s :: [in] Salinity [PSU].

  • p_t :: [in] Pressure at the top of the layer [Pa]

  • dp :: [in] Pressure change in the layer [Pa]

  • spv_avg :: [inout] The vertical average specific volume in the layer [m3 kg-1]

  • start :: [in] the starting point in the arrays.

  • npts :: [in] the number of values to calculate.

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/eos_fit_range_buggy_wright(this, T_min, T_max, S_min, S_max, p_min, p_max)

Return the range of temperatures, salinities and pressures for which the reduced-range equation of state from Wright (1997) has been fitted to observations. Care should be taken when applying this equation of state outside of its fit range.

Parameters:
  • this :: [in] This EOS

  • t_min :: [out] The minimum potential temperature over which this EoS is fitted [degC]

  • t_max :: [out] The maximum potential temperature over which this EoS is fitted [degC]

  • s_min :: [out] The minimum practical salinity over which this EoS is fitted [PSU]

  • s_max :: [out] The maximum practical salinity over which this EoS is fitted [PSU]

  • p_min :: [out] The minimum pressure over which this EoS is fitted [Pa]

  • p_max :: [out] The maximum pressure over which this EoS is fitted [Pa]

subroutine mom_eos_wright/int_density_dz_wright(T, S, z_t, z_b, rho_ref, rho_0, G_e, HI, dpa, intz_dpa, intx_dpa, inty_dpa, bathyT, dz_neglect, useMassWghtInterp, rho_scale, pres_scale, temp_scale, saln_scale, Z_0p)

Calculates analytical and nearly-analytical integrals, in geopotential across layers, of pressure anomalies, which are required for calculating the finite-volume form pressure accelerations in a Boussinesq model. There are essentially no free assumptions, apart from the use of Boole’s rule rule to do the horizontal integrals, and from a truncation in the series for log(1-eps/1+eps) that assumes that |eps| < 0.34.

Parameters:
  • hi :: [in] The horizontal index type for the arrays.

  • t :: [in] Potential temperature relative to the surface

  • s :: [in] Salinity [S ~> PSU].

  • z_t :: [in] Height at the top of the layer in depth units [Z ~> m].

  • z_b :: [in] Height at the top of the layer [Z ~> m].

  • rho_ref :: [in] A mean density [R ~> kg m-3], that is subtracted out to reduce the magnitude of each of the integrals. (The pressure is calculated as p~=-z*rho_0*G_e.)

  • rho_0 :: [in] Density [R ~> kg m-3], that is used to calculate the pressure (as p~=-z*rho_0*G_e) used in the equation of state.

  • g_e :: [in] The Earth’s gravitational acceleration [L2 Z-1 T-2 ~> m s-2].

  • dpa :: [inout] The change in the pressure anomaly across the

  • intz_dpa :: [inout] The integral through the thickness of the layer

  • intx_dpa :: [inout] The integral in x of the difference between the

  • inty_dpa :: [inout] The integral in y of the difference between the

  • bathyt :: [in] The depth of the bathymetry [Z ~> m].

  • dz_neglect :: [in] A miniscule thickness change [Z ~> m].

  • usemasswghtinterp :: [in] If true, uses mass weighting to interpolate T/S for top and bottom integrals.

  • rho_scale :: [in] A multiplicative factor by which to scale density from kg m-3 to the desired units [R m3 kg-1 ~> 1]

  • pres_scale :: [in] A multiplicative factor to convert pressure into Pa [Pa T2 R-1 L-2 ~> 1].

  • temp_scale :: [in] A multiplicative factor by which to scale temperature into degC [degC C-1 ~> 1]

  • saln_scale :: [in] A multiplicative factor to convert pressure into PSU [PSU S-1 ~> 1].

  • z_0p :: [in] The height at which the pressure is 0 [Z ~> m]

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/int_spec_vol_dp_wright(T, S, p_t, p_b, spv_ref, HI, dza, intp_dza, intx_dza, inty_dza, halo_size, bathyP, dP_neglect, useMassWghtInterp, SV_scale, pres_scale, temp_scale, saln_scale)

Calculates analytical and nearly-analytical integrals, in pressure across layers, of geopotential anomalies, which are required for calculating the finite-volume form pressure accelerations in a non-Boussinesq model. There are essentially no free assumptions, apart from the use of Boole’s rule to do the horizontal integrals, and from a truncation in the series for log(1-eps/1+eps) that assumes that |eps| < 0.34.

Parameters:
  • hi :: [in] The ocean’s horizontal index type.

  • t :: [in] Potential temperature relative to the surface

  • s :: [in] Salinity [S ~> PSU].

  • p_t :: [in] Pressure at the top of the layer [R L2 T-2 ~> Pa]

  • p_b :: [in] Pressure at the top of the layer [R L2 T-2 ~> Pa]

  • spv_ref :: [in] A mean specific volume that is subtracted out to reduce the magnitude of each of the integrals [R-1 ~> m3 kg-1]. The calculation is mathematically identical with different values of spv_ref, but this reduces the effects of roundoff.

  • dza :: [inout] The change in the geopotential anomaly across

  • intp_dza :: [inout] The integral in pressure through the layer of

  • intx_dza :: [inout] The integral in x of the difference between the

  • inty_dza :: [inout] The integral in y of the difference between the

  • halo_size :: [in] The width of halo points on which to calculate dza.

  • bathyp :: [in] The pressure at the bathymetry [R L2 T-2 ~> Pa]

  • dp_neglect :: [in] A miniscule pressure change with the same units as p_t [R L2 T-2 ~> Pa]

  • usemasswghtinterp :: [in] If true, uses mass weighting to interpolate T/S for top and bottom integrals.

  • sv_scale :: [in] A multiplicative factor by which to scale specific volume from m3 kg-1 to the desired units [kg m-3 R-1 ~> 1]

  • pres_scale :: [in] A multiplicative factor to convert pressure into Pa [Pa T2 R-1 L-2 ~> 1].

  • temp_scale :: [in] A multiplicative factor by which to scale temperature into degC [degC C-1 ~> 1]

  • saln_scale :: [in] A multiplicative factor to convert pressure into PSU [PSU S-1 ~> 1].

Call to:

a0 a1 a2 b0 b1 b2 b3 b4 b5 c0 c1 c2 c3 c4 c5

subroutine mom_eos_wright/calculate_density_array_buggy_wright(this, T, S, pressure, rho, start, npts, rho_ref)

Calculate the in-situ density for 1D arraya inputs and outputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature relative to the surface [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • rho :: [out] In situ density [kg m-3]

  • start :: [in] The starting index for calculations

  • npts :: [in] The number of values to calculate

  • rho_ref :: [in] A reference density [kg m-3]

Call to:

density_anomaly_elem_buggy_wright density_elem_buggy_wright

subroutine mom_eos_wright/calculate_spec_vol_array_buggy_wright(this, T, S, pressure, specvol, start, npts, spv_ref)

Calculate the in-situ specific volume for 1D array inputs and outputs.

Parameters:
  • this :: [in] This EOS

  • t :: [in] Potential temperature relative to the surface [degC]

  • s :: [in] Salinity [PSU]

  • pressure :: [in] Pressure [Pa]

  • specvol :: [out] In situ specific volume [m3 kg-1]

  • start :: [in] The starting index for calculations

  • npts :: [in] The number of values to calculate

  • spv_ref :: [in] A reference specific volume [m3 kg-1]

Call to:

spec_vol_anomaly_elem_buggy_wright spec_vol_elem_buggy_wright