Advance n_steps fixed-dt (cfg%dt_fixed) outer steps via the
shared engine_step / engine_step_ice / engine_step_finalize
sequence (P2.4 + P2.4b) — the SAME calls driver_run_ocean’s time
loop makes: the dyn-core advance, then sea-ice per-step physics
(engine_step_ice — a no-op when &ocean_ice_nml enable = .false.,
so this is bit-identical to before P2.4b for every non-ice config),
then surface-flux-component assembly / the diag step. n_steps <=
0 is a successful no-op (mirrors an empty range, not an error).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in), | value | :: | c_handle | ||
| integer(kind=c_int), | intent(in), | value | :: | n_steps |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=wp), | private | :: | dt | ||||
| type(ocean_handle_t), | private, | pointer | :: | h | |||
| integer, | private | :: | i | ||||
| integer, | private | :: | step_ierr |
function rdb_ocean_step(c_handle, n_steps) result(status) & bind(c, name="rdb_ocean_step") !! Advance `n_steps` fixed-`dt` (`cfg%dt_fixed`) outer steps via the !! shared `engine_step` / `engine_step_ice` / `engine_step_finalize` !! sequence (P2.4 + P2.4b) — the SAME calls `driver_run_ocean`'s time !! loop makes: the dyn-core advance, then sea-ice per-step physics !! (`engine_step_ice` — a no-op when `&ocean_ice_nml enable = .false.`, !! so this is bit-identical to before P2.4b for every non-ice config), !! then surface-flux-component assembly / the diag step. `n_steps <= !! 0` is a successful no-op (mirrors an empty range, not an error). type(c_ptr), intent(in), value :: c_handle integer(c_int), intent(in), value :: n_steps integer(c_int) :: status type(ocean_handle_t), pointer :: h integer :: i real(wp) :: dt integer :: step_ierr status = resolve_ocean(c_handle, h) if (status /= OCEAN_STATUS_OK) return if (n_steps <= 0_c_int) return dt = h%cfg%dt_fixed do i = 1, int(n_steps) call engine_step(h%engine, dt, h%t_current, ierr=step_ierr) if (step_ierr /= OCEAN_STATUS_OK) then status = int(step_ierr, c_int) return end if call engine_step_ice(h%engine, h%cfg, dt, h%t_current, ierr=step_ierr) if (step_ierr /= OCEAN_STATUS_OK) then status = int(step_ierr, c_int) return end if call engine_step_finalize(h%engine, dt, h%t_current, ierr=step_ierr) if (step_ierr /= OCEAN_STATUS_OK) then status = int(step_ierr, c_int) return end if h%t_current = h%t_current + dt end do ! P2 D<->H contract (docs/ocean_python_api_plan.md S3): a step only ! CLEARS the lazy-sync flag, never syncs — the next accessor that ! needs a live host view calls rdb_ocean_refresh_host itself. h%host_is_current = .false. status = int(OCEAN_STATUS_OK, c_int) end function rdb_ocean_step