rdb_ocean_step Function

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

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in), value :: c_handle
integer(kind=c_int), intent(in), value :: n_steps

Return Value integer(kind=c_int)


Calls

proc~~rdb_ocean_step~~CallsGraph proc~rdb_ocean_step rdb_ocean_step proc~engine_step engine_step proc~rdb_ocean_step->proc~engine_step proc~engine_step_finalize engine_step_finalize proc~rdb_ocean_step->proc~engine_step_finalize proc~engine_step_ice engine_step_ice proc~rdb_ocean_step->proc~engine_step_ice proc~resolve_ocean resolve_ocean proc~rdb_ocean_step->proc~resolve_ocean proc~constant_update ocean_boundary_data_constant_t%constant_update proc~engine_step->proc~constant_update proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~engine_step->proc~ocean_data_forcing_apply proc~ocean_data_input_update_all ocean_data_input_update_all proc~engine_step->proc~ocean_data_input_update_all proc~ocean_dyn_step ocean_dyn_step proc~engine_step->proc~ocean_dyn_step proc~ocean_dyn_step_split ocean_dyn_step_split proc~engine_step->proc~ocean_dyn_step_split proc~ocean_porous_refresh ocean_porous_refresh proc~engine_step->proc~ocean_porous_refresh proc~ocean_sponge_refresh_target ocean_sponge_refresh_target proc~engine_step->proc~ocean_sponge_refresh_target proc~profiler_start profiler_start proc~engine_step->proc~profiler_start proc~profiler_stop profiler_stop proc~engine_step->proc~profiler_stop proc~ocean_cavity_flux_step ocean_cavity_flux_step proc~engine_step_finalize->proc~ocean_cavity_flux_step proc~ocean_diag_step ocean_diag_t%ocean_diag_step proc~engine_step_finalize->proc~ocean_diag_step proc~ocean_dyn_is_thermo_step ocean_dyn_t%ocean_dyn_is_thermo_step proc~engine_step_finalize->proc~ocean_dyn_is_thermo_step proc~ocean_surface_flux_assemble ocean_surface_flux_assemble proc~engine_step_finalize->proc~ocean_surface_flux_assemble proc~ocean_surface_stress_set_shelf_from_ustar ocean_surface_stress_set_shelf_from_ustar proc~engine_step_finalize->proc~ocean_surface_stress_set_shelf_from_ustar error error proc~engine_step_ice->error proc~halo_allreduce_sum_i8 halo_allreduce_sum_i8 proc~engine_step_ice->proc~halo_allreduce_sum_i8 proc~ice_adjust_categories ice_adjust_categories proc~engine_step_ice->proc~ice_adjust_categories proc~ice_atm_forcing_restoring ice_atm_forcing_restoring proc~engine_step_ice->proc~ice_atm_forcing_restoring proc~ice_compute_basal_flux ice_compute_basal_flux proc~engine_step_ice->proc~ice_compute_basal_flux proc~ice_evp_step ice_evp_step proc~engine_step_ice->proc~ice_evp_step proc~ice_frazil_accumulate ice_frazil_accumulate proc~engine_step_ice->proc~ice_frazil_accumulate proc~ice_frazil_uptake ice_frazil_uptake proc~engine_step_ice->proc~ice_frazil_uptake proc~ice_ocean_brine_flux ice_ocean_brine_flux proc~engine_step_ice->proc~ice_ocean_brine_flux proc~ice_ocean_heat_flux ice_ocean_heat_flux proc~engine_step_ice->proc~ice_ocean_heat_flux proc~ice_ocean_stress_flux ice_ocean_stress_flux proc~engine_step_ice->proc~ice_ocean_stress_flux proc~ice_ocean_sw_flux ice_ocean_sw_flux proc~engine_step_ice->proc~ice_ocean_sw_flux proc~ice_snowfall_ocean_share ice_snowfall_ocean_share proc~engine_step_ice->proc~ice_snowfall_ocean_share proc~ice_thermo_driver_step ice_thermo_driver_step proc~engine_step_ice->proc~ice_thermo_driver_step proc~ice_transport_step ice_transport_step proc~engine_step_ice->proc~ice_transport_step proc~engine_step_ice->proc~ocean_dyn_is_thermo_step proc~ocean_dyn_therm_dt ocean_dyn_t%ocean_dyn_therm_dt proc~engine_step_ice->proc~ocean_dyn_therm_dt proc~ocean_halo_exchange_ice_fluxes ocean_halo_exchange_ice_fluxes proc~engine_step_ice->proc~ocean_halo_exchange_ice_fluxes proc~ocean_halo_exchange_ice_state ocean_halo_exchange_ice_state proc~engine_step_ice->proc~ocean_halo_exchange_ice_state proc~ocean_halo_is_decomposed ocean_halo_is_decomposed proc~engine_step_ice->proc~ocean_halo_is_decomposed proc~engine_step_ice->proc~profiler_start proc~engine_step_ice->proc~profiler_stop to_string to_string proc~engine_step_ice->to_string warning warning proc~engine_step_ice->warning proc~handle_check handle_check proc~resolve_ocean->proc~handle_check allreduce allreduce proc~halo_allreduce_sum_i8->allreduce proc~comm_env_compute_comm comm_env_compute_comm proc~halo_allreduce_sum_i8->proc~comm_env_compute_comm proc~ice_adjust_categories_impl ice_adjust_categories_impl proc~ice_adjust_categories->proc~ice_adjust_categories_impl proc~ice_atm_forcing_restoring_impl ice_atm_forcing_restoring_impl proc~ice_atm_forcing_restoring->proc~ice_atm_forcing_restoring_impl proc~ice_compute_basal_flux_impl ice_compute_basal_flux_impl proc~ice_compute_basal_flux->proc~ice_compute_basal_flux_impl proc~ice_cell_concentration_impl ice_cell_concentration_impl proc~ice_evp_step->proc~ice_cell_concentration_impl proc~ice_evp_dynamics ice_evp_dynamics proc~ice_evp_step->proc~ice_evp_dynamics proc~ocean_halo_is_decomposed_x ocean_halo_is_decomposed_x proc~ice_evp_step->proc~ocean_halo_is_decomposed_x proc~ocean_halo_is_decomposed_y ocean_halo_is_decomposed_y proc~ice_evp_step->proc~ocean_halo_is_decomposed_y proc~ice_frazil_accumulate_impl ice_frazil_accumulate_impl proc~ice_frazil_accumulate->proc~ice_frazil_accumulate_impl proc~ice_frazil_uptake_impl ice_frazil_uptake_impl proc~ice_frazil_uptake->proc~ice_frazil_uptake_impl proc~ice_frazil_uptake_multicat_impl ice_frazil_uptake_multicat_impl proc~ice_frazil_uptake->proc~ice_frazil_uptake_multicat_impl proc~ice_ocean_brine_flux_components_impl ice_ocean_brine_flux_components_impl proc~ice_ocean_brine_flux->proc~ice_ocean_brine_flux_components_impl proc~ice_ocean_brine_flux_impl ice_ocean_brine_flux_impl proc~ice_ocean_brine_flux->proc~ice_ocean_brine_flux_impl proc~ice_ocean_heat_flux_components_impl ice_ocean_heat_flux_components_impl proc~ice_ocean_heat_flux->proc~ice_ocean_heat_flux_components_impl proc~ice_ocean_heat_flux_impl ice_ocean_heat_flux_impl proc~ice_ocean_heat_flux->proc~ice_ocean_heat_flux_impl proc~ice_ocean_stress_flux->proc~ice_cell_concentration_impl proc~ice_ocean_stress_flux_impl ice_ocean_stress_flux_impl proc~ice_ocean_stress_flux->proc~ice_ocean_stress_flux_impl proc~ice_tau_mirror_impl ice_tau_mirror_impl proc~ice_ocean_stress_flux->proc~ice_tau_mirror_impl proc~ocean_seam_refresh_surface_stress ocean_seam_refresh_surface_stress proc~ice_ocean_stress_flux->proc~ocean_seam_refresh_surface_stress proc~ocean_surface_stress_refresh_mag ocean_surface_stress_refresh_mag proc~ice_ocean_stress_flux->proc~ocean_surface_stress_refresh_mag proc~stress_scratch_ensure stress_scratch_ensure proc~ice_ocean_stress_flux->proc~stress_scratch_ensure proc~ice_ocean_sw_flux_add_impl ice_ocean_sw_flux_add_impl proc~ice_ocean_sw_flux->proc~ice_ocean_sw_flux_add_impl proc~ice_ocean_sw_flux_components_impl ice_ocean_sw_flux_components_impl proc~ice_ocean_sw_flux->proc~ice_ocean_sw_flux_components_impl proc~ice_snowfall_ocean_share_impl ice_snowfall_ocean_share_impl proc~ice_snowfall_ocean_share->proc~ice_snowfall_ocean_share_impl proc~ice_fb_part_sum_fill_impl ice_fb_part_sum_fill_impl proc~ice_thermo_driver_step->proc~ice_fb_part_sum_fill_impl proc~ice_snow_part_ocn_fill_impl ice_snow_part_ocn_fill_impl proc~ice_thermo_driver_step->proc~ice_snow_part_ocn_fill_impl proc~ice_thermo_columns ice_thermo_columns proc~ice_thermo_driver_step->proc~ice_thermo_columns proc~ice_thermo_driver_reduce_impl ice_thermo_driver_reduce_impl proc~ice_thermo_driver_step->proc~ice_thermo_driver_reduce_impl proc~ice_thermo_driver_reduce_multicat_impl ice_thermo_driver_reduce_multicat_impl proc~ice_thermo_driver_step->proc~ice_thermo_driver_reduce_multicat_impl proc~ice_transport_step->proc~ice_adjust_categories proc~ice_transport_step->proc~ocean_halo_is_decomposed proc~halo_allreduce_max halo_allreduce_max proc~ice_transport_step->proc~halo_allreduce_max proc~ice_cas_to_ist_impl ice_cas_to_ist_impl proc~ice_transport_step->proc~ice_cas_to_ist_impl proc~ice_compress_impl ice_compress_impl proc~ice_transport_step->proc~ice_compress_impl proc~ice_ist_to_cas_impl ice_ist_to_cas_impl proc~ice_transport_step->proc~ice_ist_to_cas_impl proc~ice_max_speed_impl ice_max_speed_impl proc~ice_transport_step->proc~ice_max_speed_impl proc~ice_pass_x ice_pass_x proc~ice_transport_step->proc~ice_pass_x proc~ice_pass_y ice_pass_y proc~ice_transport_step->proc~ice_pass_y proc~ice_sample_velocity_impl ice_sample_velocity_impl proc~ice_transport_step->proc~ice_sample_velocity_impl proc~ocean_halo_exchange_ice_transport ocean_halo_exchange_ice_transport proc~ice_transport_step->proc~ocean_halo_exchange_ice_transport proc~ocean_halo_is_init ocean_halo_is_init proc~ice_transport_step->proc~ocean_halo_is_init proc~ok_all_ranks ok_all_ranks proc~ice_transport_step->proc~ok_all_ranks proc~ocean_cavity_flux_step->to_string proc~ocean_cavity_flux_step->warning proc~cavity_far_field_impl cavity_far_field_impl proc~ocean_cavity_flux_step->proc~cavity_far_field_impl proc~cavity_flux_fill_impl cavity_flux_fill_impl proc~ocean_cavity_flux_step->proc~cavity_flux_fill_impl proc~cavity_melt_columns_2d cavity_melt_columns_2d proc~ocean_cavity_flux_step->proc~cavity_melt_columns_2d proc~cavity_melt_status_is_fatal cavity_melt_status_is_fatal proc~ocean_cavity_flux_step->proc~cavity_melt_status_is_fatal proc~cavity_status_counts_impl cavity_status_counts_impl proc~ocean_cavity_flux_step->proc~cavity_status_counts_impl proc~fail fail proc~ocean_cavity_flux_step->proc~fail proc~ocean_data_input_update_2d ocean_data_input_update_2d proc~ocean_data_forcing_apply->proc~ocean_data_input_update_2d proc~ocean_data_forcing_apply->proc~ocean_seam_refresh_surface_stress proc~data_input_refresh_brackets data_input_refresh_brackets proc~ocean_data_input_update_all->proc~data_input_refresh_brackets info info proc~ocean_diag_step->info proc~diag_field_stats diag_field_stats proc~ocean_diag_step->proc~diag_field_stats proc~fill_and_remap fill_and_remap proc~ocean_diag_step->proc~fill_and_remap proc~finalise_accumulator finalise_accumulator proc~ocean_diag_step->proc~finalise_accumulator proc~fold_sample fold_sample proc~ocean_diag_step->proc~fold_sample proc~reset_accumulator reset_accumulator proc~ocean_diag_step->proc~reset_accumulator proc~ocean_dyn_step->proc~ocean_dyn_is_thermo_step proc~apply_velocity_truncation apply_velocity_truncation proc~ocean_dyn_step->proc~apply_velocity_truncation proc~check_h_positive_or_die check_h_positive_or_die proc~ocean_dyn_step->proc~check_h_positive_or_die proc~continuity_tracer_drain continuity_tracer_drain proc~ocean_dyn_step->proc~continuity_tracer_drain proc~copy_field_3d copy_field_3d proc~ocean_dyn_step->proc~copy_field_3d proc~mask_layer_velocities mask_layer_velocities proc~ocean_dyn_step->proc~mask_layer_velocities proc~ocean_dyn_is_tracer_advect_step ocean_dyn_t%ocean_dyn_is_tracer_advect_step proc~ocean_dyn_step->proc~ocean_dyn_is_tracer_advect_step proc~ocean_ideal_age_reset_surface ocean_ideal_age_reset_surface proc~ocean_dyn_step->proc~ocean_ideal_age_reset_surface proc~ocean_ideal_age_young_val ocean_ideal_age_young_val proc~ocean_dyn_step->proc~ocean_ideal_age_young_val proc~rk2_average rk2_average proc~ocean_dyn_step->proc~rk2_average proc~rk2_average_field_3d rk2_average_field_3d proc~ocean_dyn_step->proc~rk2_average_field_3d proc~run_stage run_stage proc~ocean_dyn_step->proc~run_stage proc~save_state save_state proc~ocean_dyn_step->proc~save_state proc~vdiff_set_viscous_bbl vdiff_set_viscous_bbl proc~ocean_dyn_step->proc~vdiff_set_viscous_bbl proc~ocean_dyn_step_split->proc~ocean_dyn_is_thermo_step proc~ocean_dyn_step_split->proc~ocean_dyn_therm_dt proc~ocean_dyn_step_split->proc~profiler_start proc~ocean_dyn_step_split->proc~profiler_stop interface~ocean_halo_centre ocean_halo_centre proc~ocean_dyn_step_split->interface~ocean_halo_centre proc~ocean_dyn_step_split->proc~apply_velocity_truncation proc~ocean_dyn_step_split->proc~check_h_positive_or_die proc~check_remap_preconditions_or_die check_remap_preconditions_or_die proc~ocean_dyn_step_split->proc~check_remap_preconditions_or_die proc~check_vanished_invariant_or_die check_vanished_invariant_or_die proc~ocean_dyn_step_split->proc~check_vanished_invariant_or_die proc~chksum_state chksum_state proc~ocean_dyn_step_split->proc~chksum_state proc~ocean_dyn_step_split->proc~continuity_tracer_drain proc~ocean_dyn_step_split->proc~copy_field_3d proc~gm_refreshes_varmix gm_refreshes_varmix proc~ocean_dyn_step_split->proc~gm_refreshes_varmix proc~isopycnal_vanish_tol isopycnal_vanish_tol proc~ocean_dyn_step_split->proc~isopycnal_vanish_tol proc~ocean_dyn_step_split->proc~mask_layer_velocities proc~mask_time_mean_velocities mask_time_mean_velocities proc~ocean_dyn_step_split->proc~mask_time_mean_velocities proc~mle_compute_transports mle_compute_transports proc~ocean_dyn_step_split->proc~mle_compute_transports proc~multilayer_enforce_vanished_content multilayer_state_t%multilayer_enforce_vanished_content proc~ocean_dyn_step_split->proc~multilayer_enforce_vanished_content proc~ocean_apply_ale_remap_step ocean_apply_ale_remap_step proc~ocean_dyn_step_split->proc~ocean_apply_ale_remap_step proc~ocean_dyn_step_split->proc~ocean_dyn_is_tracer_advect_step proc~ocean_dyn_step_split->proc~ocean_ideal_age_reset_surface proc~ocean_dyn_step_split->proc~ocean_ideal_age_young_val proc~ocean_obc_refill_ghost_ssh ocean_obc_refill_ghost_ssh proc~ocean_dyn_step_split->proc~ocean_obc_refill_ghost_ssh proc~ocean_poison_ghost_bands ocean_poison_ghost_bands proc~ocean_dyn_step_split->proc~ocean_poison_ghost_bands proc~ocean_slopes_compute ocean_slopes_compute proc~ocean_dyn_step_split->proc~ocean_slopes_compute proc~p_surf_update_seam p_surf_update_seam proc~ocean_dyn_step_split->proc~p_surf_update_seam proc~probe_ds probe_dS proc~ocean_dyn_step_split->proc~probe_ds proc~redi_calc_coeffs redi_calc_coeffs proc~ocean_dyn_step_split->proc~redi_calc_coeffs proc~reset_vanished_layer_velocities reset_vanished_layer_velocities proc~ocean_dyn_step_split->proc~reset_vanished_layer_velocities proc~restore_state restore_state proc~ocean_dyn_step_split->proc~restore_state proc~ocean_dyn_step_split->proc~rk2_average proc~ocean_dyn_step_split->proc~rk2_average_field_3d proc~run_gm_step run_gm_step proc~ocean_dyn_step_split->proc~run_gm_step proc~run_meke_step run_meke_step proc~ocean_dyn_step_split->proc~run_meke_step proc~run_stage_split run_stage_split proc~ocean_dyn_step_split->proc~run_stage_split proc~ocean_dyn_step_split->proc~save_state proc~tides_update_eta_eq tides_update_eta_eq proc~ocean_dyn_step_split->proc~tides_update_eta_eq proc~tides_update_eta_sal tides_update_eta_sal proc~ocean_dyn_step_split->proc~tides_update_eta_sal proc~varmix_compute varmix_compute proc~ocean_dyn_step_split->proc~varmix_compute proc~ocean_dyn_step_split->proc~vdiff_set_viscous_bbl proc~wavespeed_compute wavespeed_compute proc~ocean_dyn_step_split->proc~wavespeed_compute proc~ocean_halo_exchange_ice_fluxes->proc~profiler_start proc~ocean_halo_exchange_ice_fluxes->proc~profiler_stop proc~ocean_halo_exchange_ice_fluxes->interface~ocean_halo_centre proc~ocean_fold_wrap_centre_flat ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_fluxes->proc~ocean_fold_wrap_centre_flat proc~oh_count_suppress_off oh_count_suppress_off proc~ocean_halo_exchange_ice_fluxes->proc~oh_count_suppress_off proc~oh_count_suppress_on oh_count_suppress_on proc~ocean_halo_exchange_ice_fluxes->proc~oh_count_suppress_on proc~ocean_halo_exchange_ice_state->proc~profiler_start proc~ocean_halo_exchange_ice_state->proc~profiler_stop proc~ice_halo_centre_flat ice_halo_centre_flat proc~ocean_halo_exchange_ice_state->proc~ice_halo_centre_flat proc~ocean_halo_exchange_ice_state->proc~ocean_fold_wrap_centre_flat proc~ocean_halo_exchange_ice_state->proc~oh_count_suppress_off proc~ocean_halo_exchange_ice_state->proc~oh_count_suppress_on proc~closed_faces_update_bt_widths closed_faces_update_bt_widths proc~ocean_porous_refresh->proc~closed_faces_update_bt_widths proc~porous_update_face_areas porous_update_face_areas proc~ocean_porous_refresh->proc~porous_update_face_areas proc~refresh_linear_z_impl refresh_linear_z_impl proc~ocean_sponge_refresh_target->proc~refresh_linear_z_impl proc~ocean_surfflux_assemble_cover_impl ocean_surfflux_assemble_cover_impl proc~ocean_surface_flux_assemble->proc~ocean_surfflux_assemble_cover_impl proc~ocean_surfflux_assemble_impl ocean_surfflux_assemble_impl proc~ocean_surface_flux_assemble->proc~ocean_surfflux_assemble_impl proc~find_or_create_region find_or_create_region proc~profiler_start->proc~find_or_create_region proc~get_wall_time get_wall_time proc~profiler_start->proc~get_wall_time proc~nvtx_range_push nvtx_range_push proc~profiler_start->proc~nvtx_range_push proc~profiler_stop->proc~get_wall_time proc~nvtx_range_pop nvtx_range_pop proc~profiler_stop->proc~nvtx_range_pop

Variables

Type Visibility Attributes Name Initial
real(kind=wp), private :: dt
type(ocean_handle_t), private, pointer :: h
integer, private :: i
integer, private :: step_ierr

Source Code

   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