Cyclic update previous time steps.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrand_object), | intent(in) | :: | U | Field to be integrated. |
||
class(integrand_object), | intent(inout) | :: | previous(1:) | Previous time steps solutions of integrand. |
||
real(kind=R_P), | intent(in), | optional | :: | Dt | Time step. |
|
real(kind=R_P), | intent(in), | optional | :: | t | Time. |
|
real(kind=R_P), | intent(inout), | optional | :: | previous_Dt(1:) | Time step. |
|
real(kind=R_P), | intent(inout), | optional | :: | previous_t(1:) | Time. |
subroutine update_previous(U, previous, Dt, t, previous_Dt, previous_t)
!< Cyclic update previous time steps.
class(integrand_object), intent(in) :: U !< Field to be integrated.
class(integrand_object), intent(inout) :: previous(1:) !< Previous time steps solutions of integrand.
real(R_P), intent(in), optional :: Dt !< Time step.
real(R_P), intent(in), optional :: t !< Time.
real(R_P), intent(inout), optional :: previous_Dt(1:) !< Time step.
real(R_P), intent(inout), optional :: previous_t(1:) !< Time.
integer(I_P) :: last_step !< Last step.
integer(I_P) :: s !< Steps counter.
last_step = size(previous, dim=1)
do s=1, last_step - 1
previous(s) = previous(s + 1)
if (present(previous_Dt)) previous_Dt(s) = previous_Dt(s + 1)
if (present(previous_t)) previous_t(s) = previous_t(s + 1)
enddo
previous(last_step) = U
if (present(previous_Dt)) previous_Dt(last_step) = Dt
if (present(previous_t)) previous_t(last_step) = t + Dt
endsubroutine update_previous