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

fieldAverage fails to continue averaging the fields

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 7, 2015, 17:10
Thumbs down fieldAverage fails to continue averaging the fields
  #1
New Member
 
Fernando Soares Alves
Join Date: Oct 2013
Posts: 16
Rep Power: 13
FernandoSoares is on a distinguished road
Hi there dear Foamers,

I am currently running some simple LES cases and I wish to, during runTime, average some fields of interest. For instance I'm using fieldAverage in my controlDict in the following way

Code:
funtions
{
    fieldAverage
    {
        type                    fieldAverage;
        functionObjectLibs      ("libfieldFunctionObjects.so");
        enabled                 true;
        cleanRestart            false;
        outputControl           outputTime;
        resetOnOutput           false;
        resetOnRestart          false;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

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

        );
    }
}
Right now I face multiple 'sudden-stops' here at the University and every time I restart the simulation from its latestTime the averages, specially UPrime2Mean, start all over again. How could I avoid such an issue? Am I setting the controlDict (functions) incorrectly?

Could any expert or someone who has already experienced a similar situation advise me?

Thanks in advance and best regards,

F. Soares.
Attached Images
File Type: png RxxAfterStop.png (62.2 KB, 69 views)
File Type: png RxxBeforeStop.png (73.5 KB, 56 views)
FernandoSoares is offline   Reply With Quote

Old   December 8, 2015, 05:12
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
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
Quick answer: I vaguely remember there was a bug related to this in one of OpenFOAM's older versions. I've found the bug report for it: http://www.openfoam.org/mantisbt/view.php?id=898

Which version of OpenFOAM are you using?
__________________
wyldckat is offline   Reply With Quote

Old   December 8, 2015, 08:48
Default
  #3
New Member
 
Fernando Soares Alves
Join Date: Oct 2013
Posts: 16
Rep Power: 13
FernandoSoares is on a distinguished road
Sorry, I should have attached the other threads I was reading about this issue. I currently use OpenFOAM 2.4.x.
FernandoSoares is offline   Reply With Quote

Old   December 8, 2015, 08:56
Default
  #4
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
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
A few quick questions:
  1. Does your "controlDict" really have then entry named "funtions", or did you only mistype here on the post? Notice that it's missing a "c".
  2. Do you know which is the latest commit of 2.4.x you have? You can check with the following command:
    Code:
    blockMesh -help
    the hash number is shown near the end, associated to the version number.
  3. Can you provide a quick test case with which this issue can be reproduced? For example, can you reproduce this with one of the tutorial cases from OpenFOAM?
wyldckat is offline   Reply With Quote

Old   December 8, 2015, 13:30
Default
  #5
New Member
 
Fernando Soares Alves
Join Date: Oct 2013
Posts: 16
Rep Power: 13
FernandoSoares is on a distinguished road
According to 'blockMesh -help' I am currently

Code:
Using: OpenFOAM-2.4.x (see www.OpenFOAM.org)
Build: 2.4.x-e713234c04f6
Sorry about that, typo common mistake. My controlDict file is

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

application     pisoFoam;

startFrom       startTime;

startTime       200;

stopAt          endTime;

endTime         3000;

deltaT          2e-04;

writeControl    adjustableRunTime;

writeInterval   0.25;

purgeWrite      1;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  on;

maxCo           0.250000;

maxDeltaT       0.001500;



functions
{
   
    fieldAverage1
    {
        type                fieldAverage;
        functionObjectLibs     ("libfieldFunctionObjects.so");
        enabled             true;
        cleanRestart        false;
        outputControl       outputTime;
        resetOnOutput       false;
        resetOnRestart      false;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;
                base        time;
            }

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

        );
    }


     
    epsilon
    {
       type              epsilonTsr;
        UName           U;
        UMeanName       UMean;
        functionObjectLibs ("myTurbFieldsFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
    }  

    epsilonTrue
    {
        type              epsilonTsrTrue;
        UName           U;
        UMeanName       UMean;
        functionObjectLibs ("myTurbFieldsFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
    }  

    pStrain
    {
        type              pStrain;
        UName           U;
        UMeanName       UMean;
        pName            p;
        pMeanName        pMean;
        functionObjectLibs ("myTurbFieldsFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
    } 

    pU
    {
        type            pU;
        UName           U;
        UMeanName       UMean;
        pName            p;
        pMeanName        pMean;
        functionObjectLibs ("myTurbFieldsFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
    } 

    triU
    {
        type             triU;
        UName           U;
        UMeanName       UMean;
        functionObjectLibs ("myTurbFieldsFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
    } 


    fieldAverage2
    {
        type                fieldAverage;
        functionObjectLibs     ("libfieldFunctionObjects.so");
        enabled                 true;
        cleanRestart            false;
        outputControl           outputTime;
        resetOnOutput           false;
        resetOnRestart          false;
        fields
        (   
        epsilonTsr
        {
        mean        on;
        prime2Mean  off;
        base        time;
        }

        epsilonTsrTrue
        {
        mean        on;
        prime2Mean  off;
        base        time;
        }

        pStrain
        {
        mean        on;
        prime2Mean  off;
        base        time;
        }

        pU
        {
        mean        on;
        prime2Mean  off;
        base        time;
        }

        triU
        {
        mean        on;
        prime2Mean  off;
        base        time;
        }
        );
   }



    probes
    {
        type            probes;
        functionObjectLibs ("libsampling.so");
        enabled         true;
        outputControl   timeStep;
        outputInterval  10;

        fields
        (
        // inst fields
    /*
        U        
        p
        k
    */
        // mean fields
    
        UMean
            pMean
        UPrime2Mean
        epsilonTsrMean
        epsilonTsrTrueMean
        pStrainMean
        pUMean
        triUMean        
    
        );

        probeLocations
        (
        (0.125 0.95 0)
        (0.250 0.95 0)
        (0.375 0.95 0)
        (0.500 0.95 0)
        (0.625 0.95 0)
        (0.750 0.95 0)
        (0.875 0.95 0)

        (0.125 0.85 0)
        (0.250 0.85 0)
        (0.375 0.85 0)
        (0.500 0.85 0)
        (0.625 0.85 0)
        (0.750 0.85 0)
        (0.875 0.85 0)

        (0.125 0.7 0)
        (0.250 0.7 0)
        (0.375 0.7 0)
        (0.500 0.7 0)
        (0.625 0.7 0)
        (0.750 0.7 0)
        (0.875 0.7 0)

        (0.125 0.6 0)
        (0.250 0.6 0)
        (0.375 0.6 0)
        (0.500 0.6 0)
        (0.625 0.6 0)
        (0.750 0.6 0)
        (0.875 0.6 0)
        );

    }

}

// ************************************************************************* //
The other fields I am trying to take averages are related to the transport of the Reynolds stress. So I'm in fact doing two averages in my simulation: fieldAverage1 and fieldAverage2.

Once again thank you for your time and patience Mr. Santos,

F. Soares.
FernandoSoares is offline   Reply With Quote

Old   December 8, 2015, 14:39
Default
  #6
New Member
 
Fernando Soares Alves
Join Date: Oct 2013
Posts: 16
Rep Power: 13
FernandoSoares is on a distinguished road
I forgot to address a similar tutorial in my last reply. In $FOAM_TUTORIALS/incompressible/pisoFoam/les/pitzDaily there is a similar structure to the case I am trying to run here. However modifying the controlFidct file

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

application     pisoFoam;

//startFrom       startTime;
startFrom       latestTime;

startTime       0;

stopAt          endTime;

//endTime         10e-05;
endTime         20e-05;

deltaT          1e-05;

writeControl    timeStep;

writeInterval   1;

purgeWrite      1;

writeFormat     ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision   6;

runTimeModifiable true;

functions
{
    fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
        timeStart       3e-05;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }

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

    fieldAverage2
    {
        type            fieldAverage;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl   outputTime;
        timeStart       9e-05;
        fields
        (
            U
            {
                mean        on;
                prime2Mean  on;                base        time;
            }
        );
    }
}

// ************************************************************************* //
so to use fieldAverage twice (one for obtaining p and U mean field and another for UPrime2Mean) doesn't seem to yield the problem I've been having all this time. According to the log after restarting the simulation under the programmed stop

Code:
Starting time loop

fieldAverage fieldAverage1:
    Restarting averaging for fields:
        U iters = 5 time = 5e-05

fieldAverage fieldAverage2:
    Restarting averaging for fields:
        U iters = 5 time = 5e-05
Apparently OF is working for this specific tutorial. Any ideas why?
FernandoSoares is offline   Reply With Quote

Old   December 8, 2015, 16:43
Default
  #7
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
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 F. Soares,

This is starting to look like it's a somewhat severe bug. The case you prepared with the tutorial has the function objects prepared differently and that could be enough for the first one to not conflict with the second one, given that you gave two different start times and different averaging mechanisms.

And I went looking for bug reports about "fieldAverage" and found the following issue still open: http://www.openfoam.org/mantisbt/view.php?id=1336 - it seems to be related to your issue.

I'm adding this to my to-do list for the upcoming weekend. If you can figure out a way to reproduce this issue with the tutorial case, it would help a lot in isolating the origin of the problem and to fix it.
The other possibility for the origin of this bug is if you are running in parallel at the University, which could potentially also bring up other problems.

Best regards,
Bruno
wyldckat 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
How to restart averaging of the fields? huangxianbei OpenFOAM Running, Solving & CFD 0 March 21, 2014 06:21
a reconstructPar issue immortality OpenFOAM Post-Processing 8 June 16, 2013 12:25
an odd(at least for me!) reconstructPar error on a field immortality OpenFOAM Running, Solving & CFD 3 June 3, 2013 23:36
EULER-Forward-Method freak Main CFD Forum 4 June 12, 2001 10:19


All times are GMT -4. The time now is 21:11.