MOM6
mom_eos_linear Module Reference

Detailed Description

A simple linear equation of state for sea water with constant coefficients.

Data Types

interface  calculate_density_derivs_linear
 For a given thermodynamic state, return the derivatives of density with temperature and salinity using the simple linear equation of state. More...
 
interface  calculate_density_linear
 Compute the density of sea water (in kg/m^3), or its anomaly from a reference density, using a simple linear equation of state from salinity (in psu), potential temperature (in deg C) and pressure [Pa]. More...
 
interface  calculate_density_second_derivs_linear
 For a given thermodynamic state, return the second derivatives of density with various combinations of temperature, salinity, and pressure. Note that with a simple linear equation of state these second derivatives are all 0. More...
 
interface  calculate_spec_vol_linear
 Compute the specific volume of sea water (in m^3/kg), or its anomaly from a reference value, using a simple linear equation of state from salinity (in psu), potential temperature (in deg C) and pressure [Pa]. More...
 

Functions/Subroutines

subroutine, public calculate_density_scalar_linear (T, S, pressure, rho, Rho_T0_S0, dRho_dT, dRho_dS, rho_ref)
 This subroutine computes the density of sea water with a trivial linear equation of state (in [kg m-3]) from salinity (sal [PSU]), potential temperature (T [degC]), and pressure [Pa]. More...
 
subroutine, public calculate_density_array_linear (T, S, pressure, rho, start, npts, Rho_T0_S0, dRho_dT, dRho_dS, rho_ref)
 This subroutine computes the density of sea water with a trivial linear equation of state (in kg/m^3) from salinity (sal in psu), potential temperature (T [degC]), and pressure [Pa]. More...
 
subroutine calculate_spec_vol_scalar_linear (T, S, pressure, specvol, Rho_T0_S0, dRho_dT, dRho_dS, spv_ref)
 This subroutine computes the in situ specific volume of sea water (specvol in [m3 kg-1]) from salinity (S [PSU]), potential temperature (T [degC]) and pressure [Pa], using a trivial linear equation of state for density. If spv_ref is present, specvol is an anomaly from spv_ref. More...
 
subroutine calculate_spec_vol_array_linear (T, S, pressure, specvol, start, npts, Rho_T0_S0, dRho_dT, dRho_dS, spv_ref)
 This subroutine computes the in situ specific volume of sea water (specvol in [m3 kg-1]) from salinity (S [PSU]), potential temperature (T [degC]) and pressure [Pa], using a trivial linear equation of state for density. If spv_ref is present, specvol is an anomaly from spv_ref. More...
 
subroutine calculate_density_derivs_array_linear (T, S, pressure, drho_dT_out, drho_dS_out, Rho_T0_S0, dRho_dT, dRho_dS, start, npts)
 This subroutine calculates the partial derivatives of density * with potential temperature and salinity. More...
 
subroutine, public calculate_density_derivs_scalar_linear (T, S, pressure, drho_dT_out, drho_dS_out, Rho_T0_S0, dRho_dT, dRho_dS)
 This subroutine calculates the partial derivatives of density * with potential temperature and salinity for a single point. More...
 
subroutine calculate_density_second_derivs_scalar_linear (T, S, pressure, drho_dS_dS, drho_dS_dT, drho_dT_dT, drho_dS_dP, drho_dT_dP)
 This subroutine calculates the five, partial second derivatives of density w.r.t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. More...
 
subroutine calculate_density_second_derivs_array_linear (T, S, pressure, drho_dS_dS, drho_dS_dT, drho_dT_dT, drho_dS_dP, drho_dT_dP, start, npts)
 This subroutine calculates the five, partial second derivatives of density w.r.t. potential temperature and salinity and pressure which for a linear equation of state should all be 0. More...
 
subroutine, public calculate_specvol_derivs_linear (T, S, pressure, dSV_dT, dSV_dS, start, npts, Rho_T0_S0, dRho_dT, dRho_dS)
 Calculate the derivatives of specific volume with temperature and salinity. More...
 
subroutine, public calculate_compress_linear (T, S, pressure, rho, drho_dp, start, npts, Rho_T0_S0, dRho_dT, dRho_dS)
 This subroutine computes the in situ density of sea water (rho) and the compressibility (drho/dp == C_sound^-2) at the given salinity, potential temperature, and pressure. More...
 
subroutine, public int_density_dz_linear (T, S, z_t, z_b, rho_ref, rho_0_pres, G_e, HII, HIO, Rho_T0_S0, dRho_dT, dRho_dS, dpa, intz_dpa, intx_dpa, inty_dpa, bathyT, dz_neglect, useMassWghtInterp)
 This subroutine calculates analytical and nearly-analytical integrals of pressure anomalies across layers, which are required for calculating the finite-volume form pressure accelerations in a Boussinesq model. More...
 
subroutine, public int_spec_vol_dp_linear (T, S, p_t, p_b, alpha_ref, HI, Rho_T0_S0, dRho_dT, dRho_dS, dza, intp_dza, intx_dza, inty_dza, halo_size, bathyP, dP_neglect, useMassWghtInterp)
 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. Specific volume is assumed to vary linearly between adjacent points. More...
 

Function/Subroutine Documentation

◆ calculate_compress_linear()

subroutine, public mom_eos_linear::calculate_compress_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  rho,
real, dimension(:), intent(out)  drho_dp,
integer, intent(in)  start,
integer, intent(in)  npts,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS 
)

This subroutine computes the in situ density of sea water (rho) and the compressibility (drho/dp == C_sound^-2) at the given salinity, potential temperature, and pressure.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]rhoIn situ density [kg m-3].
[out]drho_dpThe partial derivative of density with pressure (also the inverse of the square of sound speed) [s2 m-2].
[in]startThe starting point in the arrays.
[in]nptsThe number of values to calculate.
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivative of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivative of density with salinity [kg m-3 ppt-1].

Definition at line 301 of file MOM_EOS_linear.F90.

301  real, intent(in), dimension(:) :: T !< Potential temperature relative to the surface
302  !! [degC].
303  real, intent(in), dimension(:) :: S !< Salinity [PSU].
304  real, intent(in), dimension(:) :: pressure !< pressure [Pa].
305  real, intent(out), dimension(:) :: rho !< In situ density [kg m-3].
306  real, intent(out), dimension(:) :: drho_dp !< The partial derivative of density with pressure
307  !! (also the inverse of the square of sound speed)
308  !! [s2 m-2].
309  integer, intent(in) :: start !< The starting point in the arrays.
310  integer, intent(in) :: npts !< The number of values to calculate.
311  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
312  real, intent(in) :: dRho_dT !< The derivative of density with
313  !! temperature [kg m-3 degC-1].
314  real, intent(in) :: dRho_dS !< The derivative of density with
315  !! salinity [kg m-3 ppt-1].
316  ! Local variables
317  integer :: j
318 
319  do j=start,start+npts-1
320  rho(j) = rho_t0_s0 + drho_dt*t(j) + drho_ds*s(j)
321  drho_dp(j) = 0.0
322  enddo

