Error in solving PDE with a heterogeneous coefficient #251
-
Hi, I am trying to simulate a PDE on [-50, 50] with BC The coefficient My code is
The code complains when initializing the stepper
Any help is appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The problem is a semantic problem in the definition of the PDE. The way it is written, you're adding the Laplacian of a scalar field to the gradient of the same field, which are fields of different rank and thus cannot work. Instead of taking the gradient, you need to take a derivative in x-direction explicitly. This is as simple as replacing the definition of your PDE by eq = PDE({"u": "laplace(u) - a*d_dx(u)"}, consts={'a': a}, bc={"value": 0}) Note that |
Beta Was this translation helpful? Give feedback.
The problem is a semantic problem in the definition of the PDE. The way it is written, you're adding the Laplacian of a scalar field to the gradient of the same field, which are fields of different rank and thus cannot work. Instead of taking the gradient, you need to take a derivative in x-direction explicitly. This is as simple as replacing the definition of your PDE by
Note that
a
here is not included in the derivative, which you might or might not want.