Scaling of sensitivities in PyBaMM against finite difference check #3814
-
Hello, I am trying to use PyBaMM to compute the sensitivities of some functions of interest (e.g., average temperature) with a custom discharge profile. It is not complaining about the implementation and the code is running. However, when I am trying to validate the sensitivities with a finite difference scheme, it seems that the sensitivities from PyBaMM are scaled compared to the one obtained with the finite difference (~ a factor of 3 difference.). For instance here for the average temperature w.r.t. positive electrode porosity: Is there a reason why this is happening and am I missing something here? Please find below a minimum working example I have used to generate the plot above.
Thanks a lot! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @AlexGuibert, the difference you see here is related to the base value you have chosen for the parameter (i.e. 0.335), the finite difference formula should be |
Beta Was this translation helpful? Give feedback.
Hi @AlexGuibert, the difference you see here is related to the base value you have chosen for the parameter (i.e. 0.335), the finite difference formula should be
dTdt = (volt - volt_perturb) / (0.335 * perturbation)