tem_timeControl_triggered Function

public function tem_timeControl_triggered(me, now) result(hasTriggered)

Returns if the timeControl has triggered since last update.

This is true if now >= me%trigger and with in the bounds of min and max. Please note that, to allow arbitrary settings of min and interval, this routine might change the timeControl data given in me, by setting the trigger to now, when min is reached for the first time. This is required to allow independent time definitions for min, max and interval.

Arguments

Type IntentOptional Attributes Name
type(tem_timeControl_type), intent(inout) :: me

Time control to check if it was triggered.

type(tem_time_type), intent(in) :: now

Current time that is to be used as comparison for the trigger check.

Return Value logical

Result indicating if the time control has triggered.


Calls

proc~~tem_timecontrol_triggered~~CallsGraph proc~tem_timecontrol_triggered tem_timeControl_triggered proc~tem_time_ge_trigger tem_time_ge_trigger proc~tem_timecontrol_triggered->proc~tem_time_ge_trigger proc~tem_time_gt_trigger tem_time_gt_trigger proc~tem_timecontrol_triggered->proc~tem_time_gt_trigger proc~tem_time_never tem_time_never proc~tem_timecontrol_triggered->proc~tem_time_never

Called by

proc~~tem_timecontrol_triggered~~CalledByGraph proc~tem_timecontrol_triggered tem_timeControl_triggered proc~tem_simcontrol_syncupdate tem_simControl_syncUpdate proc~tem_simcontrol_syncupdate->proc~tem_timecontrol_triggered proc~tem_timecontrol_update tem_timeControl_update proc~tem_simcontrol_syncupdate->proc~tem_timecontrol_update proc~tem_timecontrol_globaltriggered tem_timeControl_globalTriggered proc~tem_timecontrol_globaltriggered->proc~tem_timecontrol_triggered proc~tem_timecontrol_update->proc~tem_timecontrol_triggered proc~tem_timecontrol_check tem_timeControl_check proc~tem_timecontrol_check->proc~tem_timecontrol_globaltriggered proc~tem_timecontrol_check->proc~tem_timecontrol_update proc~tem_convergence_check tem_convergence_check proc~tem_convergence_check->proc~tem_timecontrol_check proc~tem_tracking_has_triggered tem_tracking_has_triggered proc~tem_tracking_has_triggered->proc~tem_timecontrol_check proc~tem_tracker tem_tracker proc~tem_tracker->proc~tem_tracking_has_triggered

Source Code

  function tem_timeControl_triggered(me, now) result(hasTriggered)
    ! -------------------------------------------------------------------- !
    !> Time control to check if it was triggered.
    type(tem_timeControl_type), intent(inout) :: me

    !> Current time that is to be used as comparison for the trigger check.
    type(tem_time_type), intent(in) :: now

    !> Result indicating if the time control has triggered.
    logical :: hasTriggered
    ! -------------------------------------------------------------------- !
    ! -------------------------------------------------------------------- !

    hasTriggered = .false.

    ! Time control intervals *only* are checked every check_iter iteration,
    ! in between the intervals, the triggered status remains false.
    if (mod(now%iter, me%check_iter) == 0) then

      ! As long as the min was not reached yet, we need to do some extra checks,
      ! to ensure that the trigger can be set correctly when min is reached for
      ! first time.
      if (.not. me%min_reached) then

        me%min_reached = tem_time_ge_trigger(now, me%min)

        ! 'Now' has reached min, set the trigger accordingly for all those
        ! entries that are relevant in the interval configuration.
        if (me%min_reached) then
          me%trigger = tem_time_never()
          if (me%interval%sim   < huge(me%interval%sim)) then
            me%trigger%sim = now%sim
          end if
          if (me%interval%iter  < huge(me%interval%iter)) then
            me%trigger%iter = now%iter
          end if
          if (me%interval%clock < huge(me%interval%clock)) then
            me%trigger%clock = now%clock
          end if
        end if

      end if

      if (me%min_reached .and. (.not. tem_time_gt_trigger(now, me%max)) ) then
        hasTriggered = tem_time_ge_trigger(now, me%trigger)
      end if

    end if

  end function tem_timeControl_triggered