CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to use datafile with gnuplot

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 10, 2008, 15:02
Default Hello World. I'm struggling
  #1
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Hello World.

I'm struggling trought the second tutorial.
I came to the point of comparing the numerical solution with the analytical.

Unfortunately I don't get what to do with the plot command stated as:

plot [0.5:2] '<datafile>', 1e4*(1+(0.125/(x**2))+(0.09375/(x**4)))

What has to be in the place of <datafile>?

As I have found there is no specific file created by the sample utility - rather there are some empty directorys.

I have installed gnuplot with x11-package.

What am I doing wrong?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 10, 2008, 15:18
Default Hello Sebastian, Something
  #2
Senior Member
 
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17
mike_jaworski is on a distinguished road
Hello Sebastian,
Something is not correct if the utility is not creating a file. The file structure should look like this:

<root>/<case>/samples/<timesteps>/<samplefiles>

that is, it makes a "samples" subdirectory off of the case directory. In the sampleDict file, you give a name to a sample subset and this forms the start of the file name created (the rest being made of the fields).

I made use of gnuplot in the tutorial I wrote for benchmarking OF and you can see an example of the sample utility used with gnuplot here:

http://www.openfoamwiki.net/index.php/Blasius_Flat-Plate_Flow_Benchmark#Running_ the_Case_and_post-processing

Good Luck,
Mike J.
mike_jaworski is offline   Reply With Quote

Old   April 10, 2008, 15:54
Default Well the utility is creating t
  #3
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Well the utility is creating the timestep-directories, but they are all empty.

Where do I have to state the name of the sample subset?

Is It usefull to post the sampleDict file?
If so, here it is:

// FoamX Case Dictionary.