Referenced by mom_eos::calculate_compress_array().

Here is the caller graph for this function:

◆ calculate_density_array_linear()

subroutine, public mom_eos_linear::calculate_density_array_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  rho,
integer, intent(in)  start,
integer, intent(in)  npts,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, intent(in), optional  rho_ref 
)

This subroutine computes the density of sea water with a trivial linear equation of state (in kg/m^3) from salinity (sal in psu), potential temperature (T [degC]), and pressure [Pa].

Parameters
[in]tpotential temperature relative to the surface [degC].
[in]ssalinity [PSU].
[in]pressurepressure [Pa].
[out]rhoin situ density [kg m-3].
[in]startthe starting point in the arrays.
[in]nptsthe number of values to calculate.
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivatives of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivatives of density with salinity in [kg m-3 ppt-1].
[in]rho_refA reference density [kg m-3].

Definition at line 82 of file MOM_EOS_linear.F90.

82  real, dimension(:), intent(in) :: T !< potential temperature relative to the surface [degC].
83  real, dimension(:), intent(in) :: S !< salinity [PSU].
84  real, dimension(:), intent(in) :: pressure !< pressure [Pa].
85  real, dimension(:), intent(out) :: rho !< in situ density [kg m-3].
86  integer, intent(in) :: start !< the starting point in the arrays.
87  integer, intent(in) :: npts !< the number of values to calculate.
88  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
89  real, intent(in) :: dRho_dT !< The derivatives of density with temperature
90  !! [kg m-3 degC-1].
91  real, intent(in) :: dRho_dS !< The derivatives of density with salinity
92  !! in [kg m-3 ppt-1].
93  real, optional, intent(in) :: rho_ref !< A reference density [kg m-3].
94  ! Local variables
95  integer :: j
96 
97  if (present(rho_ref)) then ; do j=start,start+npts-1
98  rho(j) = (rho_t0_s0 - rho_ref) + (drho_dt*t(j) + drho_ds*s(j))
99  enddo ; else ; do j=start,start+npts-1
100  rho(j) = rho_t0_s0 + drho_dt*t(j) + drho_ds*s(j)
101  enddo ; endif
102 

◆ calculate_density_derivs_array_linear()

subroutine mom_eos_linear::calculate_density_derivs_array_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  drho_dT_out,
real, dimension(:), intent(out)  drho_dS_out,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
integer, intent(in)  start,
integer, intent(in)  npts 
)
private

This subroutine calculates the partial derivatives of density * with potential temperature and salinity.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurePressure [Pa].
[out]drho_dt_outThe partial derivative of density with potential temperature [kg m-3 degC-1].
[out]drho_ds_outThe partial derivative of density with salinity [kg m-3 ppt-1].
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivative of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivative of density with salinity [kg m-3 ppt-1].
[in]startThe starting point in the arrays.
[in]nptsThe number of values to calculate.

Definition at line 165 of file MOM_EOS_linear.F90.

165  real, intent(in), dimension(:) :: T !< Potential temperature relative to the surface
166  !! [degC].
167  real, intent(in), dimension(:) :: S !< Salinity [PSU].
168  real, intent(in), dimension(:) :: pressure !< Pressure [Pa].
169  real, intent(out), dimension(:) :: drho_dT_out !< The partial derivative of density with
170  !! potential temperature [kg m-3 degC-1].
171  real, intent(out), dimension(:) :: drho_dS_out !< The partial derivative of density with
172  !! salinity [kg m-3 ppt-1].
173  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
174  real, intent(in) :: dRho_dT !< The derivative of density with temperature [kg m-3 degC-1].
175  real, intent(in) :: dRho_dS !< The derivative of density with salinity [kg m-3 ppt-1].
176  integer, intent(in) :: start !< The starting point in the arrays.
177  integer, intent(in) :: npts !< The number of values to calculate.
178  ! Local variables
179  integer :: j
180 
181  do j=start,start+npts-1
182  drho_dt_out(j) = drho_dt
183  drho_ds_out(j) = drho_ds
184  enddo
185 

◆ calculate_density_derivs_scalar_linear()

subroutine, public mom_eos_linear::calculate_density_derivs_scalar_linear ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
real, intent(out)  drho_dT_out,
real, intent(out)  drho_dS_out,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS 
)

This subroutine calculates the partial derivatives of density * with potential temperature and salinity for a single point.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]drho_dt_outThe partial derivative of density with potential temperature [kg m-3 degC-1].
[out]drho_ds_outThe partial derivative of density with salinity [kg m-3 ppt-1].
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivatives of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivatives of density with salinity [kg m-3 ppt-1].

Definition at line 192 of file MOM_EOS_linear.F90.

192  real, intent(in) :: T !< Potential temperature relative to the surface
193  !! [degC].
194  real, intent(in) :: S !< Salinity [PSU].
195  real, intent(in) :: pressure !< pressure [Pa].
196  real, intent(out) :: drho_dT_out !< The partial derivative of density with
197  !! potential temperature [kg m-3 degC-1].
198  real, intent(out) :: drho_dS_out !< The partial derivative of density with
199  !! salinity [kg m-3 ppt-1].
200  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
201  real, intent(in) :: dRho_dT !< The derivatives of density with temperature [kg m-3 degC-1].
202  real, intent(in) :: dRho_dS !< The derivatives of density with salinity [kg m-3 ppt-1].
203  drho_dt_out = drho_dt
204  drho_ds_out = drho_ds
205 

◆ calculate_density_scalar_linear()

subroutine, public mom_eos_linear::calculate_density_scalar_linear ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
real, intent(out)  rho,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, intent(in), optional  rho_ref 
)

This subroutine computes the density of sea water with a trivial linear equation of state (in [kg m-3]) from salinity (sal [PSU]), potential temperature (T [degC]), and pressure [Pa].

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]rhoIn situ density [kg m-3].
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivatives of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivatives of density with salinity in [kg m-3 ppt-1].
[in]rho_refA reference density [kg m-3].

Definition at line 58 of file MOM_EOS_linear.F90.

58  real, intent(in) :: T !< Potential temperature relative to the surface [degC].
59  real, intent(in) :: S !< Salinity [PSU].
60  real, intent(in) :: pressure !< pressure [Pa].
61  real, intent(out) :: rho !< In situ density [kg m-3].
62  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
63  real, intent(in) :: dRho_dT !< The derivatives of density with temperature
64  !! [kg m-3 degC-1].
65  real, intent(in) :: dRho_dS !< The derivatives of density with salinity
66  !! in [kg m-3 ppt-1].
67  real, optional, intent(in) :: rho_ref !< A reference density [kg m-3].
68 
69  if (present(rho_ref)) then
70  rho = (rho_t0_s0 - rho_ref) + (drho_dt*t + drho_ds*s)
71  else
72  rho = rho_t0_s0 + drho_dt*t + drho_ds*s
73  endif
74 

◆ calculate_density_second_derivs_array_linear()

subroutine mom_eos_linear::calculate_density_second_derivs_array_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  drho_dS_dS,
real, dimension(:), intent(out)  drho_dS_dT,
real, dimension(:), intent(out)  drho_dT_dT,
real, dimension(:), intent(out)  drho_dS_dP,
real, dimension(:), intent(out)  drho_dT_dP,
integer, intent(in)  start,
integer, intent(in)  npts 
)
private

This subroutine calculates the five, partial second derivatives of density w.r.t. potential temperature and salinity and pressure which for a linear equation of state should all be 0.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]drho_ds_dsThe second derivative of density with salinity [kg m-3 PSU-2].
[out]drho_ds_dtThe second derivative of density with temperature and salinity [kg m-3 ppt-1 degC-1].
[out]drho_dt_dtThe second derivative of density with temperature [kg m-3 degC-2].
[out]drho_ds_dpThe second derivative of density with salinity and pressure [kg m-3 PSU-1 Pa-1].
[out]drho_dt_dpThe second derivative of density with temperature and pressure [kg m-3 degC-1 Pa-1].
[in]startThe starting point in the arrays.
[in]nptsThe number of values to calculate.

Definition at line 238 of file MOM_EOS_linear.F90.

238  real, dimension(:), intent(in) :: T !< Potential temperature relative to the surface [degC].
239  real, dimension(:), intent(in) :: S !< Salinity [PSU].
240  real, dimension(:), intent(in) :: pressure !< pressure [Pa].
241  real, dimension(:), intent(out) :: drho_dS_dS !< The second derivative of density with
242  !! salinity [kg m-3 PSU-2].
243  real, dimension(:), intent(out) :: drho_dS_dT !< The second derivative of density with
244  !! temperature and salinity [kg m-3 ppt-1 degC-1].
245  real, dimension(:), intent(out) :: drho_dT_dT !< The second derivative of density with
246  !! temperature [kg m-3 degC-2].
247  real, dimension(:), intent(out) :: drho_dS_dP !< The second derivative of density with
248  !! salinity and pressure [kg m-3 PSU-1 Pa-1].
249  real, dimension(:), intent(out) :: drho_dT_dP !< The second derivative of density with
250  !! temperature and pressure [kg m-3 degC-1 Pa-1].
251  integer, intent(in) :: start !< The starting point in the arrays.
252  integer, intent(in) :: npts !< The number of values to calculate.
253  ! Local variables
254  integer :: j
255  do j=start,start+npts-1
256  drho_ds_ds(j) = 0.
257  drho_ds_dt(j) = 0.
258  drho_dt_dt(j) = 0.
259  drho_ds_dp(j) = 0.
260  drho_dt_dp(j) = 0.
261  enddo
262 

◆ calculate_density_second_derivs_scalar_linear()

subroutine mom_eos_linear::calculate_density_second_derivs_scalar_linear ( 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 
)
private

This subroutine calculates the five, partial second derivatives of density w.r.t. potential temperature and salinity and pressure which for a linear equation of state should all be 0.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]drho_ds_dsThe second derivative of density with salinity [kg m-3 PSU-2].
[out]drho_ds_dtThe second derivative of density with temperature and salinity [kg m-3 ppt-1 degC-1].
[out]drho_dt_dtThe second derivative of density with temperature [kg m-3 degC-2].
[out]drho_ds_dpThe second derivative of density with salinity and pressure [kg m-3 PSU-1 Pa-1].
[out]drho_dt_dpThe second derivative of density with temperature and pressure [kg m-3 degC-1 Pa-1].

Definition at line 212 of file MOM_EOS_linear.F90.

212  real, intent(in) :: T !< Potential temperature relative to the surface [degC].
213  real, intent(in) :: S !< Salinity [PSU].
214  real, intent(in) :: pressure !< pressure [Pa].
215  real, intent(out) :: drho_dS_dS !< The second derivative of density with
216  !! salinity [kg m-3 PSU-2].
217  real, intent(out) :: drho_dS_dT !< The second derivative of density with
218  !! temperature and salinity [kg m-3 ppt-1 degC-1].
219  real, intent(out) :: drho_dT_dT !< The second derivative of density with
220  !! temperature [kg m-3 degC-2].
221  real, intent(out) :: drho_dS_dP !< The second derivative of density with
222  !! salinity and pressure [kg m-3 PSU-1 Pa-1].
223  real, intent(out) :: drho_dT_dP !< The second derivative of density with
224  !! temperature and pressure [kg m-3 degC-1 Pa-1].
225 
226  drho_ds_ds = 0.
227  drho_ds_dt = 0.
228  drho_dt_dt = 0.
229  drho_ds_dp = 0.
230  drho_dt_dp = 0.
231 

◆ calculate_spec_vol_array_linear()

subroutine mom_eos_linear::calculate_spec_vol_array_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  specvol,
integer, intent(in)  start,
integer, intent(in)  npts,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, intent(in), optional  spv_ref 
)
private

This subroutine computes the in situ specific volume of sea water (specvol in [m3 kg-1]) from salinity (S [PSU]), potential temperature (T [degC]) and pressure [Pa], using a trivial linear equation of state for density. If spv_ref is present, specvol is an anomaly from spv_ref.

Parameters
[in]tpotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurePressure [Pa].
[out]specvolin situ specific volume [m3 kg-1].
[in]startthe starting point in the arrays.
[in]nptsthe number of values to calculate.
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivatives of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivatives of density with salinity [kg m-3 ppt-1].
[in]spv_refA reference specific volume [m3 kg-1].

Definition at line 138 of file MOM_EOS_linear.F90.

