CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   problem with sampling Utility in openFOAM 1.6 (http://www.cfd-online.com/Forums/openfoam-post-processing/67941-problem-sampling-utility-openfoam-1-6-a.html)

carmir September 1, 2009 09:16

problem with sampling Utility in openFOAM 1.6
 
Hello to All,

I'm trying to use the sampling utility within the openFOAM version 1.6 in order to extract data for later post-processing in Matlab. I want to extract the cell values of the solution variables (x-velocity) along the y-coordinate for different x-locations.

My problem is that after running the utility, none sample data is stored / created.

Below is a copy of the dictionary entries I am using:

-----------------------------sampleDict----------------------------------
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cellPoint;

setFormat raw;

sets
(
location1
{
type midPoint;
axis y;
start (0.02 0.00 0.0);
end (0.02 0.120 0.0);
}
);

surfaces ();

fields
(
U.component(0)
);
-----------------------------------------------------------------------

If I understood the instructions in the User-Guide well, the utility is supposed to create a folder for each solution-time and each set (location) with the ASCII files inside. Here is the output I get when executing the sample Utility:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0

Time = 0.2

Time = 0.4

Time = 0.6

Time = 0.8

Time = 1

End

-------------------------------------------------------------------------

First I tough that my entries in the dictionary were wrong (for example that my coordinates were outside of the domain), but I checked them several times and started using other options like "uniform", "cell", "pointAndCell", ...) as well. But the result was always the same.

I would appreciate any kind of help or suggestions. Thank you very much

carmir September 3, 2009 06:07

entry in sampleDict was not recognized
 
Hello again,

after several trials, I think I found the problem. In the user guide, on chapter 6.5 three options are listed for the sampling of tensor/vector fields: the whole tensor (e.g. U), only one component (e.g. U.component(0)) or the magnitude (e.g. mag(U)). These fields keywords should be used in the sampleDict file. However, only the sampling of the whole tensor seem to work.

In my case, after changing the entry in the sampleDict from:

fields
(
U.component(0)
);

to

fields
(
U
);

the utility worked properly, and the ASCII files were created in the sets directory.

So the problem concerns now only to the sampling of specific tensor terms. I will take a look at the source files of the utility, perhaps has someone any suggestion were to start, since I'm a newbie in openFOAM.

Thanks

bigphil August 31, 2010 13:52

I realise this thread is old,
but for anyone else who has a similar problem,
you can use "foamCalc" to calculate the components of a tensor/vector and then you can you sample to sample these components.

For example:
If I have the stress tensor sigma, then I type:
foamCalc components sigma

This will create the volScalarFields sigmaxx,sigmayy,sigmazz,sigmaxy,sigmaxz and sigmayz.

Then you can sample these fields.


Philip

Edison_Ge September 5, 2010 22:32

Quote:

Originally Posted by bigphil (Post 273519)
I realise this thread is old,
but for anyone else who has a similar problem,
you can use "foamCalc" to calculate the components of a tensor/vector and then you can you sample to sample these components.

For example:
If I have the stress tensor sigma, then I type:
foamCalc components sigma

This will create the volScalarFields sigmaxx,sigmayy,sigmazz,sigmaxy,sigmaxz and sigmayz.

Then you can sample these fields.


Philip

Hi Philip,
Thanks for the tips. Do you also have some idea about calculate particle values? say I want the velocity components of my all my particles located under case/time/lagruangian, how can I get them?

bigphil September 6, 2010 04:37

Edison_Ge,

Unfortunately I have no experience with particles so I cannot help.
You could try:
foamCalc components lagrangian/U
but that is a total guess, so I really don't know.

Sorry I couldn't be of more help,

Philip

Jimbomet November 21, 2011 11:03

Hi,
I have a problem with sample, it doesn't work at all...
I want only to sample the pressure field in the x direction, and my sampleDict file so reads:

