CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   fieldAverage1 question (https://www.cfd-online.com/Forums/openfoam-solving/230439-fieldaverage1-question.html)

MaySea September 23, 2020 11:31

fieldAverage1 question
 
Hi all,

I am trying to run a simulation, where a timeStep is 0.1, the output is saved each 500 time steps (meaning 50s). Additionally, I want to have averages of all the fields each 100 seconds (therefore the average should be calculated each 1000 timeSteps. My timeEnd is 1000, meaning that I want 10 averages (each 100 seconds).

I need to admit that I totally don't get the

restartOnRestart
restartOnOutput
periodicRestart

fields, even after reading the documentation. restartOnRestart seems totally non-intuitive to me, restartOnOutput means that averaging is restarted upon every output I guess and periodicRestart should restart the averaging every x seconds. Are periodicRestart units in timeStep units or rather simulation run time? E.g. if I set it as 100, will it restart every 100 timeSteps or rather 100 s of sim runtime? I realise that these are quite basic questions, but I got lost after multiple attempts.

Here is my control dict, which unfortunately doesn't serve the purpose. Any suggestions how should I amend it? Thanks a million to anyone willing to help.


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    pimpleFoam;

startFrom      latestTime;

startTime      0;

stopAt          endTime;

endTime        1000;

deltaT          0.1;

writeControl    timeStep;

writeInterval  500;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression off;

timeFormat      general;

timePrecision  6;

runTimeModifiable true;


functions

{

wallShearStress1
{
    // Mandatory entries (unmodifiable)
    type            wallShearStress;
    libs            ("libfieldFunctionObjects.so");

    // Optional entries (runtime modifiable)
    patches        ("barkley");

    // Optional (inherited) entries
    writePrecision  8;
    writeToFile    true;
    useUserTime    true;
    enabled        true;
    log            true;
    timeStart      0;
    timeEnd        1000;
    executeControl  timeStep;
    executeInterval 1;
    writeControl    timeStep;
    writeInterval  500;
}

fieldAverage1                                                                                                                                                     
    {                                                                                                                                                                 
        type                fieldAverage;                                                                                                                             
        libs                ("libfieldFunctionObjects.so");                                                                                                           
                                                                                                                                                                       
        writeControl    writeTime;  //maybe timeStep instead?                                                                                                                                 
                                                                                                                                                                       
        restartOnRestart    false;                                                                                                                                     
        restartOnOutput    false;                                                                                                                                     
        periodicRestart    true;                                                                                                                                     
        restartPeriod      100;                                                                                                                                     
                                                                                                                                                                       
        fields                                                                                                                                                         
        (                                                                                                                                                             
            U                                                                                                                                                         
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                base            time;  //maybe timeStep?                                                                                                                               
                window          100.0; //maybe 1000 with timeStep as base?                                                                                                                                 
                windowName      w1;                                                                                                                                   
            }                                                                                                                                                         
            p                                                                                                                                                         
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                base            time;
                window          100.0;                                                                                                                                 
                windowName      w1;                                   
                               
            }
              k
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                base            time;
                window          100.0;                                                                                                                                 
                windowName      w1;                                   
            }
            epsilon
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                base            time; 
                window          100.0;                                                                                                                                 
                windowName      w1;                                   
            }
            wallShearStress
            {
                mean        on;
                prime2Mean  off;
                base        time;
                window          100.0;                                                                                                                                 
                windowName      w1;   
            }
        );                                                                                                                                                             
    } 

}


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


Richard97 September 25, 2020 08:58

Similar Problem
 
Been having a similar issue with the averaging, anyone able to resolve this for me?

MaySea November 4, 2020 13:53

Hi,

I am still having the problem.

Code:

fieldAverage1                                                                                                                                                     
    {                                                                                                                                                                 
        type                fieldAverage;                                                                                                                             
        libs                ("libfieldFunctionObjects.so");                                                                                                           
                                                                                                                                                                       
        executeControl  timeStep;
                executeInterval 1;
                writeControl    adjustableRunTime;
                writeInterval  100;
                                                                                                                                                                       
        restartOnRestart          false;                                                                                                                                     
        restartOnOutput    false;                                                                                                                                     
        periodicRestart    true;
                restartPeriod      100;
                                                                                                                                                                       
        fields                                                                                                                                                         
        (                                                                                                                                                             
            U                                                                                                                                                         
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;   
                                base                        time;
                                window      100.0;
                                windowName  w100;
                                allowRestart true;
                                       
                                                                                                                             
            }                                                                                                                                                         
            p                                                                                                                                                         
            {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                                base                        time;
                                window      100.0;
                                windowName  w100;
                                allowRestart true;
                               
            }
                          k
                        {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                                base                        time;
                                window      100.0;
                                windowName  w100;
                                allowRestart true;
            }
                        omega
                        {                                                                                                                                                         
                mean            on;                                                                                                                                   
                prime2Mean      off;                                                                                                                                   
                                base                        time;
                                window      100.0;
                                windowName  w100;
                                allowRestart true;
            }
                        wallShearStress
                        {
                                mean        on;
                                prime2Mean  off;
                                base                        time;
                                window      100.0;
                                windowName  w100;
                                allowRestart true;
                        }
        );                                                                                                                                                             
    } 

}

This averaging doesn't work - my averaged fields are exactly the same as fields calculated for the given time steps. Does anyone see what's wrong here?

Thanks,
Jan


All times are GMT -4. The time now is 07:39.