# [OpenFOAM] How to get the coordinates of velocity data at all cells and at all times

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

 June 19, 2017, 09:33 How to get the coordinates of velocity data at all cells and at all times #1 Senior Member   vidyadhar Join Date: Jul 2016 Posts: 138 Rep Power: 9 Hello, I have done a simulation, from its output, I have velocity (U.gz) at different times. If I open the U.gz file at a certain time, it contains velocity data of all cells (nCells:5515515) in my domain. I would like to know the coordinates of these velocity data at these cells. In constant/polyMesh, I have points.gz which are the coordinates of points (nPoints:5673136) of my domain. The number of points are greater than the no. of cells according to owner.gz ( "nPoints:5673136 nCells:5515515 nFaces:16702984 nInternalFaces:16390106"; ) I dont know how paraview reads the data. Can anyone let me know how to get the coordinates of the velocity data at each cell as contained in U.gz and for each time. Thanks in advance!!! vidyadhar Last edited by vidyadhar; June 19, 2017 at 09:37. Reason: need to edit the title

June 20, 2017, 05:40
How to get coordinates of cell data
#2
Senior Member

Join Date: Jul 2016
Posts: 138
Rep Power: 9
Quote:
 Originally Posted by wyldckat Hi Ehsan, For reference, the official guide says this: http://www.paraview.org/Wiki/ParaVie...s.2C_arrays.29 I can't believe I'm going to have to explain this ... OK, in ParaView there are three basic geometrical types of representation: Points Lines Surfaces If this wasn't enough, there are at least two basic types of data content: Data that is registered in points, aka "Point Data". Among these are the following usual usage scenarios:The data is associated to the vertexes of cells and faces as real data. The data is associated to the vertexes of cells and faces as interpolated data. One example of this type of data is to use the filter "Cell Data" to "Point Data". Data that is registered in surfaces, aka "Cell Data". Among these are the following usual usage scenarios:The data is associated to the centre of each cell or face as real data (this is how OpenFOAM usually stores the real data). The data is associated to the centre of each cell or face as interpolated data or perhaps as an average of the data. Example of interpolation for this case is the filter "Cell Data" to "Point Data". In addition, ParaView uses the following convention: Data on surfaces are either the real values from the centres i.e. "Cell Data" or are showing the interpolated values from the "Point Data". Data on points are usually only the data from themselves, assuming that they have the geometrical characteristic associated to it.Note: Glyphs themselves (e.g. used as vector representation or for seeing where the points are) only work on "Point Data". Data on Lines... are probably what ParaView thinks it's best to show, depending on "Cell Data" or "Point Data". Is it clear enough now? Best regards, Bruno

Hello Bruno,

I need your help in getting the following:

I have a simulation data of various times. In each time, I have the velocity data as a file U.gz.

If I open this U.gz file in any saved time, I can see the velocity values (x y z components) for all the cells of my domain. (I hope this data corresponds to cell data only)

In my constant/polyMesh directory, I have points.gz containing the coordinates of all the points of my domain.

But, I would like to know the coordinates of the cell data (velocity data) as mentioned in the U.gz file, if possible. (I have saved the data from paraview: File>saveData: it gave me .csv files for all times. This data contains both velocity values and points. Does it represent cell data or point data?)

Else, I request you to let me know how to find the velocity data at all points of my domain for all times.

Thanks & Regards,

 June 25, 2017, 11:03 #3 Retired Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 10,975 Blog Entries: 45 Rep Power: 128 Quick answer: When opening an OpenFOAM case In ParaView, by default the U values that have positions are only for the "Point Data" fields. This means that you need to use the "Cell Centers" filter, and select the option to create the vertex data as well. This will create a new fields on the centres of the cells, which will be of type "Point Data", but should be in reference to the original fields in "Cell Data" format. Furthermore, if your mesh has polyhedral cells, then make sure that you use the polyhedral representation mode in ParaView, as explained here: https://openfoamwiki.net/index.php/F...is_in_ParaView Beyond this, in order to export directly in OpenFOAM without relying on ParaView, you will need to either use a function object for sampling or the sample utility to do so. I know there is at least one thread on this topic here at the forum... but I'm unable to find it at the moment. Turin Turambar, kooki_13 and ari003 like this. __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide Read this before sending me PM

April 27, 2020, 07:41
#4
New Member

