Test explicit leapfrog 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_leapfrog()
!---------------------------------------------------------------------------------------------------------------------------------
!< Test explicit leapfrog class of ODE solvers.
!---------------------------------------------------------------------------------------------------------------------------------
type(integrator_runge_kutta_tvd) :: rk_integrator !< Runge-Kutta integrator.
integer, parameter :: rk_stages=2 !< Runge-Kutta stages number.
type(burgers) :: rk_stage(1:rk_stages) !< Runge-Kutta stages.
type(burgers) :: filter !< Filter displacement.
type(integrator_leapfrog) :: lf_integrator !< Leapfrog integrator.
type(burgers) :: previous(1:2) !< Previous time steps solutions.
real(R_P) :: dt !< Time step.
real(R_P) :: t !< Time.
integer :: step !< Time steps counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
print "(A)", 'Integrating Burgers equation by means of leapfrog (RAW filtered) class of solvers'
call lf_integrator%init(nu=1.0_R_P, alpha=0._R_P)
call rk_integrator%init(stages=rk_stages)
call domain%init(initial_state=initial_state, Ni=Ni, h=h, nu=nu, steps=2)
dt = domain%dt(CFL=CFL)
t = 0._R_P
step = 1
do while(t<t_final)
if (2>=step) then
! the time steps from 1 to 2 must be computed with other scheme...
call rk_integrator%integrate(U=domain, stage=rk_stage, dt=dt, t=t)
previous(step) = domain
else
call lf_integrator%integrate(U=domain, previous=previous, dt=dt, t=t, filter=filter)
endif
t = t + dt
step = step + 1
enddo
final_state = domain%output()
call save_results(title='FOODIE test: Burgers equation integration, t='//str(n=t_final)//' explicit leapfrog scheme',&
filename='burgers_integration-lf-RAW-filter')
print "(A)", 'Finish!'
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine test_leapfrog