176 integer :: l_meth = -1
179 integer :: sl_meth = -1
182 integer :: dc_meth = -1
185 integer :: nl_meth = -1
191 logical :: check_overflow = .false.
255 slv%check_overflow = .false.
282 & os_meth, SL_meth, NL_meth, L_meth, &
284 & check_overflow, verb)
result(slv)
287 integer ,
intent(in) :: type
288 integer,
optional,
intent(in) :: os_meth, SL_meth, DC_meth
289 integer,
optional,
intent(in) :: NL_meth, L_meth, verb
290 logical,
optional,
intent(in) :: check_overflow
295 &
"ode_solver_mod : ode_solver_create" 301 slv%kry =
krylov(type=
kry_cg, tol=1
e-6_rp, itmax=100, verb=0)
306 if (.NOT.bool)
call quit(&
307 &
"ode_solver_mod: ode_solver_create: 'pb' not valid")
313 if (.NOT.bool)
call quit(&
314 &
"ode_solver_mod: ode_solver_create:& 315 & wrong argument 'type'")
318 if (
present(nl_meth)) slv%NL_meth = nl_meth
319 if (
present(sl_meth)) slv%SL_meth = sl_meth
320 if (
present(dc_meth)) slv%DC_meth = dc_meth
321 if (
present(l_meth )) slv%L_meth = l_meth
322 if (
present(verb)) slv%verb = verb
325 if (
present(os_meth))
then 326 slv%os =
ode_opsplt(os_meth, slv%L_meth, slv%NL_meth, &
331 if (
present(check_overflow))
then 332 slv%check_overflow = check_overflow
336 &
"ode_solver_mod: ode_solver_create: not valid")
350 if (.NOT.bool)
return 354 if (.NOT.bool)
return 358 if (.NOT.bool)
return 365 select case(slv%type)
372 select case(slv%type)
385 select case(slv%type)
394 select case(slv%type)
414 write(*,*)
"ode_solver_mod : print" 416 write(*,*)
" Associated ODE problem = ",&
419 write(*,*)
" ODE solver type = ",&
422 if (
valid(slv))
then 423 write(*,*)
" Status = valid" 425 write(*,*)
" Status = invalid" 428 select case(slv%type)
433 if (slv%L_meth /= -1 )
then 434 write(*,*)
" one-step linear solver = ",&
437 if (slv%NL_meth /= -1 )
then 438 write(*,*)
" one-step non-linear solver = ",&
443 if (slv%NL_meth /= -1 )
then 444 write(*,*)
" multistep non-linear solver = ",&
447 if (slv%SL_meth /= -1 )
then 448 write(*,*)
" multistep semilinear solver = ",&
453 write(*,*)
" deferred correction ode solver = ",&
457 write(*,*)
" check overfow =", slv%check_overflow
458 write(*,*)
" verbosity =", slv%verb
467 integer,
intent(in) :: type
468 character(len=20) :: name
478 name=
"deferred corrections" 496 integer,
intent(in) :: method, pb_type, slv_type
503 select case(slv_type)
511 select case(slv_type)
522 select case(slv_type)
530 select case(slv_type)
560 &
"ode_solver_mod : ode_solution_create" 563 if (.NOT.bool)
call quit(&
564 &
"ode_solver_mod: ode_solution_create: 'pb' not valid")
567 if (.NOT.bool)
call quit(&
568 &
"ode_solver_mod: ode_solution_create: 'slv' not valid")
575 select case(slv%type)
583 select case(slv%type)
594 select case(slv%type)
605 select case(slv%type)
611 & slv%SL_meth, slv%NL_meth)
629 real(RP) ,
intent(in) :: t0
630 real(RP),
dimension(:),
intent(in) :: y0
632 integer :: jj, ii, N, Na
636 & initialCond = homogeneous" 638 if (
size(y0)/=sol%N)
call quit( &
639 &
"ode_solver_mod: homogeneous_initialCond:& 640 & wrong size for Y0" )
645 associate( y=>sol%Y, by=>sol%BY, ay=>sol%AY, &
661 if (sol%NFY==0)
return 664 call pb%AB(ay(:,1,ii), by(:,1,ii), x(:,ii), &
669 ay(:,jj,:) = ay(:,1,:)
670 by(:,jj,:) = by(:,1,:)
680 by(n,jj,ii) = by(n,jj,ii) &
681 & + ay(n,jj,ii)*y0(n)
718 real(RP) ,
intent(in) :: dt, t0, T
720 procedure(linsystem_solver),
optional :: KInv
728 if (slv%verb>0)
write(*,*) &
729 &
"ode_solver_mod : solve dt =", dt
732 if (.NOT.bool)
call quit(&
733 &
"ode_solver_mod: ode_solver_solve: arg 'pb' not valid")
736 if (.NOT.bool)
call quit(&
737 &
"ode_solver_mod: ode_solver_solve: arg 'slv' not valid")
741 if (
present(output))
then 744 if( .NOT.output%assembled &
745 & .OR. (output%nbDof /= pb%dof) &
746 & .OR. (output%N /= pb%N ) )
then 748 &
"ode_solver_mod: ode_solver_solve: arg 'out' not valid")
766 select case(slv%type)
770 & slv%L_meth, out, kinv, slv%kry)
775 select case(slv%type)
779 & slv%NL_meth, out, &
780 & slv%check_overflow)
785 & slv%NL_meth, out, &
786 & slv%check_overflow)
791 select case(slv%type)
795 & slv%SL_meth, out, &
796 & slv%check_overflow, kinv, slv%kry)
800 & slv%os, pb, slv%kry, out)
805 select case(slv%type)
809 & slv%SL_meth, slv%NL_meth, out, &
810 & slv%check_overflow, kinv, slv%kry)
814 &slv%os, pb, slv%kry, out)
819 & slv%DC_meth, out, &
820 & slv%check_overflow, kinv, slv%kry)
827 write(*,*)
"ode_solver_mod : solve end, CPU =",&
831 if (sol%ierr/=0)
then 832 if (slv%verb>0)
write(*,*) &
834 & solve = ERROR DETECTED, IERR = ", sol%ierr
841 call out(time, sol, bool)
847 real(RP) ,
intent(in) :: tn
849 logical ,
intent(inout) :: stop
DEFERRED CORRECTION SOLVERS FOR A SEMILINEAR ODE coupled with a non-linear ODE system ...
MULTISTEP SOLVERS FOR A SEMILINEAR ODE coupled with a non-linear ODE system
type(ode_solver) function ode_solver_create(pb, type, os_meth, SL_meth, NL_meth, L_meth, DC_meth, check_overflow, verb)
Constructor for the type ode_solver
subroutine homogeneous_initialcond(sol, pb, slv, t0, y0)
homogeneous initial condition
subroutine ode_solver_clear(slv)
destructor for ode_solver
DERIVED TYPE ode_problem: definition of ODE/PDE problems
subroutine, public create_ode_sl_nl_ms_sol(sol, pb, SL_meth, NL_meth)
Create the solution data structure.
subroutine, public solve_ode_opsplt(sol, t0, T, dt, os, pb, kry, out)
solve : operator splitting with constant time step
subroutine, public create_ode_sl_nl_dc_sol(sol, pb, method)
Create the solution data structure.
subroutine, public create_ode_opsplt_sol(sol, pb, os)
The type krylov defines the settings of a linear solver.
subroutine, public solve_ode_sl_nl_dc(sol, pb, t0, T, dt, meth, out, check_overflow, Kinv, kry)
solve : multistep with constant time step
subroutine, public create_ode_sl_ms_sol(sol, pb, method)
create memory for the ode_solution structure 'sol'
integer, parameter, public sp
simple precision for real numbers
integer, parameter ode_pb_tot_nb
Number of ode problem types.
logical function, public check_ode_method_nl_ms(method)
is 'method' a multi-step non-linear ODE solver ?
The type opSplt defines operator spltting methods.
integer, parameter ode_slv_ms
multistep
logical function, public check_ode_method_sl_nl_dc(method)
is 'method' a DC method for SL_NL problem ?
character(len=15) function, public name_ode_method(method)
Get ODE method name.
subroutine, public solve_ode_sl_nl_ms(sol, pb, t0, T, dt, SL_meth, NL_meth, out, check_overflow, Kinv, kry)
solve : multistep with constant time step
REAL NUMBERS PRECISION IN CHORAL: selects simple/double/quad
subroutine, public solve_ode_lin_1s(sol, pb, t0, T, dt, method, out, Kinv, kry)
solve with constant time-step
logical function, public check_ode_method_nl_1s(method)
is 'method' a one-step non-linear ODE solver ?
integer, parameter ode_pb_sl
SemiLinear ODE : with .
ONE-STEP SOLVERS FOR LINEAR ODEs
integer, parameter ode_pb_lin
Linear ODE : .
DERIVED TYPE ode_solution: data straucture to solve ODEs
type(ode_solution) function ode_solution_create(pb, nV, NY, NFY)
Bottom level constructor for ode_solution.
real(rp) function e(x, v1, v2)
logical function, public check_ode_method(method, pb_type, slv_type)
check whether the ode method 'method' is available for the problem type 'pb_type' and for the solver ...
subroutine, public solve_ode_nl_1s(sol, pb, t0, T, dt, method, out, check_overflow)
solve with constant time-step
integer, parameter ode_slv_dc
deferred corrections
subroutine, public output_proc(out, time, s, final)
Pre-defined output for ODE resolution
integer, parameter ode_slv_tot_nb
number of ode solver types
DERIVED TYPE ode_output: handles output for PDE/ODE simulations
logical function, public check_ode_method_sl_ms(method)
is 'method' a multi-step semilinear ODE solver ?
subroutine, public solve_ode_nl_ms(sol, pb, t0, T, dt, method, out, check_overflow)
solve with constant time-step
subroutine ode_solver_solve(sol, slv, pb, t0, T, dt, KInv, output)
Solve an ODE with constant time step
BOTTOM LEVEL MODULE FOR ODEs
TOP LEVEL MODULE FOR ODEs, derived type ode_solver
integer choral_verb
Verbosity level.
subroutine, public create_ode_nl_1s_sol(sol, pb, method)
create memory for the ode_solution structure 'sol'
integer, parameter ode_pb_sl_nl
SemiLinear ODE coupled with a non-linear ODE system for with .
character(len=20) function, public name_ode_solver_type(type)
name the type of ode_solver
integer, parameter ode_slv_os
operator splitting
The type ode_output handles output for ODE simulations.
subroutine local_output(tn, s, stop)
ONE-STEP SOLVERS FOR NON LINEAR ODEs
subroutine, public create_ode_lin_1s_sol(sol, pb, method)
allocate memory for the ode_solution structure 'sol'
subroutine, public set_ode_solver_output(slv, output)
Load a user defined output for ODE resolution
MULTISTEP SOLVERS FOR SEMILINEAR ODEs
DEFINITION OF GLOBAL VARIABLES FOR THE LIBRARY CHORAL
subroutine, public solve_ode_sl_ms(sol, pb, t0, T, dt, method, out, check_overflow, Kinv, kry)
solve with constant time-step Case where pbN = 1
logical function, public check_ode_method_lin_1s(method)
is 'method' a one-step linear ODE solver ?
character(len=15) function, public name_ode_problem(type)
ode_problem name
MULTISTEP SOLVERS FOR NON LINEAR ODEs
DERIVED TYPE ode_opSplt: operator splitting methods for ODEs.
Generic 'solve' for ODEs.
Type ode_problem: definition of ODE/PDE problems.
integer, parameter ode_pb_nl
Non-Linear ODE system: , .
subroutine ode_solver_print(slv)
print ode_solver
DERIVED TYPE krylov: for the resolution of linear systems
subroutine, public void_ode_output(tn, s, stop)
void output for ode resolution
integer, parameter ode_slv_1s
onestep
integer, parameter kry_cg
CG linear solver.
logical function ode_solver_valid(slv)
check ode_solver
subroutine, public create_ode_nl_ms_sol(sol, pb, method)
create memory for the ode_solution structure 'sol'