@@ -50,7 +50,7 @@ module foodie_integrator_backward_differentiation_formula
5050 trim (class_name_)// ' _5' , &
5151 trim (class_name_)// ' _6' ] ! < List of supported schemes.
5252
53- logical , parameter :: has_fast_mode_= .false . ! < Flag to check if integrator provides *fast mode* integrate.
53+ logical , parameter :: has_fast_mode_= .true . ! < Flag to check if integrator provides *fast mode* integrate.
5454
5555type, extends(integrator_object) :: integrator_back_df
5656 ! < FOODIE integrator: provide an implicit class of Backward-Differentiation-Formula multi-step schemes, from 1st to 6th order
@@ -73,6 +73,7 @@ module foodie_integrator_backward_differentiation_formula
7373 procedure , pass(self) :: destroy ! < Destroy the integrator.
7474 procedure , pass(self) :: initialize ! < Initialize (create) the integrator.
7575 procedure , pass(self) :: integrate ! < Integrate integrand field.
76+ procedure , pass(self) :: integrate_fast ! < Integrate integrand field, fast mode.
7677 procedure , pass(self) :: update_previous ! < Cyclic update previous time steps.
7778endtype integrator_back_df
7879
@@ -246,6 +247,38 @@ subroutine integrate(self, U, previous, Dt, t, iterations, autoupdate)
246247 if (autoupdate_) call self% update_previous(U= U, previous= previous)
247248 end subroutine integrate
248249
250+ subroutine integrate_fast (self , U , previous , buffer , Dt , t , iterations , autoupdate )
251+ ! < Integrate field with BDF class scheme.
252+ class(integrator_back_df), intent (in ) :: self ! < Integrator.
253+ class(integrand_object), intent (inout ) :: U ! < Field to be integrated.
254+ class(integrand_object), intent (inout ) :: previous(1 :) ! < Previous time steps solutions of integrand field.
255+ class(integrand_object), intent (inout ) :: buffer ! < Temporary buffer for doing fast operation.
256+ real (R_P), intent (in ) :: Dt ! < Time steps.
257+ real (R_P), intent (in ) :: t(:) ! < Times.
258+ integer (I_P), optional , intent (in ) :: iterations ! < Fixed point iterations.
259+ logical , optional , intent (in ) :: autoupdate ! < Perform cyclic autoupdate of previous time steps.
260+ integer (I_P) :: iterations_ ! < Fixed point iterations.
261+ logical :: autoupdate_ ! < Perform cyclic autoupdate of previous time steps, dummy var.
262+ class(integrand_object), allocatable :: delta ! < Delta RHS for fixed point iterations.
263+ integer (I_P) :: s ! < Steps counter.
264+
265+ autoupdate_ = .true. ; if (present (autoupdate)) autoupdate_ = autoupdate
266+ iterations_ = 1 ; if (present (iterations)) iterations_ = iterations
267+ allocate (delta, mold= U)
268+ call delta% multiply_fast(lhs= previous(self% steps), rhs=- self% a(self% steps))
269+ do s= 1 , self% steps - 1
270+ call buffer% multiply_fast(lhs= previous(s), rhs=- self% a(s))
271+ call delta% add_fast(lhs= delta, rhs= buffer)
272+ enddo
273+ do s= 1 , iterations
274+ buffer = U
275+ call buffer% t_fast(t= t(self% steps) + Dt)
276+ call buffer% multiply_fast(lhs= buffer, rhs= Dt * self% b)
277+ call U% add_fast(lhs= delta, rhs= buffer)
278+ enddo
279+ if (autoupdate_) call self% update_previous(U= U, previous= previous)
280+ end subroutine integrate_fast
281+
249282 subroutine update_previous (self , U , previous )
250283 ! < Cyclic update previous time steps.
251284 class(integrator_back_df), intent (in ) :: self ! < Integrator.
0 commit comments