MOM_hor_bnd_diffusion module reference

Calculates and applies diffusive fluxes as a parameterization of horizontal mixing (non-neutral) by mesoscale eddies near the top and bottom (to be implemented) boundary layers of the ocean.

Data Types

hbd_CS

Set a value that corresponds to the bottom boundary

Functions/Subroutines

hor_bnd_diffusion_init

Initialization routine that reads runtime parameters and sets up pointers to other control structures that might be needed for horizontal boundary diffusion.

hor_bnd_diffusion

Driver routine for calculating horizontal diffusive fluxes near the top and bottom boundaries. Diffusion is applied using only information from neighboring cells, as follows:

hbd_grid

Build the HBD grid where tracers will be remapped to.

harmonic_mean

Calculate the harmonic mean of two quantities [arbitrary] See Harmonic Mean.

find_minimum

Returns the location of the minimum value in a 1D array between indices s and e.

swap

Swaps the values of its two formal arguments.

sort

Receives a 1D array x and sorts it into ascending order.

unique

Returns the unique values in a 1D array.

merge_interfaces

Given layer thicknesses (and corresponding interfaces) and BLDs in two adjacent columns, return a set of 1-d layer thicknesses whose interfaces cover all interfaces in the left and right columns plus the two BLDs. This can be used to accurately remap tracer tendencies in both columns.

flux_limiter

Calculates the maximum flux that can leave a cell and uses that to apply a limiter to F_layer.

boundary_k_range

Find the k-index range corresponding to the layers that are within the boundary-layer region

fluxes_layer_method

Calculate the horizontal boundary diffusive fluxes using the layer by layer method. See Along layer approach

near_boundary_unit_tests

Unit tests for near-boundary horizontal mixing

test_layer_fluxes

Returns true if output of near-boundary unit tests does not match correct computed values and conditionally writes results to stream

test_boundary_k_range

Return true if output of unit tests for boundary_k_range does not match answers

hbd_grid_test

Same as hbd_grid, but only used in the unit tests.

hor_bnd_diffusion_end

Deallocates hor_bnd_diffusion control structure

Detailed Description

The Horizontal Boundary Diffusion (HBD) framework

The HBD framework accounts for the effects of diabatic mesoscale fluxes within surface and bottom boundary layers. Unlike the equivalent adiabatic fluxes, which is applied along neutral density surfaces, HBD is purely horizontal. To assure that diffusive fluxes are strictly horizontal regardless of the vertical coordinate system, this method relies on regridding/remapping techniques.

The bottom boundary layer fluxes remain to be implemented, although some of the steps needed to do so have already been added and tested.

Horizontal boundary diffusion is applied as follows:

  1. remap tracer to a z* grid (HBD grid)

  2. calculate diffusive tracer fluxes (F) in the HBD grid using a layer by layer approach (Along layer approach)

  3. remap fluxes to the native grid

  4. update tracer by adding the divergence of F

Along layer approach

Here diffusion is applied layer by layer using only information from neighboring cells.

Step #1: define vertical grid using interfaces and surface boundary layers from left and right columns (see merge_interfaces).

Step #2: compute vertical indices containing boundary layer (boundary_k_range). For the TOP boundary layer, these are:

k_top, k_bot, zeta_top, zeta_bot

Step #2: calculate the diffusive flux at each layer:

\begin{equation*} F_{k} = -KHTR \times h_{eff}(k) \times (\phi_R(k) - \phi_L(k)), \end{equation*}

where h_eff is the harmonic mean of the layer thickness in the left and right columns.

Step #3: option to linearly decay the flux from k_bot_min to k_bot_max:

If HBD_LINEAR_TRANSITION = True and k_bot_diff > 1, the diffusive flux will decay linearly between the top interface of the layer containing the minimum boundary layer depth (k_bot_min) and the lower interface of the layer containing the maximum layer depth (k_bot_max).

Step #4: remap the fluxes back to the native grid. This is done at velocity points, whose vertical grid is determined using harmonic mean. To assure monotonicity, tracer fluxes are limited so that 1) only down-gradient fluxes are applied, and 2) the flux cannot be larger than F_max, which is defined using the tracer gradient:

