-
Notifications
You must be signed in to change notification settings - Fork 5
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
Decrease relative tolerance from 1e-5 to 1e-7 #1874
Conversation
With #1819 the state goes further away from 0 with time. That meanse we rely more on the relative tolerance than the aboslute tolerance. Reducing the default `reltol` by two orders of magnitude is enough to get only negligible leaky Terminals with occasional very brief leaks of 1e-8 m3/s. It is also enough to minimize the infiltration error to acceptable levels as can be seen in #1863 (comment). For HWS this slows down simulation from 9.1s to 12.3s, which isn't too bad for a two orders of magnitude reduction in relative tolerance. https://docs.sciml.ai/DiffEqDocs/stable/basics/faq/#What-does-tolerance-mean-and-how-much-error-should-I-expect
Perhaps for simplicity/consistency we should set the abstol to 1e-7 as well. |
This seems very obvious in retrospect, indeed. |
It's hard to find a good time for resetting though that doesn't cause issues for BMI, which currently assumes there is never any resetting. Also saveat can be infinite. Not resetting also makes it easy to get the total water balance over time. |
I understand, but a boundary condition that continually supplies water will see its flow grow and grow; at that point the |
In what way meaningless? Do you mean floating point accuracy issues? Perhaps a yearly reset would be predictable enough for BMI to work around, although the BMI driver would have to be calendar aware. |
Let's say you have a flow boundary constantly pumping in water and the flow on the edge accumulates monotonically, with 1000 m3/d; let's further assume that flow is (nigh) steady-state. At t=1 day, flow = 1000; relative tolerance value is I.e. the tolerance has effectively become a 1000 times relaxed, right? While the physical meaning of the model remains the same. |
With #1819 the state goes further away from 0 with time. That means we rely more on the relative tolerance than the absolute tolerance, see the SciML docs on the topic. Hence I found that reducing the
abstol
had no effect, but reducing the defaultreltol
by two orders of magnitude is enough to get only negligible leaky Terminals with occasional very brief leaks of 1e-8 m3/s. It is also enough to minimize the infiltration error to acceptable levels as can be seen in #1863 (comment).For HWS this slows down simulation from 9.1s to 12.3s, which isn't too bad for a two orders of magnitude reduction in relative tolerance.Rechecking HWS performance gives a speedup! 12.4s for 1e-8, 8.1s for 1e-7, 10.2s for 1e-6. So 1e-7 seems optimal. Not sure what went wrong last time, but this seems pretty consistent. This is with both absolute and relative set to the same number.Fixes #1851
Fixes #1863