ice_ocean_stress_resume_apply Subroutine

public pure subroutine ice_ocean_stress_resume_apply(stress, ice)

Configure-time resume apply (PR 63). tau_x/tau_y were just re-seeded from the wind-stress config by configure_ocean_forcing; if the checkpoint carried a blend (tau_ocn_valid > 0.5), overwrite them with it — the EXACT stress the uninterrupted run would have handed the ocean at this step boundary. Otherwise leave the pristine wind (D8: a fresh run’s first outer step drives the ocean with pure wind — and, for the first time, this is now literally true: no (1-a)*tau_a residual from an uninitialised fxoc).

REPLACES the old configure-time resume-fold routine (deleted). That routine RECONSTRUCTED the blend from the checkpointed ci — which is the POST-thermo/post-transport concentration, not the PRE-thermo ci the uninterrupted run actually blended against (F4) — so it was wrong whenever a checkpoint step’s thermo/transport changed ci after the blend. This routine COPIES the blend’s own recorded output instead, which is exact by construction and stays exact under any future change to the blend formula (SIS2 Ice%flux_u/ flux_v, ice_type.F90:240-243 — carried, not reconstructed).

Host-only whole-array assignment; runs BEFORE enter_data (mirrors the deleted routine’s host-only contract, but for a trivial reason now — a plain copy needs no device kernel at all, so the GPU-hazard this used to carry — do-concurrent kernels over unmapped host arrays at configure time, see rdb_ice_evp’s D8 note and CLAUDE.md — is gone by construction, not by discipline).

Arguments

Type IntentOptional Attributes Name
type(ocean_surface_stress_t), intent(inout) :: stress
type(ocean_sea_ice_t), intent(in) :: ice

Calls

proc~~ice_ocean_stress_resume_apply~~CallsGraph proc~ice_ocean_stress_resume_apply ice_ocean_stress_resume_apply proc~ocean_surface_stress_refresh_mag ocean_surface_stress_refresh_mag proc~ice_ocean_stress_resume_apply->proc~ocean_surface_stress_refresh_mag 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_derived_impl->local

Called by

proc~~ice_ocean_stress_resume_apply~~CalledByGraph proc~ice_ocean_stress_resume_apply ice_ocean_stress_resume_apply proc~engine_setup engine_setup proc~engine_setup->proc~ice_ocean_stress_resume_apply 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

Source Code

   pure subroutine ice_ocean_stress_resume_apply(stress, ice)
      !! Configure-time resume apply (PR 63).  `tau_x`/`tau_y` were just
      !! re-seeded from the wind-stress config by `configure_ocean_forcing`;
      !! if the checkpoint carried a blend (`tau_ocn_valid > 0.5`),
      !! overwrite them with it — the EXACT stress the uninterrupted run
      !! would have handed the ocean at this step boundary.  Otherwise
      !! leave the pristine wind (D8: a fresh run's first outer step
      !! drives the ocean with pure wind — and, for the first time, this
      !! is now literally true: no `(1-a)*tau_a` residual from an
      !! uninitialised `fxoc`).
      !!
      !! REPLACES the old configure-time resume-fold routine (deleted).
      !! That routine RECONSTRUCTED the blend from the checkpointed `ci`
      !! — which is the POST-thermo/post-transport concentration, not the
      !! PRE-thermo `ci`
      !! the uninterrupted run actually blended against (F4) — so it was
      !! wrong whenever a checkpoint step's thermo/transport changed `ci`
      !! after the blend.  This routine COPIES the blend's own recorded
      !! output instead, which is exact by construction and stays exact
      !! under any future change to the blend formula (SIS2 `Ice%flux_u`/
      !! `flux_v`, `ice_type.F90:240-243` — carried, not reconstructed).
      !!
      !! Host-only whole-array assignment; runs BEFORE `enter_data`
      !! (mirrors the deleted routine's host-only contract, but for a
      !! trivial reason now — a plain copy needs no device kernel at all,
      !! so the GPU-hazard this used to carry — do-concurrent kernels over
      !! unmapped host arrays at configure time, see rdb_ice_evp's D8 note
      !! and CLAUDE.md — is gone by construction, not by discipline).
      type(ocean_surface_stress_t), intent(inout) :: stress
      type(ocean_sea_ice_t), intent(in) :: ice
      if (ice%tau_ocn_valid <= 0.5_wp) return
      stress%tau_x = ice%tau_ocn_x
      stress%tau_y = ice%tau_ocn_y
      ! Same obligation as the per-step blend: a write to the `tau` pair
      ! that leaves `stress_mag` behind hands KPP/EPBL the WIND magnitude
      ! for the first outer step of the resumed run, because
      ! `configure_ocean_forcing`'s seam refresh already ran (on the
      ! pristine wind) by the time this overwrite lands.  Host-side here —
      ! this routine runs before `enter_data`, so the whole-array
      ! assignments above and this refresh all operate on host memory.
      ! On the no-checkpoint path the early return above skips it and the
      ! configure-time `stress_mag` stands, unchanged.
      call ocean_surface_stress_refresh_mag(stress)
   end subroutine ice_ocean_stress_resume_apply