MOM_neutral_diffusion module reference

A column-wise toolbox for implementing neutral diffusion

Data Types

neutral_diffusion_CS

The control structure for the MOM_neutral_diffusion module

Functions/Subroutines

neutral_diffusion_init

Read parameters and allocate control structure for neutral_diffusion module.

neutral_diffusion_calc_coeffs

Calculate remapping factors for u/v columns used to map adjoining columns to a shared coordinate space.

neutral_diffusion

Update tracer concentration due to neutral diffusion; layer thickness unchanged by this update.

compute_tapering_coeffs

Computes linear tapering coefficients at interfaces of the left and right columns within a region defined by the boundary layer depths in the two columns.

interface_scalar

Returns interface scalar, Si, for a column of layer values, S.

ppm_edge

Returns the PPM quasi-fourth order edge value at k+1/2 following equation 1.6 in Colella & Woodward, 1984: JCP 54, 174-201. The returned units are the same as those of Ak (e.g. [C ~> degC] for temperature).

ppm_ave

Returns the average of a PPM reconstruction between two fractional positions in the same arbitrary concentration units as aMean (e.g. usually [C ~> degC] for temperature)

signum

A true signum function that returns either -abs(a), when x<0; or abs(a) when x>0; or 0 when x=0. The returned units are the same as those of a [arbitrary].

PLM_diff

Returns PLM slopes for a column where the slopes are the difference in value across each cell. The limiting follows equation 1.8 in Colella & Woodward, 1984: JCP 54, 174-201.

fv_diff

Returns the cell-centered second-order finite volume (unlimited PLM) slope using three consecutive cell widths and average values. Slope is returned as a difference across the central cell (i.e. units of scalar S, e.g. [C ~> degC] for temperature). Discretization follows equation 1.7 in Colella & Woodward, 1984: JCP 54, 174-201.

fvlsq_slope

Returns the cell-centered second-order weighted least squares slope using three consecutive cell widths and average values. Slope is returned as a gradient (i.e. units of scalar S over width units). For example, for temperature fvlsq_slope would usually be returned in units of [C H-1 ~> degC m-1 or degC m2 kg-1].

find_neutral_surface_positions_continuous

Returns positions within left/right columns of combined interfaces using continuous reconstructions of T/S

interpolate_for_nondim_position

Returns the non-dimensional position between Pneg and Ppos where the interpolated density difference equals zero [nondim]. The result is always bounded to be between 0 and 1.

find_neutral_surface_positions_discontinuous

Higher order version of find_neutral_surface_positions. Returns positions within left/right columns of combined interfaces using intracell reconstructions of T/S. Note that the polynomial reconstructions of T and S are optional to aid with unit testing, but will always be passed otherwise

mark_unstable_cells

Sweep down through the column and mark as stable if the bottom interface of a cell is denser than the top

search_other_column

Searches the "other" (searched) column for the position of the neutral surface, returning the fractional postion within the layer [nondim]

increment_interface

Increments the interface which was just connected and also set flags if the bottom is reached

find_neutral_pos_linear

Search a layer to find where delta_rho = 0 based on a linear interpolation of alpha and beta of the top and bottom being searched and polynomial reconstructions of T and S. Compressibility is not needed because either, we are assuming incompressibility in the equation of state for this module or alpha and beta are calculated having been displaced to the average pressures of the two pressures We need Newton's method because the T and S reconstructions make delta_rho a polynomial function of z if using PPM or higher. If Newton's method would search fall out of the interval [0,1], a bisection step would be taken instead. Also this linearization of alpha, beta means that second derivatives of the EOS are not needed. Note that delta in variable names below refers to horizontal differences and 'd' refers to vertical differences

find_neutral_pos_full

Use the full equation of state to calculate the difference in locally referenced potential density. The derivatives in this case are not trivial to calculate, so instead we use a regula falsi method

calc_delta_rho_and_derivs

Calculate the difference in density between two points in a variety of ways

delta_rho_from_derivs

Calculate delta rho from derivatives and gradients of properties \(\Delta \rho = \frac{1}{2}\left[ (\alpha_1 + \alpha_2)*(T_1-T_2) + (\beta_1 + \beta_2)*(S_1-S_2) + (\gamma^{-1}_1 + \gamma^{-1}_2)*(P_1-P_2) \right]\)

absolute_position

Converts non-dimensional position within a layer to absolute position (for debugging)

absolute_positions

Converts non-dimensional positions within layers to absolute positions (for debugging)

neutral_surface_flux

Returns a single column of neutral diffusion fluxes of a tracer.

neutral_surface_T_eval

Evaluate various parts of the reconstructions to calculate gradient-based flux limiter

ppm_left_right_edge_values

Discontinuous PPM reconstructions of the left/right edge values within a cell

neutral_diffusion_unit_tests

Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.

ndiff_unit_tests_continuous

Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.

ndiff_unit_tests_discontinuous

test_fv_diff

Returns true if a test of fv_diff() fails, and conditionally writes results to stream

test_fvlsq_slope

Returns true if a test of fvlsq_slope() fails, and conditionally writes results to stream

test_ifndp

Returns true if a test of interpolate_for_nondim_position() fails, and conditionally writes results to stream

test_data1d

Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream

test_data1di

Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream

test_nsp

Returns true if output of find_neutral_surface_positions() does not match correct values, and conditionally writes results to stream

compare_nsp_row

Compares a single row, k, of output from find_neutral_surface_positions()

test_rnp

Compares output position from refine_nondim_position with an expected value

neutral_diffusion_end

Deallocates neutral_diffusion control structure

Type Documentation

type, public :: neutral_diffusion_CS

The control structure for the MOM_neutral_diffusion module

Parameters
  • nkp1

    Number of interfaces for a column = nk + 1

  • nsurf

    Number of neutral surfaces

  • deg

    Degree of polynomial used for reconstructions

  • continuous_reconstruction

    True if using continuous PPM reconstruction at interfaces

  • debug

    If true, write verbose debugging messages

  • hard_fail_heff

    Bring down the model if a problem with heff is detected

  • max_iter

    Maximum number of iterations if refine_position is defined

  • drho_tol

    Convergence criterion representing density difference from true neutrality [R ~> kg m-3]

  • x_tol

    Convergence criterion for how small an update of the position can be [nondim]

  • ref_pres

    Reference pressure, negative if using locally referenced neutral density [R L2 T-2 ~> Pa]

  • interior_only

    If true, only applies neutral diffusion in the ocean interior. That is, the algorithm will exclude the surface and bottom boundary layers.

  • tapering

    If true, neutral diffusion linearly decays towards zero within a transition zone defined using boundary layer depths. Only available when interior_only=true.

  • KhTh_use_vert_struct

    If true, uses vertical structure for tracer diffusivity.

  • use_unmasked_transport_bug

    If true, use an older form for the accumulation of neutral-diffusion transports that were unmasked, as used prior to Jan 2018.

  • hbl

    Boundary layer depth [H ~> m or kg m-2]

  • coeff_l

    Non-dimensional coefficient in the left column, at cell interfaces [nondim]

  • coeff_r

    Non-dimensional coefficient in the right column, at cell interfaces [nondim]

  • Coef_h

    Coef_x and Coef_y averaged at t-points [L2 ~> m2]

  • uPoL

    Non-dimensional position with left layer uKoL-1, u-point [nondim]

  • uPoR

    Non-dimensional position with right layer uKoR-1, u-point [nondim]

  • uKoL

    Index of left interface corresponding to neutral surface, at a u-point

  • uKoR

    Index of right interface corresponding to neutral surface, at a u-point

  • uHeff

    Effective thickness at u-point [H ~> m or kg m-2]

  • vPoL

    Non-dimensional position with left layer uKoL-1, v-point [nondim]

  • vPoR

    Non-dimensional position with right layer uKoR-1, v-point [nondim]

  • vKoL

    Index of left interface corresponding to neutral surface, at a v-point

  • vKoR

    Index of right interface corresponding to neutral surface, at a v-point

  • vHeff

    Effective thickness at v-point [H ~> m or kg m-2]

  • ppoly_coeffs_T

    Polynomial coefficients of the sub-gridscale temperatures [C ~> degC]

  • ppoly_coeffs_S

    Polynomial coefficients of the sub-gridscale salinity [S ~> ppt]

  • dRdT

    dRho/dT [R C-1 ~> kg m-3 degC-1] at interfaces

  • dRdS

    dRho/dS [R S-1 ~> kg m-3 ppt-1] at interfaces

  • Tint

    Interface T [C ~> degC]

  • Sint

    Interface S [S ~> ppt]

  • Pint

    Interface pressure [R L2 T-2 ~> Pa]

  • T_i

    Top edge reconstruction of temperature [C ~> degC]

  • S_i

    Top edge reconstruction of salinity [S ~> ppt]

  • P_i

    Interface pressures [R L2 T-2 ~> Pa]

  • dRdT_i

    dRho/dT [R C-1 ~> kg m-3 degC-1] at top edge

  • dRdS_i

    dRho/dS [R S-1 ~> kg m-3 ppt-1] at top edge

  • ns

    Number of interfaces in a column

  • stable_cell

    True if the cell is stably stratified wrt to the next cell

  • R_to_kg_m3

    A rescaling factor translating density to kg m-3 for use in diagnostic messages [kg m-3 R-1 ~> 1].

  • diag

    A structure that is used to regulate the timing of diagnostic output.

  • neutral_pos_method

    Method to find the position of a neutral surface within the layer

  • delta_rho_form

    Determine which (if any) approximation is made to the equation describing the difference in density

  • id_uhEff_2d

    Diagnostic IDs

  • id_vhEff_2d

    Diagnostic IDs

  • EOS

    Equation of state parameters

  • remap_CS

    Remapping control structure used to create sublayers

  • remap_answer_date

    The vintage of the order of arithmetic and expressions to use for remapping. Values below 20190101 recover the remapping answers from 2018, while higher values use more robust forms of the same remapping expressions.

  • ndiff_answer_date

    The vintage of the order of arithmetic to use for the neutral diffusion. Values of 20240330 or below recover the answers from the original form of this code, while higher values use mathematically equivalent expressions that recover rotational symmetry.

  • KPP_CSp

    KPP control structure needed to get BLD

  • energetic_PBL_CSp

    ePBL control structure needed to get MLD

