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(euler_1D) :: rk_stage(1:rk_stages) !< Runge-Kutta stages.
type(euler_1D) :: filter !< Filter displacement.
type(integrator_leapfrog) :: lf_integrator !< Leapfrog integrator.
type(euler_1D) :: previous(1:2) !< Previous time steps solutions.
integer :: step !< Time steps counter.
real(R_P) :: dt !< Time step.
real(R_P) :: t !< Time.
character(len=:), allocatable :: title !< Output files title.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
print "(A)", 'Integrating 1D Euler equations by means of leapfrog (RAW filtered) class of solvers'
title = '1D Euler equations integration, explicit leapfrog (RAW filtered), t='//str(n=t_final)
call lf_integrator%init(nu=1.0_R_P, alpha=0._R_P)
call rk_integrator%init(stages=rk_stages)
call domain%init(Ni=Ni, Ns=Ns, Dx=Dx, BC_L=BC_L, BC_R=BC_R, initial_state=initial_state, cp0=cp0, cv0=cv0, steps=2, ord=3)
t = 0._R_P
call save_time_serie(title=title, filename=output//'-time_serie.dat', t=t)
step = 1
do while(t<t_final)
if (verbose) print "(A)", ' Time step: '//str(n=dt)//', Time: '//str(n=t)
dt = domain%dt(Nmax=0, Tmax=t_final, t=t, CFL=0.1_R_P*CFL)
if (2>=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)
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
call save_time_serie(t=t)
enddo
call save_time_serie(t=t, finish=.true.)
call save_results(title=title, basename=output)
print "(A)", 'Finish!'
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine test_leapfrog