\begin{equation*} F_{max} = -0.2 \times [(V_R(k) \times \phi_R(k)) - (V_L(k) \times \phi_L(k))], \end{equation*}

where V is the cell volume. Why 0.2? t=0 t=inf 0 .2 0 1 0 .2.2.2 0 .2

Harmonic Mean

The harmonic mean (HM) between h1 and h2 is defined as:

\begin{equation*} HM = \frac{2 \times h1 \times h2}{h1 + h2} \end{equation*}

Type Documentation

type, public :: hbd_CS

Set a value that corresponds to the bottom boundary

Sets parameters for horizontal boundary mixing module.

Parameters
  • debug

    If true, write verbose checksums for debugging.

  • deg

    Degree of polynomial reconstruction.

  • hbd_nk

    Maximum number of levels in the HBD grid [nondim]

  • surface_boundary_scheme

    Which boundary layer scheme to use

    1. ePBL; 2. KPP

  • limiter

    Controls whether a flux limiter is applied in the native grid (default is true).

  • limiter_remap

    Controls whether a flux limiter is applied in the remapped grid (default is false).

  • linear

    If True, apply a linear transition at the base/top of the boundary. The flux will be fully applied at k=k_min and zero at k=k_max.

  • H_subroundoff

    A thickness that is so small that it can be added to a thickness of Angstrom or larger without changing it at the bit level [H ~> m or kg m-2]. If Angstrom is 0 or exceedingly small, this is negligible compared to 1e-17 m.

  • hbd_grd_u

    HBD thicknesses at t-points adjacent to u-points [H ~> m or kg m-2]

  • hbd_grd_v

    HBD thicknesses at t-points adjacent to v-points (left and right) [H ~> m or kg m-2]

  • hbd_u_kmax

    Maximum vertical index in hbd_grd_u [nondim]

  • hbd_v_kmax

    Maximum vertical index in hbd_grd_v [nondim]

  • remap_CS

    Control structure to hold remapping configuration.

  • KPP_CSp

    KPP control structure needed to get BLD.

  • energetic_PBL_CSp

    ePBL control structure needed to get BLD.

  • diag

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

Functions/Subroutine Documentation

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

Initialization routine that reads runtime parameters and sets up pointers to other control structures that might be needed for horizontal boundary diffusion.

Parameters
  • Time [in]

    Time structure

  • G [in]

    Grid structure

  • GV [in]

    ocean vertical grid structure

  • US [in]

    A dimensional unit scaling type

  • param_file [in]

    Parameter file structure

  • diag [inout]

    Diagnostics control structure

  • diabatic_CSp

    KPP control structure needed to get BLD

  • CS

    Horizontal boundary mixing control structure

  • debug

    If true, write verbose checksums for debugging purposes

Callees call graph
Callees of mom_hor_bnd_diffusion::hor_bnd_diffusion_init calls cluster_mom_cpu_clock_infra MOM_cpu_clock_infra cluster_mom_diabatic_driver MOM_diabatic_driver cluster_mom_error_handler MOM_error_handler cluster_mom_file_parser MOM_file_parser cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_remapping MOM_remapping mom_cpu_clock_infra::cpu_clock_id cpu_clock_id 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_hor_bnd_diffusion::hor_bnd_diffusion_init hor_bnd_diffusion_init mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_cpu_clock_infra::cpu_clock_id mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_diabatic_driver::extract_diabatic_member mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_error_handler::mom_error mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_file_parser::interface::get_param mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_file_parser::interface::log_version mom_remapping::extract_member_remapping_cs extract_member_remapping_CS mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_remapping::extract_member_remapping_cs mom_remapping::initialize_remapping initialize_remapping mom_hor_bnd_diffusion::hor_bnd_diffusion_init->mom_remapping::initialize_remapping
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::hor_bnd_diffusion_init calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_hor_bnd_diffusion::hor_bnd_diffusion_init hor_bnd_diffusion_init mom_tracer_hor_diff::tracer_hor_diff_init tracer_hor_diff_init mom_tracer_hor_diff::tracer_hor_diff_init->mom_hor_bnd_diffusion::hor_bnd_diffusion_init
Text view
subroutine hor_bnd_diffusion(G, GV, US, h, Coef_x, Coef_y, dt, Reg, visc, CS)

