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

A more intelligent solution control class

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2015, 09:42
Lightbulb A more intelligent solution control class
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I have always found it a bit annoying that you need to find the residual tolerances for PIMPLE loops yourself to get the solver to break the loop after convergence, so I have written a solutionControl class that recognizes converged residuals. This is done by checking that the minimum residual didn't drop atleast by a factor of x after y steps. Using this class in a solver makes it possible to break the loop at convergence using nearly a minimum amount of steps without manually finding tolerance levels. This is also beneficial for unsteady cases in which the converged residual values change with time and have to be adjusted. In a case like this, set the absolute residual tolerances to something very low which won't be reached by the solver and residual tolerances to zero so only the new method is used.

For using the class in a solver simply replace the
Code:
#include pimpleControl.H
line with
Code:
#include smartControl.H
and instantiate the smartControl class instead of the pimpleControl class. You can use nSteps and minResidualDecrease properties in PIMPLE subdictionary in fvSolution.
Attached Files
File Type: zip smartControl.zip (3.5 KB, 22 views)
chriss85 is offline   Reply With Quote

Old   April 30, 2015, 11:57
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
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
Greetings Chris,

Thanks for sharing. A few suggestions:
  1. You can report this on the bug tracker (on both OpenFOAM and foam-extend) as a feature request and provide the files and information you've provided here. Both projects accept code contributions.
  2. And/or if the feature request is not accepted, please add an entry on the wiki, for example, here: http://openfoamwiki.net/index.php/Contrib/smartControl
Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   April 30, 2015, 12:38
Default
  #3
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
For integrating it into the official OpenFOAM version it would be smarter to insert the code directly into the pimpleControl class, since there is some duplicate code and the current approach requires modifications to the solvers. I went this route to maintain compatibility with future OF versions without modifying their source files. This would not be needed if it was in the official code though.
chriss85 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
grid dependancy gueynard a. Main CFD Forum 19 June 27, 2014 21:22
Solution Diverging with Trimmer Mesh rietuk STAR-CCM+ 8 February 27, 2013 04:50
Exact solution of Burgers equation mcaro Main CFD Forum 3 January 25, 2011 06:46
How to get the solution of last time step? lzgwhy Fluent UDF and Scheme Programming 0 September 15, 2010 22:23
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 01:16


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