CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to write a field at time when converged? (https://www.cfd-online.com/Forums/openfoam-programming-development/146486-how-write-field-time-when-converged.html)

pbachant December 29, 2014 21:44

How to write a field at time when converged?
 
I am working on a custom fvOption that is writing a field at normal outputTimes using

Code:

if (mesh_.time().outputTime())
{
    myField.write();
}

However, the field is not written when the steady state solver (simpleFoam) converges--the most important time to write! What other condition can I use to make this field write?

kmooney January 9, 2015 20:56

Hi Pete,

If you have residualControls defined in the fvSolution file, simpleFoam should write and stop as soon as all of the criteria are satisfied. Is this different than what you are trying to do with the function object?

Cheers!
Kyle

Quote:

Originally Posted by pbachant (Post 525494)
I am working on a custom fvOption that is writing a field at normal outputTimes using

Code:

if (mesh_.time().outputTime())
{
    myField.write();
}

However, the field is not written when the steady state solver (simpleFoam) converges--the most important time to write! What other condition can I use to make this field write?


pbachant January 9, 2015 21:09

Kyle,

This is indeed what I'm trying to do. What I gather is the final time is not an outputTime, so my field is not writing, but all the other OpenFOAM fields write.

kmooney January 9, 2015 21:21

Right.

The issue is likely this: The convergence check is performed within the simple.loop() call at the beginning of the simple loop. If its satisfied, then it writes and stops.

If you look at ::loop()

Code:

/src/finiteVolume/lnInclude/simpleControls.C
You'll see that it will drop out before returning time.loop() later in the function. <- this is what was about to call your function object but it stopped before hand.


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