Overwrite the C-grid surface wind stress (N/m^2) mid-run:
taux_data is (nx_p+1, ny_p) (east faces), tauy_data is
(nx_p, ny_p+1) (north faces) over the physical interior; ghost
faces are left untouched (0 from init — wall faces see no
spurious stress). Narrow-pushes tau_x/tau_y only. Settable
repeatedly for a time-varying wind schedule.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in), | value | :: | c_handle | ||
| real(kind=c_double), | intent(in) | :: | taux_data(nx_p+1,ny_p) | |||
| real(kind=c_double), | intent(in) | :: | tauy_data(nx_p,ny_p+1) | |||
| integer(kind=c_int), | intent(in), | value | :: | nx_p | ||
| integer(kind=c_int), | intent(in), | value | :: | ny_p |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(ocean_handle_t), | private, | pointer | :: | h | |||
| integer, | private | :: | ierr_local | ||||
| integer, | private | :: | ng |
function rdb_ocean_set_wind(c_handle, taux_data, tauy_data, nx_p, ny_p) result(status) & bind(c, name="rdb_ocean_set_wind") !! Overwrite the C-grid surface wind stress (N/m^2) mid-run: !! `taux_data` is `(nx_p+1, ny_p)` (east faces), `tauy_data` is !! `(nx_p, ny_p+1)` (north faces) over the physical interior; ghost !! faces are left untouched (0 from init — wall faces see no !! spurious stress). Narrow-pushes `tau_x`/`tau_y` only. Settable !! repeatedly for a time-varying wind schedule. type(c_ptr), intent(in), value :: c_handle integer(c_int), intent(in), value :: nx_p, ny_p real(c_double), intent(in) :: taux_data(nx_p + 1, ny_p) real(c_double), intent(in) :: tauy_data(nx_p, ny_p + 1) integer(c_int) :: status type(ocean_handle_t), pointer :: h integer :: ng, ierr_local status = resolve_ocean(c_handle, h) if (status /= OCEAN_STATUS_OK) return if (nx_p /= h%grid%nx_phys .or. ny_p /= h%grid%ny_phys) then call fail("rdb_ocean_set_wind: shape mismatch against the physical interior", & ierr_local, OCEAN_STATUS_ERR_BAD_SHAPE) status = int(ierr_local, c_int) return end if ng = h%grid%nghost associate (tx => h%state%surface_stress%tau_x, ty => h%state%surface_stress%tau_y) tx(ng + 1:ng + nx_p + 1, ng + 1:ng + ny_p) = real(taux_data, wp) ty(ng + 1:ng + nx_p, ng + 1:ng + ny_p + 1) = real(tauy_data, wp) !$acc update device(tx, ty) end associate status = int(OCEAN_STATUS_OK, c_int) end function rdb_ocean_set_wind