138  real, dimension(:), intent(in) :: T !< potential temperature relative to the surface
139  !! [degC].
140  real, dimension(:), intent(in) :: S !< Salinity [PSU].
141  real, dimension(:), intent(in) :: pressure !< Pressure [Pa].
142  real, dimension(:), intent(out) :: specvol !< in situ specific volume [m3 kg-1].
143  integer, intent(in) :: start !< the starting point in the arrays.
144  integer, intent(in) :: npts !< the number of values to calculate.
145  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
146  real, intent(in) :: dRho_dT !< The derivatives of density with temperature [kg m-3 degC-1].
147  real, intent(in) :: dRho_dS !< The derivatives of density with salinity [kg m-3 ppt-1].
148  real, optional, intent(in) :: spv_ref !< A reference specific volume [m3 kg-1].
149  ! Local variables
150  integer :: j
151 
152  if (present(spv_ref)) then ; do j=start,start+npts-1
153  specvol(j) = ((1.0 - rho_t0_s0*spv_ref) + spv_ref*(drho_dt*t(j) + drho_ds*s(j))) / &
154  ( rho_t0_s0 + (drho_dt*t(j) + drho_ds*s(j)))
155  enddo ; else ; do j=start,start+npts-1
156  specvol(j) = 1.0 / ( rho_t0_s0 + (drho_dt*t(j) + drho_ds*s(j)))
157  enddo ; endif
158 

◆ calculate_spec_vol_scalar_linear()

subroutine mom_eos_linear::calculate_spec_vol_scalar_linear ( real, intent(in)  T,
real, intent(in)  S,
real, intent(in)  pressure,
real, intent(out)  specvol,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, intent(in), optional  spv_ref 
)
private

This subroutine computes the in situ specific volume of sea water (specvol in [m3 kg-1]) from salinity (S [PSU]), potential temperature (T [degC]) and pressure [Pa], using a trivial linear equation of state for density. If spv_ref is present, specvol is an anomaly from spv_ref.

Parameters
[in]tpotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurePressure [Pa].
[out]specvolIn situ specific volume [m3 kg-1].
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivatives of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivatives of density with salinity [kg m-3 ppt-1].
[in]spv_refA reference specific volume [m3 kg-1].

Definition at line 111 of file MOM_EOS_linear.F90.

111  real, intent(in) :: T !< potential temperature relative to the surface
112  !! [degC].
113  real, intent(in) :: S !< Salinity [PSU].
114  real, intent(in) :: pressure !< Pressure [Pa].
115  real, intent(out) :: specvol !< In situ specific volume [m3 kg-1].
116  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
117  real, intent(in) :: dRho_dT !< The derivatives of density with temperature [kg m-3 degC-1].
118  real, intent(in) :: dRho_dS !< The derivatives of density with salinity [kg m-3 ppt-1].
119  real, optional, intent(in) :: spv_ref !< A reference specific volume [m3 kg-1].
120  ! Local variables
121  integer :: j
122 
123  if (present(spv_ref)) then
124  specvol = ((1.0 - rho_t0_s0*spv_ref) + spv_ref*(drho_dt*t + drho_ds*s)) / &
125  ( rho_t0_s0 + (drho_dt*t + drho_ds*s))
126  else
127  specvol = 1.0 / ( rho_t0_s0 + (drho_dt*t + drho_ds*s))
128  endif
129 

◆ calculate_specvol_derivs_linear()

subroutine, public mom_eos_linear::calculate_specvol_derivs_linear ( real, dimension(:), intent(in)  T,
real, dimension(:), intent(in)  S,
real, dimension(:), intent(in)  pressure,
real, dimension(:), intent(out)  dSV_dT,
real, dimension(:), intent(out)  dSV_dS,
integer, intent(in)  start,
integer, intent(in)  npts,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS 
)

Calculate the derivatives of specific volume with temperature and salinity.

Parameters
[in]tPotential temperature relative to the surface [degC].
[in]sSalinity [PSU].
[in]pressurepressure [Pa].
[out]dsv_dsThe partial derivative of specific volume with salinity [m3 kg-1 PSU-1].
[out]dsv_dtThe partial derivative of specific volume with potential temperature [m3 kg-1 degC-1].
[in]startThe starting point in the arrays.
[in]nptsThe number of values to calculate.
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivative of density with temperature, [kg m-3 degC-1].
[in]drho_dsThe derivative of density with salinity [kg m-3 ppt-1].

Definition at line 268 of file MOM_EOS_linear.F90.

268  real, intent(in), dimension(:) :: T !< Potential temperature relative to the surface
269  !! [degC].
270  real, intent(in), dimension(:) :: S !< Salinity [PSU].
271  real, intent(in), dimension(:) :: pressure !< pressure [Pa].
272  real, intent(out), dimension(:) :: dSV_dS !< The partial derivative of specific volume with
273  !! salinity [m3 kg-1 PSU-1].
274  real, intent(out), dimension(:) :: dSV_dT !< The partial derivative of specific volume with
275  !! potential temperature [m3 kg-1 degC-1].
276  integer, intent(in) :: start !< The starting point in the arrays.
277  integer, intent(in) :: npts !< The number of values to calculate.
278  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
279  real, intent(in) :: dRho_dT !< The derivative of density with
280  !! temperature, [kg m-3 degC-1].
281  real, intent(in) :: dRho_dS !< The derivative of density with
282  !! salinity [kg m-3 ppt-1].
283  ! Local variables
284  real :: I_rho2
285  integer :: j
286 
287  do j=start,start+npts-1
288  ! Sv = 1.0 / (Rho_T0_S0 + dRho_dT*T(j) + dRho_dS*S(j))
289  i_rho2 = 1.0 / (rho_t0_s0 + (drho_dt*t(j) + drho_ds*s(j)))**2
290  dsv_dt(j) = -drho_dt * i_rho2
291  dsv_ds(j) = -drho_ds * i_rho2
292  enddo
293 

◆ int_density_dz_linear()

subroutine, public mom_eos_linear::int_density_dz_linear ( real, dimension(hii%isd:hii%ied,hii%jsd:hii%jed), intent(in)  T,
real, dimension(hii%isd:hii%ied,hii%jsd:hii%jed), intent(in)  S,
real, dimension(hii%isd:hii%ied,hii%jsd:hii%jed), intent(in)  z_t,
real, dimension(hii%isd:hii%ied,hii%jsd:hii%jed), intent(in)  z_b,
real, intent(in)  rho_ref,
real, intent(in)  rho_0_pres,
real, intent(in)  G_e,
type(hor_index_type), intent(in)  HII,
type(hor_index_type), intent(in)  HIO,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, dimension(hio%isd:hio%ied,hio%jsd:hio%jed), intent(out)  dpa,
real, dimension(hio%isd:hio%ied,hio%jsd:hio%jed), intent(out), optional  intz_dpa,
real, dimension(hio%isdb:hio%iedb,hio%jsd:hio%jed), intent(out), optional  intx_dpa,
real, dimension(hio%isd:hio%ied,hio%jsdb:hio%jedb), intent(out), optional  inty_dpa,
real, dimension(hii%isd:hii%ied,hii%jsd:hii%jed), intent(in), optional  bathyT,
real, intent(in), optional  dz_neglect,
logical, intent(in), optional  useMassWghtInterp 
)

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

