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

How to write a field at time when converged?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 29, 2014, 21:44
Default How to write a field at time when converged?
  #1
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13
pbachant is on a distinguished road
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?
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   January 9, 2015, 20:56
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
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 View Post
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 is offline   Reply With Quote

Old   January 9, 2015, 21:09
Default
  #3
Senior Member
 
Pete Bachant
Join Date: Jun 2012
Location: Boston, MA
Posts: 173
Rep Power: 13
pbachant is on a distinguished road
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.
__________________
Home | Twitter | GitHub
pbachant is offline   Reply With Quote

Old   January 9, 2015, 21:21
Default
  #4
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
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.
kmooney 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
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 13:40
Unstabil Simulation with chtMultiRegionFoam mbay101 OpenFOAM Running, Solving & CFD 13 December 28, 2013 13:12
pimpleFoam: turbulence->correct(); is not executed when using residualControl hfs OpenFOAM Running, Solving & CFD 3 October 29, 2013 08:35
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 15:33
AMG versus ICCG msrinath80 OpenFOAM Running, Solving & CFD 2 November 7, 2006 15:15


All times are GMT -4. The time now is 15:36.