Quick OpenFoam to MatLab lesson plz :)
Hey fellow Foamers,
I want to transfer my data from OpenFoam to MatLab in order to do plots of correlations for fuel-distribution and penetration depth aso,
Do I need plugin-programs for MatLab or anything similar?
Also how do I load it into MatLab and how is the data read ? I have a refined Mesh so there are more cells in one direction than the other, does it read x - axis before y - axis etc....?
I would really appreciate the help
Just export your OpenFOAM data in any text format (.txt, .csv, ...).
Then there are many different possibility in matlab to read a text file but the most famous are "load" and "textscan".
Load is really easy to use but no so powerfull. Indeed, your text file must be a rectangular matrix without header...
So for me textscan is the best because you can go through your whole file and import every data that you are interested in. All the possibility are really well explained in the matlab help for texscan.
Okay thx !
I was curious since I just tried to plot the velocity (i think it was) and the output was pretty strange. I got the magnitude as a function of the grid points. Ill try to plot it as a function of time.
Hello Rickard and Christian,
I am using interFoam for jet breakup studies. I want to use Matlab for perofrming some statistics on breakup length based on time. So i want to read the output of alpha1 into matlab.
From what I understood from your post, i will have to load the certain time step output of openfoam output in paraFoam and then load alpha1 and surface and then switch to spreadsheet view and then export that data into .txt or .csv file.
This gives me the alpha1 with respect to points (alpha1 x y z).
But i have hundreds of time steps and do I have to load each time step in paraFoam and export it in .csv format.
Is there any other way to export the data into .csv format.
Basically what I did was to use sampleDict to choose the plane/surface I want to study.
For instance, when I want to observe my jet penetration length , i assumed that the maximum penetration distance was along the central propagating axis.
Therefore this was the plane I extracted using sampleDict
It looked something like: plane (-0.01 0 0)
normal (0 0 -1)
since my injection is in the negative z-axis
Using sampleDict I just used
sample -time . . . . input time (see you dont need all the output time)
Also you dont need paraview or anything. I hope you chose your output as ascii
Ask if you need more help
Hi, I am new to foam please can you tell me how to put these changes in the sampleDict. For example I have a following sampleDict
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
start (0.0 0.00 0.0);
end (0.0 0.0 -0.205);
|All times are GMT -4. The time now is 02:50.|