stress_scratch_ensure Subroutine

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

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nx
integer, intent(in) :: ny

Calls

proc~~stress_scratch_ensure~~CallsGraph proc~stress_scratch_ensure stress_scratch_ensure proc~ice_ocean_stress_cleanup ice_ocean_stress_cleanup proc~stress_scratch_ensure->proc~ice_ocean_stress_cleanup

Called by

proc~~stress_scratch_ensure~~CalledByGraph proc~stress_scratch_ensure stress_scratch_ensure proc~ice_ocean_stress_flux ice_ocean_stress_flux proc~ice_ocean_stress_flux->proc~stress_scratch_ensure proc~engine_step_ice engine_step_ice proc~engine_step_ice->proc~ice_ocean_stress_flux proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step_ice proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step_ice proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Source Code

   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