MOM_EOS_Wright module reference

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

Data Types

buggy_Wright_EOS

@}

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

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. Care should be taken when applying this equation of state outside of its fit range.

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

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

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.

set_params_buggy_Wright

Set coefficients that can correct bugs un the buggy Wright equation of state.

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, extends(EOS_base) :: buggy_Wright_EOS

@}

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

Parameters
  • three

    A constant that can be adjusted to recreate some bugs [nondim]

Functions/Subroutine Documentation

real elemental function density_elem_buggy_Wright(this, T, S, pressure)

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].

Callers call graph
Callers of mom_eos_wright::density_elem_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_density_array_buggy_wright calculate_density_array_buggy_Wright [private/internal] mom_eos_wright::density_elem_buggy_wright density_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_density_array_buggy_wright->mom_eos_wright::density_elem_buggy_wright
Text view
real elemental function density_anomaly_elem_buggy_Wright(this, T, S, pressure, rho_ref)

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].

Callers call graph
Callers of mom_eos_wright::density_anomaly_elem_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_density_array_buggy_wright calculate_density_array_buggy_Wright [private/internal] mom_eos_wright::density_anomaly_elem_buggy_wright density_anomaly_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_density_array_buggy_wright->mom_eos_wright::density_anomaly_elem_buggy_wright
Text view
real elemental function spec_vol_elem_buggy_Wright(this, T, S, pressure)

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].

Callers call graph
Callers of mom_eos_wright::spec_vol_elem_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_spec_vol_array_buggy_wright calculate_spec_vol_array_buggy_Wright [private/internal] mom_eos_wright::spec_vol_elem_buggy_wright spec_vol_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_spec_vol_array_buggy_wright->mom_eos_wright::spec_vol_elem_buggy_wright
Text view
real elemental function spec_vol_anomaly_elem_buggy_Wright(this, T, S, pressure, spv_ref)

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].

Callers call graph
Callers of mom_eos_wright::spec_vol_anomaly_elem_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_spec_vol_array_buggy_wright calculate_spec_vol_array_buggy_Wright [private/internal] mom_eos_wright::spec_vol_anomaly_elem_buggy_wright spec_vol_anomaly_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_spec_vol_array_buggy_wright->mom_eos_wright::spec_vol_anomaly_elem_buggy_wright
Text view
elemental subroutine 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]

elemental subroutine 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]

elemental subroutine 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]

elemental subroutine 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].

subroutine 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.

Callers call graph
Callers of mom_eos_wright::avg_spec_vol_buggy_wright calls cluster_mom_eos MOM_EOS cluster_mom_eos_wright MOM_EOS_Wright mom_eos::average_specific_vol average_specific_vol mom_eos_wright::avg_spec_vol_buggy_wright avg_spec_vol_buggy_Wright mom_eos::average_specific_vol->mom_eos_wright::avg_spec_vol_buggy_wright
Text view
subroutine 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 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, SSH, dz_neglect, MassWghtInterp, 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 [C ~> degC].

  • 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 layer [R L2 T-2 ~> Pa].

  • intz_dpa [inout]

    The integral through the thickness of the layer of the pressure anomaly relative to the anomaly at the top of the layer [R Z L2 T-2 ~> Pa m].

  • intx_dpa [inout]

    The integral in x of the difference between the pressure anomaly at the top and bottom of the layer divided by the x grid spacing [R L2 T-2 ~> Pa].

  • inty_dpa [inout]

    The integral in y of the difference between the pressure anomaly at the top and bottom of the layer divided by the y grid spacing [R L2 T-2 ~> Pa].

  • bathyT [in]

    The depth of the bathymetry [Z ~> m].

  • SSH [in]

    The sea surface height [Z ~> m]

  • dz_neglect [in]

    A miniscule thickness change [Z ~> m].

  • MassWghtInterp [in]

    A flag indicating whether and how to use mass weighting to interpolate T/S in 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]

Callers call graph
Callers of mom_eos_wright::int_density_dz_wright calls cluster_mom_eos MOM_EOS cluster_mom_eos_wright MOM_EOS_Wright mom_eos::analytic_int_density_dz analytic_int_density_dz mom_eos_wright::int_density_dz_wright int_density_dz_wright mom_eos::analytic_int_density_dz->mom_eos_wright::int_density_dz_wright
Text view
subroutine int_spec_vol_dp_wright(T, S, p_t, p_b, spv_ref, HI, dza, intp_dza, intx_dza, inty_dza, halo_size, bathyP, P_surf, dP_neglect, MassWghtInterp, 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 [C ~> degC].

  • 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 the layer [L2 T-2 ~> m2 s-2].

  • intp_dza [inout]

    The integral in pressure through the layer of the geopotential anomaly relative to the anomaly at the bottom of the layer [R L4 T-4 ~> Pa m2 s-2]

  • intx_dza [inout]

    The integral in x of the difference between the geopotential anomaly at the top and bottom of the layer divided by the x grid spacing [L2 T-2 ~> m2 s-2].

  • inty_dza [inout]

    The integral in y of the difference between the geopotential anomaly at the top and bottom of the layer divided by the y grid spacing [L2 T-2 ~> m2 s-2].

  • 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]

  • P_surf [in]

    The pressure at the ocean surface [R L2 T-2 ~> Pa]

  • dP_neglect [in]

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

  • MassWghtInterp [in]

    A flag indicating whether and how to use mass weighting to interpolate T/S in 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].

Callers call graph
Callers of mom_eos_wright::int_spec_vol_dp_wright calls cluster_mom_eos MOM_EOS cluster_mom_eos_wright MOM_EOS_Wright mom_eos::analytic_int_specific_vol_dp analytic_int_specific_vol_dp mom_eos_wright::int_spec_vol_dp_wright int_spec_vol_dp_wright mom_eos::analytic_int_specific_vol_dp->mom_eos_wright::int_spec_vol_dp_wright
Text view
subroutine 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]

Callees call graph
Callees of mom_eos_wright::calculate_density_array_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_density_array_buggy_wright calculate_density_array_buggy_Wright [private/internal] mom_eos_wright::density_anomaly_elem_buggy_wright density_anomaly_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_density_array_buggy_wright->mom_eos_wright::density_anomaly_elem_buggy_wright mom_eos_wright::density_elem_buggy_wright density_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_density_array_buggy_wright->mom_eos_wright::density_elem_buggy_wright
Text view
subroutine 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]

Callees call graph
Callees of mom_eos_wright::calculate_spec_vol_array_buggy_wright calls cluster_mom_eos_wright MOM_EOS_Wright mom_eos_wright::calculate_spec_vol_array_buggy_wright calculate_spec_vol_array_buggy_Wright [private/internal] mom_eos_wright::spec_vol_anomaly_elem_buggy_wright spec_vol_anomaly_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_spec_vol_array_buggy_wright->mom_eos_wright::spec_vol_anomaly_elem_buggy_wright mom_eos_wright::spec_vol_elem_buggy_wright spec_vol_elem_buggy_Wright [private/internal] mom_eos_wright::calculate_spec_vol_array_buggy_wright->mom_eos_wright::spec_vol_elem_buggy_wright
Text view
subroutine set_params_buggy_Wright(this, use_Wright_2nd_deriv_bug)

Set coefficients that can correct bugs un the buggy Wright equation of state.

Parameters
  • this [inout]

    This EOS

  • use_Wright_2nd_deriv_bug [in]

    If true, use a buggy buggy version of the calculations of the second derivative of density with temperature and with temperature and pressure. This bug is corrected in the default version.

API generated with Flint · Rendered from reStructuredText