#include <NOX_StatusTest_Stagnation.H>
Public Member Functions | |
Stagnation (int n=50, double tol=1.0) | |
Constructor. | |
virtual | ~Stagnation () |
Destructor. | |
virtual NOX::StatusTest::StatusType | checkStatus (const NOX::Solver::Generic &problem, NOX::StatusTest::CheckType checkType) |
Tests the stopping criterion. | |
virtual NOX::StatusTest::StatusType | getStatus () const |
Return the result of the most recent checkStatus call. | |
virtual ostream & | print (ostream &stream, int indent=0) const |
Output formatted description of stopping test to output stream. | |
virtual int | getMaxNumSteps () const |
Returns the used specified number of steps that can consecutively fail the tolerance test before the test returns a failed status. | |
virtual int | getCurrentNumSteps () const |
Returns the current number of steps that have consecutively failed the tolerance test. | |
virtual double | getTolerance () const |
Returns the user specified tolerance. | |
virtual double | getConvRate () const |
Returns the current convergence rate. | |
Private Attributes | |
int | maxSteps |
User supplied value of n. | |
int | numSteps |
Current number of consecutive nonlinear iterations that have failed the specified tolerance. | |
int | lastIteration |
The last nonlinear iteration index. | |
double | tolerance |
User specified tolerance. | |
double | convRate |
Currently computed convergence rate. | |
NOX::StatusTest::StatusType | status |
Status |
This status test returns NOX::StatusTest::Failed if we fail to reduce the norm of by a specified tolerance for n consecutive iterations. In other words, if
for n consecutive iterations, the status is set to NOX::StatusTest::Failed and returned. Otherwise, the status is set to NOX::StatusTest::Uncoverged and returned. Both n and the tolerance are specified in the constructor, by n
and tol
, respectively.
Based on experience the following values are recommended:
Definition at line 81 of file NOX_StatusTest_Stagnation.H.
NOX::StatusTest::Stagnation::Stagnation | ( | int | n = 50 , |
|
double | tol = 1.0 | |||
) |
Constructor.
n | - Number of consecutive nonlinear iterations | |
tol | - Tolerance for stagnation test |
Definition at line 47 of file NOX_StatusTest_Stagnation.C.
References NOX::StatusTest::Unevaluated.
NOX::StatusTest::Stagnation::~Stagnation | ( | ) | [virtual] |
NOX::StatusTest::StatusType NOX::StatusTest::Stagnation::checkStatus | ( | const NOX::Solver::Generic & | problem, | |
NOX::StatusTest::CheckType | checkType | |||
) | [virtual] |
Tests the stopping criterion.
Implements NOX::StatusTest::Generic.
Definition at line 64 of file NOX_StatusTest_Stagnation.C.
References convRate, NOX::StatusTest::Failed, NOX::Abstract::Group::getNormF(), NOX::Solver::Generic::getNumIterations(), NOX::Solver::Generic::getPreviousSolutionGroup(), NOX::Solver::Generic::getSolutionGroup(), lastIteration, maxSteps, numSteps, status, tolerance, and NOX::StatusTest::Unconverged.
NOX::StatusTest::StatusType NOX::StatusTest::Stagnation::getStatus | ( | ) | const [virtual] |
Return the result of the most recent checkStatus call.
Implements NOX::StatusTest::Generic.
Definition at line 110 of file NOX_StatusTest_Stagnation.C.
References status.
ostream & NOX::StatusTest::Stagnation::print | ( | ostream & | stream, | |
int | indent = 0 | |||
) | const [virtual] |
Output formatted description of stopping test to output stream.
Implements NOX::StatusTest::Generic.
Definition at line 115 of file NOX_StatusTest_Stagnation.C.
int NOX::StatusTest::Stagnation::getMaxNumSteps | ( | ) | const [virtual] |
Returns the used specified number of steps that can consecutively fail the tolerance test before the test returns a failed status.
Definition at line 130 of file NOX_StatusTest_Stagnation.C.
References maxSteps.
int NOX::StatusTest::Stagnation::getCurrentNumSteps | ( | ) | const [virtual] |
Returns the current number of steps that have consecutively failed the tolerance test.
Definition at line 135 of file NOX_StatusTest_Stagnation.C.
References numSteps.
double NOX::StatusTest::Stagnation::getTolerance | ( | ) | const [virtual] |
Returns the user specified tolerance.
Definition at line 140 of file NOX_StatusTest_Stagnation.C.
References tolerance.
double NOX::StatusTest::Stagnation::getConvRate | ( | ) | const [virtual] |
Returns the current convergence rate.
Definition at line 145 of file NOX_StatusTest_Stagnation.C.
References convRate.
int NOX::StatusTest::Stagnation::maxSteps [private] |
User supplied value of n.
Definition at line 129 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus(), getMaxNumSteps(), and print().
int NOX::StatusTest::Stagnation::numSteps [private] |
Current number of consecutive nonlinear iterations that have failed the specified tolerance.
Definition at line 132 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus(), getCurrentNumSteps(), and print().
int NOX::StatusTest::Stagnation::lastIteration [private] |
The last nonlinear iteration index.
This is used to prevent counting a step multiple times if by chance the status test is called multiple times between iterations.
Definition at line 138 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus().
double NOX::StatusTest::Stagnation::tolerance [private] |
User specified tolerance.
Definition at line 141 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus(), and getTolerance().
double NOX::StatusTest::Stagnation::convRate [private] |
Currently computed convergence rate.
Definition at line 144 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus(), getConvRate(), and print().
Status
Definition at line 147 of file NOX_StatusTest_Stagnation.H.
Referenced by checkStatus(), getStatus(), and print().