paraviewopenfoam

How to export openfoam data to .csv file


After running a simpleFoam simulation, I would like to export the simulation data to a .csv file using only cmd (not opening paraview). Is it possible? (In openfoam v10)

The way I am doing right now is opening the openfoam directory in paraview, skipping to time=50, selecting 'U' and File->Save Data.

The .csv file looks like this: "Points:0","Points:1","Points:2","U:0","U:1","U:2","p" -4.147,-3.0289,0,-0.011237,-0.00025071,0.00025511,5.7826e-05 -4.0892,-3.0333,0,0,0,0,4.6586e-05 ...


Solution

  • You can use Python scripting to do that: https://docs.paraview.org/en/latest/UsersGuide/introduction.html#getting-started-with-pvpython

    Basically you will need to OpenDataFile and to SaveData (from paraview.simple package)

    But if you know how to do in the interface, you can use the Python Trace (from Tools menu) to generate a Python script: https://docs.paraview.org/en/latest/UsersGuide/introduction.html#tracing-actions-for-scripting