Emre
Join Date: Oct 2016
Posts: 5
Rep Power: 9
Quote:
 Originally Posted by wyldckat Quick answer: When opening an OpenFOAM case In ParaView, by default the U values that have positions are only for the "Point Data" fields. This means that you need to use the "Cell Centers" filter, and select the option to create the vertex data as well. This will create a new fields on the centres of the cells, which will be of type "Point Data", but should be in reference to the original fields in "Cell Data" format. Furthermore, if your mesh has polyhedral cells, then make sure that you use the polyhedral representation mode in ParaView, as explained here: https://openfoamwiki.net/index.php/F...is_in_ParaView Beyond this, in order to export directly in OpenFOAM without relying on ParaView, you will need to either use a function object for sampling or the sample utility to do so. I know there is at least one thread on this topic here at the forum... but I'm unable to find it at the moment.

Hello Bruno, have you found out how to export all velocity field and its point coordinates without a need of using paraview? I searched the forum but I also couldn't find the thread you mentioned in step four.

Thank you.

Regards

 April 28, 2020, 16:05 #5 Senior Member   Mikko Join Date: Jul 2014 Location: The Hague, The Netherlands Posts: 243 Rep Power: 13 Hi Turin, OpenFOAM has a function object to write the cell Centers. Just execute Code: `simpleFoam -postProcess -func writeCellCentres` and the utility will write the cell centers where the U values are also stored. Best, Mikko Turin Turambar likes this.

April 29, 2020, 07:17
#6
New Member

Emre
Join Date: Oct 2016
Posts: 5
Rep Power: 9
Quote:
 Originally Posted by Flowkersma Hi Turin, OpenFOAM has a function object to write the cell Centers. Just execute Code: `simpleFoam -postProcess -func writeCellCentres` and the utility will write the cell centers where the U values are also stored. Best, Mikko

Thank you very much Mikko. I am using the old version (2.4.0), so here for anyone wants to know how to invoke this command in that case. Just simply type:

Code:
```
writeCellCentres```

Thank you again

Best regards

Turin

May 10, 2020, 08:19
#7
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
Quote:
 Originally Posted by vidyadhar Hello Bruno, I need your help in getting the following: I have a simulation data of various times. In each time, I have the velocity data as a file U.gz. If I open this U.gz file in any saved time, I can see the velocity values (x y z components) for all the cells of my domain. (I hope this data corresponds to cell data only) In my constant/polyMesh directory, I have points.gz containing the coordinates of all the points of my domain. But, I would like to know the coordinates of the cell data (velocity data) as mentioned in the U.gz file, if possible. (I have saved the data from paraview: File>saveData: it gave me .csv files for all times. This data contains both velocity values and points. Does it represent cell data or point data?) Else, I request you to let me know how to find the velocity data at all points of my domain for all times. Thanks & Regards, vidyadhar
Hi, it s Arijit I am also in search of a tool which will give me the velocity at all cells in a plane. Would you please share how you get that for each time step?

 May 10, 2020, 21:45 #8 Senior Member   vidyadhar Join Date: Jul 2016 Posts: 138 Rep Power: 9 Hi, I was using caelus (caelus-cml.com) which was similar to openFoam. The velocities are saved automatically in each time step.

 May 11, 2020, 08:35 #9 Senior Member   Arijit Saha Join Date: Feb 2019 Location: Singapore Posts: 132 Rep Power: 7 Thanks for the reply, if anyone of you know about OpenFoam then I was keen to ask one more thing that is as following:- I want to create a plane in my OpenFoam simulation where I would like to get the velocities of each cell at each time interval. I used the cutting plane tool and made some addition to the control dict file and it gave me the values of velocity at each time interval but when I used the probe option over a line in ParaView it gave me value of 1000 cells along a horizontal line but when I checked the vtk file of cutting plane it only showed 24 results along a horizontal. How is that possible? Last edited by ari003; May 22, 2020 at 09:53.

May 20, 2020, 20:06
#10
Senior Member

Arijit Saha
Join Date: Feb 2019
Location: Singapore
Posts: 132
Rep Power: 7
Quote:
 Originally Posted by wyldckat Quick answer: When opening an OpenFOAM case In ParaView, by default the U values that have positions are only for the "Point Data" fields. This means that you need to use the "Cell Centers" filter, and select the option to create the vertex data as well. This will create a new fields on the centres of the cells, which will be of type "Point Data", but should be in reference to the original fields in "Cell Data" format. Furthermore, if your mesh has polyhedral cells, then make sure that you use the polyhedral representation mode in ParaView, as explained here: https://openfoamwiki.net/index.php/F...is_in_ParaView Beyond this, in order to export directly in OpenFOAM without relying on ParaView, you will need to either use a function object for sampling or the sample utility to do so. I know there is at least one thread on this topic here at the forum... but I'm unable to find it at the moment.
I was wondering how to execute your point 2. I mean I want to get the velocity corresponding to cell centers and not of points. So in this regard it will be really helpful if anyone willing to reply.