No convergence in test cases for Sundials 5.7.0 and Python 3.8
Opened this issue · 3 comments
Hi,
I am testing the ODES using Sundials 5.7.0 and Python 3.8. Everything seems to be fine, except for some DeprecationWarning running nose. Nevertheless I cannot converge the tutorial cases or even the nose tests.
My packages:
(venv) ~/ pip freeze
nose==1.3.7
numpy==1.20.1
scikits.odes==2.6.1
scipy==1.6.1
Here it is a test case:
import numpy as np
from scikits.odes.dae import dae
SOLVER = 'ida'
tout = np.linspace(0, 1)
y_initial = np.array([0])
ydot_initial = np.array([0])
extra_options = {'old_api': False}
def right_hand_side(t, y, ydot, residue):
"""
User's right hand side function
"""
pass
dae_solver = dae(SOLVER, right_hand_side, **extra_options)
output = dae_solver.solve(tout, y_initial, ydot_initial)
print(output.values.y)
That outputs the following error:
[IDA ERROR] IDASolve
At t = 0 and h = 1.94627e-11, the corrector convergence failed repeatedly or with |h| = hmin.
[[0.]]
Here it is my nose tests output (all failed in Sundials calculations):
(venv) ~/ python -c "import scikits.odes as od; od.test()"
Running unit tests for scikits.odes
NumPy version 1.20.1
NumPy relaxed strides checking option: True
NumPy is installed in /Users/jaimenms/PycharmProjects/optimal-design/venv/lib/python3.8/site-packages/numpy
Python version 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27) [Clang 6.0 (clang-600.0.57)]
nose version 1.3.7
/Users/jaimenms/PycharmProjects/optimal-design/venv/lib/python3.8/site-packages/nose/suite.py:106: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
if isinstance(tests, collections.Callable) and not is_suite:
<__array_function__ internals>:5: DeprecationWarning: `np.alen` is deprecated, use `len` instead
../Users/jaimenms/PycharmProjects/optimal-design/venv/lib/python3.8/site-packages/scikits/odes/dae.py:389: DeprecationWarning: Old api is deprecated, move to new api
return self._integrator.init_step(t0, y0, yp0, y_ic0_retn, yp_ic0_retn)
......ode.get_info() =
{'NumSteps': 19, 'NumRhsEvals': 26, 'NumLinSolvSetups': 16, 'NumErrTestFails': 1, 'LastOrder': 2, 'CurrentOrder': 2, 'ActualInitStep': 0.0005000002493687262, 'LastStep': 5.632767015984214, 'CurrentStep': 11.121864790716213}
.True solution:
[ 1. 4. 9. 16. 25. 36. 49. 64. 81. 100.]
Integrated:
[ 1. 4.00000181 9.00000189 16.00000196 25.00000201
36.00000205 49.00000213 64.00000218 81.00000222 100.00000225]
Difference:
[0.00000000e+00 1.80709183e-06 1.88536923e-06 1.95964126e-06
2.00559588e-06 2.05370031e-06 2.12527937e-06 2.18137136e-06
2.22197630e-06 2.24709419e-06]
Relative:
[0.00000000e+00 4.51772957e-07 2.09485470e-07 1.22477579e-07
8.02238353e-08 5.70472309e-08 4.33730483e-08 3.40839275e-08
2.74318062e-08 2.24709419e-08]
.ode.get_info() =
{'NumSteps': 19, 'NumRhsEvals': 28, 'NumLinSolvSetups': 0, 'NumErrTestFails': 1, 'LastOrder': 2, 'CurrentOrder': 2, 'ActualInitStep': 0.0005000002493687262, 'LastStep': 5.632767015984214, 'CurrentStep': 11.121864790716213, 'NumPrecEvals': 0, 'NumPrecSolves': 0, 'NumJtimesEvals': 20, 'NumLinIters': 20, 'NumRhsEvalsJtimesFD': 20}
..............................
[CVLS ERROR] cvLsSetup
The Jacobian routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the setup routine failed in an unrecoverable manner.
.
[CVLS ERROR] cvLsSetup
The Jacobian routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the setup routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0 and h = 2.6974e-09, the corrector convergence test failed repeatedly or with |h| = hmin.
.
[CVODE ERROR] CVode
At t = 0 and h = 1.90735e-09, the corrector convergence test failed repeatedly or with |h| = hmin.
.
[CVLS ERROR] cvLsSolve
The Jacobian x vector routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the solve routine failed in an unrecoverable manner.
.
[CVLS ERROR] cvLsSolve
The Jacobian x vector routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the solve routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0.0314249, mxstep steps taken before reaching tout.
.
[CVODE ERROR] CVode
At t = 0.0222206, mxstep steps taken before reaching tout.
.......
[CVODE ERROR] CVode
At t = 0, the right-hand side routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0.458122, the right-hand side routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
The right-hand side routine failed at the first call.
.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.70033e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.70033e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.25083e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.25083e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 2.65677e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 2.65677e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.66048e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.66048e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.1512e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.1512e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
The above warning has been issued mxhnil times and will not be issued again for this problem.
[CVODE ERROR] CVode
At t = 0.5, mxstep steps taken before reaching tout.
..
[CVODE ERROR] cvRcheck1
At t = 0, the rootfinding routine failed in an unrecoverable manner.
.
[CVODE ERROR] cvRcheck3
At t = 0.458122, the rootfinding routine failed in an unrecoverable manner.
.
[CVODES WARNING] CVode
At the end of the first step, there are still some root functions identically 0. This warning will not be issued again.
...
[CVLS ERROR] cvLsSetup
The Jacobian routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the setup routine failed in an unrecoverable manner.
.
[CVLS ERROR] cvLsSetup
The Jacobian routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the setup routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0 and h = 2.6974e-09, the corrector convergence test failed repeatedly or with |h| = hmin.
.
[CVODE ERROR] CVode
At t = 0 and h = 1.90735e-09, the corrector convergence test failed repeatedly or with |h| = hmin.
.
[CVLS ERROR] cvLsSolve
The Jacobian x vector routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the solve routine failed in an unrecoverable manner.
.
[CVLS ERROR] cvLsSolve
The Jacobian x vector routine failed in an unrecoverable manner.
[CVODE ERROR] CVode
At t = 0, the solve routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0.0314249, mxstep steps taken before reaching tout.
.
[CVODE ERROR] CVode
At t = 0.0222206, mxstep steps taken before reaching tout.
.......
[CVODE ERROR] CVode
At t = 0, the right-hand side routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
At t = 0.458122, the right-hand side routine failed in an unrecoverable manner.
.
[CVODE ERROR] CVode
The right-hand side routine failed at the first call.
.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.70033e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.70033e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.25083e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.25083e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 2.65677e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 2.65677e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.66048e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 1.66048e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.1512e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
Internal t = 0.5 and h = 4.1512e-17 are such that t + h = t on the next step. The solver will continue anyway.
[CVODE WARNING] CVode
The above warning has been issued mxhnil times and will not be issued again for this problem.
[CVODE ERROR] CVode
At t = 0.5, mxstep steps taken before reaching tout.
..
[CVODE ERROR] cvRcheck1
At t = 0, the rootfinding routine failed in an unrecoverable manner.
.
[CVODE ERROR] cvRcheck3
At t = 0.458122, the rootfinding routine failed in an unrecoverable manner.
.
[CVODES WARNING] CVode
At the end of the first step, there are still some root functions identically 0. This warning will not be issued again.
...
[IDALS ERROR] idaLsSetup
The Jacobian routine failed in an unrecoverable manner.
[IDA ERROR] IDASolve
At t = 0, the linear solver setup failed unrecoverably.
.
[IDALS ERROR] idaLsSetup
The Jacobian routine failed in an unrecoverable manner.
[IDA ERROR] IDASolve
At t = 0, the linear solver setup failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0 and h = 9.53674e-10, the corrector convergence failed repeatedly or with |h| = hmin.
.
[IDA ERROR] IDASolve
At t = 0 and h = 9.53674e-10, the corrector convergence failed repeatedly or with |h| = hmin.
.....
[IDA ERROR] IDASolve
At t = 0, the residual function failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0.287979, the residual function failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0, repeated recoverable residual errors.
.
[IDA ERROR] IDASolve
At t = 0.5, , mxstep steps taken before reaching tout.
..
[IDA ERROR] IDARcheck1
At t = 0, , the rootfinding routine failed in an unrecoverable manner.
.
[IDA ERROR] IDARcheck3
At t = 0.287979, , the rootfinding routine failed in an unrecoverable manner.
.
[IDA WARNING] IDASolve
At the end of the first step, there are still some root functions identically 0. This warning will not be issued again.
...
[IDALS ERROR] idaLsSetup
The Jacobian routine failed in an unrecoverable manner.
[IDA ERROR] IDASolve
At t = 0, the linear solver setup failed unrecoverably.
.
[IDALS ERROR] idaLsSetup
The Jacobian routine failed in an unrecoverable manner.
[IDA ERROR] IDASolve
At t = 0, the linear solver setup failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0 and h = 9.53674e-10, the corrector convergence failed repeatedly or with |h| = hmin.
.
[IDA ERROR] IDASolve
At t = 0 and h = 9.53674e-10, the corrector convergence failed repeatedly or with |h| = hmin.
.....
[IDA ERROR] IDASolve
At t = 0, the residual function failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0.287979, the residual function failed unrecoverably.
.
[IDA ERROR] IDASolve
At t = 0, repeated recoverable residual errors.
.
[IDA ERROR] IDASolve
At t = 0.5, , mxstep steps taken before reaching tout.
..
[IDA ERROR] IDARcheck1
At t = 0, , the rootfinding routine failed in an unrecoverable manner.
.
[IDA ERROR] IDARcheck3
At t = 0.287979, , the rootfinding routine failed in an unrecoverable manner.
.
[IDA WARNING] IDASolve
At the end of the first step, there are still some root functions identically 0. This warning will not be issued again.
...
----------------------------------------------------------------------
Ran 124 tests in 0.748s
OK
I would like to know if it is a incompatibility with my Sundials version. If so, what is the most recent version that can be wrapped by ODES?
Thanks!
Current ODES is for Sundials 5.1.0
as written here: https://scikits-odes.readthedocs.io/en/stable/installation.html#requirements-before-install
Quite some of the tests are working I see, the failing ones could be due to wrong sundials versions, so test that first.
About your testcase, as the doc writes: assuming you have implemented the ODE right_hand_side mentioned above
https://scikits-odes.readthedocs.io/en/stable/guide.html#object-oriented-interface-ode-and-dae
You do pass
in it as in the doc, instead give a function, eg as in
https://github.com/bmcage/odes/blob/master/ipython_examples/Simple%20Oscillator.ipynb
I cannot get scikits.odes to work with python 3.8. Upon install I get the following error:
File "/private/var/folders/qz/4s8vn6v90nv8_r7_472q7g1c0000gn/T/pip-build-env-lfjzcav3/overlay/lib/python3.8/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension
extra_cflags = ext.extra_c_compile_args or []
AttributeError: 'Extension' object has no attribute 'extra_c_compile_args'
----------------------------------------
ERROR: Failed building wheel for scikits.odes
When I use python 3.6 everything works.
I am using macOS, Sundials 5.1.0, all other depenedencies installed, and everything is working with Python 3.6, but would like to get 3.8 working
@rstoddard24 latest release should fix this, see #131