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/)
-   -   Sample utility (http://www.cfd-online.com/Forums/openfoam-post-processing/75724-sample-utility.html)

Gearb0x May 4, 2010 03:25

Sample utility
 
Dear Foamers,

I'm trying to use the sample utility but this doesn't work... I'm using openfoam 1.6, simpleFoam.

here is my sampleDict :
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.0                                  |
|  \\  /    A nd          | Web:      http://www.openfoam.org              |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/

FoamFile
{
    version        2.0;
    format          ascii;

    root        ".";
    case        "";
    instance        "system";
    local          "";

    class          dictionary;
    object          sampleDict;
}

interpolationScheme cellPoint;

setFormat raw;

sets
(
    leftPatch
    {   
        type uniform;
        axis xyz;
        start (-0.095 0.4 0); //0.0875856727361679
        end  (-0.02  0.4 0);
        nPoints 50;
    }
);

surfaces    ();

fields        (U);

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

command : sample
here is the output :
Code:

iter:55420 at startPoint:(-0.02 0.4 0)
    node:112 octant:6 bb:(-0.02375 0.374062 -0.00109482) (-0.011875 0.4275 0)
    iter:55420 hit face:front at:(-0.02 0.4 0)
    node:112 octant:6 bb:(-0.02375 0.374062 -0.00109482) (-0.011875 0.4275 0)
    walking to neighbour containing:(-0.02 0.4 1.09482e-17)
    walked for point:(-0.02 0.4 0)
    to neighbour node:246 octant:2 face:back of octantBb:(-0.02375 0.374062 0) (-0.011875 0.4275 0.00109482)

iter:55421 at startPoint:(-0.02 0.4 0)
    node:246 octant:2 bb:(-0.02375 0.374062 0) (-0.011875 0.4275 0.00109482)
    iter:55421 hit face:back at:(-0.02 0.4 0)
    node:246 octant:2 bb:(-0.02375 0.374062 0) (-0.011875 0.4275 0.00109482)
    walking to neighbour containing:(-0.02 0.4 -1.09482e-17)
    walked for point:(-0.02 0.4 0)
    to neighbour node:112 octant:6 face:front of octantBb:(-0.02375 0.374062 -0.00109482) (-0.011875 0.4275 0)

iter:55422 at startPoint:(-0.02 0.4 0)
    node:112 octant:6 bb:(-0.02375 0.374062 -0.00109482) (-0.011875 0.4275 0)
    iter:55422 hit face:front at:(-0.02 0.4 0)
    node:112 octant:6 bb:(-0.02375 0.374062 -0.00109482) (-0.011875 0.4275 0)
    walking to neighbour containing:(-0.02 0.4 1.09482e-17)
    walked for point:(-0.02 0.4 0)
    to neighbour node:246 octant:2 face:back of octantBb:(-0.02375 0.374062 0) (-0.011875 0.4275 0.00109482)

and this never stopps. I tried to change the z coordinate for 0.0875856727361679 (because that is what parafoam was using when he ploted the data)
but this didn't work well either : it created a sets directory with 556 for the time, a field leftpatch_U.xy but with only four numbers...

Please does anyone know how to solve this problem?

Thanks for your help

naval May 7, 2010 09:33

Hi there,
I'm not sure, but after comparing your sampleDict to the one in the source dir I noticed two things:

Quote:

lineX1
{
type uniform;
axis distance;

//- cavity. Slightly perturbed so not to align with face or edge.
start (0.0201 0.05101 0.00501);
end (0.06
01 0.05101 0.00501);
nPoints 10;
}
Did you try changing the axis setting or perturbing your line a little?





And now for something completely different:

I tried to receive the field data on a cutting plane using the sample utility, so far without success. I get no output whatsoever only empty folders are being created.

I don't even get an error.

Well, at least almost no error. If I change the origin of the plane to (0 0 0) (and only then) I get the following warning:

Quote:

--> FOAM Warning :
From function Foam::cuttingPlane::walkCell
in file cuttingPlane/cuttingPlane.C at line 228
Did not find closed walk along surface of cell 26919 starting from edge 173432 in 1001 iterations.
Collected cutPoints so far:
1001
(
232
349
164
165
163
164
...
I'm stumped, but I might have completely misunderstood and misused the tool from the beginning.

Anyway, this is may sampleDict:


Quote:

...
fields (
U
p
);

interpolationScheme cellPointFace; // no change with different settings

setFormat raw;
surfaceFomat raw;

sets ( );

surfaces (
K_out
{
type plane;
basePoint (0.0 0.0 0.1);
normalVector (0 0 1);
interpolate true; //I tried leaving this, no change
}
);
cheers,
naval

Gearb0x May 10, 2010 09:22

Hi thanks for the help. Now it's working :)

One important problem I had : don't forget to set the output format for SETS & SURFACE otherwise you will end up with no error but no files either and might continue wondering why it's not working ... :)

mohsenkh599 May 26, 2010 09:50

hi foamers

I am using O.F. 1.6 and my sampleDict is:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cellPoint;

setFormat raw;

sets
(
leftPatch
{
type uniform;
axis y;
start ( 0 0.5 0.25 );
end ( 0 2 0.25 );
nPoints 100;
}
);

surfaces ();

fields ( sigmaxx );


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

but I get no results we running the sample utility. whats the problem?

Gearb0x May 26, 2010 10:19

Hi,

Do you have any error messages?

Are you sure you have correct field : sigmaxx ?
Are you sure your line is on your domain?

Can you try "face" instead of uniform? (then you can comment numberofpoints cause it's not needed anymore). This will sample data on your nodes :)

Tell me if it's working or not

titio June 2, 2010 14:43

Problem seems to be sigmaxx
 
Dear Foamers,

I also had problems initially in using the sample utility in OpenFoam 1.6, and also in OpenFoam 1.5, official and development version. I checked the fields that are sampled, and I discover that sigma was a tensor. SigmaEq is a scalar field. When I changed the fields to be sample to sigmaEq, a scalar, it worked with no problem.

Looks like sigmaxx does not work to get the xx component of the tensor. Tried other versions, such as:

sigma.component(tensor::XX) - gives segmentation fault
sigma(xx) - does not work
sigma().xx - does not work

How it is possible to sample components of vectorial and tensorial fields. Have I to define scalar fields for the components of the tensor that I want to sample? Or, how do I sample tensorial fields using sample? I try some solutions, none worked.

Regards,

António Martins

Gearb0x June 2, 2010 14:46

Never tried with tensor but my guess would be like velocity :

U.component(1)

So for tensor I would say

Sigma.componenent(n) where n can go from 1 to 9

titio June 9, 2010 09:35

Results of some tests I have
 
GearB0x,

Thanks for your reply, but unfortunately it did not work. To better understand what is going on, I went to the description in the internet of solidDisplacementFoam, to check out in particular the variable definition. After some tests, I found out the following.

- Only for variables defined for the mesh it was possible to sample. For example, for D is possible as it is defined as

volVectorField D
00003 (
00004 IOobject
00005 (
00006 "D",
00007 runTime.timeName(),
00008 mesh,
00009 IOobject::MUST_READ,
00010 IOobject::AUTO_WRITE
00011 ),
00012 mesh
00013 );

but sigmaD no, being D defined as

00041 (
00042 IOobject
00043 (
00044 "sigmaD",
00045 runTime.timeName(),
00046 mesh,
00047 IOobject::NO_READ,
00048 IOobject::NO_WRITE
00049 ),
00050 mu*twoSymm(fvc::grad(D)) + lambda*(I*tr(fvc::grad(D)))
00051 );

Please note the differences, sigmaD involves a calculated field,
D not.

Also, I cannot extract single components, but, as I got all the
components separately, there is not much of a problem, only more
numbers....

How I can sample sigmaD? Is the sample utility not suitable for
this? Should I use probes instead? Why there is an example of the
usage of samples that does not work at all? I do not believe this is
problem of the system I am using, Ubuntu 8.10.

If you any other idea, please answer me and help me out.

Regards,

António Martins

mirko June 24, 2010 18:22

Quote:

Originally Posted by mohsenkh599 (Post 260334)
hi foamers

I am using O.F. 1.6 and my sampleDict is:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cellPoint;

setFormat raw;

sets
(
leftPatch
{
type uniform;
axis y;
start ( 0 0.5 0.25 );
end ( 0 2 0.25 );
nPoints 100;
}
);

surfaces ();

fields ( sigmaxx );


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

but I get no results we running the sample utility. whats the problem?

Funny, I have a problem on the same file.

I am doing the stress tutorial, and created a problem with a larger plate.

When I ran sample, it says that it is processing time 100, 120, 140, ... , 200, but I can find the sampled data only for time 100.

In other words, the sets directory only has the 100 subdirectory, but not the others. I can't figure out what I'm doing wrong.

Mirko

Daniele111 June 25, 2010 07:02

Hi
I would use option cloud in sampleDict dictionary like this:

sets
(
Inlet
{
type cloud;
axis x;
start (0 0 0);
end (100 0 0);
nPoints 3;
(
(1 1 0)
(2 3 0)
(3 2 0)
);
}

);

Must I give the start and end of line? With this setting th utility sample give me choose field on point (1 1 0) (2 3 0) and (3 2 0)? I have a curve bottom and I would have for post processing the U field at bottom, the sampleDict that I use is correct?

mirko June 25, 2010 11:56

Never mind, I forgot to calculate the components via foamCalc components sigma.

Sorry for the noise.

Mirko

heavy_user July 12, 2010 08:01

sample Utility = wrong results -- be aware!!
 
Hey There,

i figured that sample does some dangerous things!


I chose a box of 1*1*1 m.
I have 4 walls (parallel to x-axis) , an inlet and an outlet.
Flow direction is x+ ..

I assigned for U:

Code:

internalField  uniform (22 0 0) ;

boundaryField
{
    inlet
    {
        type            fixedValue;
        value          uniform (11 0 0);
    }
    sidewall
    {
        type            slip;
    }
    outlet
    {
        type            fixedValue;
    value        uniform (33 0 0);
    }
}

and p

Code:

internalField  uniform 2;

boundaryField
{
    inlet         
    {
        type            fixedValue;
    value      uniform 1;
    }


    outlet                   
    {
        type            fixedValue;
    value      uniform 3;
    }

    sidewall     
    {
        type            slip;
    }

 

}

I use sample to do a sample-line on the inlet

Code:

    start          (0 0 0.5);
        end            (0 1 0.5);

If I use " interpolationScheme cell" I get correct results. If I use other options
(
cellPoint
cellPointFace
cellPointWallModified
)

I get results like this :eek: -->

for u:

Code:

0 22    0    0   
0.00502513 16.2236    0    0   
0.0100503 15.9472    0    0   
0.0150754 15.6709    0    0   
0.0201005 15.3945    0    0   
0.0251256 15.1181    0    0   
0.0301508 14.8417    0    0   
0.0351759 14.5653    0    0   
0.040201 14.2889    0    0   
0.0452261 14.0126    0    0   
0.0502513 13.7362    0    0   
0.0552764 13.4598    0    0   
0.0603015 13.1834    0    0   
0.0653266 12.907    0    0   
0.0703518 12.6307    0    0   
0.0753769 12.3543    0    0   
0.080402 12.0779    0    0   
0.0854271 11.8015    0    0   
0.0904523 11.5251    0    0   
0.0954774 11.2487    0    0   
0.100503 11    0    0   
0.105528 11    0    0   
0.110553 11    0    0   
0.115578 11    0    0   
0.120603 11    0    0   
0.125628 11    0    0   
0.130653 11    0    0   
0.135678 11    0    0   
0.140704 11    0    0   
0.145729 11    0    0   
0.150754 11    0    0   
0.155779 11    0    0   
0.160804 11    0    0   
0.165829 11    0    0   
0.170854 11    0    0   
0.175879 11    0    0   
0.180905 11    0    0   
0.18593 11    0    0   
0.190955 11    0    0   
0.19598 11    0    0   
0.201005 11    0    0   
0.20603 11    0    0   
0.211055 11    0    0   
0.21608 11    0    0   
0.221106 11    0    0   
0.226131 11    0    0   
0.231156 11    0    0   
0.236181 11    0    0   
0.241206 11    0    0   
0.246231 11    0    0   
0.251256 11    0    0   
0.256281 11    0    0   
0.261307 11    0    0   
0.266332 11    0    0   
0.271357 11    0    0   
0.276382 11    0    0   
0.281407 11    0    0   
0.286432 11    0    0   
0.291457 11    0    0   
0.296482 11    0    0   
0.301508 11    0    0   
0.306533 11    0    0   
0.311558 11    0    0   
0.316583 11    0    0   
0.321608 11    0    0   
0.326633 11    0    0   
0.331658 11    0    0   
0.336683 11    0    0   
0.341709 11    0    0   
0.346734 11    0    0   
0.351759 11    0    0   
0.356784 11    0    0   
0.361809 11    0    0   
0.366834 11    0    0   
0.371859 11    0    0   
0.376884 11    0    0   
0.38191 11    0    0   
0.386935 11    0    0   
0.39196 11    0    0   
0.396985 11    0    0   
0.40201 11    0    0   
0.407035 11    0    0   
0.41206 11    0    0   
0.417085 11    0    0   
0.422111 11    0    0   
0.427136 11    0    0   
0.432161 11    0    0   
0.437186 11    0    0   
0.442211 11    0    0   
0.447236 11    0    0   
0.452261 11    0    0   
0.457286 11    0    0   
0.462312 11    0    0   
0.467337 11    0    0   
0.472362 11    0    0   
0.477387 11    0    0   
0.482412 11    0    0   
0.487437 11    0    0   
0.492462 11    0    0   
0.497487 11    0    0   
0.502513 11    0    0   
0.507538 11    0    0   
0.512563 11    0    0   
0.517588 11    0    0   
0.522613 11    0    0   
0.527638 11    0    0   
0.532663 11    0    0   
0.537688 11    0    0   
0.542714 11    0    0   
0.547739 11    0    0   
0.552764 11    0    0   
0.557789 11    0    0   
0.562814 11    0    0   
0.567839 11    0    0   
0.572864 11    0    0   
0.577889 11    0    0   
0.582915 11    0    0   
0.58794 11    0    0   
0.592965 11    0    0   
0.59799 11    0    0   
0.603015 11    0    0   
0.60804 11    0    0   
0.613065 11    0    0   
0.61809 11    0    0   
0.623116 11    0    0   
0.628141 11    0    0   
0.633166 11    0    0   
0.638191 11    0    0   
0.643216 11    0    0   
0.648241 11    0    0   
0.653266 11    0    0   
0.658291 11    0    0   
0.663317 11    0    0   
0.668342 11    0    0   
0.673367 11    0    0   
0.678392 11    0    0   
0.683417 11    0    0   
0.688442 11    0    0   
0.693467 11    0    0   
0.698492 11    0    0   
0.703518 11    0    0   
0.708543 11    0    0   
0.713568 11    0    0   
0.718593 11    0    0   
0.723618 11    0    0   
0.728643 11    0    0   
0.733668 11    0    0   
0.738693 11    0    0   
0.743719 11    0    0   
0.748744 11    0    0   
0.753769 11    0    0   
0.758794 11    0    0   
0.763819 11    0    0   
0.768844 11    0    0   
0.773869 11    0    0   
0.778894 11    0    0   
0.78392 11    0    0   
0.788945 11    0    0   
0.79397 11    0    0   
0.798995 11    0    0   
0.80402 11    0    0   
0.809045 11    0    0   
0.81407 11    0    0   
0.819095 11    0    0   
0.824121 11    0    0   
0.829146 11    0    0   
0.834171 11    0    0   
0.839196 11    0    0   
0.844221 11    0    0   
0.849246 11    0    0   
0.854271 11    0    0   
0.859296 11    0    0   
0.864322 11    0    0   
0.869347 11    0    0   
0.874372 11    0    0   
0.879397 11    0    0   
0.884422 11    0    0   
0.889447 11    0    0   
0.894472 11    0    0   
0.899497 11    0    0   
0.904523 11.2487    0    0   
0.909548 11.5251    0    0   
0.914573 11.8015    0    0   
0.919598 12.0779    0    0   
0.924623 12.3543    0    0   
0.929648 12.6307    0    0   
0.934673 12.907    0    0   
0.939698 13.1834    0    0   
0.944724 13.4598    0    0   
0.949749 13.7362    0    0   
0.954774 14.0126    0    0   
0.959799 14.2889    0    0   
0.964824 14.5653    0    0   
0.969849 14.8417    0    0   
0.974874 15.1181    0    0   
0.979899 15.3945    0    0   
0.984925 15.6709    0    0   
0.98995 15.9472    0    0   
0.994975 16.2236    0    0   
1 16.5    0    0

for p:

Code:

0 2
0.00502513 1.47487
0.0100503 1.44975
0.0150754 1.42462
0.0201005 1.3995
0.0251256 1.37437
0.0301508 1.34925
0.0351759 1.32412
0.040201 1.29899
0.0452261 1.27387
0.0502513 1.24874
0.0552764 1.22362
0.0603015 1.19849
0.0653266 1.17337
0.0703518 1.14824
0.0753769 1.12312
0.080402 1.09799
0.0854271 1.07286
0.0904523 1.04774
0.0954774 1.02261
0.100503 1
0.105528 1
0.110553 1
0.115578 1
0.120603 1
0.125628 1
0.130653 1
0.135678 1
0.140704 1
0.145729 1
0.150754 1
0.155779 1
0.160804 1
0.165829 1
0.170854 1
0.175879 1
0.180905 1
0.18593 1
0.190955 1
0.19598 1
0.201005 1
0.20603 1
0.211055 1
0.21608 1
0.221106 1
0.226131 1
0.231156 1
0.236181 1
0.241206 1
0.246231 1
0.251256 1
0.256281 1
0.261307 1
0.266332 1
0.271357 1
0.276382 1
0.281407 1
0.286432 1
0.291457 1
0.296482 1
0.301508 1
0.306533 1
0.311558 1
0.316583 1
0.321608 1
0.326633 1
0.331658 1
0.336683 1
0.341709 1
0.346734 1
0.351759 1
0.356784 1
0.361809 1
0.366834 1
0.371859 1
0.376884 1
0.38191 1
0.386935 1
0.39196 1
0.396985 1
0.40201 1
0.407035 1
0.41206 1
0.417085 1
0.422111 1
0.427136 1
0.432161 1
0.437186 1
0.442211 1
0.447236 1
0.452261 1
0.457286 1
0.462312 1
0.467337 1
0.472362 1
0.477387 1
0.482412 1
0.487437 1
0.492462 1
0.497487 1
0.502513 1
0.507538 1
0.512563 1
0.517588 1
0.522613 1
0.527638 1
0.532663 1
0.537688 1
0.542714 1
0.547739 1
0.552764 1
0.557789 1
0.562814 1
0.567839 1
0.572864 1
0.577889 1
0.582915 1
0.58794 1
0.592965 1
0.59799 1
0.603015 1
0.60804 1
0.613065 1
0.61809 1
0.623116 1
0.628141 1
0.633166 1
0.638191 1
0.643216 1
0.648241 1
0.653266 1
0.658291 1
0.663317 1
0.668342 1
0.673367 1
0.678392 1
0.683417 1
0.688442 1
0.693467 1
0.698492 1
0.703518 1
0.708543 1
0.713568 1
0.718593 1
0.723618 1
0.728643 1
0.733668 1
0.738693 1
0.743719 1
0.748744 1
0.753769 1
0.758794 1
0.763819 1
0.768844 1
0.773869 1
0.778894 1
0.78392 1
0.788945 1
0.79397 1
0.798995 1
0.80402 1
0.809045 1
0.81407 1
0.819095 1
0.824121 1
0.829146 1
0.834171 1
0.839196 1
0.844221 1
0.849246 1
0.854271 1
0.859296 1
0.864322 1
0.869347 1
0.874372 1
0.879397 1
0.884422 1
0.889447 1
0.894472 1
0.899497 1
0.904523 1.02261
0.909548 1.04774
0.914573 1.07286
0.919598 1.09799
0.924623 1.12312
0.929648 1.14824
0.934673 1.17337
0.939698 1.19849
0.944724 1.22362
0.949749 1.24874
0.954774 1.27387
0.959799 1.29899
0.964824 1.32412
0.969849 1.34925
0.974874 1.37437
0.979899 1.3995
0.984925 1.42462
0.98995 1.44975
0.994975 1.47487
1 1.5

-- as you can see the interpolation at the Edge-cells seems to be mixed up with the internal-field-layers!! I think this sucks, if someone doesnt know it might give you real trouble!!


So be aware!!

P.S.: can you reproduce the error? Is there any help to it/what did i do wrong?

desert_1250 March 27, 2011 15:13

extracting curve data
 
Hi all, How can i extract data for curve line with sample utility? eny advice...

tanks, Rasoul


All times are GMT -4. The time now is 09:48.