| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | TDRAG_INVALID | = | -1 |
Sentinel for an unrecognised |
| integer, | public, | parameter | :: | TDRAG_LINEAR | = | 1 |
Linear Rayleigh top drag, |
| integer, | public, | parameter | :: | TDRAG_QUADRATIC | = | 2 |
Quadratic (log-layer) top drag, |
Ice-shelf top-drag slot. Every array is full size when
enable, a (1,1) / (1,1,1) placeholder otherwise — the
ocean_cavity_flux_t gating convention, latched in
ocean_state_init_from_config BEFORE init so the allocation
gate can read it.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | public | :: | c_drag | = | 0.0_wp |
Quadratic drag coefficient (dimensionless). ISOMIP+ 2.5e-3. Zero disables the quadratic branch. |
|
| real(kind=wp), | public, | allocatable | :: | cover_t(:,:) |
CELL-CENTRED ice-cover mask, shape (nx, ny) — a configure-time
copy of |
||
| real(kind=wp), | public, | allocatable | :: | cover_u(:,:) |
Face ice-cover mask at east faces, shape (nx+1, ny): the OR of
the two abutting cells’ |
||
| real(kind=wp), | public, | allocatable | :: | cover_v(:,:) |
Face ice-cover mask at north faces, shape (nx, ny+1). |
||
| real(kind=wp), | public | :: | drag_bg_vel | = | 0.0_wp |
Background velocity floor (m/s) in the quadratic speed,
|
|
| type(scratch_3d_buffer_t), | public | :: | du_drag |
Top-drag tendency at east faces, shape (nx+1, ny, nz). Only layers inside the top boundary layer carry a non-zero value. |
|||
| type(scratch_3d_buffer_t), | public | :: | dv_drag |
Top-drag tendency at north faces, shape (nx, ny+1, nz). |
|||
| logical, | public | :: | enable | = | .false. |
|
|
| real(kind=wp), | public | :: | h_min | = | 1.0e-3_wp |
Floor on the top-layer face thickness inside the |
|
| real(kind=wp), | public | :: | htbl | = | 0.0_wp |
Top-boundary-layer thickness (m) the stress is distributed
over (the mirror of |
|
| logical, | public | :: | implicit | = | .false. |
Backward-Euler top drag in this kernel: the tendency is formed
as |
|
| logical, | public | :: | implicit_fold | = | .false. |
|
|
| logical, | public | :: | is_init | = | .false. |
True between |
|
| real(kind=wp), | public, | allocatable | :: | lambda_top_u(:,:) |
Top-layer (k=nz) Rayleigh RATE lambda (1/s) at east faces,
shape (nx+1, ny): |
||
| real(kind=wp), | public, | allocatable | :: | lambda_top_v(:,:) |
Top-layer Rayleigh rate at north faces, shape (nx, ny+1). |
||
| real(kind=wp), | public | :: | r_linear | = | 0.0_wp |
Linear Rayleigh coefficient (1/s). Zero disables the linear branch even when the variant tag selects it. |
|
| real(kind=wp), | public | :: | rho0 | = | 0.0_wp |
Boussinesq reference density (kg/m^3) — |
|
| real(kind=wp), | public, | allocatable | :: | stress_top(:,:) |
Cell-centred magnitude of the top stress (N/m^2),
|
||
| real(kind=wp), | public | :: | tbl_thick_min | = | 0.0_wp |
Minimum effective TBL thickness (m) in the |
|
| integer, | public | :: | variant | = | TDRAG_QUADRATIC |
Active drag variant ( |
| procedure, public, non_overridable :: bytes => ocean_top_drag_bytes | |
| procedure, public, non_overridable :: destroy => ocean_top_drag_destroy | |
| procedure, public, non_overridable :: enter_data => ocean_top_drag_enter_data | |
| procedure, public, non_overridable :: exit_data => ocean_top_drag_exit_data | |
| procedure, public, non_overridable :: init => ocean_top_drag_init |
Translate a namelist string into a TDRAG_* code. An
unrecognised string returns TDRAG_INVALID — a typo must abort
rather than silently select one of two laws with different
coefficient dimensions. Accepts the same spellings as
parse_bdrag_variant, deliberately: the two groups mirror.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
.true. only for a top-drag variant with a real kernel. The
single gate validate_config consumes.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | code |
Counted allocatable footprint of the top-drag 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_top_drag_t), | intent(in) | :: | this |
u += dt*du_drag, v += dt*dv_drag over the whole face array —
layers outside the top boundary layer carry an exact zero.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_top_drag_t), | intent(in) | :: | this | |||
| type(multilayer_state_t), | intent(inout) | :: | ms | |||
| real(kind=wp), | intent(in) | :: | dt | |||
| logical, | intent(in), | optional | :: | no_wait |
Fill du_drag / dv_drag with the top-boundary drag
acceleration, stress_top with the cell-centred stress
magnitude, and (when implicit_fold) lambda_top_u/v with the
k = k_top Rayleigh rate the vdiff diagonal consumes (the
rate-capture row and the sink row MUST be the same row).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_top_drag_t), | intent(inout) | :: | this | |||
| type(multilayer_state_t), | intent(in) | :: | ms | |||
| real(kind=wp), | intent(in) | :: | dt |
Outer-step length (s); only read when |
Project the cell-centred cover_frac onto velocity faces with
the OR rule (see the module docstring for why OR and not AND
at a calving front). Host-side, once, at configure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(out) | :: | cover_u(nx+1,ny) | |||
| real(kind=wp), | intent(out) | :: | cover_v(nx,ny+1) | |||
| real(kind=wp), | intent(in) | :: | cover_frac(nx,ny) | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny |
Cell-centred magnitude of the top stress (N/m^2), for the
later ustar_shelf consumer:
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(out) | :: | stress_top(nx,ny) | |||
| real(kind=wp), | intent(in) | :: | u_face(nx_u,ny_u,nz) | |||
| real(kind=wp), | intent(in) | :: | v_face(nx_v,ny_v,nz) | |||
| real(kind=wp), | intent(in) | :: | h_layer(nx,ny,nz) | |||
| real(kind=wp), | intent(in) | :: | wet_mask(nx,ny) | |||
| real(kind=wp), | intent(in) | :: | cover_frac(nx,ny) | |||
| integer, | intent(in) | :: | k_top(nx,ny) |
|
||
| real(kind=wp), | intent(in) | :: | h_vanished |
|
||
| integer, | intent(in) | :: | variant | |||
| real(kind=wp), | intent(in) | :: | r | |||
| real(kind=wp), | intent(in) | :: | c_d | |||
| real(kind=wp), | intent(in) | :: | h_floor | |||
| real(kind=wp), | intent(in) | :: | htbl | |||
| real(kind=wp), | intent(in) | :: | bg_vel | |||
| real(kind=wp), | intent(in) | :: | tbl_min | |||
| real(kind=wp), | intent(in) | :: | rho0 | |||
| integer, | intent(in) | :: | nx_u | |||
| integer, | intent(in) | :: | ny_u | |||
| integer, | intent(in) | :: | nx_v | |||
| integer, | intent(in) | :: | ny_v | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny | |||
| integer, | intent(in) | :: | nz |
Flat device kernel: explicit-shape dummies, no derived-type
dereference inside the do concurrent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(out) | :: | du_drag(nx_u,ny_u,nz) | |||
| real(kind=wp), | intent(out) | :: | dv_drag(nx_v,ny_v,nz) | |||
| real(kind=wp), | intent(out) | :: | lambda_u(nx+1,ny) | |||
| real(kind=wp), | intent(out) | :: | lambda_v(nx,ny+1) | |||
| real(kind=wp), | intent(in) | :: | u_face(nx_u,ny_u,nz) | |||
| real(kind=wp), | intent(in) | :: | v_face(nx_v,ny_v,nz) | |||
| real(kind=wp), | intent(in) | :: | h_layer(nx,ny,nz) | |||
| real(kind=wp), | intent(in) | :: | wet_mask(nx,ny) | |||
| real(kind=wp), | intent(in) | :: | cover_u(nx+1,ny) | |||
| real(kind=wp), | intent(in) | :: | cover_v(nx,ny+1) | |||
| integer, | intent(in) | :: | k_top_u(nx+1,ny) |
|
||
| integer, | intent(in) | :: | k_top_v(nx,ny+1) |
|
||
| real(kind=wp), | intent(in) | :: | h_vanished |
|
||
| integer, | intent(in) | :: | variant | |||
| real(kind=wp), | intent(in) | :: | r | |||
| real(kind=wp), | intent(in) | :: | c_d | |||
| real(kind=wp), | intent(in) | :: | h_floor | |||
| real(kind=wp), | intent(in) | :: | htbl | |||
| real(kind=wp), | intent(in) | :: | bg_vel | |||
| real(kind=wp), | intent(in) | :: | tbl_min | |||
| real(kind=wp), | intent(in) | :: | dt_imp | |||
| logical, | intent(in) | :: | fold | |||
| integer, | intent(in) | :: | nx_u | |||
| integer, | intent(in) | :: | ny_u | |||
| integer, | intent(in) | :: | nx_v | |||
| integer, | intent(in) | :: | ny_v | |||
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny | |||
| integer, | intent(in) | :: | nz |
Release the slot. is_init is cleared FIRST.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_top_drag_t), | intent(inout) | :: | this |
Type-bound wrapper — delegates to the non-polymorphic impl so the device-attach map base is the heap object, not a polymorphic box.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_top_drag_t), | intent(inout) | :: | this |
copyin (not create) for the four host-filled 2-D fields —
cover_u/cover_v are STATIC configure-time geometry and would
otherwise reach the device as allocator leftovers
(mem:separate).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_top_drag_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_top_drag_t), | intent(inout) | :: | this |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_top_drag_t), | intent(inout) | :: | this |
Allocate the slot. Gated on enable (latched before this runs),
so a run without an ice shelf pays five (1,1) placeholders and
two (1,1,1) scratch buffers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(ocean_top_drag_t), | intent(inout) | :: | this | |||
| type(hgrid_t), | intent(in) | :: | grid | |||
| integer, | intent(in), | optional | :: | nz_ml |