CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Using MatLab (http://www.cfd-online.com/Forums/openfoam/78765-using-matlab.html)

Rickard.Solsjo August 2, 2010 03:02

Using MatLab
 
Hi everyone!
I have succesfully used sampleDict to get a plane slicing through my domain. So I have the x,y and z-direction plus the amount of fuel in each cell.
Does anyone know how to plot this in MatLab?

akidess August 2, 2010 03:18

http://web.cecs.pdx.edu/~gerry/MATLA...ml#loadAndPlot

musahossein December 4, 2011 09:49

Plotting SampleDict output using GNU Plot
 
I would appreciate it very much if some one could tell me how to plot the sampleDict output using GNU plot. I can do simple x y plots in GNU plot, but I have no idea how to plot all the individual files in the set folders. Would I have a write a script of sorts? I had assumed that since OpenFOAM permits data output in GNU format, there would some direction in the OpenFOAM users guide as to how to plot the data in GNU plot. But I have not found it yet. Any suggestion/help would be greatly appreciated. Thanks!

wyldckat December 4, 2011 16:54

Hi musahossein,

Without looking deeper into this, I can say that the tutorial "mesh/moveDynamicMesh/simpleHarmonicMotion" from OpenFOAM 2.0 seems to have several hints to what you need to do. There you'll find 3 important files:
  • Allrun - the main script for running the tutorial.
  • extractData - called by "Allrun" for extracting data into a format that gnuplot can easily understand.
  • shm.gnuplot - the script for gnuplot.
Another tutorial that uses gnuplot is "./incompressible/boundaryFoam/boundaryWallFunctionsProfile", but at first glance is doesn't seem to do what you need.


Good luck!
Bruno

tonyuprm December 4, 2011 17:06

1 Attachment(s)
Hey musaddeque,

I had the same situation a while ago having too many plots. Scripting is the way to go. I first used Octave to plot and handle different files. Octave uses gnuplot as the plotting engine. I had a hard time getting quality plots because of bugs between Octave/gnuplot and finally opted for using python and the matplotlib which works like a charm for generating good quality plots.

gl,

Tony

Here are some scripts which might help.

Attachment 10313

musahossein December 4, 2011 19:54

Bruno / Tom,
Thankyou very much for your suggestions and files.

Musa


All times are GMT -4. The time now is 03:52.