45 integer,
intent(in) :: method
61 integer,
intent(out) :: n_FY, n_Y, n_V
62 integer,
intent(in) :: method
67 n_y = 5; n_fy = 2; n_v = 1
70 n_y = 9; n_fy = 4; n_v = 1
73 call quit(
"ode_SL_NL_DC_mod: memSize_ode_SL_NL_DC: uncorrect method")
84 integer ,
intent(in) :: method
86 integer :: n_Y, n_FY, n_V
88 if (pb%Na/=0)
call quit(
"ode_SL_NL_DC_mod: create_ode_SL_NL_DC:& 98 subroutine init_nl_dc(sol, pb, meth, t0, dt, KInv)
101 integer ,
intent(in) :: meth
102 real(RP) ,
intent(in) :: t0, dt
103 procedure(linsystem_solver) :: Kinv
113 call quit(
"ode_NL_DC_mod: init_NL_DC: wrong method")
120 subroutine init_dc_2(sol, pb, t0, dt, KInv)
123 real(RP) ,
intent(in) :: t0, dt
124 procedure(linsystem_solver) :: Kinv
126 real(RP),
dimension(0) :: a
133 associate( y=>sol%Y,
f=>sol%BY, x=>pb%X, &
134 & v=>sol%V, aux=>sol%aux, rhs=>sol%rhs)
144 call pb%AB(a,
f(:,1,ii), x(:,ii), t0, y(:,1,ii), n, 0 )
151 y(:,3,:) = y(:,1,:) + dt*
f(:,1,:)
156 call kinv(v(:,1), ierr, rhs)
169 subroutine init_dc_3(sol, pb, t0, dt, KInv)
170 type(ode_solution),
intent(inout) :: sol
171 type(ode_problem) ,
intent(in) :: pb
172 real(RP) ,
intent(in) :: t0, dt
173 procedure(linsystem_solver) :: Kinv
175 real(RP),
dimension(0) :: a
182 associate( y=>sol%Y,
f=>sol%BY, x=>pb%X, &
183 & v=>sol%V, aux=>sol%aux, rhs=>sol%rhs)
194 call pb%AB(a,
f(:,1,ii), x(:,ii), t0, y(:,1,ii), n, 0 )
198 y(:,3,:) = y(:,1,:) + dt*
f(:,1,:)
202 call kinv(v(:,1), ierr, rhs)
207 call pb%AB(a,
f(:,2,ii), x(:,ii), t0+dt, y(:,3,ii), n, 0 )
211 y(:,4,:) = y(:,3,:) + dt*
f(:,2,:)
215 call kinv(v(:,1), ierr, rhs)
222 y(:,6,:) = (y(:,4,:) - 2._rp*y(:,3,:) + y(:,2,:))*(-0.5_rp/dt) &
223 & +
f(:,4,:) -
f(:,1,:)
227 call kinv(v(:,1), ierr, rhs)
241 & meth, out, check_overflow, Kinv, kry)
242 type(ode_solution) ,
intent(inout) :: sol
243 type(ode_problem) ,
intent(in) :: pb
244 real(RP) ,
intent(in) :: t0, T, dt
245 integer ,
intent(in) :: meth
246 procedure(ode_output_proc) :: out
247 logical ,
intent(in) :: check_overflow
248 procedure(linsystem_solver),
optional :: Kinv
249 type(krylov) ,
optional :: kry
251 procedure(linsystem_solver),
pointer :: KInv_1
252 type(krylov) :: kry_1
254 integer :: nS, jj, ii
255 logical :: exit_comp, bool
257 if (choral_verb>1)
write(*,*) &
258 &
"ode_SL_NL_DC_mod: solve" 259 if (choral_verb>2)
write(*,*) &
261 & name_ode_method(meth)
262 if (choral_verb>2)
write(*,*) &
263 &
" K_inv provided =",&
265 if (.NOT.
present(kinv))
then 266 if (choral_verb>2)
write(*,*) &
267 &
" Krylov settings provided = ",&
272 if (.NOT.bool)
call quit(
"ode_SL_NL_DC_mod: solve_ode_SL_NL_DC:& 275 if (pb%Na/=0)
call quit(
"ode_SL_NL_DC_mod: solve_ode_SL_NL_DC:& 276 & Na muste be ezero")
280 cs = s_prefactor(meth, dt)
284 if (
present(kinv))
then 288 if (
present(kry)) kry_1 = kry
293 call ode_solution_init_indexes(sol)
297 call init_nl_dc(sol, pb, meth, t0, dt, kinv_1)
301 ns = int( (t-t0) / dt)
308 tn = t0 + re(jj-1)*dt
312 call out(tn, sol, exit_comp)
314 if (choral_verb>2)
write(*,*) &
315 &
"ode_SL_NL_DC_mod: solve& 316 & time = ", tn,
': EXIT_COMPp' 330 if (sol%ierr/=0)
then 336 if (check_overflow)
then 338 bool = ( minval(sol%V) < -200.0_rp ) .OR. &
339 & ( maxval(sol%V) > 200.0_rp )
355 real(RP),
dimension(:),
intent(inout) :: x
356 logical ,
intent(out) :: bool
357 real(RP),
dimension(:),
intent(in) :: b
367 real(RP),
dimension(:),
intent(out) :: y
368 real(RP),
dimension(:),
intent(in) :: x
371 call pb%S(sol%aux, x)
372 call xpay(y, cs, sol%aux)
382 type(ode_solution),
intent(inout) :: sol
383 real(RP) ,
intent(in) :: dt, t
384 type(ode_problem) ,
intent(in) :: pb
385 procedure(linsystem_solver) :: Kinv
388 real(RP),
dimension(pb%N) :: F1, yy
389 real(RP),
dimension(0) :: a
391 real(RP) :: dt_inv, t1
398 associate( y=>sol%Y,
f=>sol%BY, x=>pb%X, &
399 & v=>sol%V, aux=>sol%aux, rhs=>sol%rhs, &
400 & yi=>sol%Y_i, fi=>sol%F_i)
407 y(:,5,ii) = (y(:,yi(3),ii)-y(:,yi(2),ii)) * dt_inv
410 v(ii,1) = y(n,yi(3),ii)
413 call pb%AB(a,
f(:,fi(2),ii),x(:,ii),t1,y(:,yi(3),ii),n,0)
416 y(:,yi(2),ii) = y(:,yi(3),ii) + dt*
f(:,fi(2),ii)
419 aux(ii) = y(n,yi(2),ii)
427 call kinv(v(:,1), ierr, rhs)
439 y(n,yi(2),ii) = v(ii,1)
445 yy = y(:,yi(3),ii) + dt*y(:,4,ii)
446 call pb%AB(a, f1, x(:,ii), t1, yy, n, 0 )
449 yy = y(:,5,ii) - ( y(:,yi(2),ii) - y(:,yi(3),ii) ) * dt_inv
453 y(:,4,ii) = y(:,4,ii) + yy + f1 -
f(:,fi(1),ii)
464 call kinv(v(:,1), ierr, rhs)
478 y(:,1,ii) = y(:,yi(3),ii) + dt * y(:,4,ii)
502 type(ode_solution),
intent(inout) :: sol
503 real(RP) ,
intent(in) :: dt, t
504 type(ode_problem) ,
intent(in) :: pb
505 procedure(linsystem_solver) :: Kinv
508 real(RP),
dimension(pb%N) :: yy, F2
509 real(RP),
dimension(0) :: a
512 real(RP) :: dt_inv, dt2_inv_6, dt_inv_2
515 dt_inv_2 = 1.0_rp / (dt * 2._rp)
516 dt2_inv_6 = 1.0_rp / (dt**2 * 6._rp)
523 associate( y=>sol%Y,
f=>sol%BY, x=>pb%X, &
524 & v=>sol%V, aux=>sol%aux, rhs=>sol%rhs, &
525 & yi=>sol%Y_i, fi=>sol%F_i)
532 y(:,8,ii) = y(:,yi(4),ii) - 2._rp*y(:,yi(3),ii) &
536 call pb%AB(a,
f(:,fi(1),ii),x(:,ii),t2,y(:,yi(4),ii),n,0)
539 y(:,yi(2),ii) = y(:,yi(4),ii) + dt*
f(:,fi(1),ii)
542 aux(ii) = y(n,yi(2),ii)
545 v(ii,1) = y(n,yi(4),ii)
553 call kinv(v(:,1), ierr, rhs)
564 y(n,yi(2),ii) = v(ii,1)
567 y(:,9,ii) = y(:,yi(5),ii)
570 yy = y(:,yi(4),ii) + dt*y(:,yi(6),ii)
571 call pb%AB(a,
f(:,fi(3),ii),x(:,ii),t2,yy,n,0)
574 yy = y(:,yi(2),ii) - 2._rp*y(:,yi(4),ii) &
578 y(:,8,ii) = ( yy - y(:,8,ii) ) * dt2_inv_6
584 y(:,yi(5),ii) = y(:,yi(6),ii) + yy &
585 & +
f(:,fi(3),ii) -
f(:,fi(2),ii)
588 v(ii,1) = y(n,yi(6),ii)
591 aux(ii) = y(n,yi(5),ii)
599 call kinv(v(:,1), ierr, rhs)
610 y(n,yi(5),ii) = v(ii,1)
616 yy = y(:,yi(3),ii) + dt*y(:,yi(6),ii) + dt**2*y(:,7,ii)
617 call pb%AB(a,f2,x(:,ii),t1,yy,n,0)
620 yy = -y(:,9,ii) + 2._rp*y(:,yi(6),ii) - y(:,yi(5),ii)
624 yy = yy + ( f2 -
f(:,fi(4),ii) ) * dt_inv
625 y(:,7,ii) = y(:,7,ii) + y(:,8,ii) + yy
636 call kinv(v(:,1), ierr, rhs)
650 y(:,1,ii) = y(:,yi(3),ii) + dt * y(:,yi(6),ii) &
651 & + dt**2 * y(:,7,ii)
673 integer,
dimension(2),
intent(inout) :: T
685 integer,
dimension(3),
intent(inout) :: T
integer, parameter ode_dc_3
Deferred corrections 3.
DEFERRED CORRECTION SOLVERS FOR A SEMILINEAR ODE coupled with a non-linear ODE system ...
subroutine init_nl_dc(sol, pb, meth, t0, dt, KInv)
Type ode_solution: data structure to solve ODE/PDE problems.
subroutine k_default(y, x)
DERIVED TYPE ode_problem: definition of ODE/PDE problems
subroutine, public create_ode_sl_nl_dc_sol(sol, pb, method)
Create the solution data structure.
subroutine init_dc_3(sol, pb, t0, dt, KInv)
subroutine, public solve_ode_sl_nl_dc(sol, pb, t0, T, dt, meth, out, check_overflow, Kinv, kry)
solve : multistep with constant time step
logical function, public check_ode_method_sl_nl_dc(method)
is 'method' a DC method for SL_NL problem ?
integer, parameter ode_dc_2
Deferred corrections 2.
REAL NUMBERS PRECISION IN CHORAL: selects simple/double/quad
OPENMP OPERATIONS ON 1-DIMENSIONAL REAL ARRAYS
DERIVED TYPE ode_solution: data straucture to solve ODEs
subroutine kinv_default(x, bool, b)
Default solver for K*x = b.
subroutine memsize_ode_sl_nl_dc(n_Y, n_FY, n_V, method)
required sizes to allocate memory
real(rp) function f(x)
right hand side 'f'
BOTTOM LEVEL MODULE FOR ODEs
x = x + b*y // OR // z = x + b*y
DEFINITION OF GLOBAL VARIABLES FOR THE LIBRARY CHORAL
subroutine init_dc_2(sol, pb, t0, dt, KInv)
Type ode_problem: definition of ODE/PDE problems.
DERIVED TYPE krylov: for the resolution of linear systems
subroutine sl_nl_dc_3(sol, dt, t, pb, KInv)
DC order 3.
subroutine sl_nl_dc_2(sol, dt, t, pb, KInv)
DC order 2.