Functions/Subroutine Documentation

logical function neutral_diffusion_init(Time, G, GV, US, param_file, diag, EOS, diabatic_CSp, CS)

Read parameters and allocate control structure for neutral_diffusion module.

Parameters
  • Time [in]

    Time structure

  • G [in]

    Grid structure

  • GV [in]

    The ocean's vertical grid structure

  • US [in]

    A dimensional unit scaling type

  • diag [inout]

    Diagnostics control structure

  • param_file [in]

    Parameter file structure

  • EOS [in]

    Equation of state

  • diabatic_CSp

    diabatic control structure needed to get BLD

  • CS

    Neutral diffusion control structure

  • boundary_extrap

    extrapolation should be used within boundary cells.

Callees call graph
Callees of mom_neutral_diffusion::neutral_diffusion_init calls cluster_mom_diabatic_driver MOM_diabatic_driver cluster_mom_error_handler MOM_error_handler cluster_mom_file_parser MOM_file_parser cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_remapping MOM_remapping mom_diabatic_driver::extract_diabatic_member extract_diabatic_member mom_error_handler::mom_error MOM_error mom_file_parser::interface::get_param get_param (interface) mom_file_parser::interface::log_version log_version (interface) mom_neutral_diffusion::neutral_diffusion_init neutral_diffusion_init mom_neutral_diffusion::neutral_diffusion_init->mom_diabatic_driver::extract_diabatic_member mom_neutral_diffusion::neutral_diffusion_init->mom_error_handler::mom_error mom_neutral_diffusion::neutral_diffusion_init->mom_file_parser::interface::get_param mom_neutral_diffusion::neutral_diffusion_init->mom_file_parser::interface::log_version mom_remapping::extract_member_remapping_cs extract_member_remapping_CS mom_neutral_diffusion::neutral_diffusion_init->mom_remapping::extract_member_remapping_cs mom_remapping::initialize_remapping initialize_remapping mom_neutral_diffusion::neutral_diffusion_init->mom_remapping::initialize_remapping
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_diffusion_init calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_neutral_diffusion::neutral_diffusion_init neutral_diffusion_init mom_tracer_hor_diff::tracer_hor_diff_init tracer_hor_diff_init mom_tracer_hor_diff::tracer_hor_diff_init->mom_neutral_diffusion::neutral_diffusion_init
Text view
subroutine neutral_diffusion_calc_coeffs(G, GV, US, h, T, S, visc, CS, p_surf)

Calculate remapping factors for u/v columns used to map adjoining columns to a shared coordinate space.

Parameters
  • G [in]

    Ocean grid structure

  • GV [in]

    ocean vertical grid structure

  • US [in]

    A dimensional unit scaling type

  • h [in]

    Layer thickness [H ~> m or kg m-2]

  • T [in]

    Potential temperature [C ~> degC]

  • S [in]

    Salinity [S ~> ppt]

  • visc [in]

    Structure with vertical viscosities, boundary layer properties and related fields

  • CS

    Neutral diffusion control structure

  • p_surf [in]

    Surface pressure to include in pressures used for equation of state calculations [R L2 T-2 ~> Pa]

Callees call graph
Callees of mom_neutral_diffusion::neutral_diffusion_calc_coeffs calls cluster_mom_diag_mediator MOM_diag_mediator cluster_mom_domain_infra MOM_domain_infra cluster_mom_eos MOM_EOS cluster_mom_error_handler MOM_error_handler cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_remapping MOM_remapping cluster_polynomial_functions polynomial_functions mom_diag_mediator::interface::post_data post_data (interface) mom_domain_infra::interface::pass_var pass_var (interface) mom_eos::eos_domain EOS_domain mom_eos::interface::calculate_density_derivs calculate_density_derivs (interface) mom_error_handler::mom_error MOM_error mom_hor_bnd_diffusion::boundary_k_range boundary_k_range mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::mark_unstable_cells mark_unstable_cells [private/internal] mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_diag_mediator::interface::post_data mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_domain_infra::interface::pass_var mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_eos::eos_domain mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_eos::interface::calculate_density_derivs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_error_handler::mom_error mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_hor_bnd_diffusion::boundary_k_range mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::find_neutral_surface_positions_continuous mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::find_neutral_surface_positions_discontinuous mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::interface_scalar mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::mark_unstable_cells mom_remapping::build_reconstructions_1d build_reconstructions_1d mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_remapping::build_reconstructions_1d polynomial_functions::evaluation_polynomial evaluation_polynomial mom_neutral_diffusion::neutral_diffusion_calc_coeffs->polynomial_functions::evaluation_polynomial
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_diffusion_calc_coeffs calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_tracer_hor_diff::tracer_hordiff tracer_hordiff mom_tracer_hor_diff::tracer_hordiff->mom_neutral_diffusion::neutral_diffusion_calc_coeffs
Text view
subroutine neutral_diffusion(G, GV, h, Coef_x, Coef_y, dt, Reg, US, CS)

Update tracer concentration due to neutral diffusion; layer thickness unchanged by this update.

Parameters
  • G [in]

    Ocean grid structure

  • GV [in]

    ocean vertical grid structure

  • h [in]

    Layer thickness [H ~> m or kg m-2]

  • Coef_x [in]

    dt * Kh * dy / dx at u-points [L2 ~> m2]

  • Coef_y [in]

    dt * Kh * dx / dy at v-points [L2 ~> m2]

  • dt [in]

    Tracer time step * I_numitts [T ~> s] (I_numitts is in tracer_hordiff)

  • Reg

    Tracer registry

  • US [in]

    A dimensional unit scaling type

  • CS

    Neutral diffusion control structure

Callees call graph
Callees of mom_neutral_diffusion::neutral_diffusion calls cluster_mom_diag_mediator MOM_diag_mediator cluster_mom_domain_infra MOM_domain_infra cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_diag_mediator::interface::post_data post_data (interface) mom_domain_infra::interface::pass_var pass_var (interface) mom_neutral_diffusion::compute_tapering_coeffs compute_tapering_coeffs [private/internal] mom_neutral_diffusion::neutral_diffusion neutral_diffusion mom_neutral_diffusion::neutral_diffusion->mom_diag_mediator::interface::post_data mom_neutral_diffusion::neutral_diffusion->mom_domain_infra::interface::pass_var mom_neutral_diffusion::neutral_diffusion->mom_neutral_diffusion::compute_tapering_coeffs mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::neutral_diffusion->mom_neutral_diffusion::neutral_surface_flux
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_diffusion calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_neutral_diffusion::neutral_diffusion neutral_diffusion mom_tracer_hor_diff::tracer_hordiff tracer_hordiff mom_tracer_hor_diff::tracer_hordiff->mom_neutral_diffusion::neutral_diffusion
Text view
subroutine compute_tapering_coeffs(ne, bld_l, bld_r, coeff_l, coeff_r, h_l, h_r)