Parameters
[in]hiiThe horizontal index type for the input arrays.
[in]hioThe horizontal index type for the output arrays.
[in]tPotential temperature relative to the surface
[in]sSalinity [PSU].
[in]z_tHeight at the top of the layer in depth units [Z ~> m].
[in]z_bHeight at the top of the layer [Z ~> m].
[in]rho_refA mean density [kg m-3], that is subtracted out to reduce the magnitude of each of the integrals.
[in]rho_0_presA density [kg m-3], that is used to calculate the pressure (as p~=-z*rho_0_pres*G_e) used in the equation of state. rho_0_pres is not used here.
[in]g_eThe Earth's gravitational acceleration [m2 Z-1 s-2 ~> m s-2].
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivative of density with temperature, [kg m-3 degC-1].
[in]drho_dsThe derivative of density with salinity, in [kg m-3 ppt-1].
[out]dpaThe change in the pressure anomaly across the
[out]intz_dpaThe integral through the thickness of the layer
[out]intx_dpaThe integral in x of the difference between the
[out]inty_dpaThe integral in y of the difference between the
[in]bathytThe depth of the bathymetry [Z ~> m].
[in]dz_neglectA miniscule thickness change [Z ~> m].
[in]usemasswghtinterpIf true, uses mass weighting to interpolate T/S for top and bottom integrals.

Definition at line 331 of file MOM_EOS_linear.F90.