Driver routine for calculating horizontal diffusive fluxes near the top and bottom boundaries. Diffusion is applied using only information from neighboring cells, as follows:

  1. remap tracer to a z* grid (HBD grid)

  2. calculate diffusive tracer fluxes (F) in the HBD grid using a layer by layer approach

  3. remap fluxes to the native grid

  4. update tracer by adding the divergence of F

Parameters
  • G [inout]

    Grid type

  • GV [in]

    ocean vertical grid structure

  • US [in]

    A dimensional unit scaling type

  • 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 (I_numitts in tracer_hordiff) [T ~> s]

  • Reg

    Tracer registry

  • visc [in]

    Structure with vertical viscosities, boundary layer properties and related fields

  • CS

    Control structure for this module

  • hbl

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

  • uFlx

    Zonal flux of tracer [conc H L2 ~> conc m3 or conc kg]

  • vFlx

    Meridional flux of tracer [conc H L2 ~> conc m3 or conc kg]

  • uwork_2d

    Layer summed u-flux transport [conc H L2 ~> conc m3 or conc kg]

  • vwork_2d

    Layer summed v-flux transport [conc H L2 ~> conc m3 or conc kg]

  • tendency

    tendency array for diagnostics at first in [H conc T-1 ~> m conc s-1 or kg m-2 conc s-1], then converted to [conc T-1 ~> conc s-1].

  • tendency_2d

    depth integrated content tendency for diagnostics in [H conc T-1 ~> m conc s-1 or kg m-2 conc s-1]. For temperature these units are [C H T-1 ~> degC m s-1 or degC kg m-2 s-1].

  • tracer

    Pointer to the current tracer [conc]

  • tracer_old

    local copy of the initial tracer concentration, only used to compute tendencies [conc].

  • tracer_int_prev

    Globally integrated tracer before HBD is applied, in mks units [conc kg]

  • tracer_int_end

    Integrated tracer after HBD is applied, in mks units [conc kg]

  • Idt

    inverse of the time step [T-1 ~> s-1]

  • mesg

    Message for error messages.

  • i

    indices to loop over

  • j

    indices to loop over

  • k

    indices to loop over

  • m

    indices to loop over

Callees call graph
Callees of mom_hor_bnd_diffusion::hor_bnd_diffusion calls cluster_mom_checksums MOM_checksums cluster_mom_cpu_clock_infra MOM_cpu_clock_infra cluster_mom_diag_mediator MOM_diag_mediator cluster_mom_domain_infra MOM_domain_infra cluster_mom_error_handler MOM_error_handler cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_spatial_means MOM_spatial_means mom_checksums::interface::hchksum hchksum (interface) mom_cpu_clock_infra::cpu_clock_begin cpu_clock_begin mom_cpu_clock_infra::cpu_clock_end cpu_clock_end mom_diag_mediator::interface::post_data post_data (interface) mom_domain_infra::interface::pass_var pass_var (interface) mom_error_handler::mom_error MOM_error mom_error_handler::mom_mesg MOM_mesg mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::hbd_grid hbd_grid [private/internal] mom_hor_bnd_diffusion::hor_bnd_diffusion hor_bnd_diffusion mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_checksums::interface::hchksum mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_cpu_clock_infra::cpu_clock_begin mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_cpu_clock_infra::cpu_clock_end mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_diag_mediator::interface::post_data mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_domain_infra::interface::pass_var mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_error_handler::mom_error mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_error_handler::mom_mesg mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_hor_bnd_diffusion::fluxes_layer_method mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_hor_bnd_diffusion::hbd_grid mom_spatial_means::global_mass_integral global_mass_integral mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_spatial_means::global_mass_integral
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::hor_bnd_diffusion calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_hor_bnd_diffusion::hor_bnd_diffusion hor_bnd_diffusion mom_tracer_hor_diff::tracer_hordiff tracer_hordiff mom_tracer_hor_diff::tracer_hordiff->mom_hor_bnd_diffusion::hor_bnd_diffusion
Text view
subroutine hbd_grid(boundary, G, GV, hbl, h, CS)

