MOM_meso_sfn_ANN module reference
Implements an ANN-based mesoscale streamfunction parameterization for use with isopycnal height diffusion in MOM_thickness_diffuse.
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.
Data Types
Control structure for meso-scale streamfunction ANN parameterization |
Functions/Subroutines
Compute the ANN-based mesoscale streamfunction on u- and v-points. |
|
Interpolate density gradients from u- and v-points to cell centers. |
|
Interpolate two fields from cell centers to u- and v-points. |
|
Calculates the velocity gradients at the center points in 3D. |
|
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. |
|
Initializes the meso-scale streamfunction ANN parameterization |
|
Finalizes the meso-scale streamfunction ANN parameterization |
Type Documentation
- type, public :: MESO_SFN_ANN_CS
Control structure for meso-scale streamfunction ANN parameterization
- Parameters
initialized
If true, the module has been initialized.
debug
if true, write verbose checksums for debugging purposes.
ann_coeff
Coefficient to multiply the ANN output by.
kappa_smooth
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
Size of the window used in the ANN model.
ann_rho_flux
ANN instance for off-diagonal and diagonal stress
ann_file_rho_flux
Path to netcdf file with ANN
min_dist_from_boundary
Minimum distance from bottom for valid interface [Z ~> m]
mag_grad_floor
Floor for density gradient magnitude [R Z-1 ~> kg m-4]
flux_clamp
Maximum magnitude of ANN output density flux [R L T-1 ~> kg m-2 s-1]
Upsilon_clamp
Maximum magnitude of the velocity-scale streamfunction Upsilon (Ferrari et al. 2010) [L Z T-1 ~> m2 s-1]
diag
structure used to regulate timing of diagnostics
id_drdx_u
Diagnostic id for zonal density gradient at u-points.
id_drdy_v
Diagnostic id for meridional density gradient at v-points.
id_drdz_u
Diagnostic id for vertical density gradient at u-points.
id_drdz_v
Diagnostic id for vertical density gradient at v-points.
id_drdx_c
Diagnostic id for zonal density gradient at center points.
id_drdy_c
Diagnostic id for meridional density gradient at center points.
id_Fx_c
Diagnostic id for zonal density flux at center points.
id_Fy_c
Diagnostic id for meridional density flux at center points.
id_Fx_u
Diagnostic id for zonal density flux at u-points.
id_Fy_v
Diagnostic id for meridional density flux at v-points.
id_sfn_u
Diagnostic id for volume streamfunction at u-points.
id_sfn_v
Diagnostic id for volume streamfunction at v-points.
Functions/Subroutine Documentation
- subroutine 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 [in]
Thermodynamics structure
h [in]
Layer thickness [Z ~> m or kg m-2]
e [in]
Layer thickness [Z ~> m or kg m-2]
CS [inout]
Control structure for thickness_flux_ann
sfn_u [out]
Mesoscale volume streamfunction on u-points [Z L2 T-1 ~> m3 s-1]
sfn_v [out]
Mesoscale volume streamfunction on v-points [Z L2 T-1 ~> m3 s-1]
dt [in]
Model time step [T ~> s]
u [in]
Zonal velocity [L T-1 ~> m s-1].
v [in]
Meridional velocity [L T-1 ~> m s-1].
drdx_u
Zonal density gradient at u [R L-1 ~> kg m-4]
drdz_u
Vertical density gradient at u [R Z-1 ~> kg m-4]
drdy_v
Meridional density gradient at v [R L-1 ~> kg m-4]
drdz_v
Vertical density gradient at v [R Z-1 ~> kg m-4]
slope_x
Isopycnal slope in x at u [Z L-1 ~> nondim]
slope_y
Isopycnal slope in y at v [Z L-1 ~> nondim]
Fx_u
Zonal density flux at u-points [R L T-1 ~> kg m-2 s-1]
Fy_v
Meridional density flux at v-points [R L T-1 ~> kg m-2 s-1]
drdx_c
Zonal density gradient at center points [R L-1 ~> kg m-4]
drdy_c
Meridional density gradient at center points [R L-1 ~> kg m-4]
Fx_c
Zonal density flux at center points [R L T-1 ~> kg m-2 s-1]
Fy_c
Meridional density flux at center points [R L T-1 ~> kg m-2 s-1]
dudx
du/dx at cell center [T-1 ~> s-1]
dvdy
dv/dy at cell center [T-1 ~> s-1]
dudy
du/dy at cell center [T-1 ~> s-1]
dvdx
dv/dx at cell center [T-1 ~> s-1]
norm_y
Scaling coefficient for ANN outputs [R L-1 T-1 ~> kg m-4 s-1]
drdx_local
Local stencil of drdx [R L-1 ~> kg m-4]
drdy_local
Local stencil of drdy [R L-1 ~> kg m-4]
dudx_local
Local stencil of du/dx [T-1 ~> s-1]
dudy_local
Local stencil of du/dy [T-1 ~> s-1]
dvdx_local
Local stencil of dv/dx [T-1 ~> s-1]
dvdy_local
Local stencil of dv/dy [T-1 ~> s-1]
sh_xx_local
Local stencil of normal strain [T-1 ~> s-1]
sh_xy_local
Local stencil of shear strain [T-1 ~> s-1]
vort_local
Local stencil of relative vorticity [T-1 ~> s-1]
vel_grad_mag
Magnitude of velocity gradient tensor over stencil [T-1 ~> s-1]
rho_grad_mag
Magnitude of density gradient over stencil [R L-1 ~> kg m-4]
x
Input vector to the ANN
y
Output vector from the ANN
yy
Local output vector from the ANN
mag_grad
Magnitude of 3-D density gradient [R Z-1 ~> kg m-4]
Callees call graph
Text view
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_ann::ann_apply_array_sio
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_diag_mediator::interface::post_data
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_domain_infra::interface::pass_vector
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_error_handler::mom_error
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_isopycnal_slopes::calc_isoneutral_slopes
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_meso_sfn_ann::calc_layered_density_gradients
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_meso_sfn_ann::center2uv
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_meso_sfn_ann::center_grad_rho
mom_meso_sfn_ann::meso_sfn_ann_compute → mom_meso_sfn_ann::vel_gradients
Callers call graph
- subroutine 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 [in]
Zonal density gradient at u-points [R L-1 ~> kg m-4]
drdy_v [in]
Meridional density gradient at v-points [R L-1 ~> kg m-4]
drdx_c [inout]
Zonal density gradient at center [R L-1 ~> kg m-4]
drdy_c [inout]
Meridional density gradient at center [R L-1 ~> kg m-4]
Callers call graph
- subroutine 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 [in]
Variable at center points [arbitrary]
var2_c [in]
Variable at center points [arbitrary]
var1_u [inout]
Variable at u points [arbitrary]
var2_v [inout]
Variable at v points [arbitrary]
- subroutine 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 [in]
The zonal velocity [L T-1 ~> m s-1].
v [in]
The meridional velocity [L T-1 ~> m s-1].
dudx [out]
du/dx [T-1 ~> s-1]
dvdy [out]
dv/dy [T-1 ~> s-1]
dudy [out]
du/dy [T-1 ~> s-1]
dvdx [out]
dv/dx [T-1 ~> s-1]
CS [in]
Control structure for thickness_flux_ann
dudy_q
du/dy at corner points [T-1 ~> s-1]
dvdx_q
dv/dx at corner points [T-1 ~> s-1]
Callers call graph
- subroutine 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.
Callers call graph
- subroutine 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 [in]
Parameter file handles
diag [inout]
Diagnostics control structure
CS [inout]
Control structure for meso sfn ann
Callees call graph
Text view
Callers call graph
- subroutine meso_sfn_ANN_end(CS)
Finalizes the meso-scale streamfunction ANN parameterization
- Parameters
CS [inout]
Control structure