331  type(hor_index_type), intent(in) :: HII !< The horizontal index type for the input arrays.
332  type(hor_index_type), intent(in) :: HIO !< The horizontal index type for the output arrays.
333  real, dimension(HII%isd:HII%ied,HII%jsd:HII%jed), &
334  intent(in) :: T !< Potential temperature relative to the surface
335  !! [degC].
336  real, dimension(HII%isd:HII%ied,HII%jsd:HII%jed), &
337  intent(in) :: S !< Salinity [PSU].
338  real, dimension(HII%isd:HII%ied,HII%jsd:HII%jed), &
339  intent(in) :: z_t !< Height at the top of the layer in depth units [Z ~> m].
340  real, dimension(HII%isd:HII%ied,HII%jsd:HII%jed), &
341  intent(in) :: z_b !< Height at the top of the layer [Z ~> m].
342  real, intent(in) :: rho_ref !< A mean density [kg m-3], that is subtracted
343  !! out to reduce the magnitude of each of the
344  !! integrals.
345  real, intent(in) :: rho_0_pres !< A density [kg m-3], that is used to calculate
346  !! the pressure (as p~=-z*rho_0_pres*G_e) used in
347  !! the equation of state. rho_0_pres is not used
348  !! here.
349  real, intent(in) :: G_e !< The Earth's gravitational acceleration [m2 Z-1 s-2 ~> m s-2].
350  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
351  real, intent(in) :: dRho_dT !< The derivative of density with temperature,
352  !! [kg m-3 degC-1].
353  real, intent(in) :: dRho_dS !< The derivative of density with salinity,
354  !! in [kg m-3 ppt-1].
355  real, dimension(HIO%isd:HIO%ied,HIO%jsd:HIO%jed), &
356  intent(out) :: dpa !< The change in the pressure anomaly across the
357  !! layer [Pa].
358  real, dimension(HIO%isd:HIO%ied,HIO%jsd:HIO%jed), &
359  optional, intent(out) :: intz_dpa !< The integral through the thickness of the layer
360  !! of the pressure anomaly relative to the anomaly
361  !! at the top of the layer [Pa Z].
362  real, dimension(HIO%IsdB:HIO%IedB,HIO%jsd:HIO%jed), &
363  optional, intent(out) :: intx_dpa !< The integral in x of the difference between the
364  !! pressure anomaly at the top and bottom of the
365  !! layer divided by the x grid spacing [Pa].
366  real, dimension(HIO%isd:HIO%ied,HIO%JsdB:HIO%JedB), &
367  optional, intent(out) :: inty_dpa !< The integral in y of the difference between the
368  !! pressure anomaly at the top and bottom of the
369  !! layer divided by the y grid spacing [Pa].
370  real, dimension(HII%isd:HII%ied,HII%jsd:HII%jed), &
371  optional, intent(in) :: bathyT !< The depth of the bathymetry [Z ~> m].
372  real, optional, intent(in) :: dz_neglect !< A miniscule thickness change [Z ~> m].
373  logical, optional, intent(in) :: useMassWghtInterp !< If true, uses mass weighting to
374  !! interpolate T/S for top and bottom integrals.
375  ! Local variables
376  real :: rho_anom ! The density anomaly from rho_ref [kg m-3].
377  real :: raL, raR ! rho_anom to the left and right [kg m-3].
378  real :: dz, dzL, dzR ! Layer thicknesses [Z ~> m].
379  real :: hWght ! A pressure-thickness below topography [Z ~> m].
380  real :: hL, hR ! Pressure-thicknesses of the columns to the left and right [Z ~> m].
381  real :: iDenom ! The inverse of the denominator in the weights [Z-2 ~> m-2].
382  real :: hWt_LL, hWt_LR ! hWt_LA is the weighted influence of A on the left column [nondim].
383  real :: hWt_RL, hWt_RR ! hWt_RA is the weighted influence of A on the right column [nondim].
384  real :: wt_L, wt_R ! The linear weights of the left and right columns [nondim].
385  real :: wtT_L, wtT_R ! The weights for tracers from the left and right columns [nondim].
386  real :: intz(5) ! The integrals of density with height at the
387  ! 5 sub-column locations [Pa].
388  logical :: do_massWeight ! Indicates whether to do mass weighting.
389  real, parameter :: C1_6 = 1.0/6.0, c1_90 = 1.0/90.0 ! Rational constants.
390  integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, i, j, ioff, joff, m
391 
392  ioff = hio%idg_offset - hii%idg_offset
393  joff = hio%jdg_offset - hii%jdg_offset
394 
395  ! These array bounds work for the indexing convention of the input arrays, but
396  ! on the computational domain defined for the output arrays.
397  isq = hio%IscB + ioff ; ieq = hio%IecB + ioff
398  jsq = hio%JscB + joff ; jeq = hio%JecB + joff
399  is = hio%isc + ioff ; ie = hio%iec + ioff
400  js = hio%jsc + joff ; je = hio%jec + joff
401 
402  do_massweight = .false.
403  if (present(usemasswghtinterp)) then ; if (usemasswghtinterp) then
404  do_massweight = .true.
405  ! if (.not.present(bathyT)) call MOM_error(FATAL, "int_density_dz_generic: "//&
406  ! "bathyT must be present if useMassWghtInterp is present and true.")
407  ! if (.not.present(dz_neglect)) call MOM_error(FATAL, "int_density_dz_generic: "//&
408  ! "dz_neglect must be present if useMassWghtInterp is present and true.")
409  endif ; endif
410 
411  do j=jsq,jeq+1 ; do i=isq,ieq+1
412  dz = z_t(i,j) - z_b(i,j)
413  rho_anom = (rho_t0_s0 - rho_ref) + drho_dt*t(i,j) + drho_ds*s(i,j)
414  dpa(i-ioff,j-joff) = g_e*rho_anom*dz
415  if (present(intz_dpa)) intz_dpa(i-ioff,j-joff) = 0.5*g_e*rho_anom*dz**2
416  enddo ; enddo
417 
418  if (present(intx_dpa)) then ; do j=js,je ; do i=isq,ieq
419  ! hWght is the distance measure by which the cell is violation of
420  ! hydrostatic consistency. For large hWght we bias the interpolation of
421  ! T & S along the top and bottom integrals, akin to thickness weighting.
422  hwght = 0.0
423  if (do_massweight) &
424  hwght = max(0., -bathyt(i,j)-z_t(i+1,j), -bathyt(i+1,j)-z_t(i,j))
425 
426  if (hwght <= 0.0) then
427  dzl = z_t(i,j) - z_b(i,j) ; dzr = z_t(i+1,j) - z_b(i+1,j)
428  ral = (rho_t0_s0 - rho_ref) + (drho_dt*t(i,j) + drho_ds*s(i,j))
429  rar = (rho_t0_s0 - rho_ref) + (drho_dt*t(i+1,j) + drho_ds*s(i+1,j))
430 
431  intx_dpa(i-ioff,j-joff) = g_e*c1_6 * (dzl*(2.0*ral + rar) + dzr*(2.0*rar + ral))
432  else
433  hl = (z_t(i,j) - z_b(i,j)) + dz_neglect
434  hr = (z_t(i+1,j) - z_b(i+1,j)) + dz_neglect
435  hwght = hwght * ( (hl-hr)/(hl+hr) )**2
436  idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
437  hwt_ll = (hwght*hl + hr*hl) * idenom ; hwt_lr = (hwght*hr) * idenom
438  hwt_rr = (hwght*hr + hr*hl) * idenom ; hwt_rl = (hwght*hl) * idenom
439 
440  intz(1) = dpa(i-ioff,j-joff) ; intz(5) = dpa(i+1-ioff,j-joff)
441  do m=2,4
442  wt_l = 0.25*real(5-m) ; wt_r = 1.0-wt_l
443  wtt_l = wt_l*hwt_ll + wt_r*hwt_rl ; wtt_r = wt_l*hwt_lr + wt_r*hwt_rr
444 
445  dz = wt_l*(z_t(i,j) - z_b(i,j)) + wt_r*(z_t(i+1,j) - z_b(i+1,j))
446  rho_anom = (rho_t0_s0 - rho_ref) + &
447  (drho_dt * (wtt_l*t(i,j) + wtt_r*t(i+1,j)) + &
448  drho_ds * (wtt_l*s(i,j) + wtt_r*s(i+1,j)))
449  intz(m) = g_e*rho_anom*dz
450  enddo
451  ! Use Bode's rule to integrate the values.
452  intx_dpa(i-ioff,j-joff) = c1_90*(7.0*(intz(1)+intz(5)) + 32.0*(intz(2)+intz(4)) + &
453  12.0*intz(3))
454  endif
455  enddo ; enddo ; endif
456 
457  if (present(inty_dpa)) then ; do j=jsq,jeq ; do i=is,ie
458  ! hWght is the distance measure by which the cell is violation of
459  ! hydrostatic consistency. For large hWght we bias the interpolation of
460  ! T & S along the top and bottom integrals, akin to thickness weighting.
461  hwght = 0.0
462  if (do_massweight) &
463  hwght = max(0., -bathyt(i,j)-z_t(i,j+1), -bathyt(i,j+1)-z_t(i,j))
464 
465  if (hwght <= 0.0) then
466  dzl = z_t(i,j) - z_b(i,j) ; dzr = z_t(i,j+1) - z_b(i,j+1)
467  ral = (rho_t0_s0 - rho_ref) + (drho_dt*t(i,j) + drho_ds*s(i,j))
468  rar = (rho_t0_s0 - rho_ref) + (drho_dt*t(i,j+1) + drho_ds*s(i,j+1))
469 
470  inty_dpa(i-ioff,j-joff) = g_e*c1_6 * (dzl*(2.0*ral + rar) + dzr*(2.0*rar + ral))
471  else
472  hl = (z_t(i,j) - z_b(i,j)) + dz_neglect
473  hr = (z_t(i,j+1) - z_b(i,j+1)) + dz_neglect
474  hwght = hwght * ( (hl-hr)/(hl+hr) )**2
475  idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
476  hwt_ll = (hwght*hl + hr*hl) * idenom ; hwt_lr = (hwght*hr) * idenom
477  hwt_rr = (hwght*hr + hr*hl) * idenom ; hwt_rl = (hwght*hl) * idenom
478 
479  intz(1) = dpa(i-ioff,j-joff) ; intz(5) = dpa(i+1-ioff,j-joff)
480  do m=2,4
481  wt_l = 0.25*real(5-m) ; wt_r = 1.0-wt_l
482  wtt_l = wt_l*hwt_ll + wt_r*hwt_rl ; wtt_r = wt_l*hwt_lr + wt_r*hwt_rr
483 
484  dz = wt_l*(z_t(i,j) - z_b(i,j)) + wt_r*(z_t(i,j+1) - z_b(i,j+1))
485  rho_anom = (rho_t0_s0 - rho_ref) + &
486  (drho_dt * (wtt_l*t(i,j) + wtt_r*t(i,j+1)) + &
487  drho_ds * (wtt_l*s(i,j) + wtt_r*s(i,j+1)))
488  intz(m) = g_e*rho_anom*dz
489  enddo
490  ! Use Bode's rule to integrate the values.
491  inty_dpa(i-ioff,j-joff) = c1_90*(7.0*(intz(1)+intz(5)) + 32.0*(intz(2)+intz(4)) + &
492  12.0*intz(3))
493  endif
494 
495  enddo ; enddo ; endif

◆ int_spec_vol_dp_linear()

subroutine, public mom_eos_linear::int_spec_vol_dp_linear ( real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(in)  T,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(in)  S,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(in)  p_t,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(in)  p_b,
real, intent(in)  alpha_ref,
type(hor_index_type), intent(in)  HI,
real, intent(in)  Rho_T0_S0,
real, intent(in)  dRho_dT,
real, intent(in)  dRho_dS,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(out)  dza,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(out), optional  intp_dza,
real, dimension(hi%isdb:hi%iedb,hi%jsd:hi%jed), intent(out), optional  intx_dza,
real, dimension(hi%isd:hi%ied,hi%jsdb:hi%jedb), intent(out), optional  inty_dza,
integer, intent(in), optional  halo_size,
real, dimension(hi%isd:hi%ied,hi%jsd:hi%jed), intent(in), optional  bathyP,
real, intent(in), optional  dP_neglect,
logical, intent(in), optional  useMassWghtInterp 
)

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. Specific volume is assumed to vary linearly between adjacent points.

