# Compute Vorticity from Velocity in Dolfinx

**URL:** <https://fenicsproject.discourse.group/t/compute-vorticity-from-velocity-in-dolfinx/11039>\
**Category:** General\
**Created:** [April 27, 2023, 7:35am UTC](https://fenicsproject.discourse.group/t/compute-vorticity-from-velocity-in-dolfinx/11039 "2023-04-27T07:35:06Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [April 27, 2023, 7:39am UTC](https://fenicsproject.discourse.group/t/compute-vorticity-from-velocity-in-dolfinx/11039/2 "2023-04-27T07:39:54Z")

</div>

How do you define vorticity?

You can see my comments about 2D vorticity wrt to chosing an appropriate space:

> [@Get vorticity from velocity](https://fenicsproject.discourse.group/t/get-vorticity-from-velocity/6971/6):
>
> If u\_n is in a second order continuous Lagrange space, then the vorticity is in a Discontinuous Lagrange space of order 1. Thus your projection to CG-1 is introducing an error between the actual and shown vorticity. Please use a DG-1 space for the projection, and XDMFFile.write\_checkpoint to being able to visualize the DG-1 space in Paraview, as compute\_vertex\_values only does a CG-1 interpolation of any function.

As for moving the ufl-expression in to a function space, see for instance: [Gradients and divergences in fenicsx - #4 by Gianna](https://fenicsproject.discourse.group/t/gradients-and-divergences-in-fenicsx/9911/4)

---

_[View the full topic](https://fenicsproject.discourse.group/t/compute-vorticity-from-velocity-in-dolfinx/11039)._
