@@ -18,12 +18,15 @@ const SOLVER = DE.Tsit5()
18
18
const T = 4 # integration time
19
19
const T_compile = 1e-10 # force JIT compilation
20
20
const T_conv = 100 # converging integration time
21
- # const T_learn = 15 # time to gather training data for GP
22
- # const T_hist = 10000 # time to gather histogram statistics
21
+ # const T_learn = 15 # time to gather training data for GP
22
+ # const T_hist = 10000 # time to gather histogram statistics
23
23
24
- # const dt = 0.010 # maximum step size
25
- # const tau = 1e-3 # maximum step size for histogram statistics
26
- # const dt_conv = 0.01 # maximum step size for converging to attractor
24
+ # integrator parameters
25
+ const dtmax = 1e-3 # maximum step size
26
+ # const tau = 1e-3 # maximum step size for histogram statistics
27
+ # const dt_conv = 0.01 # maximum step size for converging to attractor
28
+ const reltol = 1e-3 # relative tolerance
29
+ const abstol = 1e-6 # absolute tolerance
27
30
28
31
const k = 1 # index of the slow variable to save etc.
29
32
const j = 1 # index of the fast variable to save/plot etc.
51
54
print (rpad (" (JIT compilation)" , RPAD))
52
55
elapsed_jit = @elapsed begin
53
56
pb_jit = DE. ODEProblem (full, z00, (0.0 , T_compile), l96)
54
- sol_jit = DE. solve (pb_jit, SOLVER, reltol = 1e-3 , abstol = 1e-6 )
57
+ DE. solve (pb_jit, SOLVER, reltol = reltol , abstol = abstol, dtmax = dtmax )
55
58
end
56
- println (" steps: " , lpad ( length (sol_jit . t), LPAD_INTEGER),
59
+ println (" " ^ ( LPAD_INTEGER + 6 ),
57
60
" \t\t elapsed:" , lpad (elapsed_jit, LPAD_FLOAT))
58
61
59
62
# full L96m integration (converging to attractor)
60
63
print (rpad (" (full, converging)" , RPAD))
61
64
elapsed_conv = @elapsed begin
62
65
pb_conv = DE. ODEProblem (full, z00, (0.0 , T_conv), l96)
63
- sol_conv = DE. solve (pb_conv, SOLVER, reltol = 1e-3 , abstol = 1e-6 )
66
+ sol_conv = DE. solve (pb_conv,
67
+ SOLVER,
68
+ reltol = reltol,
69
+ abstol = abstol,
70
+ dtmax = dtmax
71
+ )
64
72
end
65
73
println (" steps:" , lpad (length (sol_conv. t), LPAD_INTEGER),
66
74
" \t\t elapsed:" , lpad (elapsed_conv, LPAD_FLOAT))
@@ -70,7 +78,12 @@ z0 = sol_conv[:,end]
70
78
print (rpad (" (full)" , RPAD))
71
79
elapsed_dns = @elapsed begin
72
80
pb_dns = DE. ODEProblem (full, z0, (0.0 , T), l96)
73
- sol_dns = DE. solve (pb_dns, SOLVER, reltol = 1e-3 , abstol = 1e-6 )
81
+ sol_dns = DE. solve (pb_dns,
82
+ SOLVER,
83
+ reltol = reltol,
84
+ abstol = abstol,
85
+ dtmax = dtmax
86
+ )
74
87
end
75
88
println (" steps:" , lpad (length (sol_dns. t), LPAD_INTEGER),
76
89
" \t\t elapsed:" , lpad (elapsed_dns, LPAD_FLOAT))
0 commit comments