Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_NOX::Stagnation Class Reference

Failure test based on the convergence rate between nonlinear iterations. More...

#include <N_NLS_NOX_StagnationTest.h>

Inheritance diagram for N_NLS_NOX::Stagnation:
Collaboration diagram for N_NLS_NOX::Stagnation:

Public Member Functions

 Stagnation (int n=5, double tolerance=1.0e-3)
 Constructor. More...
 
virtual ~Stagnation ()
 Destructor. More...
 
virtual NOX::StatusTest::StatusType checkStatus (const NOX::Solver::Generic &problem)
 
virtual NOX::StatusTest::StatusType getStatus () const
 
virtual std::ostream & print (std::ostream &stream, int indent=0) const
 
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. More...
 
virtual int getCurrentNumSteps () const
 Returns the current number of steps that have consecutively failed the tolerance test. More...
 
virtual double getTolerance () const
 Returns the user specified tolerance. More...
 
virtual double getConvRate () const
 Returns the current convergence rate. More...
 

Private Attributes

int maxSteps
 User supplied value of n. More...
 
int numSteps
 Current number of consecutive nonlinear iterations that have failed the specified tolerance. More...
 
int lastIteration
 The last nonlinear iteration index. More...
 
double tolerance
 User specified tolerance. More...
 
double convRate
 Currently computed convergence rate. More...
 
double minConvRate
 
double normFInit
 
NOX::StatusTest::StatusType status
 Status More...
 

Detailed Description

Failure test based on the convergence rate between nonlinear iterations.

This status test returns a Failed status if the convergence rate is worse than a specified tolerance for $ n $ consecutive iterations.

In many codes if the Jacobian is not accurate, the solver can stagnate. In this case, further nonlinear iterations make negligible progress in reducing the norm of F. To prevent unnecessary churning, this status test will identify when a code stagnates and ends the solve.

This status test returns a Failed status if $ n $ nonlinear steps have consecutively failed the following test:

At nonlinear iteration $ k $, the convergence rate, $ \eta $ is computed by:

\[ \eta = \frac{\| F_k \|}{\| F_{k-1} \|} \]

If $ \eta $ is greater than or equal to the specified tolerance, then a counter is incremented. If the counter hits the user specified number of iterations, the status test returns a Failed status. NOTE: For the counter to increment, the steps have to fail CONSECUTIVELY. The counter is reset every time a convergence rate passes the requested tolerance.

Based on experience the following values are recomended:

  • For Newton solves: n = 50, tolerance = 1.0
  • For Newton solves with a line search: n = 15, tolerance = 0.99 <>

Definition at line 84 of file N_NLS_NOX_StagnationTest.h.

Constructor & Destructor Documentation

N_NLS_NOX::Stagnation::Stagnation ( int  n = 5,
double  tolerance = 1.0e-3 
)

Constructor.

n is the number of consecutive nonlinear iterations with a convergence rate failure for this test to return a Failed status.

Definition at line 57 of file N_NLS_NOX_StagnationTest.C.

N_NLS_NOX::Stagnation::~Stagnation ( )
virtual

Destructor.

Definition at line 70 of file N_NLS_NOX_StagnationTest.C.

Member Function Documentation

NOX::StatusTest::StatusType N_NLS_NOX::Stagnation::checkStatus ( const NOX::Solver::Generic &  problem)
virtual

Definition at line 76 of file N_NLS_NOX_StagnationTest.C.

double N_NLS_NOX::Stagnation::getConvRate ( ) const
virtual

Returns the current convergence rate.

Definition at line 174 of file N_NLS_NOX_StagnationTest.C.

int N_NLS_NOX::Stagnation::getCurrentNumSteps ( ) const
virtual

Returns the current number of steps that have consecutively failed the tolerance test.

Definition at line 164 of file N_NLS_NOX_StagnationTest.C.

int N_NLS_NOX::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 159 of file N_NLS_NOX_StagnationTest.C.

NOX::StatusTest::StatusType N_NLS_NOX::Stagnation::getStatus ( ) const
virtual

Definition at line 134 of file N_NLS_NOX_StagnationTest.C.

double N_NLS_NOX::Stagnation::getTolerance ( ) const
virtual

Returns the user specified tolerance.

Definition at line 169 of file N_NLS_NOX_StagnationTest.C.

std::ostream & N_NLS_NOX::Stagnation::print ( std::ostream &  stream,
int  indent = 0 
) const
virtual

Definition at line 139 of file N_NLS_NOX_StagnationTest.C.

Member Data Documentation

double N_NLS_NOX::Stagnation::convRate
private

Currently computed convergence rate.

Definition at line 134 of file N_NLS_NOX_StagnationTest.h.

int N_NLS_NOX::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 128 of file N_NLS_NOX_StagnationTest.h.

int N_NLS_NOX::Stagnation::maxSteps
private

User supplied value of n.

Definition at line 119 of file N_NLS_NOX_StagnationTest.h.

double N_NLS_NOX::Stagnation::minConvRate
private

Definition at line 136 of file N_NLS_NOX_StagnationTest.h.

double N_NLS_NOX::Stagnation::normFInit
private

Definition at line 138 of file N_NLS_NOX_StagnationTest.h.

int N_NLS_NOX::Stagnation::numSteps
private

Current number of consecutive nonlinear iterations that have failed the specified tolerance.

Definition at line 122 of file N_NLS_NOX_StagnationTest.h.

NOX::StatusTest::StatusType N_NLS_NOX::Stagnation::status
private

Status

Definition at line 141 of file N_NLS_NOX_StagnationTest.h.

double N_NLS_NOX::Stagnation::tolerance
private

User specified tolerance.

Definition at line 131 of file N_NLS_NOX_StagnationTest.h.


The documentation for this class was generated from the following files: