Depth-integrated state on an Arakawa C-grid (face-located velocities as continuity-PPM produces/consumes; cell-centred h-update by flux div).
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public, | allocatable | :: | b(:,:) |
Reference column DEPTH at cell centre (m, positive down):
a 4000 m deep cell holds NOTE the opposite sign of the topographic HEIGHTS used by the
porous-barrier statistics ( |
||
| real(kind=wp), | public | :: | coriolis_f | = | 0.0_wp |
Beta-plane / f-plane Coriolis parameter (1/s). |
|
| real(kind=wp), | public, | allocatable | :: | flux_h(:,:) | |||
| real(kind=wp), | public, | allocatable | :: | h(:,:) |
Water depth at cell centre (m), shape (nx_total, ny_total) |
||
| real(kind=wp), | public, | allocatable | :: | h0(:,:) | |||
| real(kind=wp), | public, | allocatable | :: | hu_face_x(:,:) |
Face-thickness x momentum h*u (m^2/s) |
||
| real(kind=wp), | public, | allocatable | :: | hv_face_y(:,:) |
Face-thickness y momentum h*v (m^2/s) |
||
| logical, | public | :: | is_init | = | .false. |
True between |
|
| real(kind=wp), | public | :: | manning_n | = | 0.0_wp |
Manning roughness for shelf-side bottom drag. |
|
| real(kind=wp), | public, | allocatable | :: | mass_flux_x(:,:) | |||
| real(kind=wp), | public, | allocatable | :: | mass_flux_y(:,:) | |||
| real(kind=wp), | public, | allocatable | :: | u_face_x(:,:) |
x-velocity at east face of each cell (m/s) |
||
| real(kind=wp), | public, | allocatable | :: | u_face_x0(:,:) | |||
| real(kind=wp), | public, | allocatable | :: | v_face_y(:,:) |
y-velocity at north face of each cell (m/s) |
||
| real(kind=wp), | public, | allocatable | :: | v_face_y0(:,:) |
Counted allocatable footprint of the ocean C-grid barotropic slot.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(barotropic_state_t), | intent(in) | :: | this |
Tear down host allocations. Call exit_data first — destroying a
still-device-mapped state leaks device memory silently.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(barotropic_state_t), | intent(inout) | :: | this |
Attach the C-grid barotropic allocatables to the device. The parent
struct is mapped by the orchestrating routine. Read+write fields use
copyin; pure-workspace fields use create.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(barotropic_state_t), | intent(inout) | :: | this |
Reverse of enter_data — copy out prognostic fields, drop scratch.
Caller detaches the parent struct after this returns.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(barotropic_state_t), | intent(inout) | :: | this |
Allocate every C-grid barotropic array zero-filled. East-face arrays
are (nx+1, ny), north-face (nx, ny+1). Scalars (manning_n, coriolis_f)
are populated by state_init_from_config afterwards.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(barotropic_state_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid |
type :: barotropic_state_t !! Depth-integrated state on an Arakawa C-grid (face-located velocities as !! continuity-PPM produces/consumes; cell-centred h-update by flux div). logical :: is_init = .false. !! True between `init` and `destroy`. Prefer to `allocated(...)` — it !! also tracks GPU device attachment, which `allocated` cannot see. ! ---- Cell-centred scalars ---- real(wp), allocatable :: h(:, :) !! Water depth at cell centre (m), shape (nx_total, ny_total) real(wp), allocatable :: b(:, :) !! Reference column DEPTH at cell centre (m, **positive down**): !! a 4000 m deep cell holds `b = +4000`, land holds `b = 0`, and a !! cell is land iff `b < LAND_DEPTH_THRESHOLD` (2 m, !! `rdb_constants`). Fixed by the SSH identity !! `eta = sum_k h_layer - b` (`rdb_ocean_diag_fills.F90:157`) and by !! `barotropic%h = b + eta` (`rdb_ocean_state.F90:2482`). !! !! NOTE the opposite sign of the topographic HEIGHTS used by the !! porous-barrier statistics (`rdb_ocean_porous.F90:17-21`) and by !! `metrics%bed_height` (`rdb_ocean_metrics.F90:151`, `= -b`), and of !! GEBCO/ETOPO products, which give a negative height. Handing a !! negative-height array in unflipped puts every cell below the land !! threshold and yields a silent, crash-free, all-land run. !! (This docstring previously read "positive up" — a coastal-path !! leftover; the coastal regime left this tree in the ocean-only !! split.) ! ---- Face-located velocities / momentum ---- ! u on east face: u_face_x(i,j) at interface (i,j)|(i+1,j), shape ! (nx_total+1, ny_total) so face index runs 1 (west wall)..nx+1 (east wall). real(wp), allocatable :: u_face_x(:, :) !! x-velocity at east face of each cell (m/s) real(wp), allocatable :: hu_face_x(:, :) !! Face-thickness x momentum h*u (m^2/s) ! v on north face: v_face_y(i,j) at interface (i,j)|(i,j+1), ! shape (nx_total, ny_total+1). real(wp), allocatable :: v_face_y(:, :) !! y-velocity at north face of each cell (m/s) real(wp), allocatable :: hv_face_y(:, :) !! Face-thickness y momentum h*v (m^2/s) ! ---- Per-face mass fluxes (continuity-PPM primary output) ---- ! PPM mass flux at east/north faces; consumed by tracer advection under ! CWC. Same shape as the face-velocity arrays. real(wp), allocatable :: mass_flux_x(:, :) real(wp), allocatable :: mass_flux_y(:, :) ! ---- Flux divergence (workspace) ---- ! Cell-centred net divergence used to step h forward. real(wp), allocatable :: flux_h(:, :) ! ---- RK2 save buffers ---- ! State at start of the outer RK step; the inner substeps run N times ! from this snapshot. real(wp), allocatable :: h0(:, :) real(wp), allocatable :: u_face_x0(:, :) real(wp), allocatable :: v_face_y0(:, :) ! ---- Physics scalars ---- real(wp) :: manning_n = 0.0_wp !! Manning roughness for shelf-side bottom drag. real(wp) :: coriolis_f = 0.0_wp !! Beta-plane / f-plane Coriolis parameter (1/s). contains procedure, non_overridable :: init => barotropic_state_init procedure, non_overridable :: destroy => barotropic_state_destroy procedure, non_overridable :: enter_data => barotropic_state_enter_data procedure, non_overridable :: exit_data => barotropic_state_exit_data procedure, non_overridable :: bytes => barotropic_state_bytes end type barotropic_state_t