CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Paraview & paraFoam

Visualization of the radial velocity component

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes
  • 3 Post By hjasak
  • 1 Post By hani

LinkBack Thread Tools Display Modes
Old   June 28, 2006, 04:57
Default Hallo, I have solved with i
Posts: n/a

I have solved with icoFOAM a problem into a cylindrical geometry and I need to visualize the radial and angular velocity components.
Please, can somebody tell me how to extract from the cartezian velocity the polar components?

  Reply With Quote

Old   June 28, 2006, 19:51
Default See
Senior Member
Srinath Madhavan (a.k.a pUl|)
Join Date: Mar 2009
Location: Edmonton, AB, Canada
Posts: 703
Rep Power: 14
msrinath80 is on a distinguished road
msrinath80 is offline   Reply With Quote

Old   June 29, 2006, 01:55
Default Hi, thank you pUl| for the
Posts: n/a

thank you pUl| for the link, but my question is not answered.
With "Ucomponents" one can extract the x,y,z components of the velocity field, and I need the U_r component. Is there a function to extract the cylindrical or sperical components of the velocity?
Or my I construct such a function? I need for that the angles of the cell centers ...

  Reply With Quote

Old   June 29, 2006, 17:39
Default Hi, I wrote a simple dirty
New Member
Os N
Join Date: Mar 2009
Posts: 2
Rep Power: 0
osn is on a distinguished road

I wrote a simple dirty program to calc angular velocity.
It is from OpenFOAM-1.3/applications/utilities/postProcessing/velocityFi
So I show diff output of magU.C and my code below.


> tensor t1(0.0, -1.0, 0.0,
> 1.0, 0.0, 0.0,
> 0.0, 0.0, 0.0);
< Info<< " Calculating magU" << endl;
< volScalarField magU
< (
> Info<< " Calculating tanU" << endl;
> volVectorField p1 = t1 & mesh.C();
> volVectorField p2 = p1/mag(p1);
> volScalarField tanU
> (
< "magU",
> "tanU",
< ),
< mag(U)
< );
> ),
> U & p2
> );
> Info << "tan(U): max: " << max(tanU.internalField())
> << " min: " << min(tanU.internalField()) << endl;
> tanU.write();
< Info << "mag(U): max: " << max(magU.internalField())
< << " min: " << min(magU.internalField()) << endl;
< magU.write();
osn is offline   Reply With Quote

Old   June 30, 2006, 04:05
Default Dear Osamu that's what I n
Posts: n/a
Dear Osamu

that's what I needed.
Thank you, it works.

  Reply With Quote

Old   June 30, 2006, 04:25
Default A thousand time easier: OpenFO
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,806
Rep Power: 25
hjasak will become famous soon enough
A thousand time easier: OpenFOAM has got some coordinate system classes. You will need a cylindrical one - the class is called cylindricalCS (have a search through the source or Doxygen).


1) make yourself a coordinate system

const word & name,
const vector & origin,
const vector & axis,
const vector & direction

or any of the other constructors.

2) transform the (internal) field to the new cs using the toLocal function

3) if you want a radial component, use vector::y

