@@ -118,19 +118,20 @@ Let's build two different ODE problems, and check how well we can solve each:
118
118
prob_index3 = ODEProblem(complete(traced_sys), Pair[], tspan)
119
119
prob_index1 = ODEProblem(simplified_sys, Pair[], tspan)
120
120
121
- sol3 = solve(prob_index3, EK1())
122
- sol1 = solve(prob_index1, EK1())
121
+ sol3 = solve(prob_index3, EK1(), abstol=1e-7 )
122
+ sol1 = solve(prob_index1, EK1(), abstol=1e-7 )
123
123
124
124
truesol = solve(prob_index1, Rodas4(), abstol=1e-10, reltol=1e-10)
125
125
126
126
sol1_final_error = norm(sol1.u[end] - truesol.u[end])
127
127
sol1_f_evals = sol1.stats.nf
128
- sol3_final_error = norm(sol3.u[end] - truesol.u[end])
128
+ perm = [findfirst(x -> x === s, unknowns(traced_sys)) for s in unknowns(simplified_sys)]
129
+ sol3_final_error = norm(sol3.u[end][perm] - truesol.u[end])
129
130
sol3_f_evals = sol3.stats.nf
130
131
@info "Results" sol1_final_error sol1_f_evals sol3_final_error sol3_f_evals
131
132
```
132
133
133
- The error for the index-1 DAE solve is _ much _ lower.
134
+ The error for the index-1 DAE solve is quite a bit lower.
134
135
Thus it seems that, even if the index-3 DAE could also be solved directly, index lowering might still be beneficial when solving DAEs with the ` EK1 ` !
135
136
136
137
0 commit comments