MOM_Zanna_Bolton module reference
Calculates Zanna and Bolton 2020 parameterization Implemented by Perezhogin P.A. Contact: pperezhogin@gmail.com
Data Types
Control structure for Zanna-Bolton-2020 parameterization. |
Functions/Subroutines
Read parameters, allocate and precompute arrays, register diagnosicts used in Zanna_Bolton_2020(). |
|
Deallocate any variables allocated in ZB_2020_init |
|
Save precomputed velocity gradients and thickness from the horizontal eddy viscosity module We save as much halo for velocity gradients as possible In symmetric (preferable) memory model: halo 2 for sh_xx and halo 1 for sh_xy and vort_xy We apply zero boundary conditions to velocity gradients which is required for filtering operations |
|
Baroclinic Zanna-Bolton-2020 parameterization, see eq. 6 in https://laurezanna.github.io/files/Zanna-Bolton-2020.pdf We compute the lateral stress tensor according to ZB2020 model and update the acceleration due to eddy viscosity (diffu, diffv) as follows: diffu = diffu + ZB2020u diffv = diffv + ZB2020v |
|
Compute the attenuation parameter similarly to Klower2018, Juricke2019,2020: c_diss = 1/(1+(shear/(f*R_diss))) where shear = sqrt(sh_xx**2 + sh_xy**2) or shear = sqrt(sh_xx**2 + sh_xy**2 + vort_xy**2) In symmetric memory model, components of velocity gradient tensor should have halo 1 and zero boundary conditions. The result: c_diss having halo 1. |
|
Compute stress tensor T = (Txx, Txy; Txy, Tyy) Which consists of the deviatoric and trace components, respectively: T = (-vort_xy * sh_xy, vort_xy * sh_xx; vort_xy * sh_xx, vort_xy * sh_xy) + 1/2 * (vort_xy^2 + sh_xy^2 + sh_xx^2, 0; 0, vort_xy^2 + sh_xy^2 + sh_xx^2) This stress tensor is multiplied by precomputed kappa=-CS%amplitude * G%area: T -> T * kappa The sign of the stress tensor is such that (neglecting h): (du/dt, dv/dt) = div(T) In symmetric memory model: sh_xy and vort_xy should have halo 1 and zero B.C.; sh_xx should have halo 2 and zero B.C. Result: Txx, Tyy, Txy with halo 1 and zero B.C. |
|
Compute stress tensor T = (Txx, Txy; Txy, Tyy) with ANN in non-dimensional form: T = dx^2 * |grad V|^2 * ANN(grad V / |grad V|) The sign of the stress tensor is such that: (du/dt, dv/dt) = 1/h * div(h * T) Algorithm: |
|
Compute the divergence of subgrid stress weighted with thickness, i.e. (fx,fy) = 1/h Div(h * [Txx, Txy; Txy, Tyy]) and update the acceleration due to eddy viscosity as diffu = diffu + dx; diffv = diffv + dy Optionally, before computing the divergence, we attenuate the stress according to the Klower formula. In symmetric memory model: Txx, Tyy, Txy, c_diss should have halo 1 with applied zero B.C. |
|
Filtering of the velocity gradients sh_xx, sh_xy, vort_xy. Here instead of smoothing we do sharpening, i.e. return (initial - smoothed) fields. The algorithm: marching halo with non-blocking grouped MPI exchanges. The input array sh_xx should have halo 2 with applied zero B.C. The arrays sh_xy and vort_xy should have halo 1 with applied B.C. The output have the same halo and B.C. |
|
Filtering of the stress tensor Txx, Tyy, Txy. The algorithm: marching halo with non-blocking grouped MPI exchanges. The input arrays (Txx, Tyy, Txy) must have halo 1 with zero B.C. applied. The output have the same halo and B.C. |
|
Wrapper for filter_3D function. The border indices for q and h arrays are substituted. |
|
Spatial lateral filter applied to 3D array. The lateral filter is given by the convolutional kernel: [1 2 1] C = |2 4 2| * 1/16 [1 2 1] The fast algorithm decomposes the 2D filter into two 1D filters as follows: [1] C = |2| * [1 2 1] * 1/16 [1] The input array must have zero B.C. applied. B.C. is applied for output array. Note that maskw contains both land mask and 1/16 factor. Filter implements marching halo. The available halo is specified and as many filter iterations as possible and as needed are performed. |
|
Computes the 3D energy source term for the ZB2020 scheme similarly to MOM_diagnostics.F90, specifically 1125 line. |
Type Documentation
- type, public :: ZB2020_CS
Control structure for Zanna-Bolton-2020 parameterization.
- Parameters
amplitude
The nondimensional scaling factor in ZB model, typically 0.1 - 10 [nondim].
ZB_type
Select how to compute the trace part of ZB model: 0 - both deviatoric and trace components are computed 1 - only deviatoric component is computed 2 - only trace component is computed
ZB_cons
Select a discretization scheme for ZB model 0 - non-conservative scheme 1 - conservative scheme for deviatoric component
HPF_iter
Number of sharpening passes for the Velocity Gradient (VG) components in ZB model.
Stress_iter
Number of smoothing passes for the Stress tensor components in ZB model.
Klower_R_diss
Attenuation of the ZB parameterization in the regions of geostrophically-unbalanced flows (Klower 2018, Juricke2020,2019) Subgrid stress is multiplied by 1/(1+(shear/(f*R_diss))) R_diss=-1: attenuation is not used; typical value R_diss=1.0 [nondim]
Klower_shear
Type of expression for shear in Klower formula 0: sqrt(sh_xx**2 + sh_xy**2) 1: sqrt(sh_xx**2 + sh_xy**2 + vort_xy**2)
Marching_halo
The number of filter iterations per a single MPI exchange
sh_xx
Horizontal tension (du/dx - dv/dy) in h (CENTER) points including metric terms [T-1 ~> s-1]
sh_xy
Horizontal shearing strain (du/dy + dv/dx) in q (CORNER) points including metric terms [T-1 ~> s-1]
vort_xy
Vertical vorticity (dv/dx - du/dy) in q (CORNER) points including metric terms [T-1 ~> s-1]
hq
Thickness in CORNER points [H ~> m or kg m-2]
Txx
Subgrid stress xx component in h [L2 T-2 ~> m2 s-2]
Tyy
Subgrid stress yy component in h [L2 T-2 ~> m2 s-2]
Txy
Subgrid stress xy component in q [L2 T-2 ~> m2 s-2]
kappa_h
Scaling coefficient in h points [L2 ~> m2]
kappa_q
Scaling coefficient in q points [L2 ~> m2]
ICoriolis_h
Inverse Coriolis parameter at h points [T ~> s]
c_diss
Attenuation parameter at h points (Klower 2018, Juricke2019,2020) [nondim]
maskw_h
Mask of land point at h points multiplied by filter weight [nondim]
maskw_q
Same mask but for q points [nondim]
use_ann
If True, momentum fluxes are inferred with ANN
stencil_size
Default is 3x3
ann_Tall
ANN instance for off-diagonal and diagonal stress
ann_file_Tall
Path to netcdf file with ANN
subroundoff_shear
Small dimensional constant for save division by zero [T-1 ~> s-1]
id_ZB2020u
Diagnostic handles
id_ZB2020v
Diagnostic handles
id_KE_ZB2020
Diagnostic handles
id_Txx
Diagnostic handles
id_Tyy
Diagnostic handles
id_Txy
Diagnostic handles
id_cdiss
Diagnostic handles
id_clock_module
CPU time clock IDs
id_clock_copy
CPU time clock IDs
id_clock_cdiss
CPU time clock IDs
id_clock_stress
CPU time clock IDs
id_clock_stress_ANN
CPU time clock IDs
id_clock_divergence
CPU time clock IDs
id_clock_mpi
CPU time clock IDs
id_clock_filter
CPU time clock IDs
id_clock_post
CPU time clock IDs
id_clock_source
CPU time clock IDs
pass_Tq
MPI group passes
pass_Th
handles for halo passes of Txy and Txx, Tyy
pass_xx
MPI group passes
pass_xy
handles for halo passes of sh_xx and sh_xy, vort_xy
Stress_halo
The halo size in filter of the stress tensor
HPF_halo
MPI group passes
Functions/Subroutine Documentation
- subroutine ZB2020_init(Time, G, GV, US, param_file, diag, CS, use_ZB2020)
Read parameters, allocate and precompute arrays, register diagnosicts used in Zanna_Bolton_2020().
- Parameters
Time [in]
The current model time.
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
US [in]
A dimensional unit scaling type
param_file [in]
Parameter file parser structure.
diag [inout]
Diagnostics structure.
CS [inout]
ZB2020 control structure.
use_ZB2020 [out]
If true, turns on ZB scheme.
Callees call graph
Text view
mom_zanna_bolton::zb2020_init → mom_cpu_clock_infra::cpu_clock_id
mom_zanna_bolton::zb2020_init → mom_diag_mediator::register_diag_field
mom_zanna_bolton::zb2020_init → mom_domain_infra::interface::create_group_pass
mom_zanna_bolton::zb2020_init → mom_file_parser::interface::get_param
mom_zanna_bolton::zb2020_init → mom_file_parser::interface::log_version
- subroutine ZB2020_end(CS)
Deallocate any variables allocated in ZB_2020_init
- Parameters
CS [inout]
ZB2020 control structure.
- subroutine ZB2020_copy_gradient_and_thickness(sh_xx, sh_xy, vort_xy, hq, G, GV, CS, k)
Save precomputed velocity gradients and thickness from the horizontal eddy viscosity module We save as much halo for velocity gradients as possible In symmetric (preferable) memory model: halo 2 for sh_xx and halo 1 for sh_xy and vort_xy We apply zero boundary conditions to velocity gradients which is required for filtering operations
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure.
CS [inout]
ZB2020 control structure.
sh_xy [in]
horizontal shearing strain (du/dy + dv/dx) including metric terms [T-1 ~> s-1]
vort_xy [in]
Vertical vorticity (dv/dx - du/dy) including metric terms [T-1 ~> s-1]
hq [in]
harmonic mean of the harmonic means of the u- & v point thicknesses [H ~> m or kg m-2]
sh_xx [in]
horizontal tension (du/dx - dv/dy) including metric terms [T-1 ~> s-1]
k [in]
The vertical index of the layer to be passed.
Callees call graph
Callers call graph
- subroutine ZB2020_lateral_stress(u, v, h, diffu, diffv, G, GV, CS, dx2h, dy2h, dx2q, dy2q)
Baroclinic Zanna-Bolton-2020 parameterization, see eq. 6 in https://laurezanna.github.io/files/Zanna-Bolton-2020.pdf We compute the lateral stress tensor according to ZB2020 model and update the acceleration due to eddy viscosity (diffu, diffv) as follows: diffu = diffu + ZB2020u diffv = diffv + ZB2020v
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure.
CS [inout]
ZB2020 control structure.
u [in]
The zonal velocity [L T-1 ~> m s-1].
v [in]
The meridional velocity [L T-1 ~> m s-1].
h [in]
Layer thicknesses [H ~> m or kg m-2].
diffu [inout]
Zonal acceleration due to eddy viscosity. It is updated with ZB closure [L T-2 ~> m s-2]
diffv [inout]
Meridional acceleration due to eddy viscosity. It is updated with ZB closure [L T-2 ~> m s-2]
dx2h [in]
dx^2 at h points [L2 ~> m2]
dy2h [in]
dy^2 at h points [L2 ~> m2]
dx2q [in]
dx^2 at q points [L2 ~> m2]
dy2q [in]
dy^2 at q points [L2 ~> m2]
Callees call graph
Text view
mom_zanna_bolton::zb2020_lateral_stress → mom_cpu_clock_infra::cpu_clock_begin
mom_zanna_bolton::zb2020_lateral_stress → mom_cpu_clock_infra::cpu_clock_end
mom_zanna_bolton::zb2020_lateral_stress → mom_diag_mediator::interface::post_data
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::compute_c_diss
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::compute_stress
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::compute_stress_ann_collocated
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::compute_stress_divergence
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::filter_stress
mom_zanna_bolton::zb2020_lateral_stress → mom_zanna_bolton::filter_velocity_gradients
Callers call graph
- subroutine compute_c_diss(G, GV, CS)
Compute the attenuation parameter similarly to Klower2018, Juricke2019,2020: c_diss = 1/(1+(shear/(f*R_diss))) where shear = sqrt(sh_xx**2 + sh_xy**2) or shear = sqrt(sh_xx**2 + sh_xy**2 + vort_xy**2) In symmetric memory model, components of velocity gradient tensor should have halo 1 and zero boundary conditions. The result: c_diss having halo 1.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [inout]
ZB2020 control structure.
Callees call graph
Callers call graph
- subroutine compute_stress(G, GV, CS)
Compute stress tensor T = (Txx, Txy; Txy, Tyy) Which consists of the deviatoric and trace components, respectively: T = (-vort_xy * sh_xy, vort_xy * sh_xx; vort_xy * sh_xx, vort_xy * sh_xy) + 1/2 * (vort_xy^2 + sh_xy^2 + sh_xx^2, 0; 0, vort_xy^2 + sh_xy^2 + sh_xx^2) This stress tensor is multiplied by precomputed kappa=-CS%amplitude * G%area: T -> T * kappa The sign of the stress tensor is such that (neglecting h): (du/dt, dv/dt) = div(T) In symmetric memory model: sh_xy and vort_xy should have halo 1 and zero B.C.; sh_xx should have halo 2 and zero B.C. Result: Txx, Tyy, Txy with halo 1 and zero B.C.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [inout]
ZB2020 control structure.
Callees call graph
Callers call graph
- subroutine compute_stress_ANN_collocated(G, GV, CS)
Compute stress tensor T = (Txx, Txy; Txy, Tyy) with ANN in non-dimensional form: T = dx^2 * |grad V|^2 * ANN(grad V / |grad V|) The sign of the stress tensor is such that: (du/dt, dv/dt) = 1/h * div(h * T) Algorithm:
Interpolate input features (sh_xy, sh_xx, vort_xy) to grid centers
Compute norm of velocity gradients on a stencil
Non-dimensionalize input features
Make ANN inference in grid centers
Restore physical dimensionality and interpolate Txy back to corners
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [inout]
ZB2020 control structure.
Callees call graph
Text view
mom_zanna_bolton::compute_stress_ann_collocated → mom_ann::ann_apply_array_sio
mom_zanna_bolton::compute_stress_ann_collocated → mom_cpu_clock_infra::cpu_clock_begin
mom_zanna_bolton::compute_stress_ann_collocated → mom_cpu_clock_infra::cpu_clock_end
mom_zanna_bolton::compute_stress_ann_collocated → mom_domain_infra::interface::pass_var
Callers call graph
- subroutine compute_stress_divergence(u, v, h, diffu, diffv, dx2h, dy2h, dx2q, dy2q, G, GV, CS)
Compute the divergence of subgrid stress weighted with thickness, i.e. (fx,fy) = 1/h Div(h * [Txx, Txy; Txy, Tyy]) and update the acceleration due to eddy viscosity as diffu = diffu + dx; diffv = diffv + dy Optionally, before computing the divergence, we attenuate the stress according to the Klower formula. In symmetric memory model: Txx, Tyy, Txy, c_diss should have halo 1 with applied zero B.C.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [in]
ZB2020 control structure.
u [in]
The zonal velocity [L T-1 ~> m s-1].
v [in]
The meridional velocity [L T-1 ~> m s-1].
h [in]
Layer thicknesses [H ~> m or kg m-2].
diffu [out]
Zonal acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2]
diffv [out]
Meridional acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2]
dx2h [in]
dx^2 at h points [L2 ~> m2]
dy2h [in]
dy^2 at h points [L2 ~> m2]
dx2q [in]
dx^2 at q points [L2 ~> m2]
dy2q [in]
dy^2 at q points [L2 ~> m2]
ZB2020u
Zonal acceleration due to convergence of along-coordinate stress tensor for ZB model [L T-2 ~> m s-2]
ZB2020v
Meridional acceleration due to convergence of along-coordinate stress tensor for ZB model [L T-2 ~> m s-2]
Callees call graph
Text view
mom_zanna_bolton::compute_stress_divergence → mom_cpu_clock_infra::cpu_clock_begin
mom_zanna_bolton::compute_stress_divergence → mom_cpu_clock_infra::cpu_clock_end
mom_zanna_bolton::compute_stress_divergence → mom_diag_mediator::interface::post_data
mom_zanna_bolton::compute_stress_divergence → mom_zanna_bolton::compute_energy_source
Callers call graph
- subroutine filter_velocity_gradients(G, GV, CS)
Filtering of the velocity gradients sh_xx, sh_xy, vort_xy. Here instead of smoothing we do sharpening, i.e. return (initial - smoothed) fields. The algorithm: marching halo with non-blocking grouped MPI exchanges. The input array sh_xx should have halo 2 with applied zero B.C. The arrays sh_xy and vort_xy should have halo 1 with applied B.C. The output have the same halo and B.C.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [inout]
ZB2020 control structure.
Callees call graph
Text view
mom_zanna_bolton::filter_velocity_gradients → mom_cpu_clock_infra::cpu_clock_begin
mom_zanna_bolton::filter_velocity_gradients → mom_cpu_clock_infra::cpu_clock_end
mom_zanna_bolton::filter_velocity_gradients → mom_domain_infra::complete_group_pass
mom_zanna_bolton::filter_velocity_gradients → mom_domain_infra::do_group_pass
mom_zanna_bolton::filter_velocity_gradients → mom_domain_infra::start_group_pass
mom_zanna_bolton::filter_velocity_gradients → mom_zanna_bolton::filter_hq
Callers call graph
- subroutine filter_stress(G, GV, CS)
Filtering of the stress tensor Txx, Tyy, Txy. The algorithm: marching halo with non-blocking grouped MPI exchanges. The input arrays (Txx, Tyy, Txy) must have halo 1 with zero B.C. applied. The output have the same halo and B.C.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [inout]
ZB2020 control structure.
Callees call graph
Callers call graph
- subroutine filter_hq(G, GV, CS, current_halo, remaining_iterations, q, h)
Wrapper for filter_3D function. The border indices for q and h arrays are substituted.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure
CS [in]
ZB2020 control structure.
h [inout]
Input/output array in h points [arbitrary]
q [inout]
Input/output array in q points [arbitrary]
current_halo [inout]
Currently available halo points
remaining_iterations [inout]
The number of iterations to perform
Callees call graph
Callers call graph
- subroutine filter_3D(x, maskw, isd, ied, jsd, jed, is, ie, js, je, nz, current_halo, remaining_iterations, direction)
Spatial lateral filter applied to 3D array. The lateral filter is given by the convolutional kernel: [1 2 1] C = |2 4 2| * 1/16 [1 2 1] The fast algorithm decomposes the 2D filter into two 1D filters as follows: [1] C = |2| * [1 2 1] * 1/16 [1] The input array must have zero B.C. applied. B.C. is applied for output array. Note that maskw contains both land mask and 1/16 factor. Filter implements marching halo. The available halo is specified and as many filter iterations as possible and as needed are performed.
- Parameters
isd [in]
Indices of array size
ied [in]
Indices of array size
jsd [in]
Indices of array size
jed [in]
Indices of array size
is [in]
Indices of owned points
ie [in]
Indices of owned points
js [in]
Indices of owned points
je [in]
Indices of owned points
nz [in]
Vertical array size
x [inout]
Input/output array [arbitrary]
maskw [in]
Mask array of land points divided by 16 [nondim]
current_halo [inout]
Currently available halo points
remaining_iterations [inout]
The number of iterations to perform
direction [in]
The direction of the first 1D filter
- subroutine compute_energy_source(u, v, h, fx, fy, G, GV, CS)
Computes the 3D energy source term for the ZB2020 scheme similarly to MOM_diagnostics.F90, specifically 1125 line.
- Parameters
G [in]
The ocean's grid structure.
GV [in]
The ocean's vertical grid structure.
CS [in]
ZB2020 control structure.
u [in]
The zonal velocity [L T-1 ~> m s-1].
v [in]
The meridional velocity [L T-1 ~> m s-1].
h [in]
Layer thicknesses [H ~> m or kg m-2].
fx [in]
Zonal acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2]
fy [in]
Meridional acceleration due to convergence of along-coordinate stress tensor [L T-2 ~> m s-2]
Callees call graph
Text view
mom_zanna_bolton::compute_energy_source → mom_cpu_clock_infra::cpu_clock_begin
mom_zanna_bolton::compute_energy_source → mom_cpu_clock_infra::cpu_clock_end
mom_zanna_bolton::compute_energy_source → mom_diag_mediator::interface::post_data
mom_zanna_bolton::compute_energy_source → mom_domain_infra::do_group_pass
mom_zanna_bolton::compute_energy_source → mom_domain_infra::interface::create_group_pass