Gent-McWilliams thickness-diffusion state. All fields default to
the inert (enable=.false.) configuration so an ocean run that
never sets &ocean_gm_nml is bit-identical.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | enable | = | .false. |
Master switch. Off => |
|
| real(kind=wp), | public, | allocatable | :: | gm_src(:,:) |
Potential-energy release |
||
| logical, | public | :: | is_init | = | .false. |
True between |
|
| real(kind=wp), | public | :: | khth | = | 0.0_wp |
Thickness-diffusion coefficient KhTh (m^2/s); constant-filled into the 2D face fields (production 1e2-1e3). |
|
| real(kind=wp), | public | :: | khth_max_cfl | = | 0.1_wp |
Fraction of the diffusive CFL the face KH may use:
|
|
| real(kind=wp), | public | :: | khth_slope_max | = | 0.01_wp |
Slope magnitude (nondim) above which the safe-streamfunction
blend takes over ( |
|
| real(kind=wp), | public, | allocatable | :: | khth_u(:,:) |
Thickness diffusivity at u-faces (m^2/s), |
||
| real(kind=wp), | public, | allocatable | :: | khth_v(:,:) |
Thickness diffusivity at v-faces (m^2/s), |
||
| integer, | public | :: | nx_total | = | 0 | ||
| integer, | public | :: | ny_total | = | 0 | ||
| integer, | public | :: | nz_ml | = | 0 | ||
| real(kind=wp), | public | :: | rho0 | = | 1035.0_wp |
Reference density (kg/m^3) for the |
|
| real(kind=wp), | public, | allocatable | :: | uhD(:,:,:) |
GM x-face transport (m^3/s), |
||
| real(kind=wp), | public, | allocatable | :: | vhD(:,:,:) |
GM y-face transport (m^3/s), |
Counted allocatable footprint of the GM slot (0 when unallocated). One arr_bytes term per array — add a term here when a new allocatable joins the type.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_gm_t), | intent(in) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_gm_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_gm_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_gm_t), | intent(inout) | :: | this |
Allocate the 2D face KhTh fields, per-layer face transports, and
the gm_src PE-release diagnostic. Always allocates (configure
runs after init); host allocation (no do concurrent before
enter_data).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_gm_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| integer, | intent(in), | optional | :: | nz_ml |
type :: ocean_gm_t !! Gent-McWilliams thickness-diffusion state. All fields default to !! the inert (`enable=.false.`) configuration so an ocean run that !! never sets `&ocean_gm_nml` is bit-identical. logical :: is_init = .false. !! True between `init` and `destroy`; gate on this (never on !! `allocated`, which misses the GPU mapping). logical :: enable = .false. !! Master switch. Off => `gm_compute_transports` and !! `continuity_gm_apply` are no-ops => bit-identity preserved. Requires the !! slopes slot (`&ocean_slopes_nml enable`); the loud invariant is !! checked at configure (`configure_ocean_gm`). real(wp) :: khth = 0.0_wp !! Thickness-diffusion coefficient KhTh (m^2/s); constant-filled !! into the 2D face fields (production 1e2-1e3). real(wp) :: khth_max_cfl = 0.1_wp !! Fraction of the diffusive CFL the face KH may use: !! `KH = min(khth, 0.25*max_cfl/(dt*(idxCu^2+idyCv^2)))`. real(wp) :: khth_slope_max = 0.01_wp !! Slope magnitude (nondim) above which the safe-streamfunction !! blend takes over (`slope_max`). real(wp) :: rho0 = 1035.0_wp !! Reference density (kg/m^3) for the `gm_src` PE-release scaling. ! ---- Cached extents ---- integer :: nx_total = 0 integer :: ny_total = 0 integer :: nz_ml = 0 ! ---- 2D face KhTh fields (CFL-clamped) ---- real(wp), allocatable :: khth_u(:, :) !! Thickness diffusivity at u-faces (m^2/s), `(nx+1,ny)`. real(wp), allocatable :: khth_v(:, :) !! Thickness diffusivity at v-faces (m^2/s), `(nx,ny+1)`. ! ---- Per-layer GM bolus transports (faces) ---- ! k=1 bed, k=nz surface. Sum_k over each face is ~0 (closed ! overturning). Step-internal: filled from the current h and spent ! by `continuity_gm_apply` in the same outer step (not restart state). real(wp), allocatable :: uhD(:, :, :) !! GM x-face transport (m^3/s), `(nx+1,ny,nz)`. Filled every outer !! step from the post-dynamics thickness and applied at once by !! `continuity_gm_apply`. real(wp), allocatable :: vhD(:, :, :) !! GM y-face transport (m^3/s), `(nx,ny+1,nz)`. ! ---- 2D GM PE-release source (for MEKE) ---- real(wp), allocatable :: gm_src(:, :) !! Potential-energy release `-1/4 Sum_k rho0 KH Slope^2 N^2 h` !! (W/m^2-ish; >= 0 for a stable tilted column), `(nx,ny)`. !! CARRIED state: filled after the dynamics of step n, read by !! `meke_step` at the top of step n+1, so it is in the restart !! registry (`gm_src`). contains procedure, non_overridable :: init => ocean_gm_init procedure, non_overridable :: destroy => ocean_gm_destroy procedure, non_overridable :: enter_data => ocean_gm_enter_data procedure, non_overridable :: exit_data => ocean_gm_exit_data procedure, non_overridable :: bytes => ocean_gm_bytes end type ocean_gm_t