# [Paraview] Calculating Vorticity from Velocity Vector

Sun Nov 12 01:02:59 EST 2006

```I had to do the same thing a few months ago, and Renato Elias pointed
out that the ParaView Wiki has instructions for adding the
vtkCellDerivatives filter to the ParaView menu: http://
www.paraview.org/Wiki/ParaView:Extend

After you follow those instructions, you should be able choose that
filter from the Filters menu. It takes point data and returns cell
data. (You'll need to convert back to point data for isosurfaces.)
You can get the vorticity vectors from it and then use the Calculator
filter to compute mag(Vorticity).  You can also get the individual
partial derivatives from tensor it returns, which is nice. For
example, you can use it to compute divergence by applying the
Calculator filter and telling it to compute Tensors_0+Tensors_4
+Tensors_8.

The vtkCellDerivatives filter has a memory-allocation bug that
requires you to have a scalar field as well as a vector field for the
vorticity calculation to work (I filed a bug on it: http://
www.vtk.org/Bug/bug.php?op=show&bugid=4019&pos=13 ). You can get
around this by moving the outVectors allocation code (line 77-93) in
<paraview_source>/VTK/Graphics/vtkCellDerivatives.cxx to line 103,
next to the allocation of outTensors. I'm not sure if this the best
way to fix it, but it works well enough if you just want to compute
the vorticity or divergence of a velocity vector field by itself,
which is what I was trying to do at the time.

ccg

On Nov 11, 2006, at 1:46 AM, Aditya Saurabh wrote:

> Hi!
> I have to create an animation(movie) from turbulent flow dataset
> urgently! I would really appreciate your help.
> I have a VTK_RECTILINEAR_GRID turbulent fluid flow dataset with
> velocity (vector) and pressure (scalar). I want to create vorticity
> isosurfaces. I know vorticity is curl of velocity vector, i.e. del
> 'cross product' V, where del is vector gradient operator and V is
> velocity vector. How do I calculate vorticity from velocity in
> paraview? I searched a lot in filters, however, could not find a
> imageGradient and not vector gradient. When I applied calc and got
> a component of velocity (which should supposedly be treated as
> scalar), even then gradient was not enabled as an applicable filter.