38 integer,
intent(in) :: method
58 integer,
intent(out) :: n_V
59 integer,
intent(in) :: method
70 call quit(
"ode_Lin_1s_mod: memSize_ode_Lin_1s;& 80 procedure(ode_lin_solver),
pointer :: slv
81 integer ,
intent(in) :: method
92 call quit(
"ode_Lin_1s_mod: set_solver_ode_Lin_1s;& 104 integer ,
intent(in) :: method
110 if (.NOT.bool)
call quit(&
111 &
"ode_Lin_1s_mod: create_ode_Lin_1s_sol: uncorrect method")
125 real(RP) ,
intent(in) :: t0, T, dt
126 integer ,
intent(in) :: method
128 procedure(linsystem_solver),
optional :: Kinv
129 type(
krylov) ,
optional :: kry
131 procedure(ode_lin_solver) ,
pointer :: slv=>null()
132 procedure(linsystem_solver),
pointer :: KInv_1
134 logical :: ierr, exit_comp
140 &
"ode_Lin_1s_mod : solve_ode_Lin_1s" 142 &
" Linear onestep solver = ",&
145 &
" K_inv provided =",&
147 if (.NOT.
present(kinv))
then 149 &
" Krylov settings provided = ",&
159 if (
present(kinv))
then 163 if (
present(kry)) kry_1 = kry
172 ns = int( (t-t0) / dt)
176 tn = t0 +
re(jj-1)*dt
179 call out(tn, sol, exit_comp)
182 &
"ode_NL_ms_mod : solve& 183 & time = ", tn,
': EXIT_COMPp' 187 call slv(sol, ierr, dt, pb, kinv_1)
200 real(RP),
dimension(:),
intent(inout) :: x
201 logical ,
intent(out) :: bool
202 real(RP),
dimension(:),
intent(in) :: b
212 real(RP),
dimension(:),
intent(out) :: y
213 real(RP),
dimension(:),
intent(in) :: x
216 call pb%S(sol%aux, x)
217 call xpay(y, cs, sol%aux)
226 subroutine lin_1s_be(sol, ierr, dt, pb, KInv)
228 logical ,
intent(out) :: ierr
229 real(RP) ,
intent(in) :: dt
231 procedure(linsystem_solver) :: KInv
233 call pb%M(sol%rhs, sol%V(:,1))
234 call kinv(sol%V(:,1), ierr, sol%rhs)
241 subroutine lin_1s_cn(sol, ierr, dt, pb, KInv)
243 logical ,
intent(out) :: ierr
244 real(RP) ,
intent(in) :: dt
246 procedure(linsystem_solver) :: KInv
248 call pb%M(sol%rhs, sol%V(:,1))
249 call pb%S(sol%aux, sol%V(:,1))
250 call xpay(sol%rhs, -dt/2._rp, sol%aux)
252 call kinv(sol%V(:,1), ierr, sol%rhs)
261 logical ,
intent(out) :: ierr
262 real(RP) ,
intent(in) :: dt
264 procedure(linsystem_solver) :: KInv
268 gamma = 1._rp/sqrt(3._rp) * cos(
pi/18._rp)
269 gamma = gamma + 0.5_rp
272 call scale(sol%aux, -1._rp, sol%V(:,1))
273 call pb%S(sol%rhs, sol%aux)
274 call kinv(sol%V(:,2), ierr, sol%rhs)
278 a = dt * (0.5_rp - gamma)
279 call axpby(sol%aux, -1._rp, sol%V(:,1), -a, sol%V(:,2))
280 call pb%S(sol%rhs, sol%aux)
281 call kinv(sol%V(:,3), ierr, sol%rhs)
285 a = dt * 2._rp * gamma
286 call axpby(sol%aux, -1._rp, sol%V(:,1), -a, sol%V(:,2))
287 a = dt * (1._rp - 4._rp*gamma)
288 call xpay(sol%aux, -a, sol%V(:,3))
289 call pb%S(sol%rhs, sol%aux)
290 call kinv(sol%V(:,4), ierr, sol%rhs)
293 a = 6._rp * ( 2._rp*gamma - 1._rp )**2
295 call xpay(sol%V(:,1), a, sol%V(:,2) )
296 call xpay(sol%V(:,1), a, sol%V(:,4) )
299 call xpay(sol%V(:,1), a, sol%V(:,3) )
integer, parameter ode_be
Backward Euler.
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 lin_1s_sdirk4(sol, ierr, dt, pb, KInv)
SDIRK4 HAIRER II p. 100.
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.
integer, parameter ode_cn
Crank Nicholson.
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
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
OPENMP OPERATIONS ON 1-DIMENSIONAL REAL ARRAYS
ONE-STEP SOLVERS FOR LINEAR ODEs
DERIVED TYPE ode_solution: data straucture to solve ODEs
subroutine kinv_default(x, bool, b)
Default solver for K*x = b.
subroutine, public set_solver_ode_lin_1s(slv, method)
Setting the solver for diffusion.
real(rp), parameter, public pi
REAL CONSTANT Pi.
subroutine lin_1s_cn(sol, ierr, dt, pb, KInv)
Crank - Nicolson.
subroutine lin_1s_be(sol, ierr, dt, pb, KInv)
BacWard Euler.
BOTTOM LEVEL MODULE FOR ODEs
integer choral_verb
Verbosity level.
x = x + b*y // OR // z = x + b*y
subroutine, public create_ode_lin_1s_sol(sol, pb, method)
allocate memory for the ode_solution structure 'sol'
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 ?
Type ode_problem: definition of ODE/PDE problems.
DERIVED TYPE krylov: for the resolution of linear systems
integer, parameter ode_sdirk4
SDIRK4.