Lazily (re)allocate + device-map the per-step tau-blend scratch (F6). Size change tears down and rebuilds. Never called inside a per-substep loop (this whole coupler runs once per outer step).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | nx | |||
| integer, | intent(in) | :: | ny |
subroutine stress_scratch_ensure(nx, ny) !! Lazily (re)allocate + device-map the per-step tau-blend scratch !! (F6). Size change tears down and rebuilds. Never called inside a !! per-substep loop (this whole coupler runs once per outer step). integer, intent(in) :: nx, ny if (stress_scratch_ready .and. ss_nx == nx .and. ss_ny == ny) return if (stress_scratch_ready) call ice_ocean_stress_cleanup() allocate (ci_scratch(nx, ny), source=0.0_wp) allocate (mis_scratch(nx, ny), source=0.0_wp) allocate (mice_scratch(nx, ny), source=0.0_wp) !$acc enter data create(ci_scratch, mis_scratch, mice_scratch) ss_nx = nx ss_ny = ny stress_scratch_ready = .true. end subroutine stress_scratch_ensure