-
Notifications
You must be signed in to change notification settings - Fork 43
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
Example that uses atol to adjust absolute tolerances for CVODE #110
Comments
This is correct and should work. Note that the default is 1e-12, and rtol 1e-6, so setting 1e-11 might not have effect. After the first section, so after [9], you can for example do following command to see obtain a more precise solution: options1= {'rtol': 1e-6, 'atol': 1e-12, 'max_steps': 50000} # default rtol and atol
options2= {'rtol': 1e-15, 'atol': 1e-25, 'max_steps': 50000}
solver1 = ode('cvode', rhseqn, old_api=False, **options1)
solver2 = ode('cvode', rhseqn, old_api=False, **options2)
solution1 = solver1.solve([0., 1., 60], initx)
solution2 = solver2.solve([0., 1., 60], initx)
print('\n t Solution1 Solution2 Exact')
print('-----------------------------------------------------')
for t, u1, u2 in zip(solution1.values.t, solution1.values.y, solution2.values.y):
print('{0:>4.0f} {1:15.8g} {2:15.8g} {3:15.8g}'.format(t, u1[0], u2[0],
initx[0]*np.cos(np.sqrt(k/m)*t)+initx[1]*np.sin(np.sqrt(k/m)*t)/np.sqrt(k/m))) Output would be:
|
Thanks, that's helpful. I evaluated the sensitivity of 17 test cases to the tolerances. |
I'm confused on how to interpret this. Rel tol of 0.0001 has highest compute time ? |
I'm using
scikits
because it's listed on the CVODE webpage. I'm building a biochemical simulator. Since populations of molecules must be non-negative, I'm following the advice in Hindmarsh, Serban and Reynolds, User Documentation for cvode v5.0.0, 2019, which recommends that tighter absolute tolerances be used to reduce the magnitude of negative values. However, I find that changingatol
does not change the solver behavior. I'm passing atol like this:Is this correct? Do you have an example that uses atol to adjust absolute tolerances for CVODE?
Thanks, Arthur
The text was updated successfully, but these errors were encountered: