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

Not continuous averaging when restarting a calculation

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By nik
  • 2 Post By h.ono

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2013, 05:22
Default Not continuous averaging when restarting a calculation
  #1
nik
New Member
 
nicolas
Join Date: Oct 2009
Posts: 24
Rep Power: 17
nik is on a distinguished road
Hi to all,

I am using the fieldAverage function to calculate average quantities. I am using an updated version of OpenFOAM 2.2.x with the necessary fixes for the restarting to work, since there was a bug in the code (see http://www.openfoam.org/mantisbt/view.php?id=854). Restarting works just fine, my problem is that when I restart from a previous calculation, it seems that the averaging is not continuous as it should be. In order to look at the time evolution of a mean value I am using the probeFunction.

I can reproduce my problem using the cavity tutorial. I start averaging from the beginning up to 0.5 sec of simulation time. Then I restart the simulation for another 0.5 sec. Below are the functions objects used at the end of the controlDict:

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

        fields
        (
            p
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }
        );
    }

    probesP
    {
        type probes;
        functionObjectLibs ("libsampling.so");
        probeLocations
        (
            (0.05 0.05 0.0)
        );

        fields
        (
            p pMean
        );
    }
}
I have also attached a figure showing the evolution of pMean with time, at a x=0.05, y=0.05 using the data from the probe function. This figure shows the discontinuous change in the evolution of the mean value, at t=0.5.

Am I doing something wrong with the flags that I am using, or is this a bug?

Thanks,
Nicolas
Attached Images
File Type: png plotXY_pMeanVsTime.png (12.7 KB, 159 views)
nik is offline   Reply With Quote

Old   June 19, 2013, 11:31
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Did you cross-check with calculating the running mean of the sampled pressure itself?
Bernhard is offline   Reply With Quote

Old   June 20, 2013, 04:04
Default
  #3
nik
New Member
 
nicolas
Join Date: Oct 2009
Posts: 24
Rep Power: 17
nik is on a distinguished road
I have attached another figure showing the calculated running average of pressure, based on the values of pressure taken from the probe.

As you can see in the calculated running average there is no discontinuity. However, I can reproduce the discontinuity of pMean shown from the probes values, if I restart the averaging in my calculations, at t=0.5.

To me it is clear, that openFoam restarts the averaging of pMean that is written in the probes. My question is why, since I am telling it not to.

Code:
resetOnRestart  false;
resetOnOutput  false;
Nicolas
Attached Images
File Type: png plotXY_pMeanVsTime_calculated.png (37.3 KB, 136 views)
atulkjoy likes this.
nik is offline   Reply With Quote

Old   July 6, 2013, 22:59
Default
  #4
New Member
 
Hiroki Ono
Join Date: Jul 2013
Posts: 2
Rep Power: 0
h.ono is on a distinguished road
I encountered the same problem. I noticed that issue by using Prime2Mean option. Prime2Mean value was always reseted to 0 when restarting.

I can reproduce my problem using the pisoFoam/pitzDaily tutorial like Nik done. I start averaging from the beginning up to 0.4 sec . Then I restart the simulation for another 0.4 sec.
When I use 2.2.0, this problem has not appeared. but in 2.2.x (latest), it comes.

I found that Foam::fieldAverage::initialize() function was not loaded in Foam::fieldAverage::read() in 2.2.x. and it will be loaded at 1st time call of Foam::fieldAverage::calcAverage().

https://github.com/OpenFOAM/OpenFOAM...fieldAverage.C
https://github.com/OpenFOAM/OpenFOAM...fieldAverage.C

So, mean and P2Mean values will reset after calculation started.

I thought call of initialize() must be in Foam::fieldAverage::read().
I have tested to fix them with changing code as shown below.

Code:
// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

void Foam::fieldAverageFixed::read(const dictionary& dict)
{
    if (active_)
    {
        initialised_ = false;

        dict.readIfPresent("resetOnRestart", resetOnRestart_);
        dict.readIfPresent("resetOnOutput", resetOnOutput_);
        dict.lookup("fields") >> faItems_;

        readAveragingProperties();
    }

    if (!initialised_)
    {
        initialize();
    }

}


void Foam::fieldAverageFixed::execute()
{
    if (active_)
    {
        calcAverages();
    }
}
In my case, it seems to work fine. averaged values are same as using 2.2.0.
But I don't know whether it is truly correct or not.
Please check and post if something is wrong.
Attached Images
File Type: jpg ContinuousWithFixed2.2.x.jpg (64.6 KB, 117 views)
File Type: jpg notContinuousWithLatest2.2.x.jpg (59.6 KB, 84 views)
File Type: jpg ContinuousWith2.2.0.jpg (63.3 KB, 68 views)
atulkjoy and JamesCC like this.

Last edited by h.ono; July 6, 2013 at 23:19. Reason: mistake
h.ono is offline   Reply With Quote

Old   July 23, 2013, 08:43
Default
  #5
nik
New Member
 
nicolas
Join Date: Oct 2009
Posts: 24
Rep Power: 17
nik is on a distinguished road
Dear Hiroki Ono,

thank you very much for the reply and suggested fix. Sorry for the late response but I had reported this bug to OpenFOAM and I was waiting for an official answer. I just got a reply that the issue has been fixed in the new version of 2.2.x. I guess based on your fix.

This thread is located at:
http://www.cfd-online.com/Forums/ope...-new-post.html

Regards,
Nicolas
nik 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
Starting field averaging using libFunctionObject after certain time eelcovv OpenFOAM Programming & Development 25 December 7, 2015 23:28
MRF and Heat transfer calculation Susan YU FLUENT 0 June 2, 2010 09:46
Nusselt averaging in Unsteady calculation elyyan FLUENT 0 August 7, 2006 14:48
unsteady calculation and Nusselt averaging elyyan FLUENT 0 August 4, 2006 15:32
Warning 097- AB Siemens 6 November 15, 2004 05:41


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