80 integer :: method = -1
86 integer :: l_meth = -1
89 integer :: nl_meth = -1
92 real(RP),
dimension(:),
allocatable :: a_nl
95 real(RP),
dimension(:),
allocatable :: a_l
99 logical ,
dimension(:),
allocatable :: nl_first
102 procedure(ode_lin_solver ),
nopass,
pointer :: slv_l =>null()
105 procedure(ode_nl_1s_solver),
nopass,
pointer :: slv_nl=>null()
108 logical :: check_overflow = .false.
155 os%check_overflow = .false.
182 & check_overflow)
result(os)
184 integer ,
intent(in) :: method, L_meth, NL_meth
185 logical,
optional,
intent(in) :: check_overflow
190 &
"ode_opSplt_mod : ode_opSplt_create" 198 if (.NOT.bool)
call quit(
"ode_opSplt_mod: ode_opSplt_set")
205 if (
present(check_overflow))
then 206 os%check_overflow = check_overflow
210 &
"ode_opSplt_mod: ode_opSplt_create: not valid")
224 select case(os%method)
234 call quit(
'rdEq_mod: def_splitting: 1' )
244 select case(os%method)
250 os%a_NL=(/.5_rp, .5_rp/)
251 os%a_L=(/.5_rp, .5_rp/)
252 os%NL_first(2) = .false.
255 os%a_L=(/
re(2,3) ,-
re(2,3), 1._rp/)
256 os%a_NL=(/
re(7,24),
re(3,4),-
re(1,24)/)
260 os%a_L(1)= 0.91966152301739985_rp
261 os%a_L(2)=-0.18799161879915978_rp
262 os%a_L(3)= 0.26833009578175992_rp
271 theta = 1._rp/(2._rp - 2._rp ** ( 1._rp / 3._rp ) )
273 os%a_NL=(/ theta/ 2._rp, (1._rp-theta)/2._rp, &
274 & (1._rp-theta)/2._rp, theta/2._rp /)
276 os%a_L=(/ theta, 1._rp-2._rp*theta, theta, 0._rp/)
302 write(*,*)
"ode_opSplt_mod : print" 304 write(*,*)
" operator spltiting Method = ",&
307 write(*,*)
" one step Non-linear ODE solver = ",&
310 write(*,*)
" one step linear ODE solver = ",&
313 write(*,*)
" check overfow =", os%check_overflow
321 integer,
intent(in) :: method
322 character(len=15) :: name
351 integer,
intent(in) :: method
381 integer :: n_V, n_Y, n_FY
385 if (.NOT.bool)
call quit(&
386 &
"ode_opSplt_mod: create_ode_opSplt_sol: 1")
400 real(RP) ,
intent(in) :: dt, t0, T
403 type(
krylov) ,
intent(inout) :: kry
406 real(RP) :: CS, tn, ts, h
407 integer :: ii, jj, nStep
408 logical :: exit_comp, ierr
411 &
"ode_opSplt_mod : solve" 413 &
" Operator splitting method = ",&
416 &
" NonLin onestep solver = ",&
419 &
" Linear onestep solver = ",&
423 nstep = int( (t-t0) / dt)
428 time_loop:
do ii=1, nstep
429 tn = t0 +
re(ii-1)*dt
432 call out(tn, sol, exit_comp)
435 &
write(*,*)
"ode_opSplt_mod :& 436 & solve = ", tn,
': EXIT_COMPp' 443 stage_loop:
do jj=1, os%ns
445 if (os%NL_first(jj))
then 450 call os%slv_NL(sol, h, ts, pb)
451 call copy(sol%V(:,1), sol%Y(sol%N, 1, :))
452 if (os%check_overflow)
then 463 call os%slv_L(sol, ierr, h, pb,
kinv)
464 call copy(sol%Y(sol%N,1,:), sol%V(:,1))
476 call os%slv_L(sol, ierr, h, pb,
kinv)
477 call copy(sol%Y(sol%N,1,:), sol%V(:,1))
486 call os%slv_NL(sol, h, ts, pb)
487 call copy(sol%V(:,1), sol%Y(sol%N,1,:))
489 if (os%check_overflow)
then 499 ts = ts + os%a_NL(jj)*dt
507 select case(sol%ierr)
509 write(*,*)
"ode_opSplt_mod : solve,& 510 & time =",
real(tn, SP),
", stage =", int(jj,1), &
514 write(*,*)
"ode_opSplt_mod : solve,& 515 & time =",
real(tn, SP),
", stage =", int(jj,1), &
516 &
': linear pb inversion error' 519 write(*,*)
"ode_opSplt_mod : solve,& 520 & time =",
real(tn, SP),
", stage =", int(jj,1), &
531 subroutine kinv(x, bool, b)
532 real(RP),
dimension(:),
intent(inout) :: x
533 logical ,
intent(out) :: bool
534 real(RP),
dimension(:),
intent(in) :: b
544 real(RP),
dimension(:),
intent(out) :: y
545 real(RP),
dimension(:),
intent(in) :: x
548 call pb%S(sol%aux, x)
549 call xpay(y, cs, sol%aux)
integer, parameter ode_os_yoshida
check 'ode_opSplt' parameters
type(ode_opsplt) function ode_opsplt_create(method, L_meth, NL_meth, check_overflow)
Constructor for the type ode_opSplt
Type ode_solution: data structure to solve ODE/PDE problems.
deallocate memory for real(RP) arrays
integer, parameter ode_os_ruth
character(len=15) function, public name_ode_method_opsplt(method)
Get operator splitting method name.
DERIVED TYPE ode_problem: definition of ODE/PDE problems
subroutine, public solve_ode_opsplt(sol, t0, T, dt, os, pb, kry, out)
solve : operator splitting with constant time step
subroutine, public create_ode_opsplt_sol(sol, pb, os)
real(rp) function, public s_prefactor(method, dt)
When discretising with two matrices, this function returns the prefactor Cs for the matrix S...
The type krylov defines the settings of a linear solver.
subroutine, public set_solver_ode_nl_1s(slv, method)
set the solver 'slv' to a predefined solver being given a method
integer, parameter ode_os_strang
subroutine ode_opsplt_clear(os)
destructor for 'ode_opSplt'
The type opSplt defines operator spltting methods.
logical function, public overflow(yy)
Detects overflow.
character(len=15) function, public name_ode_method(method)
Get ODE method name.
conversion integers or rational to real
subroutine, public memsize_ode_lin_1s(n_V, method)
required sizes to allocate memory
subroutine kinv(x, bool, b)
Solver for K*x = b.
REAL NUMBERS PRECISION IN CHORAL: selects simple/double/quad
OPENMP OPERATIONS ON 1-DIMENSIONAL REAL ARRAYS
logical function, public check_ode_method_nl_1s(method)
is 'method' a one-step non-linear ODE solver ?
subroutine ode_opsplt_print(os)
ONE-STEP SOLVERS FOR LINEAR ODEs
integer function, public order_ode_method_opsplt(method)
Get operator splitting method name.
logical function ode_opsplt_valid(os)
DERIVED TYPE ode_solution: data straucture to solve ODEs
subroutine, public set_solver_ode_lin_1s(slv, method)
Setting the solver for diffusion.
print 'ode_opSplt' parameters
allocate memory for real(RP) arrays
BOTTOM LEVEL MODULE FOR ODEs
subroutine, public memsize_ode_nl_1s(n_Y, n_FY, method)
required sizes to allocate memory
integer choral_verb
Verbosity level.
x = x + b*y // OR // z = x + b*y
ONE-STEP SOLVERS FOR NON LINEAR ODEs
DEFINITION OF GLOBAL VARIABLES FOR THE LIBRARY CHORAL
logical function, public check_ode_method_lin_1s(method)
is 'method' a one-step linear ODE solver ?
integer, parameter ode_os_aks3
DERIVED TYPE ode_opSplt: operator splitting methods for ODEs.
Type ode_problem: definition of ODE/PDE problems.
DERIVED TYPE krylov: for the resolution of linear systems
integer, parameter ode_os_lie
subroutine def_splitting(os)
Define splitting methods.
integer, parameter ode_os_tot_nb
Number of operator splitting methods.