Recompute stress_mag from the CURRENT tau_x/tau_y, shape
taken from the already-allocated arrays (no grid needed — this
is the grid-free twin of ocean_surface_stress_set_derived, for
callers that hold the slot but not the grid).
Runs where the data lives. ocean_surfstress_derived_impl is
a plain do concurrent, so at configure time (before
enter_data) this is a host loop over host arrays, and once the
slot is device-mapped the SAME call is a device kernel over the
mapped tau_x/tau_y/stress_mag. A per-step caller therefore
pays no host round trip and no allocation — which is what lets the
sea-ice stress coupler (ice_ocean_stress_flux,
rdb_ice_ocean_coupler) refresh stress_mag in step with the
ice-mediated tau it writes on the device every outer step.
Without that refresh KPP (rdb_ocean_vmix) and EPBL
(rdb_ocean_epbl) — whose only source of u_* is this field —
keep mixing on the configure-time WIND under sea ice.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(ocean_surface_stress_t), | intent(inout) | :: | ss |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private | :: | nx | ||||
| integer, | private | :: | ny |
pure subroutine ocean_surface_stress_refresh_mag(ss) !! Recompute `stress_mag` from the CURRENT `tau_x`/`tau_y`, shape !! taken from the already-allocated arrays (no `grid` needed — this !! is the grid-free twin of `ocean_surface_stress_set_derived`, for !! callers that hold the slot but not the grid). !! !! **Runs where the data lives.** `ocean_surfstress_derived_impl` is !! a plain `do concurrent`, so at configure time (before !! `enter_data`) this is a host loop over host arrays, and once the !! slot is device-mapped the SAME call is a device kernel over the !! mapped `tau_x`/`tau_y`/`stress_mag`. A per-step caller therefore !! pays no host round trip and no allocation — which is what lets the !! sea-ice stress coupler (`ice_ocean_stress_flux`, !! `rdb_ice_ocean_coupler`) refresh `stress_mag` in step with the !! ice-mediated `tau` it writes on the device every outer step. !! Without that refresh KPP (`rdb_ocean_vmix`) and EPBL !! (`rdb_ocean_epbl`) — whose only source of `u_*` is this field — !! keep mixing on the configure-time WIND under sea ice. type(ocean_surface_stress_t), intent(inout) :: ss integer :: nx, ny nx = size(ss%tau_x, 1) - 1 ny = size(ss%tau_x, 2) call ocean_surfstress_derived_impl(ss%tau_x, ss%tau_y, ss%stress_mag, nx, ny) ss%has_stress_mag = .true. end subroutine ocean_surface_stress_refresh_mag