CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Post-Processing

OpenFOAM files into csv format

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

LinkBack Thread Tools Display Modes
Old   May 30, 2014, 09:21
Default OpenFOAM files into csv format
New Member
Join Date: Nov 2011
Posts: 22
Rep Power: 7
kd55 is on a distinguished road
hi there,

Does anybody have a bit of code to post-porcess the openfoam data files into csv format; needing to do quite a few files, so doing it manually is pretty tedious. Trying to analyse data in matlab.

Kind regards,

kd55 is offline   Reply With Quote

Old   June 4, 2014, 11:15
New Member
Join Date: Nov 2011
Posts: 22
Rep Power: 7
kd55 is on a distinguished road
Ok, I kind of found a work around which will do for certain situations. If you use the sample utility or 'foamCalc components U', it puts the data (providing you can get it with these two utilities) in an easy format to extract - I'm using matlab and can use text scan quite easily with it.
kd55 is offline   Reply With Quote

Old   July 25, 2014, 22:18
New Member
David H.
Join Date: Oct 2013
Posts: 24
Rep Power: 5
djh2 is on a distinguished road
It's possible to create a data structure in Matlab that uses the output from "writeCellCentres". This OpenFOAM utility will write your cell-centered x y and z points "ccx" "ccy" and "ccz" to 0. These files are lists that correspond to the cells where the field data is stored, such as in the output file "p".



This way you can construct your Matlab data structure and say "Give me p at x=0.01" and get out "9.9".

This is just the conceptual implementation, but I have used this method with OpenFOAM, based on my research advisor's Matlab scripts.
djh2 is offline   Reply With Quote

Old   August 16, 2014, 07:44
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,748
Blog Entries: 39
Rep Power: 103
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings to all!

I've finally managed to take a look at this thread.
Regarding the original question, it really depends on the level of detail you want to extract. Because if it's just a matter of sampling the data to CSV file, it's possible to do it with sample. A detailed example is provided in the file "applications/utilities/postProcessing/sampling/sample/sampleDict".

If it's regarding a complete export of the fields to CSV, then I'm not aware of any public application which provides such a feature. It's actually not that complicated to do, specially since there are already several "foamTo*" utilities in OpenFOAM that can be used as a reference. But I guess the problem is that a specification for the types of CSV exports that are needed hasn't been drawn yet, so there hasn't been such a utility created yet.

On the other hand, it's somewhat easier to simply use ParaView to load the case, use the "Python Trace" feature to record the steps used for exporting the desired data to CSV and then use pvpython pr pvbatch to run the Python script.

Best regards,
wyldckat 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
Particle Tracking by providing particle position in CSV format t.teschner ParaView 3 June 21, 2014 16:12
Converting CSV to tecplot format xiyuqiu Tecplot 1 November 12, 2010 07:30
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
[making animations] fclose fails to close files? Mika FLUENT 0 March 30, 2001 08:19

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