ocean_surface_flux_apply_cover_const Subroutine

public 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).

Arguments

Type IntentOptional Attributes Name
type(ocean_surface_flux_t), intent(inout) :: sf
real(kind=wp), intent(in) :: cover_frac(:,:)

Ice-cover fraction at cell centres (metrics%cover_frac).


Calls

proc~~ocean_surface_flux_apply_cover_const~~CallsGraph proc~ocean_surface_flux_apply_cover_const ocean_surface_flux_apply_cover_const proc~ocean_surfflux_cover_const_impl ocean_surfflux_cover_const_impl proc~ocean_surface_flux_apply_cover_const->proc~ocean_surfflux_cover_const_impl local local proc~ocean_surfflux_cover_const_impl->local

Called by

proc~~ocean_surface_flux_apply_cover_const~~CalledByGraph proc~ocean_surface_flux_apply_cover_const ocean_surface_flux_apply_cover_const proc~configure_ocean_cavity configure_ocean_cavity proc~configure_ocean_cavity->proc~ocean_surface_flux_apply_cover_const proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_cavity proc~complete_ocean_create complete_ocean_create proc~complete_ocean_create->proc~engine_setup proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_setup proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean proc~rdb_ocean_create_finalize rdb_ocean_create_finalize proc~rdb_ocean_create_finalize->proc~complete_ocean_create proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~complete_ocean_create

Variables

Type Visibility Attributes Name Initial
integer, private :: nx
integer, private :: ny

Source Code

   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