Thus (something like this, I'm not compiling):

// This cs would be in the x-y plane, with "x" pointing up and cylindrical axis in the blobal x direction
cylindricalCS ccs
vector(0, 0, 0),
vector(1, 0, 0),
vector(0, 1, 0)

Info << "Ur: " << ccs.toLocal(U)().component(vector::Y) << endl;

(one line).

Currently, cs does not have a member to convert the whole geometric field, but I can add one for you if you wish.

renyun0511, nygbook and mgg like this.
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting:
hjasak is offline   Reply With Quote

Old   July 6, 2006, 04:57
Default I've been trying to learn how
Senior Member
Håkan Nilsson
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 196
Rep Power: 10
hani is on a distinguished road
I've been trying to learn how to use the cylindricalCS class, and I thought that I might share my experiences. No warranties to what I write though, and I guess that all of it can be made much simpler if you know what you are doing.

The example requires that you have a mesh and a velocity field U, and that you have defined inletPatchID. You also need to do #include "cylindricalCS.H". If your base code writes out the velocity field U you can then visualize the radial, tangential and axial coordinates as U at the inlet patch using for instance paraFoam. The example was developed for OF1.3.

//Test of cylindricalCS

//Find the Cartesian positions at the patch
const fvPatchVectorField& cartFaceCentres = mesh.Cf().boundaryField()[inletPatchID];

//Put the results in U at the patch so that you can visualize the result
fvPatchVectorField& CCSin = U.boundaryField()[inletPatchID];

//Define your cylindrical coordinate system
cylindricalCS ccs
vector(0, 0, 0), //center point of ccs
vector(0, 0, 1), //axis of ccs
vector(1, 1, 0) //base axis for cylindrical angle

//It doesn't seem to be possible to do the whole field at once, so
//loop through all the patch faces and set the radial, tangential and
//axial position
forAll(CCSin, facei)
CCSin[facei] = ccs.toLocal(cartFaceCentres[facei]);
//Make sure that you have only positive angles and that the
//angle is zero at the base axis:
CCSin[facei][1] = CCSin[facei][1] + neg(CCSin[facei][1])*360;

//You can also look at a single cylindrical component, here radial:
Info << "ccs.toLocal(cartFaceCentres[0]).component(vector::X)" << endl;
Info << ccs.toLocal(cartFaceCentres[0]).component(vector::X) << endl;

calim_cfd likes this.
hani is offline   Reply With Quote

Old   August 17, 2007, 05:25
Default ok I finally found that
Posts: n/a
ok I finally found that ccs.toLocal(U)().component(vector::Y) has for type Field<double> but the member write() does not work with it.

I guess that I have to convert Uz_cyl into a variable of volScalarField type. i.e (Foam::GeometricField<double,>::GeometricField(Foa m::IOobject, Foam::Field<double>&)) but I dunno how to fill the three first items...

Does anyone knows where is the source that manage the "write" member?


  Reply With Quote

Old   August 17, 2007, 07:09
Default Did you try something like thi
Senior Member
Mark Olesen
Join Date: Mar 2009
Posts: 802
Rep Power: 21
olesen will become famous soon enough
Did you try something like this?

volScalarField Uz


BTW: in 1.4.1, toLocal() has been eliminated in favour of localPosition() and localVector()

If you are using an older version (with toLocal), be certain that the origin == (0,0,0) or you will have very funny results!
olesen is offline   Reply With Quote

Old   August 20, 2007, 03:49
Default Hi mark, Thanks for answer
Posts: n/a
Hi mark,

Thanks for answering...
Actually, I am on OF-1.4 and .localVector() is not working.

I have seen in the User manual (p-32) that it was possible to convert Field<type> into volField<type> using fvc::~~ and mesh.~().

So I guess that converting ccs.toLocal(U)() which is a vectorField into volVectorField should be feasible, but I have not found yet how to make it...

If I am wrong please let me know, otherwise any idea?


  Reply With Quote

Old   October 1, 2009, 05:04
Senior Member
Florian Krause
Join Date: Mar 2009
Location: Munich
Posts: 103
Rep Power: 10
florian_krause is on a distinguished road
Hi guys!

the last post in this thread is more then 2 years old and related to the use of cylindrical CS in OF-1.4 .

I am working now with OF-1.6.x on a turbulent pipe flow (RANS & LES) with cylindrical cross section. I also want to visualize my fields in a cylindrical CS, lets say (r,teta,z).

My question - Are there any changes from OF-1.4 to OF-1.6.x in how to use the cylindrical CS or can I just try the way Hakan or Hrv explained ???

florian_krause is offline   Reply With Quote

Old   October 11, 2010, 03:56
Post HI
Senior Member
Join Date: Sep 2010
Location: France
Posts: 224
Rep Power: 10
T.D. is on a distinguished road
Hi me too, i'd like to know if i set in version 1.7 my coord system to cylindrical CS, then all my values will be automatically in (r, teta, and z) directions?

help please
T.D. is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
RSM value of fluctuating component of velocity Kushagra CFX 5 April 10, 2008 15:20
Gravity component and inlet velocity Vidya FLUENT 8 July 31, 2006 08:28
Radial velocity Milo FLUENT 0 February 11, 2006 14:26
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 12:20

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