public pure subroutine ocean_surface_stress_apply_cover(ss, cover_frac)
Zero the wind-stress pair on every C-grid face that touches an
ice-covered cell, then refresh stress_mag from the masked
pair. The two halves are ONE call on purpose: a masked tau
with a stale stress_mag would leave KPP/EPBL mixing on a wind
that no longer reaches the water.
FACE RULE — see the module docstring. open_face =
min(1 - cover_left, 1 - cover_right), i.e. a face is closed if
EITHER neighbour is covered, so no wind acts on a covered cell.
A rim face (i = 1 / i = nx+1, j = 1 / j = ny+1) has only
one neighbour in range and takes that cell’s cover.
Idempotent (multiplies by 0 or 1), so the configure-time call
and the per-bracket data-forcing seam can both run it.
Runs where the data lives — a plain do concurrent, so it
is a host loop before enter_data and a device kernel after,
exactly like ocean_surface_stress_refresh_mag.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Variables
Type
Visibility
Attributes
Name
Initial
integer,
private
::
nx
integer,
private
::
ny
Source Code
pure subroutine ocean_surface_stress_apply_cover(ss,cover_frac)!! Zero the wind-stress pair on every C-grid face that touches an!! ice-covered cell, then refresh `stress_mag` from the masked!! pair. The two halves are ONE call on purpose: a masked `tau`!! with a stale `stress_mag` would leave KPP/EPBL mixing on a wind!! that no longer reaches the water.!!!! FACE RULE — see the module docstring. `open_face =!! min(1 - cover_left, 1 - cover_right)`, i.e. a face is closed if!! EITHER neighbour is covered, so no wind acts on a covered cell.!! A rim face (`i = 1` / `i = nx+1`, `j = 1` / `j = ny+1`) has only!! one neighbour in range and takes that cell's cover.!!!! Idempotent (multiplies by 0 or 1), so the configure-time call!! and the per-bracket data-forcing seam can both run it.!!!! **Runs where the data lives** — a plain `do concurrent`, so it!! is a host loop before `enter_data` and a device kernel after,!! exactly like `ocean_surface_stress_refresh_mag`.type(ocean_surface_stress_t),intent(inout)::ssreal(wp),intent(in)::cover_frac(:,:)!! Ice-cover fraction at cell centres (`metrics%cover_frac`,!! v1 binary 0/1), shape `(nx_total, ny_total)`.! assumed-shape-ok: configure-time / per-forcing-bracket cadence,! forwarded to an explicit-shape `_impl` before any device loop.integer::nx,nyif(.not.allocated(ss%tau_x).or..not.allocated(ss%tau_y))returnnx=size(ss%tau_x,1)-1ny=size(ss%tau_x,2)! A placeholder-sized cover (the `use_cavity = .false.` (1,1)! allocation) is not a mask — refuse it rather than mask a corner.if(size(cover_frac,1)/=nx.or.size(cover_frac,2)/=ny)return call ocean_surfstress_cover_impl(ss%tau_x,ss%tau_y,cover_frac,nx,ny)call ocean_surface_stress_refresh_mag(ss)end subroutine ocean_surface_stress_apply_cover