tem_timeControl_update Subroutine

public subroutine tem_timeControl_update(me, now, hasTriggered, localTriggered)

Update the given timeControl if it just triggered.

The timeControl will be updated to trigger after the next complete interval, or at least after now. The update is only done if the timeControl actually triggered since the last update, or the optional argument hasTriggered is true.

Usually, this routine should be called right after checking the status of the time control with tem_timeControl_triggered. However, due to the fact, that the hasTriggered might need to be reduced across all processes in between (if the clock measurement is involved in the trigger), this communication has to be done first, and the hasTriggered argument can be used to pass the result from the allreduce. To avoid unnecessary communication, this allreduce might be used for other flags as well, therefore it is not included in these routines.

If such a separation is not desirable, use tem_timeControl_check, which probe the trigger and update it if needed, including communication if the clock time setting is used in the trigger definition.

Arguments

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

Time control object to update.

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

Current time to use for the update.

logical, intent(in), optional :: hasTriggered

Flag to indicate if the time control already has triggered.

If this argument is not present, the check for the trigger status of the time control will be done internally.

logical, intent(in), optional :: localTriggered

Flag to indicate if the local time control already has triggered.

This will be used in place of the hasTriggered, if delayCheck is true to avoid subsequent multiple checks of the same interval.


Calls

proc~~tem_timecontrol_update~~CallsGraph proc~tem_timecontrol_update tem_timeControl_update proc~tem_timecontrol_triggered tem_timeControl_triggered proc~tem_timecontrol_update->proc~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_update~~CalledByGraph proc~tem_timecontrol_update tem_timeControl_update proc~tem_timecontrol_check tem_timeControl_check proc~tem_timecontrol_check->proc~tem_timecontrol_update proc~tem_simcontrol_syncupdate tem_simControl_syncUpdate proc~tem_simcontrol_syncupdate->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

Contents


Source Code

  subroutine tem_timeControl_update(me, now, hasTriggered, localTriggered)
    ! -------------------------------------------------------------------- !
    !> Time control object to update.
    type(tem_timeControl_type), intent(inout) :: me

    !> Current time to use for the update.
    type(tem_time_type), intent(in) :: now

    !> Flag to indicate if the time control already has triggered.
    !!
    !! If this argument is not present, the check for the trigger status of
    !! the time control will be done internally.
    logical, intent(in), optional :: hasTriggered

    !> Flag to indicate if the local time control already has triggered.
    !!
    !! This will be used in place of the hasTriggered, if delayCheck is
    !! true to avoid subsequent multiple checks of the same interval.
    logical, intent(in), optional :: localTriggered
    ! -------------------------------------------------------------------- !
    logical :: triggered
    ! -------------------------------------------------------------------- !

    if (present(hasTriggered)) then
      triggered = hasTriggered
      if (present(localTriggered) .and. me%delay_check) then
        triggered = localTriggered
      end if
    else
      triggered = tem_timeControl_triggered(me, now)
    end if

    if (triggered) then
      me%trigger = max(me%trigger + me%interval, now)
    end if

  end subroutine tem_timeControl_update