Computes linear tapering coefficients at interfaces of the left and right columns within a region defined by the boundary layer depths in the two columns.

Parameters
  • ne [in]

    Number of interfaces

  • bld_l [in]

    Boundary layer depth, left column [H ~> m or kg m-2]

  • bld_r [in]

    Boundary layer depth, right column [H ~> m or kg m-2]

  • h_l [in]

    Layer thickness, left column [H ~> m or kg m-2]

  • h_r [in]

    Layer thickness, right column [H ~> m or kg m-2]

  • coeff_l [inout]

    Tapering coefficient, left column [nondim]

  • coeff_r [inout]

    Tapering coefficient, right column [nondim]

Callees call graph
Callees of mom_neutral_diffusion::compute_tapering_coeffs calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_hor_bnd_diffusion::boundary_k_range boundary_k_range mom_neutral_diffusion::compute_tapering_coeffs compute_tapering_coeffs [private/internal] mom_neutral_diffusion::compute_tapering_coeffs->mom_hor_bnd_diffusion::boundary_k_range
Text view
Callers call graph
Callers of mom_neutral_diffusion::compute_tapering_coeffs calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::compute_tapering_coeffs compute_tapering_coeffs [private/internal] mom_neutral_diffusion::neutral_diffusion neutral_diffusion mom_neutral_diffusion::neutral_diffusion->mom_neutral_diffusion::compute_tapering_coeffs
Text view
subroutine interface_scalar(nk, h, S, Si, i_method, h_neglect)

Returns interface scalar, Si, for a column of layer values, S.

Parameters
  • nk [in]

    Number of levels

  • h [in]

    Layer thickness [H ~> m or kg m-2]

  • S [in]

    Layer scalar (or concentrations) in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Si [inout]

    Interface scalar (or concentrations) in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • i_method [in]

    =1 use average of PLM edges =2 use continuous PPM edge interpolation

  • h_neglect [in]

    A negligibly small thickness [H ~> m or kg m-2]

Callees call graph
Callees of mom_neutral_diffusion::interface_scalar calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::interface_scalar->mom_neutral_diffusion::plm_diff mom_neutral_diffusion::ppm_edge ppm_edge [private/internal] mom_neutral_diffusion::interface_scalar->mom_neutral_diffusion::ppm_edge
Text view
Callers call graph
Callers of mom_neutral_diffusion::interface_scalar calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::interface_scalar mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::interface_scalar mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::interface_scalar
Text view
real function ppm_edge(hkm1, hk, hkp1, hkp2, Ak, Akp1, Pk, Pkp1, h_neglect)

Returns the PPM quasi-fourth order edge value at k+1/2 following equation 1.6 in Colella & Woodward, 1984: JCP 54, 174-201. The returned units are the same as those of Ak (e.g. [C ~> degC] for temperature).

Parameters
  • hkm1 [in]

    Width of cell k-1 in [H ~> m or kg m-2] or other units

  • hk [in]

    Width of cell k in [H ~> m or kg m-2] or other units

  • hkp1 [in]

    Width of cell k+1 in [H ~> m or kg m-2] or other units

  • hkp2 [in]

    Width of cell k+2 in [H ~> m or kg m-2] or other units

  • Ak [in]

    Average scalar value of cell k in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Akp1 [in]

    Average scalar value of cell k+1 in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Pk [in]

    PLM slope for cell k in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Pkp1 [in]

    PLM slope for cell k+1 in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • h_neglect [in]

    A negligibly small thickness [H ~> m or kg m-2]

Callers call graph
Callers of mom_neutral_diffusion::ppm_edge calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::ppm_edge ppm_edge [private/internal] mom_neutral_diffusion::interface_scalar->mom_neutral_diffusion::ppm_edge
Text view
real function ppm_ave(xL, xR, aL, aR, aMean)

Returns the average of a PPM reconstruction between two fractional positions in the same arbitrary concentration units as aMean (e.g. usually [C ~> degC] for temperature)

Parameters
  • xL [in]

    Fraction position of left bound (0,1) [nondim]

  • xR [in]

    Fraction position of right bound (0,1) [nondim]

  • aL [in]

    Left edge scalar value, at x=0, in arbitrary concentration units (e.g. usually [C ~> degC] for temperature)

  • aR [in]

    Right edge scalar value, at x=1 in arbitrary concentration units (e.g. usually [C ~> degC] for temperature)

  • aMean [in]

    Average scalar value of cell in arbitrary concentration units (e.g. usually [C ~> degC] for temperature)

