CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Compute mean velocity field and mean pressure field in runtime (https://www.cfd-online.com/Forums/openfoam/183093-compute-mean-velocity-field-mean-pressure-field-runtime.html)

Eman. January 26, 2017 17:49

Compute mean velocity field and mean pressure field in runtime
 
Hi,

I was wondering if it is possible to use surface sampling to compute the mean velocity and pressure field on a cut plane. I want to compute the mean average on the desired plane during runtime of a 3D LES simulation so that later I could compare it to the mean velocity and pressure field obtained by a 2D RANS simulation. Is it possible to do it in OpenFoam?

PS. I don't want to use fieldAverage function to obtain the mean fields in the whole 3D domain due to the numerical costs.


Thanks.

philippose January 27, 2017 03:05

Hi there,
A Good Morning to you.

You can have a look at this thread... should give you what you want...:
https://www.cfd-online.com/Forums/op...g-runtime.html

However, a cutting plane is by default infinite, and if the cutting plane cuts your geometry at multiple Locations, you will get inconsistent / unexpected results.

To solve that, if you are using the "plus" Version (3.0+, 1606+, 1612+) Versions of OpenFOAM, have a look at this...:
http://www.openfoam.com/version-v3.0...itTimeAndSpace

The other option is to use the triSurfaceMesh sampling method, and define an STL surface on which to calculate the average.

If the average you want to calculate can be calculated on a patch, that would be the easiest.

You can get some more information about sampling here...:
http://www.openfoam.com/documentatio...ide/sample.php

Hope this helps.

Regards,
Philippose

Eman. January 27, 2017 08:06

Quote:

Originally Posted by philippose (Post 634811)
Hi there,
A Good Morning to you.

You can have a look at this thread... should give you what you want...:
https://www.cfd-online.com/Forums/op...g-runtime.html

However, a cutting plane is by default infinite, and if the cutting plane cuts your geometry at multiple Locations, you will get inconsistent / unexpected results.

To solve that, if you are using the "plus" Version (3.0+, 1606+, 1612+) Versions of OpenFOAM, have a look at this...:
http://www.openfoam.com/version-v3.0...itTimeAndSpace

The other option is to use the triSurfaceMesh sampling method, and define an STL surface on which to calculate the average.

If the average you want to calculate can be calculated on a patch, that would be the easiest.

You can get some more information about sampling here...:
http://www.openfoam.com/documentatio...ide/sample.php

Hope this helps.

Regards,
Philippose

Thanks for your detailed answer, but the first code you provided gives the spatial average over the cut plane(planar average) in different time steps. I need a code that gives the whole mean velocity and pressure fields on the specified plane.

philippose January 27, 2017 12:26

Hello again,
What do you mean by "whole mean velocity"? And mean velocity over time in that, do you want a surface field which for each point does something like..:

Code:

Umean(x,y) = sum(U(x,y)[t])/totalTime
Or are you looking for a single value which is a mean of the velocity (that would be spatial average)?

In the former case, the best option would be to use something like "swak4Foam"... maybe a swakExpression, with a sum accumulation.

Information about swak4Foam can be found at:
https://openfoamwiki.net/index.php/Contrib/swak4Foam

Regards,
Philippose

Eman. January 27, 2017 13:05

Quote:

Originally Posted by philippose (Post 634875)
Hello again,
What do you mean by "whole mean velocity"? And mean velocity over time in that, do you want a surface field which for each point does something like..:

Code:

Umean(x,y) = sum(U(x,y)[t])/totalTime

Thanks again. This is exactly what I mean, a surface field for Mean velocity and pressure.

DanielRCalvete February 21, 2017 12:23

Hi there,

I am also interesting in knowing if there is some how to calculate a time average of a field for a given plane at run time. In my case I want to calculate the average on a plane in a field generated by a rotating impeller in a stirred tank using pimpleDyMFoam.

I tried this code into controlDict, but it does not give a plane but a whole average field.

Code:


Uplane
        {
                type expressionField;
                dimension [0 1 -1 0 0 0 0];
                fieldName "Uplane";
                valueType surface;
                surfaceName testCuttingPlane;
                surface {
                        type cuttingPlane;
                        planeType        pointAndNormal;
                        pointAndNormalDict
                        {
                                basePoint        (0 0 0);
                                normalVector        (1 1 0);
                        }
                        interpolate true;
                }
                expression "U";
                verbose true;
                autowrite true;
                outputControl timeStep;
        }


fieldAverage1
    {
        type fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        resetOnRestart false;
        resetOnOutput false;
      // outputControl timeStep;
        outputInterval  100;

 
        fields
        (
            Uplane
            {
                mean            on;
                prime2Mean      off;
                base            time;

            }

            U
            {
                mean            on;
                prime2Mean      off;
                base            time;

            }

        );
    }

Someone can help me?, I really need this tool.

Thank you in advance


All times are GMT -4. The time now is 18:34.