ocean_surface_stress_set_derived Subroutine

public subroutine ocean_surface_stress_set_derived(grid, ss, cover_frac)

Fill stress_mag from the current tau_x/tau_y — the MOM6 set_derived_forcing_fields analogue (PR-12), and the public entry point configure_ocean_forcing calls after the wind_config dispatch. Host-side (the wind field is configure-static in v1, so one fill at configure suffices — a future time-varying wind reader re-calls this after each read). Not pure: writes into ss. Call BEFORE enter_data, or follow with !$acc update device(ss%stress_mag) if already mapped. In practice this is a defensive re-fill only: every set_wind_stress_* setter already refreshes stress_mag in step (ocean_surfstress_refresh_stress_mag) so stress_mag is never stale relative to tau_x/tau_y regardless of call site (production driver OR a unit test that never reaches configure_ocean_forcing).

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid

Kept in the public signature (PR-12 plan §5.2) though shape is now taken from tau_x/tau_y directly — see ocean_surfstress_refresh_stress_mag.

type(ocean_surface_stress_t), intent(inout) :: ss
real(kind=wp), intent(in), optional :: cover_frac(:,:)

Ice-shelf cover fraction at cell centres (metrics%cover_frac). Present ⇒ the tau pair is masked on every face touching a covered cell BEFORE stress_mag is rebuilt (ocean_surface_stress_apply_cover). Absent ⇒ the original refresh-only path, byte-identical.


Calls

proc~~ocean_surface_stress_set_derived~~CallsGraph proc~ocean_surface_stress_set_derived ocean_surface_stress_set_derived proc~ocean_surface_stress_apply_cover ocean_surface_stress_apply_cover proc~ocean_surface_stress_set_derived->proc~ocean_surface_stress_apply_cover proc~ocean_surface_stress_refresh_mag ocean_surface_stress_refresh_mag proc~ocean_surface_stress_set_derived->proc~ocean_surface_stress_refresh_mag proc~ocean_surface_stress_apply_cover->proc~ocean_surface_stress_refresh_mag proc~ocean_surfstress_cover_impl ocean_surfstress_cover_impl proc~ocean_surface_stress_apply_cover->proc~ocean_surfstress_cover_impl proc~ocean_surfstress_derived_impl ocean_surfstress_derived_impl proc~ocean_surface_stress_refresh_mag->proc~ocean_surfstress_derived_impl local local proc~ocean_surfstress_cover_impl->local proc~ocean_surfstress_derived_impl->local

Called by

proc~~ocean_surface_stress_set_derived~~CalledByGraph proc~ocean_surface_stress_set_derived ocean_surface_stress_set_derived proc~ocean_seam_refresh_surface_stress ocean_seam_refresh_surface_stress proc~ocean_seam_refresh_surface_stress->proc~ocean_surface_stress_set_derived proc~configure_ocean_forcing configure_ocean_forcing proc~configure_ocean_forcing->proc~ocean_seam_refresh_surface_stress proc~ice_ocean_stress_flux ice_ocean_stress_flux proc~ice_ocean_stress_flux->proc~ocean_seam_refresh_surface_stress proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~ocean_data_forcing_apply->proc~ocean_seam_refresh_surface_stress proc~ocean_data_forcing_configure ocean_data_forcing_configure proc~ocean_data_forcing_configure->proc~ocean_seam_refresh_surface_stress proc~engine_setup engine_setup proc~engine_setup->proc~configure_ocean_forcing proc~engine_setup->proc~ocean_data_forcing_configure proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_ocean_stress_flux 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_run_ocean->proc~engine_step proc~driver_run_ocean->proc~engine_step_ice proc~driver_validate driver_validate proc~driver_validate->proc~engine_setup proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~rdb_ocean_step->proc~engine_step_ice 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

Source Code

   subroutine ocean_surface_stress_set_derived(grid, ss, cover_frac)
      !! Fill `stress_mag` from the current `tau_x`/`tau_y` — the MOM6
      !! `set_derived_forcing_fields` analogue (PR-12), and the public
      !! entry point `configure_ocean_forcing` calls after the
      !! `wind_config` dispatch.  Host-side (the wind field is
      !! configure-static in v1, so one fill at configure suffices — a
      !! future time-varying wind reader re-calls this after each read).
      !! Not `pure`: writes into `ss`.  Call BEFORE `enter_data`, or
      !! follow with `!$acc update device(ss%stress_mag)` if already
      !! mapped.  In practice this is a defensive re-fill only: every
      !! `set_wind_stress_*` setter already refreshes `stress_mag` in
      !! step (`ocean_surfstress_refresh_stress_mag`) so `stress_mag` is
      !! never stale relative to `tau_x`/`tau_y` regardless of call site
      !! (production driver OR a unit test that never reaches
      !! `configure_ocean_forcing`).
      type(hgrid_t), intent(in) :: grid
         !! Kept in the public signature (PR-12 plan §5.2) though shape
         !! is now taken from `tau_x`/`tau_y` directly — see
         !! `ocean_surfstress_refresh_stress_mag`.
      type(ocean_surface_stress_t), intent(inout) :: ss
      real(wp), intent(in), optional :: cover_frac(:, :)
         !! Ice-shelf cover fraction at cell centres
         !! (`metrics%cover_frac`).  Present ⇒ the `tau` pair is masked
         !! on every face touching a covered cell BEFORE `stress_mag` is
         !! rebuilt (`ocean_surface_stress_apply_cover`).  Absent ⇒ the
         !! original refresh-only path, byte-identical.
      ! assumed-shape-ok: configure-time / per-forcing-bracket cadence.
      if (present(cover_frac)) then
         call ocean_surface_stress_apply_cover(ss, cover_frac)
      else
         call ocean_surface_stress_refresh_mag(ss)
      end if
   end subroutine ocean_surface_stress_set_derived