mom_meso_sfn_ann module reference

Implements an ANN-based mesoscale streamfunction parameterization for use with isopycnal height diffusion in MOM_thickness_diffuse.

More…

Data Types

meso_sfn_ann_cs

Control structure for meso-scale streamfunction ANN parameterization.

Functions/Subroutines

meso_sfn_ann_compute()

Compute the ANN-based mesoscale streamfunction on u- and v-points.

center_grad_rho()

Interpolate density gradients from u- and v-points to cell centers.

center2uv()

Interpolate two fields from cell centers to u- and v-points.

vel_gradients()

Calculates the velocity gradients at the center points in 3D.

calc_layered_density_gradients()

Compute density gradients from fixed layer densities and interface heights This is a workaround for running the ANN parameterization in pure layered mode (USE_EOS=False) where calc_isoneutral_slopes won't work.

meso_sfn_ann_init()

Initializes the meso-scale streamfunction ANN parameterization.

meso_sfn_ann_end()

Finalizes the meso-scale streamfunction ANN parameterization.

Detailed Description

The network reads a nondimensionalized stencil of density gradients, strain rate components, and relative vorticity, and returns two density flux components at the cell center. The dimensionalization in meso_sfn_ANN_compute (multiplication by rho_grad_mag * vel_grad_mag * areaT * ann_coeff) must match the nondimensionalization used when the network was trained changing one without the other will produce garbage fluxes. The training procedure is the implicit contract.

Density fluxes are converted to a velocity-scale streamfunction Upsilon (Ferrari et al. 2010) by dividing by the local 3-D density gradient magnitude; a configurable clamp acts on Upsilon so the cap is grid-independent. The volume-transport streamfunction passed back to thickness_diffuse is Upsilon * dy_Cu (or dx_Cv), matching MOM6’s Sfn_unlim convention.

Type Documentation

type  mom_meso_sfn_ann/meso_sfn_ann_cs

Control structure for meso-scale streamfunction ANN parameterization.

Type fields:
  • % initialized :: logical If true, the module has been initialized.

  • % debug :: logical if true, write verbose checksums for debugging purposes.

  • % ann_coeff :: real Coefficient to multiply the ANN output by.

  • % kappa_smooth :: real Vertical diffusivity used to interpolate more sensible values of T & S into thin layers [H Z T-1 ~> m2 s-1 or kg m-1 s-1].

  • % ann_window :: integer Size of the window used in the ANN model.

  • % ann_rho_flux :: type(ann_cs) ANN instance for off-diagonal and diagonal stress.

  • % ann_file_rho_flux :: character(len=200) Path to netcdf file with ANN.

  • % min_dist_from_boundary :: real Minimum distance from bottom for valid interface [Z ~> m].

  • % mag_grad_floor :: real Floor for density gradient magnitude [R Z-1 ~> kg m-4].

  • % flux_clamp :: real Maximum magnitude of ANN output density flux [R L T-1 ~> kg m-2 s-1].

  • % upsilon_clamp :: real Maximum magnitude of the velocity-scale streamfunction Upsilon (Ferrari et al. 2010) [L Z T-1 ~> m2 s-1].

  • % diag :: type(diag_ctrl), pointer structure used to regulate timing of diagnostics

  • % id_drdx_u :: integer Diagnostic id for zonal density gradient at u-points.

  • % id_drdy_v :: integer Diagnostic id for meridional density gradient at v-points.

  • % id_drdz_u :: integer Diagnostic id for vertical density gradient at u-points.

  • % id_drdz_v :: integer Diagnostic id for vertical density gradient at v-points.

  • % id_drdx_c :: integer Diagnostic id for zonal density gradient at center points.

  • % id_drdy_c :: integer Diagnostic id for meridional density gradient at center points.

  • % id_fx_c :: integer Diagnostic id for zonal density flux at center points.

  • % id_fy_c :: integer Diagnostic id for meridional density flux at center points.

  • % id_fx_u :: integer Diagnostic id for zonal density flux at u-points.

  • % id_fy_v :: integer Diagnostic id for meridional density flux at v-points.

  • % id_sfn_u :: integer Diagnostic id for volume streamfunction at u-points.

  • % id_sfn_v :: integer Diagnostic id for volume streamfunction at v-points.

[source]

Function/Subroutine Documentation

subroutine mom_meso_sfn_ann/meso_sfn_ann_compute(h, e, sfn_u, sfn_v, G, GV, US, tv, CS, dt, u, v)

Compute the ANN-based mesoscale streamfunction on u- and v-points.

Computes density gradients and velocity gradients, feeds them through the ANN to get density fluxes at cell centers, then converts those fluxes into a streamfunction on u- and v-points for use in thickness_diffuse.

