tem_time_advance Subroutine

public subroutine tem_time_advance(me, sim_dt, iter)

Advance the time definition.

Advance the time object by the given simulation time difference. Optionally, iterations might be advanced by more than one. If iter is not provided, iterations will be advanced by one. The running time is always automatically updated using MPI_Wtime. \note This is only valid, if me has been properly set by tem_time_reset!

Arguments

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

Time definition to advance

real(kind=rk) :: sim_dt

Increment in simulation time to add

integer, optional :: iter

If the number of iterations should not be increased by one, this optional parameter can be used to define the increment for the iterations. Default: 1.


Source Code

  subroutine tem_time_advance(me, sim_dt, iter)
    ! -------------------------------------------------------------------- !
    !> Time definition to advance
    type(tem_time_type), intent(inout) :: me

    !> Increment in simulation time to add
    real(kind=rk) :: sim_dt

    !> If the number of iterations should not be increased by one,
    !! this optional parameter can be used to define the increment for the
    !! iterations. Default: 1.
    integer, optional :: iter
    ! -------------------------------------------------------------------- !
    integer :: iter_inc
    ! -------------------------------------------------------------------- !

    iter_inc = 1
    if (present(iter)) iter_inc = iter

    me%sim   = me%sim + sim_dt
    me%iter  = me%iter + iter_inc
    me%clock = MPI_Wtime() - me%clock_start

  end subroutine tem_time_advance