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

fieldAverage not "averaging"

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By MaryBau

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 25, 2013, 11:01
Default fieldAverage not "averaging"
  #1
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi everyone;

I have been having problems with the time average values of my simulations when I ran them in the cluster that I have always used. This problem started a couple weeks ago, but before that they were running fine. I talked to the people in charge of the cluster, they think it might be an OpenFoam issue. I am using OF v2.1.0

The simulations seem to run fine, I do not get any error message, but looking at the results, it seems that the fieldAverage is not working. I did not notice any big difference in the amount of time it takes for the simulations to run before and after this problem. And the output shows that the averages are being calculated.

I ran exactly the same case in my local computer and in the cluster and I get very different results. The only difference in these simulations is the number of cores I use, 6 at my local computer and 32 cores in the cluster, but it should not be important. I am attaching two plots of these results. My local computer shows results that are smooth and "averaged" and the cluster plot shows results that do not seem to be averaged.

Any ideas of what could it be the problem? or what could have changed in the cluster to make the fieldAverage stop working properly?

This is what I put in controlDict:

Code:
functions
(
    fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ( "libfieldFunctionObjects.so" );
        enabled         true;
        cleanRestart    false;
        outputControl   outputTime;
        resetOnOutput   false;
        timeStart       7.0;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;//or iteration
            }
        );
     }
......
Thanks a lot,

Mary
Attached Files
File Type: pdf averageCluster.pdf (34.7 KB, 266 views)
File Type: pdf averageLocalComputer.pdf (34.7 KB, 110 views)
MaryBau is offline   Reply With Quote

Old   October 26, 2013, 13:36
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Mary,

Well, the number of sub-domains does matter if there is a division in a location where it isn't working as intended between processor domains.

In addition, the only bug that seems to have been reported regarding "fieldAverage" for OpenFOAM 2.1 is this one: http://www.openfoam.org/mantisbt/view.php?id=818 - but it refers to continuing the simulation from another time location.

Assuming you cannot share the case, here are a few questions:
  1. Does your case have any special boundary conditions? Such as cyclic patches?
  2. What decomposition method are you using? Have you tried the "simple" or "hierarchical" methods?
  3. How many cells does your case have got?
  4. Why kind of simulation is it being performed?
  5. You said that the problem only started some time ago. What else has changed, besides this result?
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   October 29, 2013, 10:48
Default
  #3
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi Bruno;

Thanks for replying. The bug sounds a lot like what I am getting in my results.

So the problem is in the totalTime in fieldAverageProperties when the "timeStart" option is used in fieldAverage, right? I guess the work around will be start the simulation up to a certain time without averaging and then stopped it. Then add fieldAverage with a cleanRestart in controlDict and restart the simulation this time with the averaging. Am I correct? will this avoid the problem?

And just to answer your questions:

-I am running a simple channel flow case but with a hybrid model.
1. Cyclic on inlet/outlet and laterals.
2. Decompostion: hierarchical. I had some instabilities at the subdomain boundaries when using scotch, that was making my simulations crashed.
3. I have less than 1 million cells in all my cases.
4. Channel-flow with high Re to simulate the earth atmosphere.
5. I guess the problem started when I added the "timeStart" flag in fieldAverage and/or varied the time at which I started the averaging and the error became more evident.

Thanks a lot,

Mary
Attached Files
File Type: zip case.zip (14.6 KB, 24 views)
MaryBau is offline   Reply With Quote

Old   November 3, 2013, 05:42
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Mary,

Quote:
Originally Posted by MaryBau View Post
So the problem is in the totalTime in fieldAverageProperties when the "timeStart" option is used in fieldAverage, right? I guess the work around will be start the simulation up to a certain time without averaging and then stopped it. Then add fieldAverage with a cleanRestart in controlDict and restart the simulation this time with the averaging. Am I correct? will this avoid the problem?
In theory, yes, that should avoid the problem. I say in theory, because OpenFOAM sometimes has a couple of surprises for us.
For example, the folder "uniform" that usually appears in the time folders will register the time it is meant for, so you should also erase that folder when you continue your case from 0.

I haven't looked into the attached file you provided, since the problem seems to have be solved this way. Nonetheless, if it does not, then let me know what steps to take to run the case and I'll give it a try with the latest OpenFOAM 2.2.x vs the old 2.1.0.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 10, 2013, 10:51
Default
  #5
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi Bruno and all;

I am still trying to figure out this average issue that I mentioned on my previous posts.

Since there is a bug in "fieldAverage" in v2.1., I started a simulation up to a certain time (without averaging). Then add fieldAverage in controlDict and restart the simulation this time with the averaging. The average seems to be working fine like this.

But now my problem is that all the instantaneous fields give me very different results if I stopped the simulation (due to the average issue) or if I do not stopped it. See the attached images for the value of the sub grid turbulence kinetic energy when the simulation is stopped and when it is not, there are taken at the same timeStep. All the instantaneous fields seem to show the same behaviour. I have tried a couple of different cases and stopping at different times...

I am saving as binary with a writePrecision of 12. Any ideas of why this is happening?

Thanks again and have a good weekend,

Mary
Attached Images
File Type: jpg whenStopped.jpg (12.2 KB, 138 views)
File Type: jpg withoutStopping.jpg (12.2 KB, 122 views)
MaryBau is offline   Reply With Quote

Old   November 10, 2013, 13:10
Default
  #6
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Mary,

