CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   writeTimeIndex_ (or equivalent) possibly not updated for function objects (https://www.cfd-online.com/Forums/openfoam-bugs/239563-writetimeindex_-equivalent-possibly-not-updated-function-objects.html)

saladbowl November 11, 2021 20:02

writeTimeIndex_ (or equivalent) possibly not updated for function objects
 
Version: v2012

I was running a simulation with the setting

Code:

writeControl    adjustableRunTime;
adjustTimeStep yes;
writeInterval  .001;
runTimeModifiable yes;

in the main section of controlDict and

Code:

writeControl adjustableRunTime;
writeInterval  .001;
executeControl  adjustableRunTime;
executeInterval .001;

in all of my functionObjects in controlDict. Everything was working as expected. I then let the simulation run until a time of 0.008. I made some modifications to solver settings and restarted the simulation. Just after the simulation reached the runTime of 0.011, I edited controlDict and replaced all the intervals from 0.001 to 0.01.

I was expecting another write at 0.02, but this occurred at 0.018=0.008+0.01. So I decided to take a look at the code, and surely enough, I found the following in TimeIO.C

Code:

    if (oldWriteInterval != writeInterval_)
    {
        switch (writeControl_)
        {
            case wcRunTime:
            case wcAdjustableRunTime:
                // Recalculate writeTimeIndex_ to be in units of current
                // writeInterval.
                writeTimeIndex_ = label
                (
                    writeTimeIndex_
                  * oldWriteInterval
                  / writeInterval_
                );
            break;

            default:
            break;
        }
    }

Following this code, it seems that OpenFOAM did exactly as told (as always). However, all my function objects stopped outputting results after I changed writeInterval and executeInterval from 0.001 to 0.01.The last write operation in the postProcessing files is for 0.011. Is writeTimeIndex also used by writing routines for function objects? Is this the expected behaviour? I would like to know if this is just some misunderstanding on my behalf. It seems the writeTimeIndex should also be updated for anything that writes, but this does not seem to be the case for the function objects.


All times are GMT -4. The time now is 18:01.