-
Hello everyone! I will start by doing my best to avoid the x-y problem thing, by first stating what it is that I actually want as an end result: My ultimate goal is to generate C/C++ code from https://pybamm.org/ models and run them in Simulink and on embedded systems. I am approaching this by combining some built in methods of PyBamm/CasADi, but if I am going at this from the wrong way, I would be more than happy to do something else. What I understand so far:
My question:
I have tried my best to follow examples/tutorials to build the system in CasADi, but the error I get is that my rhs function does not have a derivative. Below is my test code and error:
I should note here, that when I tried myself to make a simple newton method solver with these generated functions, I found that the Jacobian of the rhs (from
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You have to provide to the rhs function the jacobian as a cached function.
the name, input and output sparsities must match exactly for the jacobian, so for example the jac_rhs_fn.name() should be |
Beta Was this translation helpful? Give feedback.
You have to provide to the rhs function the jacobian as a cached function.
In Python you'd do something like this:
the name, input and output sparsities must match exactly for the jacobian, so for example the jac_rhs_fn.name() should be
'jac_name'