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/)
-   -   How can I calculate fieldAverage in post-processing? (https://www.cfd-online.com/Forums/openfoam-post-processing/96076-how-can-i-calculate-fieldaverage-post-processing.html)

moritzhoefert January 11, 2012 14:30

How can I calculate fieldAverage in post-processing?
 
Dear all,

I have got results of a chtMultiRegionFoam (2.0.x) simulation and I'd like to calculate a fieldAverage of T in a given region. Does anybody know how to do that?

I know, that it is easy with function objects... but how do I call those during post processing?

Thanks a lot for your help!
Best,
Moritz

Toorop January 12, 2012 04:07

Hi,

in my experience, nothing is easy in OF!

I had a similar problem a couple of months ago with a simple case (no multi region and stuff). Always start from the simplest problem and advance forward from that point - I nice advice that I always forget ...

I checked the work around in my multi region case and the solution is:
- make a separate file for post processing in the systems folder
- this file should contain the FoamFile header and the functions.
- didn't figure it out how to handle multiple domains simultaneously, so stick with one
- the simpleFunctionObject worked for me, other postproc sampling didn't

@systems/postproc
Code:

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

functions
{
    T_air
    {
        type volumeAverage;
        functionObjectLibs ( "libsimpleFunctionObjects.so" );
        region "air";
        fields ( T );
        factor 1.0;
        verbose true;
    }
}

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

Code:

execFlowFunctionObjects -dict postProc -noFlow -latestTime -region air
Any addition, suggestion, improvement would be welcome.

moritzhoefert January 12, 2012 05:20

Dear Toorop,

thanks for the reply. I was not aware of execFlowFunctionObjects. In my version of OF it does not accept the options -region and -noFlow which is why it won't work for my current problem. But in the future I will use OF 2.1 and there the options are available!

Thanks again for the hint!
All the best,
Moritz

Toorop January 12, 2012 05:40

Hi Moritz,

I have 2.0.x as well so this shouldn't be an issue. Maybe an update to your current 2.0.x would solve the problem so make a git pull and a quick rebuild.
Code:

cd $WM_PROJECT_DIR
git pull
wcleanLnIncludeAll
./Allwmake



All times are GMT -4. The time now is 13:25.