check_fresh Subroutine

private subroutine check_fresh(this, id, t)

Ordering guard: update_2d/_3d must be called with the same t update_all most recently refreshed this field’s bracket with (skipped for STATIC — its bracket never changes, so “freshness” is meaningless). Catches a consumer calling update_2d/_3d before update_all has run this step, which would otherwise silently blend a stale bracket.

Arguments

Type IntentOptional Attributes Name
class(ocean_data_input_t), intent(in) :: this
integer, intent(in) :: id
real(kind=wp), intent(in) :: t

Calls

proc~~check_fresh~~CallsGraph proc~check_fresh check_fresh error error proc~check_fresh->error to_string to_string proc~check_fresh->to_string

Called by

proc~~check_fresh~~CalledByGraph proc~check_fresh check_fresh proc~ocean_data_input_update_2d ocean_data_input_update_2d proc~ocean_data_input_update_2d->proc~check_fresh proc~ocean_data_input_update_3d ocean_data_input_update_3d proc~ocean_data_input_update_3d->proc~check_fresh proc~ocean_data_forcing_apply ocean_data_forcing_apply proc~ocean_data_forcing_apply->proc~ocean_data_input_update_2d proc~engine_step engine_step proc~engine_step->proc~ocean_data_forcing_apply 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 check_fresh(this, id, t)
      !! Ordering guard: `update_2d/_3d` must be called with the same
      !! `t` `update_all` most recently refreshed this field's bracket
      !! with (skipped for STATIC — its bracket never changes, so
      !! "freshness" is meaningless).  Catches a consumer calling
      !! `update_2d/_3d` before `update_all` has run this step, which
      !! would otherwise silently blend a stale bracket.
      class(ocean_data_input_t), intent(in) :: this
      integer, intent(in) :: id
      real(wp), intent(in) :: t
      if (this%fields(id)%time_mode == DATA_TIME_STATIC) return
      if (t /= this%fields(id)%t_last) then
         call logger%error("ocean_data_input: field id "//to_string(id)// &
                           " queried at t = "//to_string(t)// &
                           "s but its bracket was last refreshed at t = "// &
                           to_string(this%fields(id)%t_last)// &
                           "s — call ocean_data_input_update_all(this, t) first")
         error stop "ocean_data_input: stale bracket (update_all not called for this t)"
      end if
   end subroutine check_fresh