Parameters:
  • g :: [in] Ocean grid structure

  • gv :: [in] Vertical grid structure

  • us :: [in] A dimensional unit scaling type

  • tv :: tv [in] Thermodynamics structure

  • h :: h [in] Layer thickness [Z ~> m or kg m-2]

  • e :: e [in] Layer thickness [Z ~> m or kg m-2]

  • cs :: [inout] Control structure for thickness_flux_ann

  • sfn_u :: sfn_u [out] Mesoscale volume streamfunction on u-points [Z L2 T-1 ~> m3 s-1]

  • sfn_v :: sfn_v [out] Mesoscale volume streamfunction on v-points [Z L2 T-1 ~> m3 s-1]

  • dt :: dt [in] Model time step [T ~> s]

  • u :: u [in] Zonal velocity [L T-1 ~> m s-1].

  • v :: v [in] Meridional velocity [L T-1 ~> m s-1].

Call to:

mom_ann::ann_apply_array_sio mom_isopycnal_slopes::calc_isoneutral_slopes calc_layered_density_gradients center2uv center_grad_rho mom_error_handler::mom_error vel_gradients

[source]

subroutine mom_meso_sfn_ann/center_grad_rho(drdx_u, drdy_v, drdx_c, drdy_c, G, GV, CS)

Interpolate density gradients from u- and v-points to cell centers.

Parameters:
  • g :: [in] Ocean grid structure

  • gv :: [in] Vertical grid structure

  • cs :: [inout] Control structure for thickness_flux_ann

  • drdx_u :: drdx_u [in] Zonal density gradient at u-points [R L-1 ~> kg m-4]

  • drdy_v :: drdy_v [in] Meridional density gradient at v-points [R L-1 ~> kg m-4]

  • drdx_c :: drdx_c [inout] Zonal density gradient at center [R L-1 ~> kg m-4]

  • drdy_c :: drdy_c [inout] Meridional density gradient at center [R L-1 ~> kg m-4]

Called from:

meso_sfn_ann_compute

[source]

subroutine mom_meso_sfn_ann/center2uv(var1_c, var2_c, var1_u, var2_v, G, GV)

Interpolate two fields from cell centers to u- and v-points.

Parameters:
  • g :: [in] Ocean grid structure

  • gv :: [in] Vertical grid structure

  • var1_c :: var1_c [in] Variable at center points [arbitrary]

  • var2_c :: var2_c [in] Variable at center points [arbitrary]

  • var1_u :: var1_u [inout] Variable at u points [arbitrary]

  • var2_v :: var2_v [inout] Variable at v points [arbitrary]

Called from:

meso_sfn_ann_compute

[source]

subroutine mom_meso_sfn_ann/vel_gradients(u, v, G, GV, dudx, dudy, dvdx, dvdy, CS)

Calculates the velocity gradients at the center points in 3D.

Parameters:
  • g :: [in] Ocean grid structure

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

  • u :: u [in] The zonal velocity [L T-1 ~> m s-1].

  • v :: v [in] The meridional velocity [L T-1 ~> m s-1].

  • dudx :: dudx [out] du/dx [T-1 ~> s-1]

  • dvdy :: dvdy [out] dv/dy [T-1 ~> s-1]

  • dudy :: dudy [out] du/dy [T-1 ~> s-1]

  • dvdx :: dvdx [out] dv/dx [T-1 ~> s-1]

  • cs :: [in] Control structure for thickness_flux_ann

Called from:

meso_sfn_ann_compute

[source]

subroutine mom_meso_sfn_ann/calc_layered_density_gradients(G, GV, US, h, e, drdx_u, drdy_v, drdz_u, drdz_v, halo, min_dist_from_boundary)

Compute density gradients from fixed layer densities and interface heights This is a workaround for running the ANN parameterization in pure layered mode (USE_EOS=False) where calc_isoneutral_slopes won’t work.

Called from:

meso_sfn_ann_compute

[source]

subroutine mom_meso_sfn_ann/meso_sfn_ann_init(Time, G, GV, US, param_file, diag, CS)

Initializes the meso-scale streamfunction ANN parameterization.

Parameters:
  • time :: [in] Current model time

  • g :: [in] Ocean grid structure

  • gv :: [in] Vertical grid structure

  • us :: [in] A dimensional unit scaling type

  • param_file :: param_file [in] Parameter file handles

  • diag :: diag [inout] Diagnostics control structure

  • cs :: [inout] Control structure for meso sfn ann

Call to:

mom_ann::ann_init mom_error_handler::mom_error mom_diag_mediator::register_diag_field

Called from:

mom_thickness_diffuse::thickness_diffuse_init

[source]

subroutine mom_meso_sfn_ann/meso_sfn_ann_end(CS)

Finalizes the meso-scale streamfunction ANN parameterization.

Parameters:

cs :: [inout] Control structure

Call to:

mom_ann::ann_end

[source]

[source]