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/)
-   -   Uniform surface sampling? (https://www.cfd-online.com/Forums/openfoam-post-processing/168152-uniform-surface-sampling.html)

RebelLion March 16, 2016 11:30

Uniform surface sampling?
 
Hello,

I would like to export field values from a nonuniform grid using a uniform sampling grid.

Any suggestions?

mapFields seems terribly inefficient since it only does one time step at a time (I have a few 100 time steps I want to export)

the sample utility 'works' but I don't see how to specify uniform sampling for a surface.

Thanks for your help!

kingjewel1 March 16, 2016 11:45

Quote:

Originally Posted by RebelLion (Post 590097)
Hello,

I would like to export field values from a nonuniform grid using a uniform sampling grid.

Any suggestions?

mapFields seems terribly inefficient since it only does one time step at a time (I have a few 100 time steps I want to export)

the sample utility 'works' but I don't see how to specify uniform sampling for a surface.

Thanks for your help!

Are you wanting to sample a solid surface e.g. a wall? Or a plane you have defined?

For the former you can't as far as I know. You need to change it to a patch then use sample.

Once you've changed your solid object to a patch (in your processor/constant/polymesh/boundary files) use:

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      sampleDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

setFormat raw;
surfaceFormat vtk;

interpolationScheme cellPoint;

// Fields to sample.
fields
(
    p
);

sets
(
);

surfaces
(
    cubes
    {
        type            patch;
        patches        ("cubes");
    }
);


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

For the second use something like this:

Code:

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


setFormat raw;
surfaceFormat vtk;

// optionally define extra controls for the output formats
formatOptions
{
    ensight
    {
        format  ascii;
    }
}


sets
(
   
);


surfaces
(
    constantPlane
    {
        type            plane;    // always triangulated
        basePoint      (0 0 3.5);
        normalVector    (0 0 1);

    }

 

);


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


RebelLion March 16, 2016 12:14

Hi kingjewel1. Thanks for the reply.

My goal is to export field values of a plane I define. I can do that using your second suggestion.

My problem is that I want the exported results to be interpolated onto a uniform grid. When exporting a 1D line set, uniform distribution is a sampleDict option but I can not find similar functionality for 2D surfaces. Any other ideas? or even other post-processing suggestions?

Thanks again!

lzhou June 21, 2016 07:56

Hello,

Have you got a solution for your question ? I am trying to do the same thing.

Thanks !

Lu ZHOU

RebelLion June 21, 2016 17:43

One way I found to do so is to define a plane source (under source menu) and then use the filter Resample with Dataset. To setup the filter use your data as the "input" and the plane as the "source". Sample periodicity is set under the plane properties, X Resolution and Y Resolution.

Good luck and let me know if you have any further questions


All times are GMT -4. The time now is 23:26.