Test explicit Adams-Bashforth class of ODE solvers.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine test_ab()
!---------------------------------------------------------------------------------------------------------------------------------
!< Test explicit Adams-Bashforth class of ODE solvers.
!---------------------------------------------------------------------------------------------------------------------------------
type(integrator_runge_kutta_tvd) :: rk_integrator !< Runge-Kutta integrator.
integer, parameter :: rk_stages=5 !< Runge-Kutta stages number.
type(burgers) :: rk_stage(1:rk_stages) !< Runge-Kutta stages.
type(integrator_adams_bashforth) :: ab_integrator !< Adams-Bashforth integrator.
integer, parameter :: ab_steps=4 !< Adams-Bashforth steps number.
type(burgers) :: previous(1:ab_steps) !< Previous time steps solutions.
integer :: step !< Time steps counter.
real(R_P) :: dt !< Time step.
real(R_P) :: t(1:ab_steps) !< Times.
integer(I_P) :: s !< AB steps counter.
integer(I_P) :: ss !< AB substeps counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
print "(A)", 'Integrating Burgers equation by means of Adams-Bashforth class of solvers'
do s=1, ab_steps
print "(A)", ' AB-'//trim(str(.true.,s))
call ab_integrator%init(steps=s)
select case(s)
case(1, 2, 3)
call rk_integrator%init(stages=s)
case(4)
call rk_integrator%init(stages=5)
endselect
call domain%init(initial_state=initial_state, Ni=Ni, h=h, nu=nu, steps=s)
dt = domain%dt(CFL=CFL)
t = 0._R_P
step = 1
do while(t(s)<t_final)
if (s>=step) then
! the time steps from 1 to s - 1 must be computed with other scheme...
call rk_integrator%integrate(U=domain, stage=rk_stage, dt=dt, t=t(s))
previous(step) = domain
if (step>1) then
t(step) = t(step-1) + dt
else
t(step) = dt
endif
else
call ab_integrator%integrate(U=domain, previous=previous(1:s), Dt=Dt, t=t)
do ss=1, s-1
t(ss) = t(ss + 1)
enddo
t(s) = t(s) + dt
endif
step = step + 1
enddo
final_state = domain%output()
call save_results(title='FOODIE test: Burgers equation integration, t='//str(n=t_final)//' explicit '//&
'Adams-Bashforth '//trim(str(.true., s))//' steps', &
filename='burgers_integration-ab-'//trim(str(.true., s)))
enddo
print "(A)", 'Finish!'
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine test_ab