Parameters
[in]hiThe ocean's horizontal index type.
[in]tPotential temperature relative to the surface
[in]sSalinity [PSU].
[in]p_tPressure at the top of the layer [Pa].
[in]p_bPressure at the top of the layer [Pa].
[in]alpha_refA mean specific volume that is subtracted out to reduce the magnitude of each of the integrals, m3 kg-1. The calculation is mathematically identical with different values of alpha_ref, but this reduces the effects of roundoff.
[in]rho_t0_s0The density at T=0, S=0 [kg m-3].
[in]drho_dtThe derivative of density with temperature [kg m-3 degC-1].
[in]drho_dsThe derivative of density with salinity, in [kg m-3 ppt-1].
[out]dzaThe change in the geopotential anomaly across
[out]intp_dzaThe integral in pressure through the layer of
[out]intx_dzaThe integral in x of the difference between the
[out]inty_dzaThe integral in y of the difference between the
[in]halo_sizeThe width of halo points on which to calculate dza.
[in]bathypThe pressure at the bathymetry [Pa]
[in]dp_neglectA miniscule pressure change with the same units as p_t [Pa]
[in]usemasswghtinterpIf true, uses mass weighting to interpolate T/S for top and bottom integrals.

Definition at line 505 of file MOM_EOS_linear.F90.

