Test explicit forward Euler ODE solver.
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_euler()
!---------------------------------------------------------------------------------------------------------------------------------
!< Test explicit forward Euler ODE solver.
!---------------------------------------------------------------------------------------------------------------------------------
type(integrator_euler_explicit) :: euler_integrator !< Euler integrator.
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 explicit Euler solver'
title = '1D Euler equations integration, explicit Euler, t='//str(n=t_final)
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)
t = 0._R_P
call save_time_serie(title=title, filename=output//'-time_serie.dat', t=t)
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=CFL)
call euler_integrator%integrate(U=domain, dt=dt, t=t)
t = t + dt
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_euler