mom_spatial_means module reference

Functions and routines to take area, volume, mass-weighted, layerwise, zonal or meridional means.

More…

Functions/Subroutines

global_area_mean()

Return the global area mean of a variable.

global_area_mean_v()

Return the global area mean of a variable.

global_area_mean_u()

Return the global area mean of a variable on U grid.

global_area_integral()

Return the global area integral of a variable, by default using the masked area from the grid, but an alternate could be used instead.

global_layer_mean()

Return the layerwise global thickness-weighted mean of a variable.

global_volume_mean()

Find the global thickness-weighted mean of a variable.

global_mass_integral()

Find the global mass-weighted integral of a variable.

global_mass_int_efp()

Find the global mass-weighted order invariant integral of a variable in mks units, returning the value as an EFP_type.

global_i_mean()

Determine the global mean of a field along rows of constant i, returning it in a 1-d array using the local indexing.

global_j_mean()

Determine the global mean of a field along rows of constant j, returning it in a 1-d array using the local indexing.

adjust_area_mean_to_zero()

Adjust 2d array such that area mean is zero without moving the zero contour.

Detailed Description

Functions and routines to take area, volume, mass-weighted, layerwise, zonal or meridional means.

Function/Subroutine Documentation

function mom_spatial_means/global_area_mean(var, G, scale, tmp_scale) [real]

Return the global area mean of a variable. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • var :: [in] The variable to average in arbitrary, possibly rescaled units [A ~> a]

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A temporary rescaling factor for the variable that is reversed in the return value [a A-1 ~> 1]

Called from:

mom_generic_tracer::mom_generic_tracer_column_physics mom_generic_tracer::mom_generic_tracer_surface_state

function mom_spatial_means/global_area_mean_v(var, G, tmp_scale) [real]

Return the global area mean of a variable. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • var :: [in] The variable to average in arbitrary, possibly rescaled units [A ~> a]

  • tmp_scale :: [in] A temporary rescaling factor for the variable that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums [a A-1 ~> 1], but is reversed before output so that the return value has the same units as var

Called from:

mom_forcing_type::homogenize_field_v mom_forcing_type::homogenize_mech_forcing

function mom_spatial_means/global_area_mean_u(var, G, tmp_scale) [real]

Return the global area mean of a variable on U grid. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • var :: [in] The variable to average in arbitrary, possibly rescaled units [A ~> a]

  • tmp_scale :: [in] A temporary rescaling factor for the variable that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums [a A-1 ~> 1], but is reversed before output so that the return value has the same units as var

Called from:

mom_forcing_type::homogenize_field_u mom_forcing_type::homogenize_mech_forcing

function mom_spatial_means/global_area_integral(var, G, scale, area, tmp_scale) [real]

Return the global area integral of a variable, by default using the masked area from the grid, but an alternate could be used instead. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • var :: [in] The variable to integrate in arbitrary, possibly rescaled units [A ~> a]

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • area :: [in] The alternate area to use, including any required masking [L2 ~> m2].

  • tmp_scale :: [in] A temporary rescaling factor for the variable that is reversed in the return value [a A-1 ~> 1]

Return:

undefined :: The returned area integral, usually in the units of var times an area, [a m2] or [A m2 ~> a m2] depending on which optional arguments are provided

Called from:

mom_ice_shelf::add_shelf_flux mom_diagnostics::post_surface_thermo_diags mom_internal_tides::sum_en

function mom_spatial_means/global_layer_mean(var, h, G, GV, scale, tmp_scale) [real]

Return the layerwise global thickness-weighted mean of a variable. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • gv :: [in] The ocean’s vertical grid structure

  • var :: [in] The variable to average in arbitrary, possibly rescaled units [A ~> a]

  • h :: [in] Layer thicknesses [H ~> m or kg m-2]

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A temporary rescaling factor for the variable that is reversed in the return value [a A-1 ~> 1]

Return:

undefined :: The mean of the variable in the arbitrary scaled [A] or unscaled [a] units of var, depending on which optional arguments are provided

function mom_spatial_means/global_volume_mean(var, h, G, GV, scale, tmp_scale) [real]

Find the global thickness-weighted mean of a variable. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • gv :: [in] The ocean’s vertical grid structure

  • var :: [in] The variable being averaged in

  • h :: [in] Layer thicknesses [H ~> m or kg m-2]

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A temporary rescaling factor for the variable that is reversed in the return value [a A-1 ~> 1]

Return:

