|
[Sponsors] |
May 30, 2014, 10:21 |
OpenFOAM files into csv format
|
#1 |
New Member
Join Date: Nov 2011
Posts: 22
Rep Power: 15 |
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, Kit |
|
June 4, 2014, 12:15 |
|
#2 |
New Member
Join Date: Nov 2011
Posts: 22
Rep Power: 15 |
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.
|
|
July 25, 2014, 23:18 |
|
#3 |
New Member
David H.
Join Date: Oct 2013
Posts: 25
Rep Power: 13 |
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".
Eg: CCX: 3 ( (0.00) (0.01) (0.02) ) p: 3 ( (10) (9.9) (9.8) ) 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. |
|
August 16, 2014, 08:44 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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, Bruno
__________________
|
|
May 16, 2023, 04:58 |
|
#5 | |
Member
sadra mahmoudi
Join Date: Feb 2021
Location: Austria
Posts: 39
Rep Power: 5 |
Quote:
Hi All, I have a question abot using csv files in openfoam and I would be thankful if you help me. I am doing some experimental research and I have the velocity vector in a domain in a csv file. I would like ti read this file in the paraview in order to postprocess it. As far as I know, after importing the file, I need to use "table to point" filter. I did it successfully. Now, I would like to plot velocity over a line, but it does not work. I think there are some missing seteps in between in order to be able to post process further. I would be thankful if you share your opinion with me. Best regards |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[General] Particle Tracking by providing particle position in CSV format | t.teschner | ParaView | 3 | June 21, 2014 17: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 04:01 |
64bitrhel5 OF installation instructions | mirko | OpenFOAM Installation | 2 | August 12, 2008 19:07 |
[making animations] fclose fails to close files? | Mika | FLUENT | 0 | March 30, 2001 09:19 |