### Evaluate gradient of function at point

160

views

0

Let

*u*be the solution to a given problem solved using FEniCS`solve(a==L, u, bcs)`

and *x *a *Point*. How do I evaluate the gradient of *u* at *x* ?

```
g = grad(u)
g(x)
```

raises an error about dimensions:

UFLException: Expecting dim to match the geometric dimension, got dim=1 and gdim=2.

Community: FEniCS Project

4

Have you tried projecting the gradient on a VectorFunctionSpace first and then evaluating in a point?

written
5 months ago by
Eleonora Piersanti

That is the answer to this question.

written
5 months ago by
pf4d

Please login to add an answer/comment or follow this question.