Integrate field with Adams-Moulton class scheme, fast mode.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_adams_moulton), | 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 Adams-Moulton class scheme, fast mode.
class(integrator_adams_moulton), 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.
class(integrand_object), allocatable :: delta !< Delta RHS for fixed point iterations.
integer(I_P) :: s !< Steps counter.
if (self%steps>0) then
if (self%iterations > 0) then ! perform fixed point iterations
allocate(delta, mold=U)
delta = self%previous(self%steps)
do s=0, self%steps - 1
self%buffer = self%previous(s+1)
call self%buffer%t_fast(t=self%t(s+1))
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%b(s))
call delta%add_fast(lhs=delta, rhs=self%buffer)
enddo
do s=1, self%iterations
self%buffer = U
call self%buffer%t_fast(t=self%t(self%steps) + Dt)
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%b(self%steps))
call U%add_fast(lhs=delta, rhs=self%buffer)
enddo
else
self%buffer = U
call self%buffer%t_fast(t=self%t(self%steps) + Dt)
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%b(self%steps))
call U%add_fast(lhs=self%previous(self%steps), rhs=self%buffer)
do s=0, self%steps - 1
self%buffer = self%previous(s+1)
call self%buffer%t_fast(t=self%t(s+1))
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%b(s))
call U%add_fast(lhs=U, rhs=self%buffer)
enddo
endif
if (self%autoupdate) call self%update_previous(U=U, previous=self%previous, Dt=Dt, t=t, previous_t=self%t)
else
self%buffer = U
call self%buffer%t_fast(t=t)
call self%buffer%multiply_fast(lhs=self%buffer, rhs=Dt * self%b(0))
call U%add_fast(lhs=U, rhs=self%buffer)
endif
endsubroutine integrate_fast