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. |
|
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. |
|
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=-CSamplitude * Garea: 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. |
|
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: 1) Interpolate input features (sh_xy, sh_xx, vort_xy) to grid centers 2) Compute norm of velocity gradients on a stencil 3) Non-dimensionalize input features 4) Make ANN inference in grid centers 5) Restore physical dimensionality and interpolate Txy back to corners. |
|
Compute the divergence of subgrid stress weighted with thickness, i.e. |
|
Filtering of the velocity gradients sh_xx, sh_xy, vort_xy. |
|
Filtering of the stress tensor Txx, Tyy, Txy. |
|
Wrapper for filter_3D function. |
|
Spatial lateral filter applied to 3D array. |
|
Computes the 3D energy source term for the ZB2020 scheme similarly to |
Detailed Description
Calculates Zanna and Bolton 2020 parameterization Implemented by Perezhogin P.A. Contact: pperezhogin@gmail.com .
Type Documentation
- type mom_zanna_bolton/zb2020_cs
Control structure for Zanna-Bolton-2020 parameterization.
- Type fields:
% id_zb2020u ::
integerDiagnostic handles.% id_zb2020v ::
integerDiagnostic handles.% id_ke_zb2020 ::
integerDiagnostic handles.% id_txx ::
integerDiagnostic handles.% id_tyy ::
integerDiagnostic handles.% id_txy ::
integerDiagnostic handles.% id_cdiss ::
integerDiagnostic handles.% id_clock_module ::
integerCPU time clock IDs.% id_clock_copy ::
integerCPU time clock IDs.% id_clock_cdiss ::
integerCPU time clock IDs.% id_clock_stress ::
integerCPU time clock IDs.% id_clock_stress_ann ::
integerCPU time clock IDs.% id_clock_divergence ::
integerCPU time clock IDs.% id_clock_mpi ::
integerCPU time clock IDs.% id_clock_filter ::
integerCPU time clock IDs.% id_clock_post ::
integerCPU time clock IDs.% id_clock_source ::
integerCPU time clock IDs.% pass_tq ::
type(group_pass_type)MPI group passes.% pass_th ::
type(group_pass_type)handles for halo passes of Txy and Txx, Tyy% pass_xx ::
type(group_pass_type)MPI group passes.% pass_xy ::
type(group_pass_type)handles for halo passes of sh_xx and sh_xy, vort_xy% stress_halo ::
integerThe halo size in filter of the stress tensor.% hpf_halo ::
integerThe halo size in filter of the velocity gradient.% amplitude ::
realThe nondimensional scaling factor in ZB model, typically 0.1 - 10 [nondim].% zb_type ::
integerSelect 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 ::
integerSelect a discretization scheme for ZB model 0 - non-conservative scheme 1 - conservative scheme for deviatoric component.% hpf_iter ::
integerNumber of sharpening passes for the Velocity Gradient (VG) components in ZB model.% stress_iter ::
integerNumber of smoothing passes for the Stress tensor components in ZB model.% klower_r_diss ::
realAttenuation 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 ::
integerType 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 ::
integerThe number of filter iterations per a single MPI exchange.% sh_xx ::
real, dimension(:,:,:), allocatableHorizontal tension (du/dx - dv/dy) in h (CENTER)% sh_xy ::
real, dimension(:,:,:), allocatableHorizontal shearing strain (du/dy + dv/dx) in q (CORNER)% vort_xy ::
real, dimension(:,:,:), allocatableVertical vorticity (dv/dx - du/dy) in q (CORNER)% hq ::
real, dimension(:,:,:), allocatableThickness in CORNER points [H ~> m or kg m-2].% txx ::
real, dimension(:,:,:), allocatableSubgrid stress xx component in h [L2 T-2 ~> m2 s-2].% tyy ::
real, dimension(:,:,:), allocatableSubgrid stress yy component in h [L2 T-2 ~> m2 s-2].% txy ::
real, dimension(:,:,:), allocatableSubgrid stress xy component in q [L2 T-2 ~> m2 s-2].% kappa_h ::
real, dimension(:,:), allocatableScaling coefficient in h points [L2 ~> m2].% kappa_q ::
real, dimension(:,:), allocatableScaling coefficient in q points [L2 ~> m2].% icoriolis_h ::
real, dimension(:,:), allocatableInverse Coriolis parameter at h points [T ~> s].% c_diss ::
real, dimension(:,:,:), allocatableAttenuation parameter at h points.% maskw_h ::
real, dimension(:,:), allocatableMask of land point at h points multiplied by filter weight [nondim].% maskw_q ::
real, dimension(:,:), allocatableSame mask but for q points [nondim].% use_ann ::
logicalIf True, momentum fluxes are inferred with ANN.% stencil_size ::
integerDefault is 3x3.% ann_tall ::
type(ann_cs)ANN instance for off-diagonal and diagonal stress.% ann_file_tall ::
character(len=200)Path to netcdf file with ANN.% subroundoff_shear ::
realSmall dimensional constant for save division by zero [T-1 ~> s-1].% diag ::
type(diag_ctrl), pointerA type that regulates diagnostics output.
Function/Subroutine Documentation
- subroutine mom_zanna_bolton/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 ::
param_file[in] Parameter file parser structure.diag ::
diag[inout] Diagnostics structure.cs :: [inout] ZB2020 control structure.
use_zb2020 :: [out] If true, turns on ZB scheme.
- Call to:
- subroutine mom_zanna_bolton/zb2020_end(CS)
Deallocate any variables allocated in ZB_2020_init.
- Parameters:
cs :: [inout] ZB2020 control structure.
- Call to:
- subroutine mom_zanna_bolton/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 ::
sh_xy[in] horizontal shearing strain (du/dy + dv/dx)vort_xy ::
vort_xy[in] Vertical vorticity (dv/dx - du/dy)hq ::
hq[in] harmonic mean of the harmonic meanssh_xx ::
sh_xx[in] horizontal tension (du/dx - dv/dy)k ::
k[in] The vertical index of the layer to be passed.
- Called from:
- subroutine mom_zanna_bolton/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 ::
u[in] The zonal velocity [L T-1 ~> m s-1].v ::
v[in] The meridional velocity [L T-1 ~> m s-1].h ::
h[in] Layer thicknesses [H ~> m or kg m-2].diffu ::
diffu[inout] Zonal acceleration due to eddy viscosity.diffv ::
diffv[inout] Meridional acceleration due to eddy viscosity.dx2h ::
dx2h[in] dx^2 at h points [L2 ~> m2]dy2h ::
dy2h[in] dy^2 at h points [L2 ~> m2]dx2q ::
dx2q[in] dx^2 at q points [L2 ~> m2]dy2q ::
dy2q[in] dy^2 at q points [L2 ~> m2]
- Call to:
compute_c_disscompute_stresscompute_stress_ann_collocatedcompute_stress_divergencefilter_stressfilter_velocity_gradients
- subroutine mom_zanna_bolton/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.
- Called from:
- subroutine mom_zanna_bolton/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=-CSamplitude * Garea: 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.
- Called from:
- subroutine mom_zanna_bolton/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: 1) Interpolate input features (sh_xy, sh_xx, vort_xy) to grid centers 2) Compute norm of velocity gradients on a stencil 3) Non-dimensionalize input features 4) Make ANN inference in grid centers 5) 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.
- Call to:
- Called from:
- subroutine mom_zanna_bolton/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 ::
u[in] The zonal velocity [L T-1 ~> m s-1].v ::
v[in] The meridional velocity [L T-1 ~> m s-1].h ::
h[in] Layer thicknesses [H ~> m or kg m-2].diffu ::
diffu[out] Zonal acceleration due to convergence ofdiffv ::
diffv[out] Meridional acceleration due to convergencedx2h ::
dx2h[in] dx^2 at h points [L2 ~> m2]dy2h ::
dy2h[in] dy^2 at h points [L2 ~> m2]dx2q ::
dx2q[in] dx^2 at q points [L2 ~> m2]dy2q ::
dy2q[in] dy^2 at q points [L2 ~> m2]
- Call to:
- Called from:
- subroutine mom_zanna_bolton/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.
- Call to:
- Called from:
- subroutine mom_zanna_bolton/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.
- Call to:
- Called from:
- subroutine mom_zanna_bolton/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 ::
h[inout] Input/output array in h points [arbitrary]q ::
q[inout] Input/output array in q points [arbitrary]current_halo ::
current_halo[inout] Currently available halo pointsremaining_iterations ::
remaining_iterations[inout] The number of iterations to perform
- Call to:
- Called from:
- subroutine mom_zanna_bolton/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 ::
isd[in] Indices of array sizeied ::
ied[in] Indices of array sizejsd ::
jsd[in] Indices of array sizejed ::
jed[in] Indices of array sizeis ::
is[in] Indices of owned pointsie ::
ie[in] Indices of owned pointsjs ::
js[in] Indices of owned pointsje ::
je[in] Indices of owned pointsnz ::
nz[in] Vertical array sizex ::
x[inout] Input/output array [arbitrary]maskw ::
maskw[in] Mask array of land points divided by 16 [nondim]current_halo ::
current_halo[inout] Currently available halo pointsremaining_iterations ::
remaining_iterations[inout] The number of iterations to performdirection ::
direction[in] The direction of the first 1D filter
- Called from:
- subroutine mom_zanna_bolton/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 ::
u[in] The zonal velocity [L T-1 ~> m s-1].v ::
v[in] The meridional velocity [L T-1 ~> m s-1].h ::
h[in] Layer thicknesses [H ~> m or kg m-2].fx ::
fx[in] Zonal acceleration due to convergence offy ::
fy[in] Meridional acceleration due to convergence
- Called from: