Hello World. I'm struggling
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?
Hello Sebastian, Something
Something is not correct if the utility is not creating a file. The file structure should look like this:
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:
Well the utility is creating t
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.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
arguments "/home/sega/OpenFOAM/sega-1.4.1/run/tutorials/solidDisplacementFoam/plateHole" off off off;
start (0 0.5 0.25);
end (0 2 0.25);
// ************************************************** *********************** //
Sebastian, In the sampleDic
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:
start (0.05 0.5 0.25);
end (0.05 0.5 0.25);
Hi Sebastian, You have to c
You have to correct sampleDict. Try to modify
Yes. sigma.component(0) is wor
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.
Sebastian, The tutorial say
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:
Yes, you are right. I haven't
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?
Hi forum members, I'm new u
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);
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
alphax = 1 - rx^(-N) + rx^(-1)
if alphax == 1
deltaSx = lx/N
deltaSx = lx * (rx - 1) / ((alphax*rx)-1) % smallest cell length
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
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
if Ry > 1
alphay = Ry^M
alphay = 1 - ry^(-M) + ry^(-1)
if alphay == 1
deltaSy = ly/M
deltaSy = l * (ry - 1) / ((alphay*ry)-1) % smallest cell length
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
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
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!!
Hi Mali, If I'm getting your
If I'm getting your problem right, you could use Filters->Cell Centers like this:
Hi Takuya, You are right, I
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
Hi mali, At least displaying
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.
Hi Takuya, Thank you for th
Thank you for the information. It is really help, at least i can compare with my matlab program. http://www.cfd-online.com/OpenFOAM_D...part/happy.gif
Hi I'm having similar problem
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?
Nevermind, I got it. (Hint: Sa
Nevermind, I got it. (Hint: Save Data in paraView, choose ascii, and then grep&awk).
Good day/evening ! Could some
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
Hi Diauddin, Your problem s
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...
Right. Use ================
//for this run "foamCalc components U" first
//for this run "foamCalc mag U" first
//for this run "ptot" first
in your sampleDict
Wolfgang: Looks like you ha
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:
|All times are GMT -4. The time now is 14:59.|