-
-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adaptive exponential Rosenbrock integrators #463
Changes from 4 commits
60aced5
efd4d2f
b3f5697
1c2a8a8
98751fd
33cf1e4
c0270d1
ec779cf
a366d74
6f46d7d
69b0554
c68385b
492c9e5
af31d36
67f588c
86afe48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,4 +101,15 @@ end | |
@test sol(1.0) ≈ exp_fun2.analytic(u0,nothing,1.0) | ||
end | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a convergence test |
||
@testset "Adaptive exponential Rosenbrock" begin | ||
dt = 0.05 | ||
abstol=1e-4; reltol=1e-3 | ||
sol_ref = solve(prob, Tsit5(); abstol=abstol, reltol=reltol) | ||
|
||
sol = solve(prob, Exprb32(m=20); adaptive=true, abstol=abstol, reltol=reltol) | ||
@test isapprox(sol(1.0), sol_ref(1.0); rtol=reltol) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure this test will do so well given that the error estimators are local instead of global. This can be off by an order of magnitude or more even in a sane integration |
||
sol = solve(prob_ip, Exprb32(m=20); adaptive=true, abstol=abstol, reltol=reltol) | ||
@test isapprox(sol(1.0), sol_ref(1.0); rtol=reltol) | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a regression test. I would do some diagnostic printing to make sure things are right: check the error estimator against the analytical solution and it should be in the same ballpark, make sure it goes to zero sanely as the tolerances decrease, etc. Then when you think you have it right, make it solve the problem at some standard tolerance and put a test that its length cannot grow much. So if you measure it at 23 steps, put it at <26 or something like that. Differences between processors can change it by a step or two due to floating point differences, but not by a whole lot. A big indicator for when the error estimator is off is that the step count will grow, so that's a nice regression test for the future to indicate any time that the error estimate breaks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the language of the paper, this is
uhat
, right? So then in our setup, the error estimate is the first argument ofcalculate_residuals
which should beu - utilde
. However, it's more numerically stable to never constructuhat
itself. Instead, defineutilde = u - uhat = [-2phi_3 phi_3] = 2dt*(-w1[:,4] + w2[:,4])
as the error estimator.