|
[Sponsors] |
July 16, 2010, 04:46 |
Quick OpenFoam to MatLab lesson plz :)
|
#1 |
Senior Member
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 16 |
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 Thx R |
|
July 16, 2010, 05:37 |
|
#2 |
New Member
Christian
Join Date: Feb 2010
Location: Payerne, Switzerland
Posts: 9
Rep Power: 16 |
Hello,
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. Best regards, Christian |
|
July 16, 2010, 06:12 |
|
#3 |
Senior Member
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 16 |
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. |
|
February 15, 2011, 06:11 |
|
#4 |
Senior Member
Suresh kumar Kannan
Join Date: Mar 2009
Location: Luxembourg, Luxembourg, Luxembourg
Posts: 129
Rep Power: 17 |
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. regards K.Suresh kumar |
|
February 15, 2011, 06:22 |
exporting data
|
#5 |
Senior Member
Rickard
Join Date: May 2010
Location: Lund, Skåne, Sweden
Posts: 143
Rep Power: 16 |
Hey Kumar
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 |
|
October 24, 2011, 07:00 |
|
#6 | |
New Member
Join Date: Jan 2011
Posts: 9
Rep Power: 15 |
Quote:
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 FoamFile { version 2.0; format ascii; class dictionary; location system; object sampleDict; } //-----------------------------sampleDict---------------------------------- FoamFile { version 2.0; format ascii; class dictionary; location "system"; object sampleDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // interpolationScheme cellPoint; setFormat raw; sets ( location1 { type midPoint; axis z; start (0.0 0.00 0.0); end (0.0 0.0 -0.205); } ); surfaces (); fields ( U ); |
||
October 26, 2020, 12:58 |
|
#7 | |
Senior Member
Join Date: Jul 2019
Posts: 148
Rep Power: 7 |
Quote:
If I have extracted a surface, do I have to use griddata in matlab to draw the contour surface? Thanks. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM - Quick way to delete previous calculation & HowTo get access to variables | kriz | OpenFOAM | 12 | March 6, 2023 04:20 |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 06:36 |
OpenFOAM command from inside MATLAB | sega | OpenFOAM Post-Processing | 18 | September 25, 2012 08:35 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 06:56 |
OpenFOAM Debian packaging current status problems and TODOs | oseen | OpenFOAM Installation | 9 | August 26, 2007 14:50 |