CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Data conversion at each time step for specific fields (http://www.cfd-online.com/Forums/openfoam-post-processing/66715-data-conversion-each-time-step-specific-fields.html)

melanie July 22, 2009 10:37

Data conversion at each time step for specific fields
 
Hello,

it's been quite a long time since I worked with OF... but now I'm back! And I am dealing with an unsteady simulation for which I would like to export, at each time step, pressure and velocity data in Ensight format. I have to mention that the mesh is quite big, and that this represents a large amount of data to be stored.

Of course one solution is to save OF data at each time step, and then reconstruct data coming from the different proc, convert it to Ensight format, remove the OF data and keep only the pressure and velocity Ensight files. This means a lot of manual operations. Furthermore, I cannot afford, even temporarily, to store too much data (many fields stored by OF are not useful to my post-processing).

Does someone have an idea to help me? I had a look at the work done with pyFoam, could it be useful?

Thank you all for your suggestions!
melanie

gschaider July 23, 2009 06:18

Quote:

Originally Posted by melanie (Post 223651)
Hello,

it's been quite a long time since I worked with OF... but now I'm back! And I am dealing with an unsteady simulation for which I would like to export, at each time step, pressure and velocity data in Ensight format. I have to mention that the mesh is quite big, and that this represents a large amount of data to be stored.

Of course one solution is to save OF data at each time step, and then reconstruct data coming from the different proc, convert it to Ensight format, remove the OF data and keep only the pressure and velocity Ensight files. This means a lot of manual operations. Furthermore, I cannot afford, even temporarily, to store too much data (many fields stored by OF are not useful to my post-processing).

Does someone have an idea to help me? I had a look at the work done with pyFoam, could it be useful?

If you want to write selected fields at every time-step one option would be to write a functionObject that basically does

U.write();
p.write();

(just an example). There is no such functionObject that I know of (but it might be an interesting candidate for the simpleFunctionObjects).

This still leaves the problem that the data still is in OF-format. The hardcore solution would be to lift the functionality of the ensight-Converter into a functionObject (good luck)

In pyFoam there is currently is no ready-made solution to your problem (I have been thinking about a facility that "watches" a case and if there is a new time directory calls a utility (reconstructPar, foamDataToExcel etc) but never had the time/pressure to implement it. Plus in your case the actual conversion probably would take more CPU-time than the calculation because the converter would have to load the whole mesh every time it is called)

Bernhard

olesen July 27, 2009 06:21

Quote:

Originally Posted by melanie (Post 223651)

I am dealing with an unsteady simulation for which I would like to export, at each time step, pressure and velocity data in Ensight format.
...
Does someone have an idea to help me?

A functionObject would be the first place to examine. The next bit which you should check is how foamToEnsightParts is calling the Ensight conversion routines (src/conversion). At the moment, writing in parallel isn't supported, but this should still give you very good starting points.

/mark

melanie July 27, 2009 07:21

Thanks a lot Mark and Bernhard, I will have a look at these functionObject you mention. I will let you know what's going on!
mélanie

melanie September 23, 2009 09:44

hi, actually I left this subject for a time, and now that I'm back I have discovered that you already made the job with writeFields* functionObjects! Thanks a lot Bernhard. Now I have to switch to OF1.6 to benefit from the timeSelector feature of foamToEnsight utility, and the processing will be almost perfect! Indeed foamToEnsight is able to work in parallel on decomposed cases so the reconstruction step is not any more required.
mélanie

gschaider September 23, 2009 12:20

Quote:

Originally Posted by melanie (Post 230312)
hi, actually I left this subject for a time, and now that I'm back I have discovered that you already made the job with writeFields* functionObjects! Thanks a lot Bernhard. Now I have to switch to OF1.6 to benefit from the timeSelector feature of foamToEnsight utility, and the processing will be almost perfect! Indeed foamToEnsight is able to work in parallel on decomposed cases so the reconstruction step is not any more required.
mélanie

Guilty. I forgot to announce it. And I think it isn't documented on the Wiki-page. If you would do that (doesn't have to be more than for the other stuff) it would show me that your "Thanks" is sincere ;)

Bernhard

PS: yes. This is part of a plot to get more people to contribute. Guilty again

melanie September 24, 2009 03:46

This is done Bernhard, I added a very short description out of the header of .H files on the Wiki-page. My first contribution to the community...
melanie

gschaider September 28, 2009 11:38

Quote:

Originally Posted by melanie (Post 230393)
This is done Bernhard, I added a very short description out of the header of .H files on the Wiki-page.

Great.

Quote:

Originally Posted by melanie (Post 230393)
My first contribution to the community...

But beware: this might become a habit ;)

melanie September 29, 2009 02:12

Quote:

But beware: this might become a habit ;)
... and I will start today!!! Indeed I would like to update these functionObjects in order to get them comply to the ''standard'' OF output, i.e. with a uniform/time file in each time directory (see thread http://www.cfd-online.com/Forums/ope...t-utility.html for the complete story). Unfortunately, I don't know where to start. I was unable to locate in OF sources where OF data writing is defined... Could you please give me a hand?
Thanks a lot!
melanie

olesen September 29, 2009 02:26

Quote:

Originally Posted by melanie (Post 230781)
... Indeed I would like to update these functionObjects in order to get them comply to the ''standard'' OF output, i.e. with a uniform/time file in each time directory
...
Unfortunately, I don't know where to start. I was unable to locate in OF sources where OF data writing is defined... Could you please give me a hand?

The place to look is src/OpenFOAM/db/Time/TimeIO.C
specifically the Foam::Time::writeObject() method

gschaider September 29, 2009 17:34

Quote:

Originally Posted by melanie (Post 230781)
... and I will start today!!! Indeed I would like to update these functionObjects in order to get them comply to the ''standard'' OF output, i.e. with a uniform/time file in each time directory (see thread http://www.cfd-online.com/Forums/ope...t-utility.html for the complete story). Unfortunately, I don't know where to start. I was unable to locate in OF sources where OF data writing is defined... Could you please give me a hand?
Thanks a lot!
melanie

I didn't read Mark's answer before answering in the other thread. Should have. If I read that source correctly calling that method won't help as it only write uniform when it thinks the outputTime has come (something that FO tries to bypass). So I guess you'll have to emulate the uniform-writing part. And make sure not to rewrite it when Time already wrote it

Bernhard


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