Integrate field with LMM-SSP class scheme, fast mode.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_ms_runge_kutta_ssp), | intent(inout) | :: | self | Integrator. |
||
class(integrand_object), | intent(inout) | :: | U | Field to be integrated. |
||
real(kind=R_P), | intent(in) | :: | Dt | Time step. |
||
real(kind=R_P), | intent(in) | :: | t | Time. |
subroutine integrate_fast(self, U, Dt, t)
!< Integrate field with LMM-SSP class scheme, fast mode.
class(integrator_ms_runge_kutta_ssp), intent(inout) :: self !< Integrator.
class(integrand_object), intent(inout) :: U !< Field to be integrated.
real(R_P), intent(in) :: Dt !< Time step.
real(R_P), intent(in) :: t !< Time.
integer(I_P) :: k, kk !< Stages counters.
integer(I_P) :: s !< Steps counter.
! computing stages
self%stage(1) = U
do k=2, self%stages
call self%stage(k)%multiply_fast(lhs=U, rhs=0._R_P)
do s=1, self%steps
if (self%D(k, s) /= 0._R_P) then
call self%buffer%multiply_fast(lhs=self%previous(s), rhs=self%D(k, s))
call self%stage(k)%add_fast(lhs=self%stage(k), rhs=self%buffer)
endif
enddo
do s=1, self%steps - 1
if (self%Ahat(k, s) /= 0._R_P) then
self%buffer = self%previous(s)
call self%buffer%t_fast(t=self%t(s))
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%Ahat(k, s))
call self%stage(k)%add_fast(lhs=self%stage(k), rhs=self%buffer)
endif
enddo
do kk=1, k - 1
if (self%A(k, kk) /= 0._R_P) then
self%buffer = self%stage(kk)
call self%buffer%t_fast(t=t)
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%A(k, kk))
call self%stage(k)%add_fast(lhs=self%stage(k), rhs=self%buffer)
endif
enddo
enddo
! computing new time step
U = U * 0._R_P
do s=1, self%steps
if (self%Q(s) /= 0._R_P) then
call self%buffer%multiply_fast(lhs=self%previous(s), rhs=self%Q(s))
call U%add_fast(lhs=U, rhs=self%buffer)
endif
enddo
do s=1, self%steps - 1
if (self%Bhat(s) /= 0._R_P) then
self%buffer = self%previous(s)
call self%buffer%t_fast(t=self%t(s))
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%Bhat(s))
call U%add_fast(lhs=U, rhs=self%buffer)
endif
enddo
do k=1, self%stages
if (self%B(k) /= 0._R_P) U = U + (self%stage(k)%t(t=t) * (Dt * self%B(k)))
if (self%B(k) /= 0._R_P) then
self%buffer = self%stage(k)
call self%buffer%t_fast(t=t)
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%B(k))
call U%add_fast(lhs=U, rhs=self%buffer)
endif
enddo
if (self%autoupdate) call self%update_previous(U=U, previous=self%previous, Dt=Dt, t=t, previous_t=self%t)
endsubroutine integrate_fast