# Evaluation of UFL expression at mesh points

**URL:** <https://fenicsproject.discourse.group/t/evaluation-of-ufl-expression-at-mesh-points/7368>\
**Category:** dolfinx\
**Created:** [December 23, 2021, 4:09pm UTC](https://fenicsproject.discourse.group/t/evaluation-of-ufl-expression-at-mesh-points/7368 "2021-12-23T16:09:45Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![dokken](https://yyz2.discourse-cdn.com/free1/user_avatar/fenicsproject.discourse.group/dokken/32/1560_2.png) [@dokken](https://fenicsproject.discourse.group/u/dokken)\
**Post date:** [January 3, 2022, 2:16pm UTC](https://fenicsproject.discourse.group/t/evaluation-of-ufl-expression-at-mesh-points/7368/6 "2022-01-03T14:16:31Z")

</div>

Please note that `Dx(f, 1)` is not uniquely defined at vertices (when f is a CG 1 function). Thus there is ambiguity in what the value should be at a vertex.

What you can do if you insist of evaluating the expression at the vertices, is that you:

1. Interpolate the ufl expression into an appropriate space, as for instance shown here: [dolfinx/test\_interpolation.py at c9f3c459a75f02abcf255a9dd05185350eb1edde · FEniCS/dolfinx · GitHub](https://github.com/FEniCS/dolfinx/blob/c9f3c459a75f02abcf255a9dd05185350eb1edde/python/test/unit/fem/test_interpolation.py#L457)
2. Use the point evaluation function for the vertices, as shown here: [Implementation — FEniCSx tutorial](https://jorgensd.github.io/dolfinx-tutorial/chapter1/membrane_code.html#making-curve-plots-throughout-the-domain)

However, note that you can send in the cells you want to use the `dolfinx.Expression` at, which you can reduce to a subset of cells spanning all the unique vertices, reducing the size of the output array from `cells * num_vertices_per_cell`=3\*num\_cells in your example above, to `3*subset_of_cells`, which will depend on which cells you choose to cover all vertices.

---

_[View the full topic](https://fenicsproject.discourse.group/t/evaluation-of-ufl-expression-at-mesh-points/7368)._
