Skip to content

Error in solving PDE with a heterogeneous coefficient #251

Answered by david-zwicker
noirchen asked this question in Q&A
Discussion options

You must be logged in to vote

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 a here is not included in the derivative, which you might or might not want.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@noirchen
Comment options

@david-zwicker
Comment options

Answer selected by noirchen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants