Problem when differentiating FunctionParameter with respect to time #4519
-
Hello everyone, I am building a PyBaMM model and I need to differentiate a pybamm.FunctionParameter whith respect to time. I have the following code:
When I try to run a customized DFN model with this pybamm.FunctionParameter derivative I get the following error:
Nevertheless, if I differentiate the nu_n variable with respect to "sto" (stoichiometry) I have no problem at all. Do you guys know a way to circumvent this issue? Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Looks like pybamm can't take the derivative of one of the nodes in the Negative electrode stoichiometry expression:
The You could circumvent this if you manually work out the derivative of |
Beta Was this translation helpful? Give feedback.
Looks like pybamm can't take the derivative of one of the nodes in the Negative electrode stoichiometry expression:
The
x-average
is the problem here,diff
doesn't seem to be implemented for any of the averages. The problem doesn't occur if you take the derivative wrtsto_n
because pybamm can work that out without taking the derivative of the average (sinced sto /d sto = 1
)You could circumvent this if you manually work out the derivative of
nu_n
and give this to apybamm.FunctionParameter
. Mind you, if the result contains the time derivative of one of the state variables (e.g. concentration) then you might not be ab…