Replies: 1 comment 2 replies
-
There currently is no direct method to access vector (or tensor) components. However, the master branch now has code which allows you to use a user-defined function. You could thus achieve what you want using eq = PDE({"u": "-get_x(gradient(u))"}, user_funcs={"get_x": lambda arr: arr[0]}) Here, Alternatively, you may also register your own operator that only evaluates the import functools
from pde.grids.operators.cartesian import _make_derivative
make_gradient_x = functools.partial(_make_derivative, axis=0)
pde.CartesianGrid.register_operator('gradient_x', make_gradient_x) If you do this, your original idea should work. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a method for this package to extract the components of the gradient when constructing equations with PDE class, such as
eq = PDE({'u':"-gradient_x(u))"})
? I did not find a direct way to implement it in the document. Can you add a similar function?Beta Was this translation helpful? Give feedback.
All reactions