CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Defining a zone for sampling a plane (https://www.cfd-online.com/Forums/openfoam-post-processing/141201-defining-zone-sampling-plane.html)

odellar September 2, 2014 05:23

Defining a zone for sampling a plane
 
Hi,

I want to sample my data over a plane, and so define the plane in the sampleDict as:

Code:

    plane1
    {
        type            plane;    // always triangulated
        basePoint      (2 0 0.5);
        normalVector    (0 0 1);

        //- Optional: restrict to a particular zone
        // zone        zone1;

        //- Optional: do not triangulate (only for surfaceFormats that support
        //            polygons)
        //triangulate    false;
    }

This of course samples a plane throughout the whole computational domain, but I only want to sample a subsection of it - I think I need to use the optional zone definition, but I'm not sure how to do this.

Can I somehow specify a square plane, for example say I want the region within the four points:

(0,1,0.5)
(4,1,0.5)
(4,-1,0.5)
(0,-1.0.5)

?

Thanks a lot.

FerdiFuchs October 23, 2014 11:15

Hi!

I had the same problem for today.

It works by defining your zones via topoSet or setSet (cellSet) and use this zone for the sample-utility:

In your case it would be something like this for the use with topoSet and sample:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      topoSetDict;
}

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

actions
(

    {
        name    zone1;
        type    cellSet;
        action  new;
        source  boxToCell;
        sourceInfo
        {
            box (0 -1 0.5) (4 1 0.5);
        }
    }
    {
        name    zone1;
        type    cellZoneSet;
        action  new;
        source  setToCellZone;
        sourceInfo
        {
            set zone1;
        }
    }

);

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

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.3.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

interpolationScheme cell;

surfaceFormat raw;

surfaces
(

    plane1
    {
        type            plane;    // always triangulated
        basePoint      (2 0 0.5);
        normalVector    (0 0 1);
        zone            zone1;
    }

);

fields          ( p );


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

Maybe you have to adjust the box for toposet to be 3-dimensional, for example: box (0 -1 0.49999) (4 1 0.5);


All times are GMT -4. The time now is 20:45.