Problems with the gradient operator #4800
Unanswered
isaacbasil
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Hi! We have now moved our discussions to Discourse. Please post your question there. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi! Do you mind posting the issue in Discourse and I will reply there? This is an issue that has come up a few times, so it would be good to have it archived there for future reference (please tag me here when you have opened the issue so I don't forget). |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am trying to build a custom model with a bit of an unusual form, but I don't see why it shouldn't be solvable. However, I am having some problem with the grad operator, and getting an "off by one" shape error, which I believe is caused by a problem with the boundary conditions not being implemented properly.
Essentially, I am trying to add another grad term to my PDE for c_e, which will be made much clearer in my minimal working example below. In the example, the key line is the following:
When I do this, I get the following error:
pybamm.expression_tree.exceptions.ModelError: rhs and initial conditions must have the same shape after discretisation but rhs.shape = (41, 1) and initial_conditions.shape = (40, 1) for variable 'c_e'.
However, if I instead write,
then everything works fine. I think this is because grad returns an object on the edges, but I need an object defined on the nodes - perhaps there's a way I can map between these two types of objects?
If anyone has any ideas on how to tackle this that'd be greatly appreciated :) Here is the example (the physics in this case is meaningless, I just want to get it to run without errors):
Beta Was this translation helpful? Give feedback.
All reactions