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=5 !< Runge-Kutta stages number.
type(lorenz) :: rk_stage(1:rk_stages) !< Runge-Kutta stages.
type(lorenz) :: filter !< Filter displacement.
type(integrator_leapfrog) :: lf_integrator !< Leapfrog integrator.
type(lorenz) :: previous(1:2) !< Previous time steps solutions.
integer :: step !< Time steps counter.
!---------------------------------------------------------------------------------------------------------------------------------
!---------------------------------------------------------------------------------------------------------------------------------
print "(A)", 'Integrating Lorenz equations 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 attractor%init(initial_state=initial_state, sigma=sigma, rho=rho, beta=beta, steps=2)
solution(0, 0) = 0._R_P
solution(1:space_dimension, 0) = attractor%output()
do step = 1, num_steps
if (2>=step) then
! the time steps from 1 to 2 must be computed with other scheme...
call rk_integrator%integrate(U=attractor, stage=rk_stage, dt=dt, t=solution(0, step))
previous(step) = attractor
else
call lf_integrator%integrate(U=attractor, previous=previous, dt=dt, t=solution(0, step), filter=filter)
endif
solution(0, step) = step * dt
solution(1:space_dimension, step) = attractor%output()
enddo
call save_results(title='FOODIE test: Lorenz equation integration, explicit leapfrog scheme',&
filename='lorenz_integration-lf-RAW-filter')
print "(A)", 'Finish!'
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine test_leapfrog