Mask the STATIC scalar Q_heat / Q_salt fill with the
ice-shelf cover, for the use_components = .false. path only.
With the component set on, Q_heat/Q_salt are assembler
outputs and the mask belongs there (ocean_surface_flux_assemble’s
cover_frac); writing them here would be a second writer on an
assembler-owned slot, which the fill contract forbids. With the
component set OFF there is no assembler, Q_heat/Q_salt are
the configure-time set_surface_flux_const fill and nothing
rewrites them per step — so masking them once, at configure
after the cover is built, is the whole job. Without this, a
geometry-only cavity run (&ocean_cavity_dyn_nml with no melt)
would still push a uniform &ocean_thermo_nml q_heat through
the ice.
No-op when the component set is on, when the fields are
unallocated, or when cover_frac is the (1,1) placeholder.
Idempotent (multiplies by 0 or 1). Host-side at configure —
call BEFORE enter_data (or follow with an !$acc update
device).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_surface_flux_t), | intent(inout) | :: | sf | |||
| real(kind=wp), | intent(in) | :: | cover_frac(:,:) |
Ice-cover fraction at cell centres ( |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny |
pure subroutine ocean_surface_flux_apply_cover_const(sf, cover_frac) !! Mask the STATIC scalar `Q_heat` / `Q_salt` fill with the !! ice-shelf cover, for the `use_components = .false.` path only. !! !! With the component set on, `Q_heat`/`Q_salt` are assembler !! outputs and the mask belongs there (`ocean_surface_flux_assemble`'s !! `cover_frac`); writing them here would be a second writer on an !! assembler-owned slot, which the fill contract forbids. With the !! component set OFF there is no assembler, `Q_heat`/`Q_salt` are !! the configure-time `set_surface_flux_const` fill and nothing !! rewrites them per step — so masking them once, at configure !! after the cover is built, is the whole job. Without this, a !! geometry-only cavity run (`&ocean_cavity_dyn_nml` with no melt) !! would still push a uniform `&ocean_thermo_nml q_heat` through !! the ice. !! !! No-op when the component set is on, when the fields are !! unallocated, or when `cover_frac` is the `(1,1)` placeholder. !! Idempotent (multiplies by 0 or 1). Host-side at configure — !! call BEFORE `enter_data` (or follow with an `!$acc update !! device`). type(ocean_surface_flux_t), intent(inout) :: sf real(wp), intent(in) :: cover_frac(:, :) !! Ice-cover fraction at cell centres (`metrics%cover_frac`). ! assumed-shape-ok: configure-time, one call per run. integer :: nx, ny if (sf%use_components) return if (.not. allocated(sf%Q_heat) .or. .not. allocated(sf%Q_salt)) return nx = size(sf%Q_heat, 1) ny = size(sf%Q_heat, 2) if (size(cover_frac, 1) /= nx .or. size(cover_frac, 2) /= ny) return call ocean_surfflux_cover_const_impl(sf%Q_heat, sf%Q_salt, cover_frac, nx, ny) end subroutine ocean_surface_flux_apply_cover_const