CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Calculating Vorticity (

David March 17, 2004 09:02

Calculating Vorticity
I am trying to calculate vorticity (3 D), is there a easier way to obtain this information than using a fortran user routine???



David March 17, 2004 10:42

Re: Calculating Vorticity
I am using CFx4, sorry

Bart Prast March 18, 2004 07:14

Re: Calculating Vorticity
If you have the velocity gradients (should be available in the code), then getting the vorticity is straightforward.

David March 18, 2004 07:19

Re: Calculating Vorticity

But how do i obtain the code, using cfx analyse or do i have to create a fortran subroutine to output this?

Bart Prast March 18, 2004 07:24

Re: Calculating Vorticity
I work in CFX post, do not know about cfx analysis. But having the velocity gradients in the results file, then you can create a new variable (vector) which is made up of the vorticity (components). A post processing program like fieldview can even calculate the rotation of the velocity field for you

David March 18, 2004 11:44

Re: Calculating Vorticity
I am still having probs: i am using cfx4 fortran routine called: usrsrc and added the following code into the the routine:










but everytime i run the solver i get a floating point error, (without the routine the simulations runs fine) (the routine does compile)

i am running a 3d cylinder with a helix structure wall inside and require to analyse the vorticity, can anyone please help , or point me in the right direction please,

Gloria Gaynor March 19, 2004 10:45

Re: Calculating Vorticity
The USRSRC subroutine is intended to perform source terms within your transport equations, variables, etc...
If you want to evaluate vorticity for post-processing only you should use USRTRN instead. Try it on this subroutine and see if you still get floating point errors.
Cheers, G. G.

David March 19, 2004 11:47

Re: Calculating Vorticity
hi, I have managed to get the fortran code to compile and run, but now the prob is that it is not storing the results in the output file .fo nor can i see the gradients of the velocity in cfx anaylse?? i must be doing something? wrong? can anybody help me please

Jeff March 19, 2004 18:06

Re: Calculating Vorticity

Using USRTRN is a wise move. You can also put the code in an IF structure so that it is only executed when KSTEP.GE.NSTEP (this will only execute after the very last iteration).

You've calculated the gradients, but not done anything with them. Create some passive user scalars (these start with USRDCC, see chapter 2 of user guide) and store your values in the scalars at each nodal value. These user scalars will then be available to plot in the post processor.

Alternately, use CFX-5. CFX-4 is a dead code, and CFX-5 has an expert parameter flag that automatically stores vorticity in the results file.


David March 22, 2004 07:55

Re: Calculating Vorticity

thanks for help, after learning how to user Fortran i managed to do it! (it was v. painful lol!!!) also thanks on the blocks structures Jeff,



mortain July 7, 2010 12:20

David, do you still have the fortran code or can you address to a formulation of the vorticity calculations given the velocities?

thank you


ghorrocks July 7, 2010 19:12

Are you using CFX4? The fortran he discusses is in that very old version.

If you are using CFX5 or higher it is already a variable you can select so no need to calculate it.

mortain July 7, 2010 20:31

I am using fortran for simulating the fluid flow not based on Navier Stokes but on lattice Boltzmann method!

I would like to evaluate the vorticity, given the velocity vectors.



ghorrocks July 8, 2010 08:33

Then why are you posting on a CFX forum?

From the velocity you will need to evaluate the spatial derivatives and get the vorticity from there. a google search will find the definition of vorticity in a flash.

mortain July 8, 2010 09:58

I'm sorry about posting in the wrong space, but there is no space for programming. A person wrote about programming in this thread before, that's why. If you can address to a bettere section I'd be pleased to cahnge.

Anyway given the definition of vorticity, doesn't mean you can evaluate it. The vorticity is, for the x direction, equal to:
since \partialu/\partialx=lim(\Deltax-->0)[u(x+\Deltax)-u(x)]/\Deltax hence I have to take the value of the next lattice minus the value at the lattice divided by one, which is the \Deltax.

Apparently tihs doesn't give the expected result in terms of vorticity. I was reading something here: but I'm not sure and I wanted the opinions of CFD, since in CFD softwares the vorticity is evaluated automatically.



ghorrocks July 8, 2010 18:44

Vorticity is simply the curl of the velocity field. See:

So you simply need to evaluate the spatial derivatives of velocity and get the vorticity from that. The equation you quote has the evaluation of the derivatives mixed up with the evaluation of the vorticity. That is a bad idea.

This question was more suited to the main CFD forum -

Jasmine July 15, 2010 15:01

Hi Ghorrocks,
I am using CFX12. I can't find "vorticity" in variables. Why?


Originally Posted by ghorrocks (Post 266249)
Are you using CFX4? The fortran he discusses is in that very old version.

If you are using CFX5 or higher it is already a variable you can select so no need to calculate it.

Jasmine July 15, 2010 15:59

I found '"Velocity.Curl" in CFX-post. It is the vorticiy I guess.

iffy June 15, 2011 08:21

Sorry to ask this question again. I was looking for variable "Vorticity" or "Velocity Curl"in CFX-Post but I could not find it. Does anyone knows is it available in CFX-11 or should I define it myself.
Thanks in advance

All times are GMT -4. The time now is 06:07.