FoamFile
{
version 2.0;
format ascii;

root "/home/sega/OpenFOAM/sega-1.4.1/run/tutorials/solidDisplacementFoam";
case "plateHole";
instance "system";
local "";

class dictionary;
object sampleDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

arguments "/home/sega/OpenFOAM/sega-1.4.1/run/tutorials/solidDisplacementFoam/plateHole" off off off;

interpolationScheme cellPoint;

writeFormat raw;

sampleSets
(
uniform
{
name leftPatch;
axis distance;
start (0 0.5 0.25);
end (0 2 0.25);
nPoints 100;
}
);

fields
(
sigmaxx
);


// ************************************************** *********************** //
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 10, 2008, 16:11
Default Sebastian, In the sampleDic
  #4
Senior Member
 
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17
mike_jaworski is on a distinguished road
Sebastian,

In the sampleDict file you quote, the "name" of the sample subset is "leftPatch". The fields that you are sampling is "sigmaxx". When you run the sampl utility, it should make some file called:

leftPatch_sigmaxx.xy or something like that.

Are there any errors when you run the sample utility itself?

Also, there are sometimes problems with the sample utility when it's placed on top of or along the edges of some elements. Try moving it in a small amount:

...
sampleSets
(
uniform
{
name leftPatch;
axis distance;
start (0.05 0.5 0.25);
end (0.05 0.5 0.25);
nPoints 100;
}
);
...
mike_jaworski is offline   Reply With Quote

Old   April 10, 2008, 20:05
Default Hi Sebastian, You have to c
  #5
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi Sebastian,

You have to correct sampleDict. Try to modify

fields
(
sigmaxx
);

to

fields
(
sigma.component(0)
);

.

Takuya
7islands is offline   Reply With Quote

Old   April 11, 2008, 09:45
Default Yes. sigma.component(0) is wor
  #6
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Yes. sigma.component(0) is working.
But why is it stated otherwise in the tutorial?

Now, I have files in each timestep-directory called leftPatch_sigma.component(0).xy

But how can I plot these files?
I really don't get I out of the tutorial.

Thanks.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 11, 2008, 11:33
Default Sebastian, The tutorial say
  #7
Senior Member
 
Michael Jaworski
Join Date: Mar 2009
Location: Champaign, IL, USA
Posts: 126
Rep Power: 17
mike_jaworski is on a distinguished road
Sebastian,
The tutorial says you should use the sigmaComponents utility before using sample.

The output of the sample utility is an ASCII data file with the first column (if you chose distance) as the distance along the line you defined by the points start and end. The other columns are the fields you sampled (sigma.component(0) or sigmaxx).

If you need help with using gnuplot, their website has several demos and tutorials can be found online:
http://www.gnuplot.info/

Good Luck,
Mike J.
mike_jaworski is offline   Reply With Quote

Old   April 12, 2008, 07:39
Default Yes, you are right. I haven't
  #8
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Yes, you are right.
I haven't run sigmaComponents before running sample.
But the tutorial is rather sloppy there.
It's not explaining where to find the sigmaComponent utility in FoamX. Maybe thats the cause I wasn't running it.

I think I will visualize the sample data with MATLAB rather than gnuplot. I'm much more familiar with this.

BTW: Which plotting tool seems to be most professional for publications?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   August 31, 2008, 23:05
Default Hi forum members, I'm new u
  #9
Member
 
Join Date: Mar 2009
Location: adelaide, SA, Australia
Posts: 32
Rep Power: 17
mali is on a distinguished road
Hi forum members,

I'm new user of OpenFoam, less than 2 months experiences. But i'll say that openFoam is really great and fun.

I'm using flow around a square cylinder as a my case study. I have done the pre-processing and solving the case using icoFoam.

Now, i'm in the stage of doing post-processing. I extensively using paraFoam to do this. However, i could not find the way to plot velocity fields at the center of every grid cell that i interested in. Instead of doing in paraFoam, i utilize the sampleDict by giving the specific coordinate of the center grid cell.

Here is the example of how i calculate the coordinate position (mesh grading: simpleGrading);

=================================================
matlab command:

N = 100 % number of cell in x direction
M = 100 % number of cell in y direction
lx = 20 % length of total cell
ly = 1
Rx = 0.125 % grading x ratio
Ry = 1 % grading y ratio

Xs = 0.5 % coordinate first cell
Ys = -0.5 % coordinate first cell

rx = Rx^(1/(N-1))
ry = Ry^(1/(M-1))

if Rx > 1
alphax = Rx^N
else
alphax = 1 - rx^(-N) + rx^(-1)
end


if alphax == 1
deltaSx = lx/N
else
deltaSx = lx * (rx - 1) / ((alphax*rx)-1) % smallest cell length
end

deltaLx = deltaSx/Rx % largest cell length

for n = 1:N+1
if n == 1
deltax(n) = deltaSx %cell length expand in increase 'n'
X(n) = Xs
else
deltax(n) = (deltax(n-1))/rx
X(n) = deltax(n-1) + X(n-1)
Xc(n-1) = (X(n) + X(n-1))/2 % Xc is center coordinate of the cell
end
end


if Ry > 1
alphay = Ry^M
else
alphay = 1 - ry^(-M) + ry^(-1)
end

if alphay == 1
deltaSy = ly/M
else
deltaSy = l * (ry - 1) / ((alphay*ry)-1) % smallest cell length
end

deltaLy = deltaSy/Ry % largest cell length

for m = 1:M+1
if m == 1
deltay(m) = deltaSy %cell length expand in increase 'n'
Y(m) = Ys
else
deltay(m) = (deltay(m-1))/ry
Y(m) = deltay(m-1) + Y(m-1)
Yc(m-1) = (Y(m) + Y(m-1))/2 % Xc is center coordinate of the cell
end
end

==============================================

after i got the coordinate of the center cell, i write it into the sampleDict.

Is there any easiest way for me to obtain the flow fields at the specific center of grid cell that i have created?

Thank you & have a nice day!!
-mali-
__________________
mali
mali is offline   Reply With Quote

Old   September 1, 2008, 08:34
Default Hi Mali, If I'm getting your
  #10
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi Mali,
If I'm getting your problem right, you could use Filters->Cell Centers like this:


Takuya
7islands is offline   Reply With Quote

Old   September 1, 2008, 22:32
Default Hi Takuya, You are right, I
  #11
Member
 
Join Date: Mar 2009
Location: adelaide, SA, Australia
Posts: 32
Rep Power: 17
mali is on a distinguished road
Hi Takuya,

You are right, I could view the center point of every cell together with its vector fields.

But I still cannot get the exact coordinate of that cell center and its vector fields value.

BTW, could paraView plot the exact cell center coordinate versus velocity fields?

Thank you & cheers
-mali-
__________________
mali
mali is offline   Reply With Quote

Old   September 1, 2008, 23:45
Default Hi mali, At least displaying
  #12
Super Moderator
 
Takuya OSHIMA
Join Date: Mar 2009
Location: Niigata City, Japan
Posts: 518
Blog Entries: 1
Rep Power: 20
7islands is on a distinguished road
Hi mali,
At least displaying coordinates and vector values is possible. Choose CellCenters1 in the Pipeline Browser and click either Split Horizontal [ | ] or Split Vertical [-] at the top right of the view, and select Spreadsheet View.


But I haven't tried plotting them within ParaView.
Takuya
7islands is offline   Reply With Quote

Old   September 3, 2008, 03:30
Default Hi Takuya, Thank you for th
  #13
Member
 
Join Date: Mar 2009
Location: adelaide, SA, Australia
Posts: 32
Rep Power: 17
mali is on a distinguished road
Hi Takuya,

Thank you for the information. It is really help, at least i can compare with my matlab program.

cheers
-mali-
__________________
mali
mali is offline   Reply With Quote

Old   October 10, 2008, 09:26
Default Hi I'm having similar problem
  #14
hkb
New Member
 
Henrik Bergersen
Join Date: Mar 2009
Posts: 17
Rep Power: 17
hkb is on a distinguished road
Hi
I'm having similar problems. I'd like to plot my fields i matlab and for that I need the cell center coordinates. Did you figure out how to export these coordinates from paraView? Or is there another way to get the cell center coordinates?

Best Regards
Henrik Bergersen
hkb is offline   Reply With Quote

Old   October 10, 2008, 10:13
Default Nevermind, I got it. (Hint: Sa
  #15
hkb
New Member
 
Henrik Bergersen
Join Date: Mar 2009
Posts: 17
Rep Power: 17
hkb is on a distinguished road
Nevermind, I got it. (Hint: Save Data in paraView, choose ascii, and then grep&awk).

Henrik
hkb is offline   Reply With Quote

Old   October 16, 2008, 04:14
Default Good day/evening ! Could some
  #16
New Member
 
Diauddin Nammari
Join Date: Mar 2009
Posts: 8
Rep Power: 17
nammari is on a distinguished road
Good day/evening !
Could someone help please, I have been trying to sample velocity and pressure using the sample command( after setting up the sampledict)

The command creates the directory and the files, however there is no data in them. I checked the foam generated files there is data there.

I hope someone can help
Best regards
Diauddin
nammari is offline   Reply With Quote

Old   October 23, 2008, 03:35
Default Hi Diauddin, Your problem s
  #17
New Member
 
Johannes Schöön
Join Date: Mar 2009
Location: Hamburg, Germany
Posts: 3
Rep Power: 17
schoon is on a distinguished road
Hi Diauddin,

Your problem sounds exactly like the one I solved a few minutes ago. The catch here is that as soon as your sampleDict file is OK, the sample utility will run without complaints, even though the data of interest isn't there.

For instance, if you want to extract the magnitude of the velocity U, it isn't enough to specify "mag(U)" in the sampleDict file, as you may think after reading the manual, you must ask for "magU" and run "foamCalc mag U" first.

It took me one extra night of sleep to figure that one out...

Cheers

Johannes
schoon is offline   Reply With Quote

Old   December 8, 2008, 04:52
Default Right. Use ================
  #18
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
Right. Use

=============================================

fields
(
p
//U

//for this run "foamCalc components U" first
//Uy
//Ux
//Uz

//for this run "foamCalc mag U" first
//magU
//for this run "ptot" first
//ptot
);

=============================================

in your sampleDict
wolle1982 is offline   Reply With Quote

Old   March 4, 2009, 14:28
Default Wolfgang: Looks like you ha
  #19
Senior Member
 
musaddeque hossein
Join Date: Mar 2009
Posts: 309
Rep Power: 18
musahossein is on a distinguished road
Wolfgang:

Looks like you have had some success with sampleDict. I am trying to run sampleDict in the dambreak tutorial in OpenFoam 1.5 to obtain pressure values along a wall, say leftWall for example. The problem is that the tutorial runs fine, but no files are generated.

I posed this problem to the bug report and per Matjis instructions I modified the file to include interpolation and triangulation, but nothing is generated:
http://www.cfd-online.com/cgi-bin/OpenFOAM_Discus/show.cgi?tpc=126&post=32641#POST326 41

Any suggestions?

Thanks.

Musaddeque
musahossein is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Gnuplot Sham FLUENT 0 April 23, 2008 02:12
Help with GNUPlot Renato. Main CFD Forum 6 June 6, 2007 19:51
gnuplot Mich Main CFD Forum 0 August 7, 2006 07:30
about gnuplot Tom,L. Main CFD Forum 3 December 30, 2002 13:55
Related to using gnuplot ANIL LAL Main CFD Forum 2 October 22, 1999 11:20


All times are GMT -4. The time now is 14:01.