505  type(hor_index_type), intent(in) :: HI !< The ocean's horizontal index type.
506  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
507  intent(in) :: T !< Potential temperature relative to the surface
508  !! [degC].
509  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
510  intent(in) :: S !< Salinity [PSU].
511  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
512  intent(in) :: p_t !< Pressure at the top of the layer [Pa].
513  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
514  intent(in) :: p_b !< Pressure at the top of the layer [Pa].
515  real, intent(in) :: alpha_ref !< A mean specific volume that is subtracted out
516  !! to reduce the magnitude of each of the integrals, m3 kg-1. The calculation is
517  !! mathematically identical with different values of alpha_ref, but this reduces the
518  !! effects of roundoff.
519  real, intent(in) :: Rho_T0_S0 !< The density at T=0, S=0 [kg m-3].
520  real, intent(in) :: dRho_dT !< The derivative of density with temperature
521  !! [kg m-3 degC-1].
522  real, intent(in) :: dRho_dS !< The derivative of density with salinity,
523  !! in [kg m-3 ppt-1].
524  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
525  intent(out) :: dza !< The change in the geopotential anomaly across
526  !! the layer [m2 s-2].
527  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
528  optional, intent(out) :: intp_dza !< The integral in pressure through the layer of
529  !! the geopotential anomaly relative to the anomaly
530  !! at the bottom of the layer [Pa m2 s-2].
531  real, dimension(HI%IsdB:HI%IedB,HI%jsd:HI%jed), &
532  optional, intent(out) :: intx_dza !< The integral in x of the difference between the
533  !! geopotential anomaly at the top and bottom of
534  !! the layer divided by the x grid spacing
535  !! [m2 s-2].
536  real, dimension(HI%isd:HI%ied,HI%JsdB:HI%JedB), &
537  optional, intent(out) :: inty_dza !< The integral in y of the difference between the
538  !! geopotential anomaly at the top and bottom of
539  !! the layer divided by the y grid spacing
540  !! [m2 s-2].
541  integer, optional, intent(in) :: halo_size !< The width of halo points on which to calculate dza.
542  real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), &
543  optional, intent(in) :: bathyP !< The pressure at the bathymetry [Pa]
544  real, optional, intent(in) :: dP_neglect !< A miniscule pressure change with
545  !! the same units as p_t [Pa]
546  logical, optional, intent(in) :: useMassWghtInterp !< If true, uses mass weighting
547  !! to interpolate T/S for top and bottom integrals.
548  ! Local variables
549  real :: dRho_TS ! The density anomaly due to T and S [kg m-3].
550  real :: alpha_anom ! The specific volume anomaly from 1/rho_ref [m3 kg-1].
551  real :: aaL, aaR ! rho_anom to the left and right [kg m-3].
552  real :: dp, dpL, dpR ! Layer pressure thicknesses [Pa].
553  real :: hWght ! A pressure-thickness below topography [Pa].
554  real :: hL, hR ! Pressure-thicknesses of the columns to the left and right [Pa].
555  real :: iDenom ! The inverse of the denominator in the weights [Pa-2].
556  real :: hWt_LL, hWt_LR ! hWt_LA is the weighted influence of A on the left column [nondim].
557  real :: hWt_RL, hWt_RR ! hWt_RA is the weighted influence of A on the right column [nondim].
558  real :: wt_L, wt_R ! The linear weights of the left and right columns [nondim].
559  real :: wtT_L, wtT_R ! The weights for tracers from the left and right columns [nondim].
560  real :: intp(5) ! The integrals of specific volume with pressure at the
561  ! 5 sub-column locations [m2 s-2].
562  logical :: do_massWeight ! Indicates whether to do mass weighting.
563  real, parameter :: C1_6 = 1.0/6.0, c1_90 = 1.0/90.0 ! Rational constants.
564  integer :: Isq, Ieq, Jsq, Jeq, ish, ieh, jsh, jeh, i, j, m, halo
565 
566  isq = hi%IscB ; ieq = hi%IecB ; jsq = hi%JscB ; jeq = hi%JecB
567  halo = 0 ; if (present(halo_size)) halo = max(halo_size,0)
568  ish = hi%isc-halo ; ieh = hi%iec+halo ; jsh = hi%jsc-halo ; jeh = hi%jec+halo
569  if (present(intx_dza)) then ; ish = min(isq,ish) ; ieh = max(ieq+1,ieh); endif
570  if (present(inty_dza)) then ; jsh = min(jsq,jsh) ; jeh = max(jeq+1,jeh); endif
571 
572  do_massweight = .false.
573  if (present(usemasswghtinterp)) then ; if (usemasswghtinterp) then
574  do_massweight = .true.
575 ! if (.not.present(bathyP)) call MOM_error(FATAL, "int_spec_vol_dp_generic: "//&
576 ! "bathyP must be present if useMassWghtInterp is present and true.")
577 ! if (.not.present(dP_neglect)) call MOM_error(FATAL, "int_spec_vol_dp_generic: "//&
578 ! "dP_neglect must be present if useMassWghtInterp is present and true.")
579  endif ; endif
580 
581  do j=jsh,jeh ; do i=ish,ieh
582  dp = p_b(i,j) - p_t(i,j)
583  drho_ts = drho_dt*t(i,j) + drho_ds*s(i,j)
584  ! alpha_anom = 1.0/(Rho_T0_S0 + dRho_TS)) - alpha_ref
585  alpha_anom = ((1.0-rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
586  dza(i,j) = alpha_anom*dp
587  if (present(intp_dza)) intp_dza(i,j) = 0.5*alpha_anom*dp**2
588  enddo ; enddo
589 
590  if (present(intx_dza)) then ; do j=hi%jsc,hi%jec ; do i=isq,ieq
591  ! hWght is the distance measure by which the cell is violation of
592  ! hydrostatic consistency. For large hWght we bias the interpolation of
593  ! T & S along the top and bottom integrals, akin to thickness weighting.
594  hwght = 0.0
595  if (do_massweight) &
596  hwght = max(0., bathyp(i,j)-p_t(i+1,j), bathyp(i+1,j)-p_t(i,j))
597 
598  if (hwght <= 0.0) then
599  dpl = p_b(i,j) - p_t(i,j) ; dpr = p_b(i+1,j) - p_t(i+1,j)
600  drho_ts = drho_dt*t(i,j) + drho_ds*s(i,j)
601  aal = ((1.0 - rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
602  drho_ts = drho_dt*t(i+1,j) + drho_ds*s(i+1,j)
603  aar = ((1.0 - rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
604 
605  intx_dza(i,j) = c1_6 * (2.0*(dpl*aal + dpr*aar) + (dpl*aar + dpr*aal))
606  else
607  hl = (p_b(i,j) - p_t(i,j)) + dp_neglect
608  hr = (p_b(i+1,j) - p_t(i+1,j)) + dp_neglect
609  hwght = hwght * ( (hl-hr)/(hl+hr) )**2
610  idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
611  hwt_ll = (hwght*hl + hr*hl) * idenom ; hwt_lr = (hwght*hr) * idenom
612  hwt_rr = (hwght*hr + hr*hl) * idenom ; hwt_rl = (hwght*hl) * idenom
613 
614  intp(1) = dza(i,j) ; intp(5) = dza(i+1,j)
615  do m=2,4
616  wt_l = 0.25*real(5-m) ; wt_r = 1.0-wt_l
617  wtt_l = wt_l*hwt_ll + wt_r*hwt_rl ; wtt_r = wt_l*hwt_lr + wt_r*hwt_rr
618 
619  ! T, S, and p are interpolated in the horizontal. The p interpolation
620  ! is linear, but for T and S it may be thickness wekghted.
621  dp = wt_l*(p_b(i,j) - p_t(i,j)) + wt_r*(p_b(i+1,j) - p_t(i+1,j))
622 
623  drho_ts = drho_dt*(wtt_l*t(i,j) + wtt_r*t(i+1,j)) + &
624  drho_ds*(wtt_l*s(i,j) + wtt_r*s(i+1,j))
625  ! alpha_anom = 1.0/(Rho_T0_S0 + dRho_TS)) - alpha_ref
626  alpha_anom = ((1.0-rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
627  intp(m) = alpha_anom*dp
628  enddo
629  ! Use Bode's rule to integrate the interface height anomaly values in y.
630  intx_dza(i,j) = c1_90*(7.0*(intp(1)+intp(5)) + 32.0*(intp(2)+intp(4)) + &
631  12.0*intp(3))
632  endif
633  enddo ; enddo ; endif
634 
635  if (present(inty_dza)) then ; do j=jsq,jeq ; do i=hi%isc,hi%iec
636  ! hWght is the distance measure by which the cell is violation of
637  ! hydrostatic consistency. For large hWght we bias the interpolation of
638  ! T & S along the top and bottom integrals, akin to thickness weighting.
639  hwght = 0.0
640  if (do_massweight) &
641  hwght = max(0., bathyp(i,j)-p_t(i,j+1), bathyp(i,j+1)-p_t(i,j))
642 
643  if (hwght <= 0.0) then
644  dpl = p_b(i,j) - p_t(i,j) ; dpr = p_b(i,j+1) - p_t(i,j+1)
645  drho_ts = drho_dt*t(i,j) + drho_ds*s(i,j)
646  aal = ((1.0 - rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
647  drho_ts = drho_dt*t(i,j+1) + drho_ds*s(i,j+1)
648  aar = ((1.0 - rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
649 
650  inty_dza(i,j) = c1_6 * (2.0*(dpl*aal + dpr*aar) + (dpl*aar + dpr*aal))
651  else
652  hl = (p_b(i,j) - p_t(i,j)) + dp_neglect
653  hr = (p_b(i,j+1) - p_t(i,j+1)) + dp_neglect
654  hwght = hwght * ( (hl-hr)/(hl+hr) )**2
655  idenom = 1.0 / ( hwght*(hr + hl) + hl*hr )
656  hwt_ll = (hwght*hl + hr*hl) * idenom ; hwt_lr = (hwght*hr) * idenom
657  hwt_rr = (hwght*hr + hr*hl) * idenom ; hwt_rl = (hwght*hl) * idenom
658 
659  intp(1) = dza(i,j) ; intp(5) = dza(i,j+1)
660  do m=2,4
661  wt_l = 0.25*real(5-m) ; wt_r = 1.0-wt_l
662  wtt_l = wt_l*hwt_ll + wt_r*hwt_rl ; wtt_r = wt_l*hwt_lr + wt_r*hwt_rr
663 
664  ! T, S, and p are interpolated in the horizontal. The p interpolation
665  ! is linear, but for T and S it may be thickness wekghted.
666  dp = wt_l*(p_b(i,j) - p_t(i,j)) + wt_r*(p_b(i,j+1) - p_t(i,j+1))
667 
668  drho_ts = drho_dt*(wtt_l*t(i,j) + wtt_r*t(i,j+1)) + &
669  drho_ds*(wtt_l*s(i,j) + wtt_r*s(i,j+1))
670  ! alpha_anom = 1.0/(Rho_T0_S0 + dRho_TS)) - alpha_ref
671  alpha_anom = ((1.0-rho_t0_s0*alpha_ref) - drho_ts*alpha_ref) / (rho_t0_s0 + drho_ts)
672  intp(m) = alpha_anom*dp
673  enddo
674  ! Use Bode's rule to integrate the interface height anomaly values in y.
675  inty_dza(i,j) = c1_90*(7.0*(intp(1)+intp(5)) + 32.0*(intp(2)+intp(4)) + &
676  12.0*intp(3))
677  endif
678  enddo ; enddo ; endif

Referenced by mom_eos::int_specific_vol_dp().

Here is the caller graph for this function: