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/)
-   -   surface sampling during runtime (http://www.cfd-online.com/Forums/openfoam-post-processing/83096-surface-sampling-during-runtime.html)

fisch December 14, 2010 10:41

surface sampling during runtime
 
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

Bernhard December 14, 2010 17:26

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;
            }
        );
    }
)


dohnie March 1, 2011 10:39

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

stevenvanharen March 1, 2011 17:03

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.

dohnie March 2, 2011 08:00

appending to existing output file
 
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!

stevenvanharen March 2, 2011 09:42

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

dohnie March 2, 2011 12:14

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.

Cloudy1988 November 1, 2012 07:42

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

r_gordon October 3, 2013 06:52

Sampling for a specific timestep
 
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.

openfoammaofnepo April 30, 2014 18:06

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 (Post 287461)
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;
            }
        );
    }
)



vigneshTG February 12, 2015 13:31

1 Attachment(s)
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;
            }

        );
    }
);


agustinvo June 8, 2016 04:28

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?


All times are GMT -4. The time now is 08:50.