CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Pre-Processing (
-   -   Convert exisiting data to openfoam (

braennstroem July 29, 2006 07:44

Hi, I would like to conver

I would like to convert existing data (e.g. u-velocity form a vtk file) to the 'native' openfoam format using a small script (python). It is a structured orthogonal hexa mesh, so it should be pretty easy...

Unfortunately, I could not find anything about the format of openfoam's U file.
Would be nice, if anybody has an idea!


gschaider July 30, 2006 15:24

The U-file is just another fie
The U-file is just another field-file. It is described in Section 4.2.7 of the UserGuide (there is even a small example of a U-file there).

Writing the U-file should be the easy once you have generated the mesh-information. THAT should be the interesting part (Chapter 6)

braennstroem July 31, 2006 09:39

Hi Bernhard, I saw the docu
Hi Bernhard,

I saw the docu, but I did not get smart out of it...
to be clear, I do not know in what kind of loop I have to write the internal field. Does it look like
a loop

for z 1 to 100
for y 1 to 100
for x 1 to 100
write u(x,y,z) to internal field

or is it totally different!? It should be important, so openfoam does not get confused...
I imported the mesh from Fluent, so it should be no problem for me


gschaider July 31, 2006 10:38

Well, the problem is, that the
Well, the problem is, that the order of the values in the internalField depends on the "order" of the cells in the geometry. Because OpenFOAM doesn't depend on a block-structured mesh to work there is no "natural" order for blocks like other solvers have it. It all depends on who contructed the mesh (and how). So there are two routes:

a) you use blockMesh to build your mesh. Reverse engineer the output (or the source) to determine in which order cells are constructed for one block. Then write the loops accordingly. I guess this is less work, but you've got to hope that the order doesn't change with future versions of blockMesh
b) you let your script write the whole polyMesh (write the points - that should be trivial for your mesh, write the faces and the cells - that shouldfn't be too hard to). Then write the data in the field according to the Fabian-given order

Sorry: I overread the Fluent-Remark (and I don't want to throw away what I previously typed). That makes things a bit more complicated. But if it's a straight block-mesh (as I assume from your pseudo-program): is Fluent necessary? (as you seem to have the data in a different format anyway)

hjasak July 31, 2006 10:49

We currently have fluentMeshTo
We currently have fluentMeshToFoam and foamDataToFluent, but I'm pretty sure I also wrote fluentDataToFoam. This would take the Fluent data file and split it up into OpenFOAM fields. If this is what you need, I can have a look at the backup tapes etc. to dig it out.


braennstroem August 3, 2006 09:22

Hi, Bernhard: I actuall

I actually created the original mesh for fluent and a fortran code (multiblock format) with icem. I could use the fluent mesh for some simpleFoam calculations and now, I want to 'import' the velocity field of my fortran code. I can convert my velocity to tecplot, ensight and vtk format, but not yet to openfoam.
You are probably right, that it would be easiest to write the whole polymesh with the script too...

Thanks, but right now, I would not need it... but maybe later :-)


gschaider August 10, 2006 18:08

Hi Hrv. If it isn't too muc
Hi Hrv.

If it isn't too much trouble and you can find it: could I have that fluentDataToFoam?


kwardle June 30, 2008 17:09

Hello, Were you able to find
Were you able to find this fluentdatatofoam utility? I would really like to have it.

ivanyao June 30, 2008 22:22

hi, I am doing a simulation,i
I am doing a simulation,it is about the wind pressure on the building.there is a problem to set the velocity of the is ok when I set it the exactly value, such as 5m/s,but the velocity of the wind is change by the height,such as 0.2Z(Z is the height.),I don't know how to fix it,I am very appreciate if someone can help me.

hansjoerg September 17, 2008 07:05

Hi! I have a problem related
I have a problem related to Hrv's posting about the fluentToFoam.

I want to solve advection diffusion on a given velocity field/mesh (generated by fluent).

scalarTransportFoam would do this for me, and
with fluentMesh3DToFoam i can import the mesh,
but what is missing is the import of the veolcity field.

The "fluentDataToFoam" would probably solve this elegantly.

Has anybody an idea where one can find the utility?

thanks a lot hansjoerg

caw September 17, 2008 08:49

Hi, i have done this once b

i have done this once by hand. Not very convenient but it worked at least for my case.

1) use fluent3DMeshToFoam for the grid
2) export the velocity field by writing a interpolation file from fluent
3) copy the appropriate data columns to 0/U

This works as long as the cell order in fluent and openfoam is the same. i remember doing this for a 2D Case. should work for 3d as well...
but no guarantee ;-)

bst regards

hansjoerg September 17, 2008 09:13

Hi christian! Sounds interest
Hi christian!
Sounds interesting, thanks a lot.
What uou mean with writing a interpolation file?

do you remember the fluent commands?

thanks hj

kwardle September 17, 2008 09:48

hj, I have also done this wit
I have also done this with a dirty little fortran program I wrote to take the Fluent .ip file and write it out to OF input formats for certain variables. While it seemed to work and the resulting fields were somewhat decent, it had a lot of "noise" (random cells with discontinuities). This may have been due to differences in cell numbering that may have occured at some point in the fluentMeshToFoam conversion...I'm not sure. If Hrv has a better fluentDataToFoam converter I would love to have it as well...*please*.

As for creating a Fluent interpolation file, you go to "file interpolate write-data" and select your fields to write out and name the file as a ".ip". The format is relatively simple and is described in section 4.13.2 of the Fluent User Guide.

kwardle September 17, 2008 10:09

One other note - the x,y,z cel
One other note - the x,y,z cell coordinates are also included in the .ip file and it may be possible to use these somehow in mapping the new fields in order to eliminate the issue of cell numbering.

braennstroem September 17, 2008 13:21

Hi, 'visit' could be the tool
'visit' could be the tool of choice, it has a lot of readers and might export into openfoam format in the near future; I hope :-) I am not sure, how easy it is to implement, but one of there developers gets an eye on it... this would be nice, to get some inlet conditions of experiments as well.


hansjoerg September 20, 2008 02:25

Hello! I'll try to write the
I'll try to write the converter for fluentDataToFoam, if nobody already did. (Horve ?)
Any ideas where to start from?
- I'll use the foamDataToFluent as template for the code, but where can i get good documentation of the storage formats (especially fluent data structure)
Thanks hj

braennstroem September 24, 2008 04:07

In visit there is a tool calle
In visit there is a tool called 'spreadsheet', which can be used to export every format into a raw text format. This is not suitable to extract all data to OpenFoam, but is certainly a way to extract bc-data from experiments and e.g. fluent for the use with 'timeVaryingMappedFixedValue' bc.


wassja November 21, 2008 08:25

I'd like to know the present s
I'd like to know the present state of the fluentDataToFoam tool which Hrvoje thought having written some time ago.
Or if someone of the people above have heard something about that.

Otherwise I'd have to write sth like that myself :P .
The other way round, converting OF Data to Fluent, seems to loose the specified boundary conditions.
Until now I didn't manage to find a solution in this forum nor in the other articles playing google.

Someone must have had this problem before!
If so, I'd be grateful for a post :-)


Hrvoje Jasak on Monday, July 31, 2006

mlawson November 12, 2009 13:47

any progress on the fluendDataToFoam converter?

I'm curious if there has been any progress on locating/writing the elusive fluentDataToFoam converter. I have a large amount of data I would like to get into OpenFOAM without having to re-run everything.

Thanks in advance,


jason.ryon February 2, 2010 10:18

Could somebody please let me know where I can find this fluentDataToFoam utility? I am using OF 1.6.


All times are GMT -4. The time now is 09:38.