ocean_ideal_age_reset_surface Subroutine

public subroutine ocean_ideal_age_reset_surface(grid, ms, young_eff, active)

Driver-facing entry point for the surface Dirichlet BC. Self-gates on ms%idx_age <= 0, else delegates to the flat-impl ocean_ideal_age_reset_step kernel. Call exactly ONCE per outer step, after rk2_average + the ALE remap — see the module header for the full ordering contract.

Arguments

Type IntentOptional Attributes Name
type(hgrid_t), intent(in) :: grid
type(multilayer_state_t), intent(inout) :: ms
real(kind=wp), intent(in) :: young_eff

Host-computed surface value (s) — see ocean_ideal_age_young_val. Computed ONCE on the host per outer step and passed by value; never call exp() inside a do concurrent body.

logical, intent(in), optional :: active

Optional gate (thermo cadence). Absent => kernel runs; present-and-false => early return.


Calls

proc~~ocean_ideal_age_reset_surface~~CallsGraph proc~ocean_ideal_age_reset_surface ocean_ideal_age_reset_surface proc~ocean_ideal_age_reset_step ocean_ideal_age_reset_step proc~ocean_ideal_age_reset_surface->proc~ocean_ideal_age_reset_step

Called by

proc~~ocean_ideal_age_reset_surface~~CalledByGraph proc~ocean_ideal_age_reset_surface ocean_ideal_age_reset_surface proc~ocean_dyn_step ocean_dyn_step proc~ocean_dyn_step->proc~ocean_ideal_age_reset_surface proc~ocean_dyn_step_split ocean_dyn_step_split proc~ocean_dyn_step_split->proc~ocean_ideal_age_reset_surface proc~engine_step engine_step proc~engine_step->proc~ocean_dyn_step proc~engine_step->proc~ocean_dyn_step_split proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~engine_step proc~rdb_ocean_step rdb_ocean_step proc~rdb_ocean_step->proc~engine_step proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Source Code

   subroutine ocean_ideal_age_reset_surface(grid, ms, young_eff, active)
      !! Driver-facing entry point for the surface Dirichlet BC.
      !! Self-gates on `ms%idx_age <= 0`, else delegates to the
      !! flat-impl `ocean_ideal_age_reset_step` kernel. Call exactly
      !! ONCE per outer step, after `rk2_average` + the ALE remap —
      !! see the module header for the full ordering contract.
      type(hgrid_t), intent(in) :: grid
      type(multilayer_state_t), intent(inout) :: ms
      real(wp), intent(in) :: young_eff
         !! Host-computed surface value (s) — see `ocean_ideal_age_young_val`.
         !! Computed ONCE on the host per outer step and passed by value;
         !! never call `exp()` inside a `do concurrent` body.
      logical, intent(in), optional :: active
         !! Optional gate (thermo cadence). Absent => kernel runs;
         !! present-and-false => early return.

      if (present(active)) then
         if (.not. active) return
      end if
      if (ms%idx_age <= 0) return
      call ocean_ideal_age_reset_step(ms%tracers(ms%idx_age)%hTr, ms%h_layer, &
                                      young_eff, grid%nx_total, grid%ny_total, ms%nz_ml)
   end subroutine ocean_ideal_age_reset_surface