CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   post processing on a specified surface (https://www.cfd-online.com/Forums/openfoam/104217-post-processing-specified-surface.html)

teolong July 5, 2012 07:47

post processing on a specified surface
 
Hi,

I was wondering if anybody knows how to generate fields output (p,U,k) on surfaces that do not belong to boundaries, from a 3D simpleFoam calculation. I'm thinking on something like the cuttingPlane post processing function, but restricted to a user defined surface, someway given.

I had a look at sampleDict and sampleSurfaceDict, but I couldn't manage to make them work.

Matteo

SirWombat July 7, 2012 06:12

sample on a surface
 
Hi Matteo

that is actually easily done. You will need a STL-File of your surface. Put that in the directory: "constant/trisurface/"

Then create a "sampleDict"-File in the "system/" folder e.g. like the one below.

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.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
    U
);

surfaces
(
    triSurfaceSampling
    {
        // Sampling on triSurface
        type        sampledTriSurfaceMesh;
        surface    YOURSURFACE.stl;
        source      boundaryFaces;  // sample cells or boundaryFaces
        interpolate true;
    }
);


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

I assume you will use paraview/paraFoam for postprocessing, so the example will generate a "vtk"-File, selected under "surfaceFormat"

change "YOURSURFACE.stl" to the name of your surface. Finally put the fields of interest under "fields to sample". In the example I was interested in U (velocity) and p (pressure).

You can then create that field after (!) you ran the simulation. Make sure the case is reconstructed if you use parallel processing. Then use the following for a surfacefield of the last computed timestep:

Code:

sample -latestTime
You will find a "vtk"-file under the corresponding time in the folder "surfaces/" in your case-folder


Hope that helps!

Greetings,
Jan

teolong July 9, 2012 04:15

Thanks Jan for your detailed reply,
it worked perfectly.

Cheers,

Matteo

hatchet November 12, 2012 04:45

Hi Jan,

I tried your advice. It works very well.
But I´ve one more question.

First my sampleDict looks like yours. So I get in /surfaces two files with the results of my stl. But I want the results averaged over the face and not for every cell. How does that work?


Greets

SirWombat November 12, 2012 07:41

Hi Falko,

have a look at Bernhard post in this thread: http://www.cfd-online.com/Forums/ope...gnitude-u.html

Instead of the built-in functions, you'll have to use swak4foam. But thats almost as easily done!

G Jan

hatchet November 13, 2012 04:22

Hi Jan,

thanks for your answer.

But I can´t use swak4foam because I´m not allowed to install something. So I´ve to use the standard options.


Greets

doubtsincfd November 13, 2012 17:44

you can use http://www.openfoam.org/version2.0.0...me-control.php

See the controlDict in tutorials/incompressible/pisoFoam/les/pitzDaily/system

You will find a bunch of stuff you can do without swak

Also see this:

http://openfoamwiki.net/index.php/Ca...nction_Objects

JR22 May 1, 2013 14:46

sampleDict interpolates solution at STL, how to minimize interpolation errors?
 
Hi Jan, thank you very much for your recipe. I generated planes with paraview (changing the resolution, applying the triangulate filter, and saving as STL-text). Then, I used your recipe, works wonderfully. I had more than one STL surface, and for some reason, the cells interpolation was better than boundaryFaces.

However, the interpolation by the sample postprocessing utility is not that clean. To overcome this, I tried adding the same STL files to my snappyHexMeshDict as refinementSurfaces but simpleFoam expects a patch and gives me an error. The best I could do was to use the STLs as refinementRegions with the type distance option to get a bit better resolution in the area; in other words:

Is there a way to get snappyHexMesh to generate mesh vertices at the STL edges/cells, so that interpolation is minimal and results have less errors?


sampleDict:
Code:

.
.
.

surfaces
(
    mySurface1
    {
        // Sampling on triSurface
        type        sampledTriSurfaceMesh;
        surface    mySurface1.stl;
        source      cells;  // sample cells or boundaryFaces
        interpolate true;
    }
    mySurface2
    {
        // Sampling on triSurface
        type        sampledTriSurfaceMesh;
        surface    mySurface2.stl;
        source      cells;  // sample cells or boundaryFaces
        interpolate true;
    }
    .
    .
    .
);
.
.
.

Quote:

Originally Posted by SirWombat (Post 370206)
that is actually easily done. You will need a STL-File of your surface. Put that in the directory: "constant/trisurface/"
Then create a "sampleDict"-File in the "system/" folder e.g. like the one below.


jorkolino July 15, 2019 10:42

What if I want to create a surface by coordinates? I have a case and I want to create an internal plane, whose boundary coordinates I know. Regards.

jtipton2 April 12, 2020 17:07

Quote:

Originally Posted by jorkolino (Post 738994)
What if I want to create a surface by coordinates? I have a case and I want to create an internal plane, whose boundary coordinates I know. Regards.

See this post:

https://www.cfd-online.com/Forums/op...tml#post765336

zeinelserfy March 31, 2021 12:02

difference between cell and boundaryFaces
 
Quote:

Originally Posted by JR22 (Post 424472)
Hi Jan, thank you very much for your recipe. I generated planes with paraview (changing the resolution, applying the triangulate filter, and saving as STL-text). Then, I used your recipe, works wonderfully. I had more than one STL surface, and for some reason, the cells interpolation was better than boundaryFaces.

However, the interpolation by the sample postprocessing utility is not that clean. To overcome this, I tried adding the same STL files to my snappyHexMeshDict as refinementSurfaces but simpleFoam expects a patch and gives me an error. The best I could do was to use the STLs as refinementRegions with the type distance option to get a bit better resolution in the area; in other words:

Is there a way to get snappyHexMesh to generate mesh vertices at the STL edges/cells, so that interpolation is minimal and results have less errors?


sampleDict:
Code:

.
.
.

surfaces
(
    mySurface1
    {
        // Sampling on triSurface
        type        sampledTriSurfaceMesh;
        surface    mySurface1.stl;
        source      cells;  // sample cells or boundaryFaces
        interpolate true;
    }
    mySurface2
    {
        // Sampling on triSurface
        type        sampledTriSurfaceMesh;
        surface    mySurface2.stl;
        source      cells;  // sample cells or boundaryFaces
        interpolate true;
    }
    .
    .
    .
);
.
.
.


what is the difference in interpolation between cell or boundaryFaces as source??


All times are GMT -4. The time now is 12:35.