Honestly, I believe that you should either try to build OpenFOAM 2.1.x or 2.2.2 or 2.2.x.

I've given a really quick look into the case you've provided and I wasn't expecting so many special requirements by the case, namely the libraries needed and the custom solver.

If you can provide a slightly modified tutorial case from OpenFOAM 2.1.1 in which this is reproducible (i.e., simple and without special requirements), I can run it in any and all OpenFOAM versions, to ascertain in which version it works properly.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   January 7, 2014, 13:44
Default
  #7
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi Bruno and all;

It took me a long time to figure this out and therefore to reply. I ended up installing v2.2.2 and I am running my simulations with it now. So the average problem is fixed.

The other problem that I had with the instantaneous fields that give me very different results if I stopped/rerun the simulation turned out to be a bug in my turbulence model code. But it had nothing to do with the average and/or OF version.

Just want to make sure the answer is in the forums in case someone has the same problem.

Thanks for your help,

Mary
wyldckat likes this.
MaryBau is offline   Reply With Quote

Old   March 21, 2014, 11:38
Default
  #8
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi again;

I do not think the fieldAverage bug mentioned by Bruno on post #2 is completly fixed in v2.2.2. I had verified it and I thought it was fixed, but apperently I was wrong and I am still having issues with averaging the fields.

At least when I use pimpleFoam with and adjustableRunTime, the value of the "totalTime" in uniform/fieldAveragingProperties file is:

totalTime = deltaT(in controlDict)+time step

instead of just:

totalTime = time step

so if the value of deltaT(in controlDict) is really big compared to the actual time step in the simulations, the averages are biased.

I have implemented the averages a bit different in my solver, but I just wanted to let you guys know.

Have a nice day,

Mary
MaryBau is offline   Reply With Quote

Old   June 14, 2014, 10:39
Red face
  #9
New Member
 
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 12
mechem is on a distinguished road
I use OpenFOAM 2.3 and time averaging does not work for MPPICFoam/Goldschemidt when putting below code to its controldict. Any idea?

Code:
 fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;

        fields
        (
            U.air
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }
        );
    }
mechem is offline   Reply With Quote

Old   June 15, 2014, 07:36
Default
  #10
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Charlie,

It does work. It creates the fields "U.airMean", "U.airPrime2Mean", "pMean" and "pPrime2Mean".

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   June 15, 2014, 07:57
Exclamation
  #11
New Member
 
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 12
mechem is on a distinguished road
But it doesn't create for me!
Maybe somewhere else of controlDict should be changed. All of controlDict:

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

application     MPPICFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         5;

deltaT          2e-4;

writeControl    runTime;

writeInterval   0.01;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

 fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;

        fields
        (
            U.air
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }
        );
    }

// ************************************************************************* //
mechem is offline   Reply With Quote

Old   June 15, 2014, 08:15
Default
  #12
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,978
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Charlie,

Looks like you didn't carefully read the very first post on this thread. It clearly shows that this function object must be placed inside a "functions" entry:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     MPPICFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         5;

deltaT          2e-4;

writeControl    runTime;

writeInterval   0.01;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

functions
{
    fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;

        fields
        (
            U.air
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }
        );
    }

}
// ************************************************************************* //
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   June 15, 2014, 08:43
Default
  #13
New Member
 
Charlie
Join Date: May 2014
Posts: 9
Rep Power: 12
mechem is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Hi Charlie,

Looks like you didn't carefully read the very first post on this thread. It clearly shows that this function object must be placed inside a "functions" entry:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     MPPICFoam;

startFrom       startTime;

startTime       0;

stopAt          endTime;

endTime         5;

deltaT          2e-4;

writeControl    runTime;

writeInterval   0.01;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

functions
{
    fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;

        fields
        (
            U.air
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }
        );
    }

}
// ************************************************************************* //
Best regards,
Bruno
You are right. I forgot to add function.
Thanks.
mechem is offline   Reply With Quote

Old   April 7, 2015, 11:43
Default
  #14
Member
 
Ye Zhang
Join Date: Dec 2009
Location: Delft,Netherland
Posts: 92
Rep Power: 16
kiddmax is on a distinguished road
Hi Mary,

I saw your attached file "averageCluster.pdf ". The plot is very beautiful and professional. May I ask you what plot software do you use? gnuplot or others??

Regards
Ye
kiddmax is offline   Reply With Quote

Old   September 7, 2015, 16:18
Default
  #15
Member
 
Join Date: Jul 2010
Posts: 52
Rep Power: 16
MaryBau is on a distinguished road
Hi Ye,

A couple months later, but I just saw your question, sorry. I used Matplotlib to do the plot.

Cheers
MaryBau is offline   Reply With Quote

Reply

Tags
fieldaverage, openfoam


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
fieldAverage problem Joanna Huang OpenFOAM Post-Processing 0 July 4, 2013 06:34
Problem with sample and fieldAverage Horus OpenFOAM 1 June 19, 2013 08:25
HOWTO use fieldAverage alesch OpenFOAM Running, Solving & CFD 6 October 22, 2012 01:51
fieldAverage restarts mid-run gfilip OpenFOAM Running, Solving & CFD 0 February 6, 2012 09:56
Continuing fieldAverage on restart? juho OpenFOAM Running, Solving & CFD 11 March 1, 2010 08:23


All times are GMT -4. The time now is 20:03.