CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

surface sampling during runtime

Register Blogs Community New Posts Updated Threads Search

Like Tree13Likes
  • 11 Post By Bernhard
  • 2 Post By stevenvanharen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 14, 2010, 10:41
Default surface sampling during runtime
  #1
Member
 
fisch
Join Date: Feb 2010
Posts: 97
Rep Power: 16
fisch is on a distinguished road
Hello,
I' more or less beginner in programming in OpenFoam; so hopefully i'm not bugging you with silly questions...

I want to do something like plane sampling during the runtime of my solver and at best i will have at the final end my sampling areas like the boundary patches to treat them in common in every timestep e.g. in paraview as vtk files.

I tried to extract lines of the code of sample.C and of http://www.cfd-online.com/Forums/openfoam-programming-development/82878-averaging-due-parallel-running-cuttingplane.html
but it was not working for solvers with meshmotion (produced memory access errors as soon meshmotion routines want to handle the mesh).
I have no idea how to proceed...

Can you help me?
I'm thankful for every little advide.

rupert
fisch is offline   Reply With Quote

Old   December 14, 2010, 17:26
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
I use the following for monitoring the free surface in an interFoam simulation. You have to put it in your controlDict. You can alter it for your case with the same definitions that are used in sampleDict. Have fun!
Code:
functions
(
    elevation
    {
        type            surfaces;
        functionObjectLibs
        (
            "libsampling.so"
        );
        outputControl   outputTime;
        surfaceFormat  raw;
        fields
        (
            alpha1
        );
        surfaces
        (
            topFreeSurface
            {
                type        isoSurface;
                isoField    alpha1;
                isoValue    0.5;
                interpolate true;
            }
        );
    }
)
David*, nimasam, pbachant and 8 others like this.
Bernhard is offline   Reply With Quote

Old   March 1, 2011, 10:39
Default
  #3
Member
 
Florian Ettner
Join Date: Mar 2009
Location: Munich, Germany
Posts: 41
Rep Power: 17
dohnie is on a distinguished road
Bernhard, thank your for this piece of code.
I would like to understand it a little better, but I cannot find the respective source code. It seems to me that functions() can be combined with a lot of stuff, but not the one I'm looking for...

Which "types" are possible?
So far I've found "surfaces", "probes", "fieldAverage".
Which other options are there?
Can I tell OF to continue the existing output file of a stopped run or does it always start a new file?

Specifically, I would like to post-process some numbers (scalars) which I calculate during the run to characterize the flow.

Thanks,
Florian
dohnie is offline   Reply With Quote

Old   March 1, 2011, 17:03
Default
  #4
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 16
stevenvanharen is on a distinguished road
us the famous "bananas" trick for problems like this:

Code:
type            bananas;//fieldAverage;
OpenFOAM will create this ERROR message:

Code:
--> FOAM FATAL ERROR: 
Unknown function type bananas
Valid functions are : 
9
(
cellSource
faceSource
fieldAverage
fieldMinMax
probes
readFields
sets
surfaceInterpolateFields
surfaces
)
Now you know all the available functions.
random_ran and Inquisitor101 like this.
stevenvanharen is offline   Reply With Quote

Old   March 2, 2011, 08:00
Default appending to existing output file
  #5
Member
 
Florian Ettner
Join Date: Mar 2009
Location: Munich, Germany
Posts: 41
Rep Power: 17
dohnie is on a distinguished road
Thank you, Steven,
as far as I understand it now,
a function object is created
which takes the values from a runTimeSelectionTable
which is provided by a library ("libsampling.so" in this case).

However, the writing options seem to be limited to: timestep, outputTime
The result is always written into a folder named after the starting time of the computation (e.g. probes/0.0/p).
If the computation is stopped and then continued, it creates a new folder with the latest time step (e.g. probes/1.0/p)

I would like to change this behaviour, so that it always writes to the same file and appends if it already exists (e.g. probes/p), but I cannot find the source code of this function object. Can anybody help me there?
Thanks in advance!
dohnie is offline   Reply With Quote

Old   March 2, 2011, 09:42
Default
  #6
Senior Member
 
Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 16
stevenvanharen is on a distinguished road
Here is the source code for how the probes function samples and appends to a file:

/software/OpenFOAM/OpenFOAM-1.7.1/src/sampling/probes/probesTemplates.C
stevenvanharen is offline   Reply With Quote

Old   March 2, 2011, 12:14
Default
  #7
Member
 
Florian Ettner
Join Date: Mar 2009
Location: Munich, Germany
Posts: 41
Rep Power: 17
dohnie is on a distinguished road
That's what I was looking for, thank you!
Somehow, I was looking for something like functions.C
because I thought that's the class which determines I/O.
dohnie is offline   Reply With Quote

Old   November 1, 2012, 07:42
Default
  #8
New Member
 
Join Date: Aug 2012
Posts: 14
Rep Power: 14
Cloudy1988 is on a distinguished road
hello Bernhard,

I would like to ask you how do you know the sampling function input in controlDict? I just found the sampling file (.c and .H) but it didnt tell you how to use them. Is there any instruction about how to setup these ultities?

Thanks
Cloudy
Cloudy1988 is offline   Reply With Quote

Old   October 3, 2013, 07:52
Default Sampling for a specific timestep
  #9
New Member
 
Rob Gordon
Join Date: Aug 2013
Posts: 8
Rep Power: 13
r_gordon is on a distinguished road
Hi,

I was wondering if anyone knew how to output a cuttingPlane for a specific time step. I currently output horizontal slice surfaces at the outputTime but would like to output other surfaces at selected time steps. Is this possible?

My cuttingPlane file

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/

cuttingPlane
{
    type            surfaces;
    functionObjectLibs ("libsampling.so");
    outputControl   outputTime;

    setFormat raw;
    surfaceFormat   vtk;
    

    interpolationScheme cellPointFace;

    fields          (U UMean);

    surfaces
    (
        vertPlane // I would like to output this at only select timesteps
        {
            type            cuttingPlane;
            planeType pointAndNormal;
            pointAndNormalDict
            {
                basePoint       (-425 0 100);
                normalVector    (0 1 0);
            }
            interpolate     true;
        }
        horPlane2
        {
            type            cuttingPlane;
            planeType pointAndNormal;
            pointAndNormalDict
            {
                basePoint       (-425 0 1.5);
                normalVector    (0 0 1);
            }
            interpolate     true;
        }
        horPlane10
        {
            type            cuttingPlane;
            planeType pointAndNormal;
            pointAndNormalDict
            {
                basePoint       (-425 0 10);
                normalVector    (0 0 1);
            }
            interpolate     true;
        }
    
    );
}
Thanks.
r_gordon is offline   Reply With Quote

Old   April 30, 2014, 19:06
Default
  #10
Senior Member
 
Join Date: Jan 2013
Posts: 372
Rep Power: 14
openfoammaofnepo is on a distinguished road
Dear Bernhard,

When we use the utilities you mentioned, can we get the velocity normal to and parallel with the iso-surface? Particualy when the iso-surface is curved. Do you have any experience with that? Thank you.

OFFO.

Quote:
Originally Posted by Bernhard View Post
I use the following for monitoring the free surface in an interFoam simulation. You have to put it in your controlDict. You can alter it for your case with the same definitions that are used in sampleDict. Have fun!
Code:
functions
(
    elevation
    {
        type            surfaces;
        functionObjectLibs
        (
            "libsampling.so"
        );
        outputControl   outputTime;
        surfaceFormat  raw;
        fields
        (
            alpha1
        );
        surfaces
        (
            topFreeSurface
            {
                type        isoSurface;
                isoField    alpha1;
                isoValue    0.5;
                interpolate true;
            }
        );
    }
)
openfoammaofnepo is offline   Reply With Quote

Old   February 12, 2015, 13:31
Default
  #11
Member
 
Vignesh
Join Date: Oct 2012
Location: Darmstadt, Germany
Posts: 66
Rep Power: 14
vigneshTG is on a distinguished road
Dear All,

I am simulating (2D) the shape of static meniscus attached to a wall. The interface is set horizontal at the start, which later changes its shape according to the contact angle defined at the wall, eventually forming a meniscus. I use the function object (given below) to extract the shape of the interface. I see oscillations of the interface when plotted, but i don't see it when visualised using paraview. Can someone explain why does it happen or how to rectify this ?

Code:
functions
(
    elevation
    {
        interpolationScheme cell;
        type            surfaces;
        functionObjectLibs
        (
            "libsampling.so"
        );
        outputControl   outputTime;
        surfaceFormat  raw;
        fields
        (
            alpha1
        );
        surfaces
        (
            interpolatedIso
            {
                // Iso surface for interpolated values only
                type            isoSurface;    // always triangulated
                isoField        alpha1;
                isoValue        0.5;
                interpolate     true;
                regularise      true;
            }

        );
    }
);
Attached Images
File Type: png Meniscus_BC.png (30.7 KB, 556 views)
__________________
Thanks and Regards

Vignesh
vigneshTG is offline   Reply With Quote

Old   June 8, 2016, 05:28
Default
  #12
Senior Member
 
Agustín Villa
Join Date: Apr 2013
Location: Alcorcón
Posts: 314
Rep Power: 15
agustinvo is on a distinguished road
Hello

I know this thread is a bit old (even older threads were re-opened after a while), but if I have understood well, it is possible to use the commands I use in my sampleDict as function objects, as it is posted here. Am I right?
agustinvo is offline   Reply With Quote

Old   February 7, 2022, 08:49
Default sample surfaces problem while running in parallel
  #13
New Member
 
Join Date: Sep 2021
Posts: 6
Rep Power: 5
Naira is on a distinguished road
Hello everyone


I am having the problem,while running in parallel, it only generates the planeA but not the left_x patch
Does anyone know ?
Thank you





sampledSurface
{
type surfaces;
libs ("libsampling.so");
libs ("libOpenFOAM.so");

writeControl timeStep;
writeInterval 1;
enabled true;

surfaceFormat boundaryData;
interpolationScheme none;
interpolate false;
triangulate false;

fields
(
U
p
);
surfaces
(
left_x
{
type patch;
patches ("left_x");
triangulate false;
}

planeA
{
type plane;
triangulate false;
planeType pointAndNormal;
pointAndNormalDict
{
point (4.186 4.18 2);
normal (1 0 0);
triangulate false;
//zone zone2;
}
}
Naira is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 12:05
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 13:43
sampling of a curved surface with distance-based coordinate? johannesk OpenFOAM Post-Processing 0 May 2, 2010 17:53
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 05:16.