Build the HBD grid where tracers will be remapped to.

Parameters
  • boundary [in]

    Which boundary layer SURFACE or BOTTOM [nondim]

  • G [inout]

    Grid type

  • GV [in]

    ocean vertical grid structure

  • hbl [in]

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

  • h [in]

    Layer thickness in the native grid [H ~> m or kg m-2]

  • CS

    Horizontal diffusion control structure

  • dz_top

    temporary HBD grid given by merge_interfaces [H ~> m or kg m-2]

  • nk

    number of layers in the HBD grid, and integers used in do-loops

  • i

    number of layers in the HBD grid, and integers used in do-loops

  • j

    number of layers in the HBD grid, and integers used in do-loops

  • k

    number of layers in the HBD grid, and integers used in do-loops

Callees call graph
Callees of mom_hor_bnd_diffusion::hbd_grid calls cluster_mom_error_handler MOM_error_handler cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_error_handler::mom_error MOM_error mom_hor_bnd_diffusion::hbd_grid hbd_grid [private/internal] mom_hor_bnd_diffusion::hbd_grid->mom_error_handler::mom_error mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::hbd_grid->mom_hor_bnd_diffusion::merge_interfaces
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::hbd_grid calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::hbd_grid hbd_grid [private/internal] mom_hor_bnd_diffusion::hor_bnd_diffusion hor_bnd_diffusion mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_hor_bnd_diffusion::hbd_grid
Text view
real function harmonic_mean(h1, h2)

Calculate the harmonic mean of two quantities [arbitrary] See Harmonic Mean.

Parameters
  • h1

    Scalar quantity [arbitrary]

  • h2

    Scalar quantity [arbitrary]