interpolationScheme cell;
setFormat xmgr;
sets
(
line
{
type uniform;
axis x;
start ( 0 1.5 0.05 );
end ( 3 1.5 0.05 );
nPoints 100;
}
);
fields ( p );


but running it, it says:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading set description:
line

Time = 0
Time = ....
End

and no outputs are created in my directory. What's wrong in what I'm doing?
Thanks for help

musahossein December 6, 2011 17:31

sampleDict - keyword patch rejected for some reason
 
Dear all:

I have the following sampleDict file:

setFormat raw;
surfaceFormat raw;

interpolationScheme cellPoint;

fields
(
alpha1
p
);


sets
(
left
{
type uniform;
axis xyz;
start ( 0 -15.0 5.0);
end ( 0 -15.0 -5.0);
nPoints 10;
}
middle
{
type uniform;
axis xyz;
start ( 0 0 5.0);
end ( 0 0 -5.0);
nPoints 10;
}
right
{
type uniform;
axis xyz;
start ( 0 15 5.0);
end ( 0 15 -5.0);
nPoints 10;
}
);

surfaces
(
test01
{
type patch;
patchName leftWall;
interpolate false;
triangulate true;
}
);

however, when I run it I get the following error:

musa@musa-Satellite-M35X:~/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D$ sample
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 2.0.1-51f1de99a4bc
Exec : sample
Date : Dec 06 2011
Time : 16:08:04
Host : musa-Satellite-M35X
PID : 7903
Case : /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Disallowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading set description:
left
middle
right



--> FOAM FATAL IO ERROR:
keyword patches is undefined in dictionary "/home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/sampleDict::surfaces"

file: /home/musa/OpenFOAM/musa-2.0.1/run/tutorials/multiphase/interDyMFoam/ras/sloshingTank2D/system/sampleDict::surfaces from line 69 to line 72.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting

if I dont use the "patch" keyword, then how am I supposed to define where the pressure is to be evaluated? Any suggestions / advice?

Thanks in advance

musahossein December 6, 2011 19:47

Quote:

Originally Posted by Jimbomet (Post 332936)
Hi,
I have a problem with sample, it doesn't work at all...
I want only to sample the pressure field in the x direction, and my sampleDict file so reads:

interpolationScheme cell;
setFormat xmgr;
sets
(
line
{
type uniform;
axis x;
start ( 0 1.5 0.05 );
end ( 3 1.5 0.05 );
nPoints 100;
}
);
fields ( p );


but running it, it says:

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading set description:
line

Time = 0
Time = ....
End

and no outputs are created in my directory. What's wrong in what I'm doing?
Thanks for help

In OpenFOAM, the x axis is in and out of the paper. Y is horizontal and Z is up and down. You may want to check your axes and the orientation of your model relative to it.

Sherlock_1812 February 25, 2014 07:43

Hi all,

This is a very old thread, but I would like to ask if there is a way to sample velocity magnitude in the r-direction? I'm using a circular geometry where I'd like to see variation along r. Can there be an alternate definition for axis instead of x,y,z or xyz?

musahossein February 25, 2014 12:06

Quote:

Originally Posted by Sherlock_1812 (Post 476682)
Hi all,

This is a very old thread, but I would like to ask if there is a way to sample velocity magnitude in the r-direction? I'm using a circular geometry where I'd like to see variation along r. Can there be an alternate definition for axis instead of x,y,z or xyz?

Interesting! I dont know. But if you look at the OpenFoam manual I think they give you conversion between cartesian and cylidrical coordinates. Also I know a paper that used open foam to study sloshing in circular tanks. They may have some pointers as to how they solved the problem in cylindrical coordinates. The paper is titled "Compariosion of CFD with Simplified Models for sloshing in space-craft tanks" Authors: O. Gloth, Y. Xia and R. Schwane. You could find it with google search. I think the paper is a free download.

Sherlock_1812 February 26, 2014 03:00

Thank you. I will have a look at the paper to see if i can get hints. Also, how should the 'distance' option in axis be specified?


All times are GMT -4. The time now is 11:08.