CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Vorticity calculation (https://www.cfd-online.com/Forums/openfoam-programming-development/255104-vorticity-calculation.html)

Divyaprakash March 19, 2024 05:52

Vorticity calculation
 
I need to calculate vorticity at every time-step since I need to use it for some other calculations. I will be doing that using


Code:

W = fvc::curl(U)

My query is about the locations of the generated field, W. Is it stored at the cell centers or at the cell face centers?

Severus March 19, 2024 10:37

Hello,
To answer it in short, cell centres.

Two ways to find out
Method 1
Take a look at the vorticity functionObject.
https://www.openfoam.com/documentati...8H_source.html
https://www.openfoam.com/documentati...8C_source.html

See line 54 in vorticity.C. It kind of does what you want to do. Basically the same operation.
Now let us look at vorticity.H, see lines 49 and 51. You see that input (which is a velocity) is of the type volVectorField and the output (which is vorticity) is also of the type volVectorField. The data of the type volVectorField is stored in cell centres.

Method 2
Just print out your vorticity.
Code:

w.write()
Now, open the file w and see the number of values in internalField. This should be the same as the number of cell centres.

Thanks


All times are GMT -4. The time now is 02:44.