Callers call graph
Callers of mom_hor_bnd_diffusion::harmonic_mean calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::harmonic_mean harmonic_mean [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::harmonic_mean
Text view
integer function find_minimum(x, s, e)

Returns the location of the minimum value in a 1D array between indices s and e.

Parameters
  • s [in]

    start index

  • e [in]

    end index

  • x [in]

    1D array to be checked [arbitrary]

Callers call graph
Callers of mom_hor_bnd_diffusion::find_minimum calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::find_minimum find_minimum [private/internal] mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::sort->mom_hor_bnd_diffusion::find_minimum
Text view
subroutine swap(a, b)

Swaps the values of its two formal arguments.

Parameters
  • a [inout]

    First value to be swapped [arbitrary]

  • b [inout]

    Second value to be swapped [arbitrary]

Callers call graph
Callers of mom_hor_bnd_diffusion::swap calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::swap swap [private/internal] mom_hor_bnd_diffusion::sort->mom_hor_bnd_diffusion::swap
Text view
subroutine sort(x, n)

Receives a 1D array x and sorts it into ascending order.

Parameters
  • n [in]

    Number of points in the array

  • x [inout]

    1D array to be sorted [arbitrary]

Callees call graph
Callees of mom_hor_bnd_diffusion::sort calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::find_minimum find_minimum [private/internal] mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::sort->mom_hor_bnd_diffusion::find_minimum mom_hor_bnd_diffusion::swap swap [private/internal] mom_hor_bnd_diffusion::sort->mom_hor_bnd_diffusion::swap
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::sort calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::merge_interfaces->mom_hor_bnd_diffusion::sort mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::sort
Text view
subroutine unique(val, n, val_unique, val_max)

Returns the unique values in a 1D array.

Parameters
  • n [in]

    Number of points in the array.

  • val [in]

    1D array to be checked [arbitrary]

  • val_unique [inout]

    Returned 1D array with unique values [arbitrary]

  • val_max [in]

    sets the maximum value in val_unique to this value [arbitrary]

Callees call graph
Callees of mom_hor_bnd_diffusion::unique calls cluster_mom_error_handler MOM_error_handler cluster_mom_error_infra MOM_error_infra cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_error_handler::mom_error MOM_error mom_error_infra::is_root_pe is_root_pe mom_hor_bnd_diffusion::unique unique [private/internal] mom_hor_bnd_diffusion::unique->mom_error_handler::mom_error mom_hor_bnd_diffusion::unique->mom_error_infra::is_root_pe
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::unique calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::unique unique [private/internal] mom_hor_bnd_diffusion::merge_interfaces->mom_hor_bnd_diffusion::unique mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::unique
Text view
subroutine merge_interfaces(nk, h_L, h_R, hbl_L, hbl_R, H_subroundoff, h)

Given layer thicknesses (and corresponding interfaces) and BLDs in two adjacent columns, return a set of 1-d layer thicknesses whose interfaces cover all interfaces in the left and right columns plus the two BLDs. This can be used to accurately remap tracer tendencies in both columns.

Parameters
  • nk [in]

    Number of layers [nondim]

  • h_L [in]

    Layer thicknesses in the left column [H ~> m or kg m-2]

  • h_R [in]

    Layer thicknesses in the right column [H ~> m or kg m-2]

  • hbl_L [in]

    Thickness of the boundary layer in the left column [H ~> m or kg m-2]

  • hbl_R [in]

    Thickness of the boundary layer in the right column [H ~> m or kg m-2]

  • H_subroundoff [in]

    GV%H_subroundoff [H ~> m or kg m-2]

  • h [inout]

    Combined thicknesses [H ~> m or kg m-2]

  • n

    Number of layers in eta_all

  • eta_L

    Interfaces in the left and right columns [H ~> m or kg m-2]

  • eta_R

    Interfaces in the left and right columns [H ~> m or kg m-2]

  • eta_all

    Combined list of interfaces in the left and right columns plus hbl_L and hbl_R [H ~> m or kg m-2]

  • eta_unique

    Combined list of unique interfaces (eta_L, eta_R), possibly hbl_L and hbl_R [H ~> m or kg m-2]

  • min_depth

    Minimum depth [H ~> m or kg m-2]

  • max_depth

    Maximum depth [H ~> m or kg m-2]

  • max_bld

    Deepest BLD [H ~> m or kg m-2]

  • k

    loop indices (k and kk) and array size (nk1)

  • kk

    loop indices (k and kk) and array size (nk1)

  • nk1

    loop indices (k and kk) and array size (nk1)

Callees call graph
Callees of mom_hor_bnd_diffusion::merge_interfaces calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::merge_interfaces->mom_hor_bnd_diffusion::sort mom_hor_bnd_diffusion::unique unique [private/internal] mom_hor_bnd_diffusion::merge_interfaces->mom_hor_bnd_diffusion::unique
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::merge_interfaces calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::hbd_grid hbd_grid [private/internal] mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::hbd_grid->mom_hor_bnd_diffusion::merge_interfaces mom_hor_bnd_diffusion::hbd_grid_test hbd_grid_test [private/internal] mom_hor_bnd_diffusion::hbd_grid_test->mom_hor_bnd_diffusion::merge_interfaces mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::merge_interfaces
Text view
subroutine flux_limiter(F_layer, area_L, area_R, phi_L, phi_R, h_L, h_R)

Calculates the maximum flux that can leave a cell and uses that to apply a limiter to F_layer.

Parameters
  • F_layer [inout]

    Tracer flux to be checked [H L2 conc ~> m3 conc]

  • area_L [in]

    Area of left cell [L2 ~> m2]

  • area_R [in]

    Area of right cell [L2 ~> m2]

  • h_L [in]

    Thickness of left cell [H ~> m or kg m-2]

  • h_R [in]

    Thickness of right cell [H ~> m or kg m-2]

  • phi_L [in]

    Tracer concentration in the left cell [conc]

  • phi_R [in]

    Tracer concentration in the right cell [conc]

  • F_max

    maximum flux allowed [conc H L2 ~> conc m3 or conc kg]

Callers call graph
Callers of mom_hor_bnd_diffusion::flux_limiter calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::flux_limiter flux_limiter [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::flux_limiter
Text view
subroutine boundary_k_range(boundary, nk, h, hbl, k_top, zeta_top, k_bot, zeta_bot)

Find the k-index range corresponding to the layers that are within the boundary-layer region

Parameters
  • boundary [in]

    SURFACE or BOTTOM [nondim]

  • nk [in]

    Number of layers [nondim]

  • h [in]

    Layer thicknesses of the column [H ~> m or kg m-2]

  • hbl [in]

    Thickness of the boundary layer [H ~> m or kg m-2] If surface, with respect to zbl_ref = 0. If bottom, with respect to zbl_ref = SUM(h)

  • k_top [out]

    Index of the first layer within the boundary

  • zeta_top [out]

    Distance from the top of a layer to the intersection of the top extent of the boundary layer (0 at top, 1 at bottom) [nondim]

  • k_bot [out]

    Index of the last layer within the boundary

  • zeta_bot [out]

    Distance of the lower layer to the boundary layer depth (0 at top, 1 at bottom) [nondim]

Callees call graph
Callees of mom_hor_bnd_diffusion::boundary_k_range calls cluster_mom_error_handler MOM_error_handler cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_error_handler::mom_error MOM_error mom_hor_bnd_diffusion::boundary_k_range boundary_k_range mom_hor_bnd_diffusion::boundary_k_range->mom_error_handler::mom_error
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::boundary_k_range 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_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::boundary_k_range mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::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 mom_neutral_diffusion::neutral_diffusion_calc_coeffs neutral_diffusion_calc_coeffs mom_neutral_diffusion::neutral_diffusion_calc_coeffs->mom_hor_bnd_diffusion::boundary_k_range
Text view
subroutine fluxes_layer_method(boundary, ke, hbl_L, hbl_R, h_L, h_R, phi_L, phi_R, khtr_u, F_layer, area_L, area_R, nk, dz_top, CS)

Calculate the horizontal boundary diffusive fluxes using the layer by layer method. See Along layer approach

Parameters
  • boundary [in]

    Which boundary layer SURFACE or BOTTOM [nondim]

  • ke [in]

    Number of layers in the native grid [nondim]

  • hbl_L [in]

    Thickness of the boundary boundary layer (left) [H ~> m or kg m-2]

  • hbl_R [in]

    Thickness of the boundary boundary layer (right) [H ~> m or kg m-2]

  • h_L [in]

    Thicknesses in the native grid (left) [H ~> m or kg m-2]

  • h_R [in]

    Thicknesses in the native grid (right) [H ~> m or kg m-2]

  • phi_L [in]

    Tracer values in the native grid (left) [conc]

  • phi_R [in]

    Tracer values in the native grid (right) [conc]

  • khtr_u [in]

    Horizontal diffusivities times the time step at a velocity point and vertical interfaces [L2 ~> m2]

  • F_layer [out]

    Layerwise diffusive flux at U- or V-point in the native grid [H L2 conc ~> m3 conc]

  • area_L [in]

    Area of the horizontal grid (left) [L2 ~> m2]

  • area_R [in]

    Area of the horizontal grid (right) [L2 ~> m2]

  • nk [in]

    Number of layers in the HBD grid [nondim]

  • dz_top [in]

    The HBD z grid [H ~> m or kg m-2]

  • CS

    Horizontal diffusion control structure

  • phi_L_z

    Tracer values in the ztop grid (left) [conc]

  • phi_R_z

    Tracer values in the ztop grid (right) [conc]

  • F_layer_z

    Diffusive flux at U/V-point in the ztop grid [H L2 conc ~> m3 conc]

  • khtr_ul_z

    khtr_u at layer centers in the ztop grid [H L2 conc ~> m3 conc]

  • h_vel

    Thicknesses at u- and v-points in the native grid The harmonic mean is used to avoid zero values [H ~> m or kg m-2]

  • khtr_ul

    khtr_u at the vertical layer of the native grid [L2 ~> m2]

  • htot

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

  • k

    Index used in the vertical direction

  • k_bot_min

    Minimum k-index for the bottom

  • k_bot_max

    Maximum k-index for the bottom

  • k_bot_diff

    Difference between bottom left and right k-indices

  • k_top_L

    k-indices left native grid

  • k_bot_L

    k-indices left native grid

  • k_top_R

    k-indices right native grid

  • k_bot_R

    k-indices right native grid

  • zeta_top_L

    distance from the top of a layer to the boundary layer depth in the native grid [nondim]

  • zeta_top_R

    distance from the top of a layer to the boundary layer depth in the native grid [nondim]

  • zeta_bot_L

    distance from the bottom of a layer to the boundary layer depth in the native grid [nondim]

  • zeta_bot_R

    distance from the bottom of a layer to the boundary layer depth in the native grid [nondim]

  • wgt

    weight to be used in the linear transition to the interior [nondim]

  • a

    coefficient used in the linear transition to the interior [nondim]

  • tmp1

    dummy variables [H ~> m or kg m-2]

  • tmp2

    dummy variables [H ~> m or kg m-2]

  • htot_max

    depth below which no fluxes should be applied [H ~> m or kg m-2]

Callees call graph
Callees of mom_hor_bnd_diffusion::fluxes_layer_method calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_remapping MOM_remapping mom_hor_bnd_diffusion::boundary_k_range boundary_k_range mom_hor_bnd_diffusion::flux_limiter flux_limiter [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::boundary_k_range mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::flux_limiter mom_hor_bnd_diffusion::harmonic_mean harmonic_mean [private/internal] mom_hor_bnd_diffusion::fluxes_layer_method->mom_hor_bnd_diffusion::harmonic_mean mom_remapping::reintegrate_column reintegrate_column mom_hor_bnd_diffusion::fluxes_layer_method->mom_remapping::reintegrate_column mom_remapping::remapping_core_h remapping_core_h mom_hor_bnd_diffusion::fluxes_layer_method->mom_remapping::remapping_core_h
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::fluxes_layer_method calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::hor_bnd_diffusion hor_bnd_diffusion mom_hor_bnd_diffusion::hor_bnd_diffusion->mom_hor_bnd_diffusion::fluxes_layer_method mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::fluxes_layer_method
Text view
logical function near_boundary_unit_tests(verbose)

Unit tests for near-boundary horizontal mixing

Parameters
  • verbose [in]

    If true, output additional information for debugging unit tests

Callees call graph
Callees of mom_hor_bnd_diffusion::near_boundary_unit_tests calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_remapping MOM_remapping mom_hor_bnd_diffusion::boundary_k_range boundary_k_range mom_hor_bnd_diffusion::fluxes_layer_method fluxes_layer_method [private/internal] mom_hor_bnd_diffusion::hbd_grid_test hbd_grid_test [private/internal] mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::boundary_k_range mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::fluxes_layer_method mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::hbd_grid_test mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::merge_interfaces mom_hor_bnd_diffusion::sort sort [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::sort mom_hor_bnd_diffusion::test_boundary_k_range test_boundary_k_range [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::test_boundary_k_range mom_hor_bnd_diffusion::test_layer_fluxes test_layer_fluxes [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::test_layer_fluxes mom_hor_bnd_diffusion::unique unique [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::unique mom_remapping::extract_member_remapping_cs extract_member_remapping_CS mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_remapping::extract_member_remapping_cs mom_remapping::initialize_remapping initialize_remapping mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_remapping::initialize_remapping
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::near_boundary_unit_tests calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_unit_tests MOM_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_unit_tests::unit_tests unit_tests mom_unit_tests::unit_tests->mom_hor_bnd_diffusion::near_boundary_unit_tests
Text view
logical function test_layer_fluxes(verbose, nk, test_name, F_calc, F_ans)

Returns true if output of near-boundary unit tests does not match correct computed values and conditionally writes results to stream

Parameters
  • verbose [in]

    If true, write results to stdout

  • test_name [in]

    Brief description of the unit test

  • nk [in]

    Number of layers

  • F_calc [in]

    Fluxes or other quantity from the algorithm [arbitrary]

  • F_ans [in]

    Expected value calculated by hand [arbitrary]

Callers call graph
Callers of mom_hor_bnd_diffusion::test_layer_fluxes calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::test_layer_fluxes test_layer_fluxes [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::test_layer_fluxes
Text view
logical function test_boundary_k_range(k_top, zeta_top, k_bot, zeta_bot, k_top_ans, zeta_top_ans, k_bot_ans, zeta_bot_ans, test_name, verbose)

Return true if output of unit tests for boundary_k_range does not match answers

Parameters
  • k_top

    Index of cell containing top of boundary

  • zeta_top

    Fractional position in the cell of the top boundary [nondim]

  • k_bot

    Index of cell containing bottom of boundary

  • zeta_bot

    Fractional position in the cell of the bottom boundary [nondim]

  • k_top_ans

    Expected index of cell containing top of boundary

  • zeta_top_ans

    Expected fractional position of the top boundary [nondim]

  • k_bot_ans

    Expected index of cell containing bottom of boundary

  • zeta_bot_ans

    Expected fractional position of the bottom boundary [nondim]

  • test_name

    Name of the unit test

  • verbose

    If true always print output

Callers call graph
Callers of mom_hor_bnd_diffusion::test_boundary_k_range calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::test_boundary_k_range test_boundary_k_range [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::test_boundary_k_range
Text view
subroutine hbd_grid_test(boundary, hbl_L, hbl_R, h_L, h_R, CS)

Same as hbd_grid, but only used in the unit tests.

Parameters
  • boundary [in]

    Which boundary layer SURFACE or BOTTOM [nondim]

  • hbl_L [in]

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

  • hbl_R [in]

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

  • h_L [in]

    Layer thickness in the native grid, left [H ~> m or kg m-2]

  • h_R [in]

    Layer thickness in the native grid, right [H ~> m or kg m-2]

  • CS

    Horizontal diffusion control structure

  • dz_top

    temporary HBD grid given by merge_interfaces [H ~> m or kg m-2]

  • nk

    number of layers in the HBD grid, and integers used in do-loops

  • k

    number of layers in the HBD grid, and integers used in do-loops

Callees call graph
Callees of mom_hor_bnd_diffusion::hbd_grid_test calls cluster_mom_error_handler MOM_error_handler cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_error_handler::mom_error MOM_error mom_hor_bnd_diffusion::hbd_grid_test hbd_grid_test [private/internal] mom_hor_bnd_diffusion::hbd_grid_test->mom_error_handler::mom_error mom_hor_bnd_diffusion::merge_interfaces merge_interfaces [private/internal] mom_hor_bnd_diffusion::hbd_grid_test->mom_hor_bnd_diffusion::merge_interfaces
Text view
Callers call graph
Callers of mom_hor_bnd_diffusion::hbd_grid_test calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion mom_hor_bnd_diffusion::hbd_grid_test hbd_grid_test [private/internal] mom_hor_bnd_diffusion::near_boundary_unit_tests near_boundary_unit_tests mom_hor_bnd_diffusion::near_boundary_unit_tests->mom_hor_bnd_diffusion::hbd_grid_test
Text view
subroutine hor_bnd_diffusion_end(CS)

Deallocates hor_bnd_diffusion control structure

Parameters
  • CS

    Horizontal boundary diffusion control structure

Callers call graph
Callers of mom_hor_bnd_diffusion::hor_bnd_diffusion_end calls cluster_mom_hor_bnd_diffusion MOM_hor_bnd_diffusion cluster_mom_tracer_hor_diff MOM_tracer_hor_diff mom_hor_bnd_diffusion::hor_bnd_diffusion_end hor_bnd_diffusion_end mom_tracer_hor_diff::tracer_hor_diff_end tracer_hor_diff_end mom_tracer_hor_diff::tracer_hor_diff_end->mom_hor_bnd_diffusion::hor_bnd_diffusion_end
Text view
API generated with Flint · Rendered from reStructuredText