undefined :: The thickness-weighted average of var in the arbitrary scaled [A] or unscaled [a] units of var, depending on which optional arguments are provided

Called from:

mom_diagnostics::calculate_diagnostic_fields

function mom_spatial_means/global_mass_integral(h, G, GV, var, on_PE_only, scale, tmp_scale) [real]

Find the global mass-weighted integral of a variable. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • gv :: [in] The ocean’s vertical grid structure

  • h :: [in] Layer thicknesses [H ~> m or kg m-2]

  • var :: [in] The variable being integrated in

  • on_pe_only :: [in] If present and true, the sum is only done on the local PE, and it is not order invariant.

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A temporary rescaling factor for the variable that is reversed in the return value [a A-1 ~> 1]

Return:

undefined :: The mass-weighted integral of var (or 1) in kg times the arbitrary units of var [kg a] or [kg A ~> kg a]

Called from:

mom::get_ocean_stocks mom_hor_bnd_diffusion::hor_bnd_diffusion

function mom_spatial_means/global_mass_int_efp(h, G, GV, var, on_PE_only, scale) [type(efp_type)]

Find the global mass-weighted order invariant integral of a variable in mks units, returning the value as an EFP_type. This uses reproducing sums.

Parameters:
  • g :: [in] The ocean’s grid structure

  • gv :: [in] The ocean’s vertical grid structure

  • h :: [in] Layer thicknesses [H ~> m or kg m-2]

  • var :: [in] The variable being integrated in

  • on_pe_only :: [in] If present and true, the sum is only done on the local PE, but it is still order invariant.

  • scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

Return:

undefined :: The mass-weighted integral of var (or 1) in kg times the arbitrary units of var [kg a]

Called from:

advection_test_tracer::advection_test_stock boundary_impulse_tracer::boundary_impulse_stock mom_cfc_cap::cfc_cap_stock regional_dyes::dye_stock ideal_age_example::ideal_age_stock mom_generic_tracer::mom_generic_tracer_stock mom_ocmip2_cfc::ocmip2_cfc_stock oil_tracer::oil_stock pseudo_salt_tracer::pseudo_salt_stock user_tracer_example::user_tracer_stock

subroutine mom_spatial_means/global_i_mean(array, i_mean, G, mask, scale, tmp_scale)

Determine the global mean of a field along rows of constant i, returning it in a 1-d array using the local indexing. This uses reproducing sums.

Parameters:
  • g :: [inout] The ocean’s grid structure

  • array :: [in] The variable being averaged in arbitrary, possibly rescaled units [A ~> a]

  • i_mean :: [out] Global mean of array along its i-axis [a] or [A ~> a]

  • mask :: [in] An array used for weighting the i-mean [nondim]

  • scale :: [in] A rescaling factor for the output variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A rescaling factor for the internal calculations that is removed from the output [a A-1 ~> 1]

Call to:

mom_error_handler::mom_error mom_coms::query_efp_overflow_error mom_coms::reset_efp_overflow_error

Called from:

mom_sponge::apply_sponge

subroutine mom_spatial_means/global_j_mean(array, j_mean, G, mask, scale, tmp_scale)

Determine the global mean of a field along rows of constant j, returning it in a 1-d array using the local indexing. This uses reproducing sums.

Parameters:
  • g :: [inout] The ocean’s grid structure

  • array :: [in] The variable being averaged in arbitrary, possibly rescaled units [A ~> a]

  • j_mean :: [out] Global mean of array along its j-axis [a] or [A ~> a]

  • mask :: [in] An array used for weighting the j-mean [nondim]

  • scale :: [in] A rescaling factor for the output variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

  • tmp_scale :: [in] A rescaling factor for the internal calculations that is removed from the output [a A-1 ~> 1]

Call to:

mom_error_handler::mom_error mom_coms::query_efp_overflow_error mom_coms::reset_efp_overflow_error

subroutine mom_spatial_means/adjust_area_mean_to_zero(array, G, scaling, unit_scale)

Adjust 2d array such that area mean is zero without moving the zero contour.

Parameters:
  • g :: [in] Grid structure

  • array :: [inout] 2D array to be adjusted in arbitrary, possibly rescaled units [A ~> a]

  • scaling :: [out] The scaling factor used [nondim]

  • unit_scale :: [in] A rescaling factor for the variable [a A-1 ~> 1] that converts it back to unscaled (e.g., mks) units to enable the use of the reproducing sums

Called from:

mom_surface_forcing_gfdl::convert_iob_to_fluxes