Callers call graph
Callers of mom_neutral_diffusion::ppm_ave calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::ppm_ave ppm_ave [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::ppm_ave
Text view
real function signum(a, x)

A true signum function that returns either -abs(a), when x<0; or abs(a) when x>0; or 0 when x=0. The returned units are the same as those of a [arbitrary].

Parameters
  • a [in]

    The magnitude argument in arbitrary units [arbitrary]

  • x [in]

    The sign (or zero) argument [arbitrary]

Callers call graph
Callers of mom_neutral_diffusion::signum calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::signum signum [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::signum mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::signum mom_neutral_diffusion::ppm_left_right_edge_values ppm_left_right_edge_values [private/internal] mom_neutral_diffusion::ppm_left_right_edge_values->mom_neutral_diffusion::signum
Text view
subroutine PLM_diff(nk, h, S, c_method, b_method, diff)

Returns PLM slopes for a column where the slopes are the difference in value across each cell. The limiting follows equation 1.8 in Colella & Woodward, 1984: JCP 54, 174-201.

Parameters
  • nk [in]

    Number of levels

  • h [in]

    Layer thickness [H ~> m or kg m-2] or other units

  • S [in]

    Layer salinity (conc, e.g. ppt) or other tracer concentration in arbitrary units [A ~> a]

  • c_method [in]

    Method to use for the centered difference

  • b_method [in]

    =1, use PCM in first/last cell, =2 uses linear extrapolation

  • diff [inout]

    Scalar difference across layer (conc, e.g. ppt) in the same arbitrary units as S [A ~> a], determined by the following values for c_method:

    1. Second order finite difference (not recommended)

    2. Second order finite volume (used in original PPM)

    3. Finite-volume weighted least squares linear fit

    Todo: The use of c_method to choose a scheme is inefficient and should eventually be moved up the call tree.

Callees call graph
Callees of mom_neutral_diffusion::plm_diff calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::fv_diff fv_diff [private/internal] mom_neutral_diffusion::fvlsq_slope fvlsq_slope [private/internal] mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::fv_diff mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::fvlsq_slope mom_neutral_diffusion::signum signum [private/internal] mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::signum
Text view
Callers call graph
Callers of mom_neutral_diffusion::plm_diff calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::interface_scalar->mom_neutral_diffusion::plm_diff
Text view
real function fv_diff(hkm1, hk, hkp1, Skm1, Sk, Skp1)

Returns the cell-centered second-order finite volume (unlimited PLM) slope using three consecutive cell widths and average values. Slope is returned as a difference across the central cell (i.e. units of scalar S, e.g. [C ~> degC] for temperature). Discretization follows equation 1.7 in Colella & Woodward, 1984: JCP 54, 174-201.

Parameters
  • hkm1 [in]

    Left cell width [H ~> m or kg m-2] or other arbitrary units

  • hk [in]

    Center cell width [H ~> m or kg m-2] or other arbitrary units

  • hkp1 [in]

    Right cell width [H ~> m or kg m-2] or other arbitrary units

  • Skm1 [in]

    Left cell average value in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Sk [in]

    Center cell average value in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Skp1 [in]

    Right cell average value in arbitrary concentration units (e.g. [C ~> degC] for temperature)

Callers call graph
Callers of mom_neutral_diffusion::fv_diff calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::fv_diff fv_diff [private/internal] mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::fv_diff mom_neutral_diffusion::test_fv_diff test_fv_diff [private/internal] mom_neutral_diffusion::test_fv_diff->mom_neutral_diffusion::fv_diff
Text view
real function fvlsq_slope(hkm1, hk, hkp1, Skm1, Sk, Skp1)

Returns the cell-centered second-order weighted least squares slope using three consecutive cell widths and average values. Slope is returned as a gradient (i.e. units of scalar S over width units). For example, for temperature fvlsq_slope would usually be returned in units of [C H-1 ~> degC m-1 or degC m2 kg-1].

Parameters
  • hkm1 [in]

    Left cell width [H ~> m or kg m-2] or other arbitrary units

  • hk [in]

    Center cell width [H ~> m or kg m-2] or other arbitrary units

  • hkp1 [in]

    Right cell width [H ~> m or kg m-2] or other arbitrary units

  • Skm1 [in]

    Left cell average value in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Sk [in]

    Center cell average value often in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Skp1 [in]

    Right cell average value often in arbitrary concentration units (e.g. [C ~> degC] for temperature)

Callers call graph
Callers of mom_neutral_diffusion::fvlsq_slope calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::fvlsq_slope fvlsq_slope [private/internal] mom_neutral_diffusion::plm_diff PLM_diff [private/internal] mom_neutral_diffusion::plm_diff->mom_neutral_diffusion::fvlsq_slope mom_neutral_diffusion::test_fvlsq_slope test_fvlsq_slope [private/internal] mom_neutral_diffusion::test_fvlsq_slope->mom_neutral_diffusion::fvlsq_slope
Text view
subroutine find_neutral_surface_positions_continuous(nk, Pl, Tl, Sl, dRdTl, dRdSl, Pr, Tr, Sr, dRdTr, dRdSr, PoL, PoR, KoL, KoR, hEff, bl_kl, bl_kr, bl_zl, bl_zr)

Returns positions within left/right columns of combined interfaces using continuous reconstructions of T/S

Parameters
  • nk [in]

    Number of levels

  • Pl [in]

    Left-column interface pressure [R L2 T-2 ~> Pa] or other units

  • Tl [in]

    Left-column interface potential temperature [C ~> degC]

  • Sl [in]

    Left-column interface salinity [S ~> ppt]

  • dRdTl [in]

    Left-column dRho/dT [R C-1 ~> kg m-3 degC-1]

  • dRdSl [in]

    Left-column dRho/dS [R S-1 ~> kg m-3 ppt-1]

  • Pr [in]

    Right-column interface pressure [R L2 T-2 ~> Pa] or other units

  • Tr [in]

    Right-column interface potential temperature [C ~> degC]

  • Sr [in]

    Right-column interface salinity [S ~> ppt]

  • dRdTr [in]

    Left-column dRho/dT [R C-1 ~> kg m-3 degC-1]

  • dRdSr [in]

    Left-column dRho/dS [R S-1 ~> kg m-3 ppt-1]

  • PoL [inout]

    Fractional position of neutral surface within layer KoL of left column [nondim]

  • PoR [inout]

    Fractional position of neutral surface within layer KoR of right column [nondim]

  • KoL [inout]

    Index of first left interface above neutral surface

  • KoR [inout]

    Index of first right interface above neutral surface

  • hEff [inout]

    Effective thickness between two neutral surfaces [R L2 T-2 ~> Pa] or other units following Pl and Pr.

  • bl_kl [in]

    Layer index of the boundary layer (left)

  • bl_kr [in]

    Layer index of the boundary layer (right)

  • bl_zl [in]

    Fractional position of the boundary layer (left) [nondim]

  • bl_zr [in]

    Fractional position of the boundary layer (right) [nondim]

Callees call graph
Callees of mom_neutral_diffusion::find_neutral_surface_positions_continuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::absolute_position absolute_position [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous->mom_neutral_diffusion::absolute_position mom_neutral_diffusion::interpolate_for_nondim_position interpolate_for_nondim_position [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous->mom_neutral_diffusion::interpolate_for_nondim_position
Text view
Callers call graph
Callers of mom_neutral_diffusion::find_neutral_surface_positions_continuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::find_neutral_surface_positions_continuous mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::find_neutral_surface_positions_continuous
Text view
real function interpolate_for_nondim_position(dRhoNeg, Pneg, dRhoPos, Ppos)

Returns the non-dimensional position between Pneg and Ppos where the interpolated density difference equals zero [nondim]. The result is always bounded to be between 0 and 1.

Parameters
  • dRhoNeg [in]

    Negative density difference [R ~> kg m-3]

  • Pneg [in]

    Position of negative density difference [R L2 T-2 ~> Pa] or [nondim]

  • dRhoPos [in]

    Positive density difference [R ~> kg m-3]

  • Ppos [in]

    Position of positive density difference [R L2 T-2 ~> Pa] or [nondim]

Callees call graph
Callees of mom_neutral_diffusion::interpolate_for_nondim_position calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_error_handler::mom_error MOM_error mom_neutral_diffusion::interpolate_for_nondim_position interpolate_for_nondim_position [private/internal] mom_neutral_diffusion::interpolate_for_nondim_position->mom_error_handler::mom_error
Text view
Callers call graph
Callers of mom_neutral_diffusion::interpolate_for_nondim_position calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::interpolate_for_nondim_position interpolate_for_nondim_position [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous->mom_neutral_diffusion::interpolate_for_nondim_position mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::interpolate_for_nondim_position mom_neutral_diffusion::test_ifndp test_ifndp [private/internal] mom_neutral_diffusion::test_ifndp->mom_neutral_diffusion::interpolate_for_nondim_position
Text view
subroutine find_neutral_surface_positions_discontinuous(CS, nk, Pres_l, hcol_l, Tl, Sl, ppoly_T_l, ppoly_S_l, stable_l, Pres_r, hcol_r, Tr, Sr, ppoly_T_r, ppoly_S_r, stable_r, PoL, PoR, KoL, KoR, hEff, zeta_bot_L, zeta_bot_R, k_bot_L, k_bot_R, hard_fail_heff)

Higher order version of find_neutral_surface_positions. Returns positions within left/right columns of combined interfaces using intracell reconstructions of T/S. Note that the polynomial reconstructions of T and S are optional to aid with unit testing, but will always be passed otherwise

Parameters
  • CS [inout]

    Neutral diffusion control structure

  • nk [in]

    Number of levels

  • Pres_l [in]

    Left-column interface pressure [R L2 T-2 ~> Pa]

  • hcol_l [in]

    Left-column layer thicknesses [H ~> m or kg m-2] or other units

  • Tl [in]

    Left-column top interface potential temperature [C ~> degC]

  • Sl [in]

    Left-column top interface salinity [S ~> ppt]

  • ppoly_T_l [in]

    Left-column coefficients of T reconstruction [C ~> degC]

  • ppoly_S_l [in]

    Left-column coefficients of S reconstruction [S ~> ppt]

  • stable_l [in]

    True where the left-column is stable

  • Pres_r [in]

    Right-column interface pressure [R L2 T-2 ~> Pa]

  • hcol_r [in]

    Left-column layer thicknesses [H ~> m or kg m-2] or other units

  • Tr [in]

    Right-column top interface potential temperature [C ~> degC]

  • Sr [in]

    Right-column top interface salinity [S ~> ppt]

  • ppoly_T_r [in]

    Right-column coefficients of T reconstruction [C ~> degC]

  • ppoly_S_r [in]

    Right-column coefficients of S reconstruction [S ~> ppt]

  • stable_r [in]

    True where the right-column is stable

  • PoL [inout]

    Fractional position of neutral surface within layer KoL of left column [nondim]

  • PoR [inout]

    Fractional position of neutral surface within layer KoR of right column [nondim]

  • KoL [inout]

    Index of first left interface above neutral surface

  • KoR [inout]

    Index of first right interface above neutral surface

  • hEff [inout]

    Effective thickness between two neutral surfaces [H ~> m or kg m-2] or other units taken from hcol_l

  • zeta_bot_L [in]

    Non-dimensional distance to where the boundary layer intersects the cell (left) [nondim]

  • zeta_bot_R [in]

    Non-dimensional distance to where the boundary layer intersects the cell (right) [nondim]

  • k_bot_L [in]

    k-index for the boundary layer (left) [nondim]

  • k_bot_R [in]

    k-index for the boundary layer (right) [nondim]

  • hard_fail_heff [in]

    If true (default) bring down the model if the neutral surfaces ever cross

Callees call graph
Callees of mom_neutral_diffusion::find_neutral_surface_positions_discontinuous calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_error_handler::mom_error MOM_error mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_error_handler::mom_error mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::calc_delta_rho_and_derivs mom_neutral_diffusion::increment_interface increment_interface [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::increment_interface mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::search_other_column
Text view
Callers call graph
Callers of mom_neutral_diffusion::find_neutral_surface_positions_discontinuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::find_neutral_surface_positions_discontinuous mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::find_neutral_surface_positions_discontinuous
Text view
subroutine mark_unstable_cells(CS, nk, T, S, P, stable_cell)

Sweep down through the column and mark as stable if the bottom interface of a cell is denser than the top

Parameters
  • CS [inout]

    Neutral diffusion control structure

  • nk [in]

    Number of levels in a column

  • T [in]

    Temperature at interfaces [C ~> degC]

  • S [in]

    Salinity at interfaces [S ~> ppt]

  • P [in]

    Pressure at interfaces [R L2 T-2 ~> Pa]

  • stable_cell [out]

    True if this cell is unstably stratified

Callees call graph
Callees of mom_neutral_diffusion::mark_unstable_cells calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::mark_unstable_cells mark_unstable_cells [private/internal] mom_neutral_diffusion::mark_unstable_cells->mom_neutral_diffusion::calc_delta_rho_and_derivs
Text view
Callers call graph
Callers of mom_neutral_diffusion::mark_unstable_cells calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::mark_unstable_cells mark_unstable_cells [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::mark_unstable_cells mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_neutral_diffusion::mark_unstable_cells
Text view
real function search_other_column(CS, ksurf, pos_last, T_from, S_from, P_from, T_top, S_top, P_top, T_bot, S_bot, P_bot, T_poly, S_poly) result(pos)

Searches the "other" (searched) column for the position of the neutral surface, returning the fractional postion within the layer [nondim]

Parameters
  • CS [in]

    Neutral diffusion control structure

  • ksurf [in]

    Current index of neutral surface

  • pos_last [in]

    Last position within the current layer, used as the lower bound in the root finding algorithm [nondim]

  • T_from [in]

    Temperature at the searched from interface [C ~> degC]

  • S_from [in]

    Salinity at the searched from interface [S ~> ppt]

  • P_from [in]

    Pressure at the searched from interface [R L2 T-2 ~> Pa]

  • T_top [in]

    Temperature at the searched to top interface [C ~> degC]

  • S_top [in]

    Salinity at the searched to top interface [S ~> ppt]

  • P_top [in]

    Pressure at the searched to top interface [R L2 T-2 ~> Pa] interface [R L2 T-2 ~> Pa]

  • T_bot [in]

    Temperature at the searched to bottom interface [C ~> degC]

  • S_bot [in]

    Salinity at the searched to bottom interface [S ~> ppt]

  • P_bot [in]

    Pressure at the searched to bottom interface [R L2 T-2 ~> Pa]

  • T_poly [in]

    Temperature polynomial reconstruction coefficients [C ~> degC]

  • S_poly [in]

    Salinity polynomial reconstruction coefficients [S ~> ppt]

Callees call graph
Callees of mom_neutral_diffusion::search_other_column calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::find_neutral_pos_full find_neutral_pos_full [private/internal] mom_neutral_diffusion::find_neutral_pos_linear find_neutral_pos_linear [private/internal] mom_neutral_diffusion::interpolate_for_nondim_position interpolate_for_nondim_position [private/internal] mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::calc_delta_rho_and_derivs mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::find_neutral_pos_full mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::find_neutral_pos_linear mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::interpolate_for_nondim_position
Text view
Callers call graph
Callers of mom_neutral_diffusion::search_other_column calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::search_other_column
Text view
subroutine increment_interface(nk, kl, ki, reached_bottom, searching_this_column, searching_other_column)

Increments the interface which was just connected and also set flags if the bottom is reached

Parameters
  • nk [in]

    Number of vertical levels

  • kl [inout]

    Current layer (potentially updated)

  • ki [inout]

    Current interface

  • reached_bottom [inout]

    Updated when kl == nk and ki == 2

  • searching_this_column [inout]

    Updated when kl == nk and ki == 2

  • searching_other_column [inout]

    Updated when kl == nk and ki == 2

Callees call graph
Callees of mom_neutral_diffusion::increment_interface calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_error_handler::mom_error MOM_error mom_neutral_diffusion::increment_interface increment_interface [private/internal] mom_neutral_diffusion::increment_interface->mom_error_handler::mom_error
Text view
Callers call graph
Callers of mom_neutral_diffusion::increment_interface calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::increment_interface increment_interface [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::increment_interface
Text view
function find_neutral_pos_linear(CS, z0, T_ref, S_ref, dRdT_ref, dRdS_ref, dRdT_top, dRdS_top, dRdT_bot, dRdS_bot, ppoly_T, ppoly_S) result(z)

Search a layer to find where delta_rho = 0 based on a linear interpolation of alpha and beta of the top and bottom being searched and polynomial reconstructions of T and S. Compressibility is not needed because either, we are assuming incompressibility in the equation of state for this module or alpha and beta are calculated having been displaced to the average pressures of the two pressures We need Newton's method because the T and S reconstructions make delta_rho a polynomial function of z if using PPM or higher. If Newton's method would search fall out of the interval [0,1], a bisection step would be taken instead. Also this linearization of alpha, beta means that second derivatives of the EOS are not needed. Note that delta in variable names below refers to horizontal differences and 'd' refers to vertical differences

Parameters
  • CS [in]

    Control structure with parameters for this module

  • z0 [in]

    Lower bound of position, also serves as the initial guess [nondim]

  • T_ref [in]

    Temperature at the searched from interface [C ~> degC]

  • S_ref [in]

    Salinity at the searched from interface [S ~> ppt]

  • dRdT_ref [in]

    dRho/dT at the searched from interface [R C-1 ~> kg m-3 degC-1]

  • dRdS_ref [in]

    dRho/dS at the searched from interface [R S-1 ~> kg m-3 ppt-1]

  • dRdT_top [in]

    dRho/dT at top of layer being searched [R C-1 ~> kg m-3 degC-1]

  • dRdS_top [in]

    dRho/dS at top of layer being searched [R S-1 ~> kg m-3 ppt-1]

  • dRdT_bot [in]

    dRho/dT at bottom of layer being searched [R C-1 ~> kg m-3 degC-1]

  • dRdS_bot [in]

    dRho/dS at bottom of layer being searched [R S-1 ~> kg m-3 ppt-1]

  • ppoly_T [in]

    Coefficients of the polynomial reconstruction of T within the layer to be searched [C ~> degC].

  • ppoly_S [in]

    Coefficients of the polynomial reconstruction of S within the layer to be searched [S ~> ppt].

  • z

    Position where drho = 0 [nondim]

Callees call graph
Callees of mom_neutral_diffusion::find_neutral_pos_linear calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_polynomial_functions polynomial_functions mom_error_handler::mom_error MOM_error mom_neutral_diffusion::find_neutral_pos_linear find_neutral_pos_linear [private/internal] mom_neutral_diffusion::find_neutral_pos_linear->mom_error_handler::mom_error polynomial_functions::evaluation_polynomial evaluation_polynomial mom_neutral_diffusion::find_neutral_pos_linear->polynomial_functions::evaluation_polynomial polynomial_functions::first_derivative_polynomial first_derivative_polynomial mom_neutral_diffusion::find_neutral_pos_linear->polynomial_functions::first_derivative_polynomial
Text view
Callers call graph
Callers of mom_neutral_diffusion::find_neutral_pos_linear calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_pos_linear find_neutral_pos_linear [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::find_neutral_pos_linear mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::find_neutral_pos_linear
Text view
function find_neutral_pos_full(CS, z0, T_ref, S_ref, P_ref, P_top, P_bot, ppoly_T, ppoly_S) result(z)

Use the full equation of state to calculate the difference in locally referenced potential density. The derivatives in this case are not trivial to calculate, so instead we use a regula falsi method

Parameters
  • CS [in]

    Control structure with parameters for this module

  • z0 [in]

    Lower bound of position, also serves as the initial guess [nondim]

  • T_ref [in]

    Temperature at the searched from interface [C ~> degC]

  • S_ref [in]

    Salinity at the searched from interface [S ~> ppt]

  • P_ref [in]

    Pressure at the searched from interface [R L2 T-2 ~> Pa]

  • P_top [in]

    Pressure at top of layer being searched [R L2 T-2 ~> Pa]

  • P_bot [in]

    Pressure at bottom of layer being searched [R L2 T-2 ~> Pa]

  • ppoly_T [in]

    Coefficients of the polynomial reconstruction of T within the layer to be searched [C ~> degC]

  • ppoly_S [in]

    Coefficients of the polynomial reconstruction of T within the layer to be searched [S ~> ppt]

  • z

    Position where drho = 0 [nondim]

Callees call graph
Callees of mom_neutral_diffusion::find_neutral_pos_full calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_polynomial_functions polynomial_functions mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::find_neutral_pos_full find_neutral_pos_full [private/internal] mom_neutral_diffusion::find_neutral_pos_full->mom_neutral_diffusion::calc_delta_rho_and_derivs polynomial_functions::evaluation_polynomial evaluation_polynomial mom_neutral_diffusion::find_neutral_pos_full->polynomial_functions::evaluation_polynomial
Text view
Callers call graph
Callers of mom_neutral_diffusion::find_neutral_pos_full calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::find_neutral_pos_full find_neutral_pos_full [private/internal] mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::find_neutral_pos_full
Text view
subroutine calc_delta_rho_and_derivs(CS, T1, S1, p1_in, T2, S2, p2_in, drho, drdt1_out, drds1_out, drdt2_out, drds2_out)

Calculate the difference in density between two points in a variety of ways

Parameters
  • CS

    Neutral diffusion control structure

  • T1 [in]

    Temperature at point 1 [C ~> degC]

  • S1 [in]

    Salinity at point 1 [S ~> ppt]

  • p1_in [in]

    Pressure at point 1 [R L2 T-2 ~> Pa]

  • T2 [in]

    Temperature at point 2 [C ~> degC]

  • S2 [in]

    Salinity at point 2 [S ~> ppt]

  • p2_in [in]

    Pressure at point 2 [R L2 T-2 ~> Pa]

  • drho [out]

    Difference in density between the two points [R ~> kg m-3]

  • dRdT1_out [out]

    drho_dt at point 1 [R C-1 ~> kg m-3 degC-1]

  • dRdS1_out [out]

    drho_ds at point 1 [R S-1 ~> kg m-3 ppt-1]

  • dRdT2_out [out]

    drho_dt at point 2 [R C-1 ~> kg m-3 degC-1]

  • dRdS2_out [out]

    drho_ds at point 2 [R S-1 ~> kg m-3 ppt-1]

Callees call graph
Callees of mom_neutral_diffusion::calc_delta_rho_and_derivs calls cluster_mom_eos MOM_EOS cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_eos::interface::calculate_density calculate_density (interface) mom_eos::interface::calculate_density_derivs calculate_density_derivs (interface) mom_error_handler::mom_error MOM_error mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::calc_delta_rho_and_derivs->mom_eos::interface::calculate_density mom_neutral_diffusion::calc_delta_rho_and_derivs->mom_eos::interface::calculate_density_derivs mom_neutral_diffusion::calc_delta_rho_and_derivs->mom_error_handler::mom_error mom_neutral_diffusion::delta_rho_from_derivs delta_rho_from_derivs [private/internal] mom_neutral_diffusion::calc_delta_rho_and_derivs->mom_neutral_diffusion::delta_rho_from_derivs
Text view
Callers call graph
Callers of mom_neutral_diffusion::calc_delta_rho_and_derivs calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::find_neutral_pos_full find_neutral_pos_full [private/internal] mom_neutral_diffusion::find_neutral_pos_full->mom_neutral_diffusion::calc_delta_rho_and_derivs mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous->mom_neutral_diffusion::calc_delta_rho_and_derivs mom_neutral_diffusion::mark_unstable_cells mark_unstable_cells [private/internal] mom_neutral_diffusion::mark_unstable_cells->mom_neutral_diffusion::calc_delta_rho_and_derivs mom_neutral_diffusion::search_other_column search_other_column [private/internal] mom_neutral_diffusion::search_other_column->mom_neutral_diffusion::calc_delta_rho_and_derivs
Text view
function delta_rho_from_derivs(T1, S1, P1, dRdT1, dRdS1, T2, S2, P2, dRdT2, dRdS2) result(drho)

Calculate delta rho from derivatives and gradients of properties \(\Delta \rho = \frac{1}{2}\left[ (\alpha_1 + \alpha_2)*(T_1-T_2) + (\beta_1 + \beta_2)*(S_1-S_2) + (\gamma^{-1}_1 + \gamma^{-1}_2)*(P_1-P_2) \right]\)

Parameters
  • T1

    Temperature at point 1 [C ~> degC]

  • S1

    Salinity at point 1 [S ~> ppt]

  • P1

    Pressure at point 1 [R L2 T-2 ~> Pa]

  • dRdT1

    The partial derivative of density with temperature at point 1 [R C-1 ~> kg m-3 degC-1]

  • dRdS1

    The partial derivative of density with salinity at point 1 [R S-1 ~> kg m-3 ppt-1]

  • T2

    Temperature at point 2 [C ~> degC]

  • S2

    Salinity at point 2 [S ~> ppt]

  • P2

    Pressure at point 2 [R L2 T-2 ~> Pa]

  • dRdT2

    The partial derivative of density with temperature at point 2 [R C-1 ~> kg m-3 degC-1]

  • dRdS2

    The partial derivative of density with salinity at point 2 [R S-1 ~> kg m-3 ppt-1]

Callers call graph
Callers of mom_neutral_diffusion::delta_rho_from_derivs calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::calc_delta_rho_and_derivs calc_delta_rho_and_derivs [private/internal] mom_neutral_diffusion::delta_rho_from_derivs delta_rho_from_derivs [private/internal] mom_neutral_diffusion::calc_delta_rho_and_derivs->mom_neutral_diffusion::delta_rho_from_derivs
Text view
function absolute_position(n, ns, Pint, Karr, NParr, k_surface)

Converts non-dimensional position within a layer to absolute position (for debugging)

Parameters
  • n [in]

    Number of levels

  • ns [in]

    Number of neutral surfaces

  • Pint [in]

    Position of interfaces [R L2 T-2 ~> Pa] or other units

  • Karr [in]

    Index of interface above position

  • NParr [in]

    Non-dimensional position within layer Karr(:) [nondim]

  • k_surface [in]

    k-interface to query

  • absolute_position

    The absolute position of a location [R L2 T-2 ~> Pa] or other units following Pint

Callers call graph
Callers of mom_neutral_diffusion::absolute_position calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::absolute_position absolute_position [private/internal] mom_neutral_diffusion::absolute_positions absolute_positions [private/internal] mom_neutral_diffusion::absolute_positions->mom_neutral_diffusion::absolute_position mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous->mom_neutral_diffusion::absolute_position
Text view
function absolute_positions(n, ns, Pint, Karr, NParr)

Converts non-dimensional positions within layers to absolute positions (for debugging)

Parameters
  • n [in]

    Number of levels

  • ns [in]

    Number of neutral surfaces

  • Pint [in]

    Position of interface [R L2 T-2 ~> Pa] or other units

  • Karr [in]

    Indexes of interfaces about positions

  • NParr [in]

    Non-dimensional positions within layers Karr(:) [nondim]

  • absolute_positions

    Absolute positions [R L2 T-2 ~> Pa] or other units following Pint

Callees call graph
Callees of mom_neutral_diffusion::absolute_positions calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::absolute_position absolute_position [private/internal] mom_neutral_diffusion::absolute_positions absolute_positions [private/internal] mom_neutral_diffusion::absolute_positions->mom_neutral_diffusion::absolute_position
Text view
Callers call graph
Callers of mom_neutral_diffusion::absolute_positions calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::absolute_positions absolute_positions [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::absolute_positions
Text view
subroutine neutral_surface_flux(nk, nsurf, deg, hl, hr, Tl, Tr, PiL, PiR, KoL, KoR, hEff, Flx, continuous, h_neglect, remap_CS, h_neglect_edge, coeff_l, coeff_r)

Returns a single column of neutral diffusion fluxes of a tracer.

Parameters
  • nk [in]

    Number of levels

  • nsurf [in]

    Number of neutral surfaces

  • deg [in]

    Degree of polynomial reconstructions

  • hl [in]

    Left-column layer thickness [H ~> m or kg m-2]

  • hr [in]

    Right-column layer thickness [H ~> m or kg m-2]

  • Tl [in]

    Left-column layer tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Tr [in]

    Right-column layer tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • PiL [in]

    Fractional position of neutral surface within layer KoL of left column [nondim]

  • PiR [in]

    Fractional position of neutral surface within layer KoR of right column [nondim]

  • KoL [in]

    Index of first left interface above neutral surface

  • KoR [in]

    Index of first right interface above neutral surface

  • hEff [in]

    Effective thickness between two neutral surfaces [H ~> m or kg m-2]

  • Flx [inout]

    Flux of tracer between pairs of neutral layers in units (conc H or conc H L2) that depend on the presence and units of coeff_l and coeff_r. If the tracer is temperature, this could have units of [C H ~> degC m or degC kg m-2] or [C H L2 ~> degC m3 or degC kg] if coeff_l has units of [L2 ~> m2]

  • continuous [in]

    True if using continuous reconstruction

  • h_neglect [in]

    A negligibly small width for the purpose of cell reconstructions [H ~> m or kg m-2]

  • remap_CS [in]

    Remapping control structure used to create sublayers

  • h_neglect_edge [in]

    A negligibly small width used for edge value calculations if continuous is false [H ~> m or kg m-2]

  • coeff_l [in]

    Left-column diffusivity [L2 ~> m2] or [nondim]

  • coeff_r [in]

    Right-column diffusivity [L2 ~> m2] or [nondim]

  • Til

    Left-column interface tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Tir

    Right-column interface tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • aL_l

    Left-column left edge value of tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • aR_l

    Left-column right edge value of tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • aL_r

    Right-column left edge value of tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • aR_r

    Right-column right edge value of tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Tid_l

    Left-column interface tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • Tid_r

    Right-column interface tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

Callees call graph
Callees of mom_neutral_diffusion::neutral_surface_flux calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_remapping MOM_remapping mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::interface_scalar mom_neutral_diffusion::neutral_surface_t_eval neutral_surface_T_eval [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::neutral_surface_t_eval mom_neutral_diffusion::ppm_ave ppm_ave [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::ppm_ave mom_neutral_diffusion::ppm_left_right_edge_values ppm_left_right_edge_values [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::ppm_left_right_edge_values mom_neutral_diffusion::signum signum [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::signum mom_remapping::build_reconstructions_1d build_reconstructions_1d mom_neutral_diffusion::neutral_surface_flux->mom_remapping::build_reconstructions_1d
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_surface_flux calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::neutral_surface_flux mom_neutral_diffusion::neutral_diffusion neutral_diffusion mom_neutral_diffusion::neutral_diffusion->mom_neutral_diffusion::neutral_surface_flux
Text view
subroutine neutral_surface_T_eval(nk, ns, k_sub, Ks, Ps, T_mean, T_int, deg, iMethod, T_poly, T_top, T_bot, T_sub, T_top_int, T_bot_int, T_layer)

Evaluate various parts of the reconstructions to calculate gradient-based flux limiter

Parameters
  • nk [in]

    Number of cell averages

  • ns [in]

    Number of neutral surfaces

  • k_sub [in]

    Index of current neutral layer

  • Ks [in]

    List of the layers associated with each neutral surface

  • Ps [in]

    List of the positions within a layer of each surface [nondim]

  • T_mean [in]

    Layer average of tracer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • T_int [in]

    Layer interface values of tracer from reconstruction in concentration units (e.g. [C ~> degC] for temperature)

  • deg [in]

    Degree of reconstruction polynomial (e.g. 1 is linear)

  • iMethod [in]

    Method of integration to use

  • T_poly [in]

    Coefficients of polynomial reconstructions in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • T_top [out]

    Tracer value at top (across discontinuity if necessary) in concentration units (e.g. [C ~> degC] for temperature)

  • T_bot [out]

    Tracer value at bottom (across discontinuity if necessary) in concentration units (e.g. [C ~> degC] for temperature)

  • T_sub [out]

    Average of the tracer value over the sublayer in arbitrary concentration units (e.g. [C ~> degC] for temperature)

  • T_top_int [out]

    Tracer value at the top interface of a neutral layer in concentration units (e.g. [C ~> degC] for temperature)

  • T_bot_int [out]

    Tracer value at the bottom interface of a neutral layer in concentration units (e.g. [C ~> degC] for temperature)

  • T_layer [out]

    Cell-average tracer concentration in a layer that the reconstruction belongs to in concentration units (e.g. [C ~> degC] for temperature)

Callees call graph
Callees of mom_neutral_diffusion::neutral_surface_t_eval calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_remapping MOM_remapping cluster_polynomial_functions polynomial_functions mom_error_handler::mom_error MOM_error mom_neutral_diffusion::neutral_surface_t_eval neutral_surface_T_eval [private/internal] mom_neutral_diffusion::neutral_surface_t_eval->mom_error_handler::mom_error mom_remapping::average_value_ppoly average_value_ppoly mom_neutral_diffusion::neutral_surface_t_eval->mom_remapping::average_value_ppoly polynomial_functions::evaluation_polynomial evaluation_polynomial mom_neutral_diffusion::neutral_surface_t_eval->polynomial_functions::evaluation_polynomial
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_surface_t_eval calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::neutral_surface_t_eval neutral_surface_T_eval [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::neutral_surface_t_eval
Text view
subroutine ppm_left_right_edge_values(nk, Tl, Ti, aL, aR)

Discontinuous PPM reconstructions of the left/right edge values within a cell

Parameters
  • nk [in]

    Number of levels

  • Tl [in]

    Layer tracer (conc, e.g. degC) in arbitrary units [A ~> a]

  • Ti [in]

    Interface tracer (conc, e.g. degC) in arbitrary units [A ~> a]

  • aL [inout]

    Left edge value of tracer (conc, e.g. degC) in the same arbitrary units as Tl and Ti [A ~> a]

  • aR [inout]

    Right edge value of tracer (conc, e.g. degC) in the same arbitrary units as Tl and Ti [A ~> a]

Callees call graph
Callees of mom_neutral_diffusion::ppm_left_right_edge_values calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ppm_left_right_edge_values ppm_left_right_edge_values [private/internal] mom_neutral_diffusion::signum signum [private/internal] mom_neutral_diffusion::ppm_left_right_edge_values->mom_neutral_diffusion::signum
Text view
Callers call graph
Callers of mom_neutral_diffusion::ppm_left_right_edge_values calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::ppm_left_right_edge_values ppm_left_right_edge_values [private/internal] mom_neutral_diffusion::neutral_surface_flux->mom_neutral_diffusion::ppm_left_right_edge_values
Text view
logical function neutral_diffusion_unit_tests(verbose)

Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.

Parameters
  • verbose [in]

    If true, write results to stdout

Callees call graph
Callees of mom_neutral_diffusion::neutral_diffusion_unit_tests calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::neutral_diffusion_unit_tests neutral_diffusion_unit_tests mom_neutral_diffusion::neutral_diffusion_unit_tests->mom_neutral_diffusion::ndiff_unit_tests_continuous mom_neutral_diffusion::neutral_diffusion_unit_tests->mom_neutral_diffusion::ndiff_unit_tests_discontinuous
Text view
Callers call graph
Callers of mom_neutral_diffusion::neutral_diffusion_unit_tests calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_unit_tests MOM_unit_tests mom_neutral_diffusion::neutral_diffusion_unit_tests neutral_diffusion_unit_tests mom_unit_tests::unit_tests unit_tests mom_unit_tests::unit_tests->mom_neutral_diffusion::neutral_diffusion_unit_tests
Text view
logical function ndiff_unit_tests_continuous(verbose)

Returns true if unit tests of neutral_diffusion functions fail. Otherwise returns false.

Parameters
  • verbose [in]

    If true, write results to stdout

Callees call graph
Callees of mom_neutral_diffusion::ndiff_unit_tests_continuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::absolute_positions absolute_positions [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_continuous find_neutral_surface_positions_continuous [private/internal] mom_neutral_diffusion::interface_scalar interface_scalar [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::absolute_positions mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::find_neutral_surface_positions_continuous mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::interface_scalar mom_neutral_diffusion::neutral_surface_flux neutral_surface_flux [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::neutral_surface_flux mom_neutral_diffusion::test_data1d test_data1d [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_data1d mom_neutral_diffusion::test_fv_diff test_fv_diff [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_fv_diff mom_neutral_diffusion::test_fvlsq_slope test_fvlsq_slope [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_fvlsq_slope mom_neutral_diffusion::test_ifndp test_ifndp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_ifndp mom_neutral_diffusion::test_nsp test_nsp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_nsp
Text view
Callers call graph
Callers of mom_neutral_diffusion::ndiff_unit_tests_continuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::neutral_diffusion_unit_tests neutral_diffusion_unit_tests mom_neutral_diffusion::neutral_diffusion_unit_tests->mom_neutral_diffusion::ndiff_unit_tests_continuous
Text view

logical function ndiff_unit_tests_discontinuous(verbose)

Parameters
  • verbose [in]

    It true, write results to stdout

  • CS

    Neutral diffusion control structure

Callees call graph
Callees of mom_neutral_diffusion::ndiff_unit_tests_discontinuous calls cluster_mom_eos MOM_EOS cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_eos::eos_manual_init EOS_manual_init mom_neutral_diffusion::find_neutral_pos_linear find_neutral_pos_linear [private/internal] mom_neutral_diffusion::find_neutral_surface_positions_discontinuous find_neutral_surface_positions_discontinuous [private/internal] mom_neutral_diffusion::mark_unstable_cells mark_unstable_cells [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_eos::eos_manual_init mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::find_neutral_pos_linear mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::find_neutral_surface_positions_discontinuous mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::mark_unstable_cells mom_neutral_diffusion::test_nsp test_nsp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::test_nsp mom_neutral_diffusion::test_rnp test_rnp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::test_rnp
Text view
Callers call graph
Callers of mom_neutral_diffusion::ndiff_unit_tests_discontinuous calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::neutral_diffusion_unit_tests neutral_diffusion_unit_tests mom_neutral_diffusion::neutral_diffusion_unit_tests->mom_neutral_diffusion::ndiff_unit_tests_discontinuous
Text view
logical function test_fv_diff(verbose, hkm1, hk, hkp1, Skm1, Sk, Skp1, Ptrue, title)

Returns true if a test of fv_diff() fails, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • hkm1 [in]

    Left cell width [nondim]

  • hk [in]

    Center cell width [nondim]

  • hkp1 [in]

    Right cell width [nondim]

  • Skm1 [in]

    Left cell average value in arbitrary units [arbitrary]

  • Sk [in]

    Center cell average value in arbitrary units [arbitrary]

  • Skp1 [in]

    Right cell average value in arbitrary units [arbitrary]

  • Ptrue [in]

    True answer in arbitrary units [arbitrary]

  • title [in]

    Title for messages

Callees call graph
Callees of mom_neutral_diffusion::test_fv_diff calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::fv_diff fv_diff [private/internal] mom_neutral_diffusion::test_fv_diff test_fv_diff [private/internal] mom_neutral_diffusion::test_fv_diff->mom_neutral_diffusion::fv_diff
Text view
Callers call graph
Callers of mom_neutral_diffusion::test_fv_diff calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::test_fv_diff test_fv_diff [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_fv_diff
Text view
logical function test_fvlsq_slope(verbose, hkm1, hk, hkp1, Skm1, Sk, Skp1, Ptrue, title)

Returns true if a test of fvlsq_slope() fails, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • hkm1 [in]

    Left cell width in arbitrary units [B ~> b]

  • hk [in]

    Center cell width in arbitrary units [B ~> b]

  • hkp1 [in]

    Right cell width in arbitrary units [B ~> b]

  • Skm1 [in]

    Left cell average value in arbitrary units [A ~> a]

  • Sk [in]

    Center cell average value in arbitrary units [A ~> a]

  • Skp1 [in]

    Right cell average value in arbitrary units [A ~> a]

  • Ptrue [in]

    True answer in arbitrary units [A B-1 ~> a b-1]

  • title [in]

    Title for messages

Callees call graph
Callees of mom_neutral_diffusion::test_fvlsq_slope calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::fvlsq_slope fvlsq_slope [private/internal] mom_neutral_diffusion::test_fvlsq_slope test_fvlsq_slope [private/internal] mom_neutral_diffusion::test_fvlsq_slope->mom_neutral_diffusion::fvlsq_slope
Text view
Callers call graph
Callers of mom_neutral_diffusion::test_fvlsq_slope calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::test_fvlsq_slope test_fvlsq_slope [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_fvlsq_slope
Text view
logical function test_ifndp(verbose, rhoNeg, Pneg, rhoPos, Ppos, Ptrue, title)

Returns true if a test of interpolate_for_nondim_position() fails, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • rhoNeg [in]

    Lighter density [R ~> kg m-3]

  • Pneg [in]

    Interface position of lighter density [nondim]

  • rhoPos [in]

    Heavier density [R ~> kg m-3]

  • Ppos [in]

    Interface position of heavier density [nondim]

  • Ptrue [in]

    True answer [nondim]

  • title [in]

    Title for messages

Callees call graph
Callees of mom_neutral_diffusion::test_ifndp calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::interpolate_for_nondim_position interpolate_for_nondim_position [private/internal] mom_neutral_diffusion::test_ifndp test_ifndp [private/internal] mom_neutral_diffusion::test_ifndp->mom_neutral_diffusion::interpolate_for_nondim_position
Text view
Callers call graph
Callers of mom_neutral_diffusion::test_ifndp calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::test_ifndp test_ifndp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_ifndp
Text view
logical function test_data1d(verbose, nk, Po, Ptrue, title)

Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • nk [in]

    Number of layers

  • Po [in]

    Calculated answer [arbitrary]

  • Ptrue [in]

    True answer [arbitrary]

  • title [in]

    Title for messages

Callers call graph
Callers of mom_neutral_diffusion::test_data1d calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::test_data1d test_data1d [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_data1d
Text view
logical function test_data1di(verbose, nk, Po, Ptrue, title)

Returns true if comparison of Po and Ptrue fails, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • nk [in]

    Number of layers

  • Po [in]

    Calculated answer [arbitrary]

  • Ptrue [in]

    True answer [arbitrary]

  • title [in]

    Title for messages

logical function test_nsp(verbose, ns, KoL, KoR, pL, pR, hEff, KoL0, KoR0, pL0, pR0, hEff0, title)

Returns true if output of find_neutral_surface_positions() does not match correct values, and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • ns [in]

    Number of surfaces

  • KoL [in]

    Index of first left interface above neutral surface

  • KoR [in]

    Index of first right interface above neutral surface

  • pL [in]

    Fractional position of neutral surface within layer KoL of left column [nondim]

  • pR [in]

    Fractional position of neutral surface within layer KoR of right column [nondim]

  • hEff [in]

    Effective thickness between two neutral surfaces [R L2 T-2 ~> Pa]

  • KoL0 [in]

    Correct value for KoL

  • KoR0 [in]

    Correct value for KoR

  • pL0 [in]

    Correct value for pL [nondim]

  • pR0 [in]

    Correct value for pR [nondim]

  • hEff0 [in]

    Correct value for hEff [R L2 T-2 ~> Pa]

  • title [in]

    Title for messages

Callees call graph
Callees of mom_neutral_diffusion::test_nsp calls cluster_mom_error_handler MOM_error_handler cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_error_handler::mom_error MOM_error mom_neutral_diffusion::compare_nsp_row compare_nsp_row [private/internal] mom_neutral_diffusion::test_nsp test_nsp [private/internal] mom_neutral_diffusion::test_nsp->mom_error_handler::mom_error mom_neutral_diffusion::test_nsp->mom_neutral_diffusion::compare_nsp_row
Text view
Callers call graph
Callers of mom_neutral_diffusion::test_nsp calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_continuous ndiff_unit_tests_continuous [private/internal] mom_neutral_diffusion::test_nsp test_nsp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_continuous->mom_neutral_diffusion::test_nsp mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::test_nsp
Text view
logical function compare_nsp_row(KoL, KoR, pL, pR, KoL0, KoR0, pL0, pR0)

Compares a single row, k, of output from find_neutral_surface_positions()

Parameters
  • KoL [in]

    Index of first left interface above neutral surface

  • KoR [in]

    Index of first right interface above neutral surface

  • pL [in]

    Fractional position of neutral surface within layer KoL of left column [nondim]

  • pR [in]

    Fractional position of neutral surface within layer KoR of right column [nondim]

  • KoL0 [in]

    Correct value for KoL

  • KoR0 [in]

    Correct value for KoR

  • pL0 [in]

    Correct value for pL [nondim]

  • pR0 [in]

    Correct value for pR [nondim]

Callers call graph
Callers of mom_neutral_diffusion::compare_nsp_row calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::compare_nsp_row compare_nsp_row [private/internal] mom_neutral_diffusion::test_nsp test_nsp [private/internal] mom_neutral_diffusion::test_nsp->mom_neutral_diffusion::compare_nsp_row
Text view
logical function test_rnp(expected_pos, test_pos, title)

Compares output position from refine_nondim_position with an expected value

Parameters
  • expected_pos [in]

    The expected position [arbitrary]

  • test_pos [in]

    The position returned by the code [arbitrary]

  • title [in]

    A label for this test

Callers call graph
Callers of mom_neutral_diffusion::test_rnp calls cluster_mom_neutral_diffusion MOM_neutral_diffusion mom_neutral_diffusion::ndiff_unit_tests_discontinuous ndiff_unit_tests_discontinuous [private/internal] mom_neutral_diffusion::test_rnp test_rnp [private/internal] mom_neutral_diffusion::ndiff_unit_tests_discontinuous->mom_neutral_diffusion::test_rnp
Text view
subroutine neutral_diffusion_end(CS)

Deallocates neutral_diffusion control structure

Parameters
  • CS

    Neutral diffusion control structure

Callers call graph
Callers of mom_neutral_diffusion::neutral_diffusion_end calls cluster_mom_neutral_diffusion MOM_neutral_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_neutral_diffusion::neutral_diffusion_end neutral_diffusion_end mom_tracer_hor_diff::tracer_hor_diff_end tracer_hor_diff_end mom_tracer_hor_diff::tracer_hor_diff_end->mom_neutral_diffusion::neutral_diffusion_end
Text view
API generated with Flint · Rendered from reStructuredText