NOX Development
Loading...
Searching...
No Matches
NOX::Solver::LineSearchBased Class Reference

Nonlinear solver based on a line search (i.e., damping). More...

#include <NOX_Solver_LineSearchBased.H>

Inheritance diagram for NOX::Solver::LineSearchBased:
Collaboration diagram for NOX::Solver::LineSearchBased:

Public Member Functions

 LineSearchBased (const Teuchos::RCP< NOX::Abstract::Group > &grp, const Teuchos::RCP< NOX::StatusTest::Generic > &tests, const Teuchos::RCP< Teuchos::ParameterList > &params)
 Constructor.
virtual ~LineSearchBased ()
 Destructor.
virtual void reset (const NOX::Abstract::Vector &initialGuess, const Teuchos::RCP< NOX::StatusTest::Generic > &tests)
 Resets the solver, sets a new status test, and sets a new initial guess.
virtual void reset (const NOX::Abstract::Vector &initialGuess)
 Resets the solver and sets a new initial guess.
virtual void reset ()
 Resets the solver for another solve. This resets the counters and status only. Uses the final solution from the last solve as the initial guess for the next solve.
virtual NOX::StatusTest::StatusType step ()
 Do one nonlinear step in the iteration sequence and return status.
virtual NOX::StatusTest::StatusType solve ()
 Solve the nonlinear problem and return final status.
virtual const NOX::Abstract::GroupgetSolutionGroup () const
 Return a reference to the current solution group.
virtual const NOX::Abstract::GroupgetPreviousSolutionGroup () const
 Return a reference to the previous solution group.
virtual NOX::StatusTest::StatusType getStatus () const
 Returns the current status of the solver.
virtual int getNumIterations () const
 Get number of iterations.
virtual const Teuchos::ParameterList & getList () const
 Return a reference to the solver parameters.
virtual double getStepSize () const
virtual Teuchos::RCP< const NOX::Abstract::GroupgetSolutionGroupPtr () const
 Return a RCP to the solution group.
virtual Teuchos::RCP< const NOX::Abstract::GroupgetPreviousSolutionGroupPtr () const
 Return a RCP to the previous solution group.
virtual Teuchos::RCP< const Teuchos::ParameterList > getListPtr () const
 Return a RCP to the solver parameters.
virtual Teuchos::RCP< const NOX::SolverStatsgetSolverStatistics () const
 Return a RCP to the solver statistics.
Public Member Functions inherited from NOX::Solver::Generic
 Generic ()
 Constructor (does nothing).
virtual ~Generic ()
 Destructor (does nothing).

Protected Member Functions

virtual void init ()
 Print out initialization information and calcuation the RHS.
virtual void printUpdate ()
 Prints the current iteration information.

Protected Attributes

Teuchos::RCP< NOX::GlobalDataglobalDataPtr
 Pointer to the global data object.
Teuchos::RCP< NOX::UtilsutilsPtr
 Utils.
Teuchos::RCP< NOX::Abstract::GroupsolnPtr
 Current solution.
Teuchos::RCP< NOX::Abstract::GroupoldSolnPtr
 Previous solution pointer.
Teuchos::RCP< NOX::Abstract::VectordirPtr
 Current search direction pointer.
Teuchos::RCP< NOX::StatusTest::GenerictestPtr
 Stopping test.
Teuchos::RCP< Teuchos::ParameterList > paramsPtr
 Input parameters.
Teuchos::RCP< NOX::LineSearch::GenericlineSearchPtr
 Linesearch.
Teuchos::RCP< NOX::Direction::GenericdirectionPtr
 Search Direction.
double stepSize
 Current step.
int nIter
 Number of nonlinear iterations.
bool catchThrowsDuringSolve
 Determine if we want to catch and ignore exceptions thrown from the linear solver stack.
NOX::StatusTest::StatusType status
 Status of nonlinear solver.
NOX::StatusTest::CheckType checkType
 Type of check to use for status tests. See NOX::StatusTest for more details.
Teuchos::RCP< NOX::Observerobserver
 Pointer to a user defined NOX::Observer object.

Detailed Description

Nonlinear solver based on a line search (i.e., damping).

Solves $ F(x)=0$ using an iterative line-search-based method.

Each iteration, the solver does the following.

The iterations progress until the status tests (see NOX::StatusTest) determine either failure or convergence.

Note
To support several line searches and status tests, this version of the solver has a getStepSize() function that returns $\lambda$.

Input Parameters

The following parameter list entries are valid for this solver:

  • "Line Search" - Sublist of the line search parameters, passed to the NOX::LineSearch::Manager constructor. Defaults to an empty list.
  • "Direction" - Sublist of the direction parameters, passed to the NOX::Direction::Manager constructor. Defaults to an empty list.
  • "Solver Options" - Sublist of general solver options.
    • "User Defined Pre/Post Operator" is supported. See NOX::Parameter::PrePostOperator for more details.

Output Parameters

Every time solve() is called, a sublist for output parameters called "Output" will be created and contain the following parameters.

"Output":

  • "Nonlinear Iterations" - Number of nonlinear iterations
  • "2-Norm of Residual" - Two-norm of final residual
Author
Tammy Kolda (SNL 8950), Roger Pawlowski (SNL 9233)

Constructor & Destructor Documentation

◆ LineSearchBased()

NOX::Solver::LineSearchBased::LineSearchBased ( const Teuchos::RCP< NOX::Abstract::Group > & grp,
const Teuchos::RCP< NOX::StatusTest::Generic > & tests,
const Teuchos::RCP< Teuchos::ParameterList > & params )

Constructor.

See reset(NOX::Abstract::Group&, NOX::StatusTest::Generic&, Teuchos::ParameterList&) for description

References NOX::DeepCopy, dirPtr, globalDataPtr, init(), observer, oldSolnPtr, paramsPtr, NOX::Solver::parseObserver(), NOX::ShapeCopy, solnPtr, testPtr, utilsPtr, and NOX::Solver::validateSolverOptionsSublist().

Member Function Documentation

◆ getList()

const Teuchos::ParameterList & NOX::Solver::LineSearchBased::getList ( ) const
virtual

Return a reference to the solver parameters.

Implements NOX::Solver::Generic.

References paramsPtr.

◆ getListPtr()

virtual Teuchos::RCP< const Teuchos::ParameterList > NOX::Solver::LineSearchBased::getListPtr ( ) const
inlinevirtual

Return a RCP to the solver parameters.

Implements NOX::Solver::Generic.

References paramsPtr.

◆ getNumIterations()

int NOX::Solver::LineSearchBased::getNumIterations ( ) const
virtual

Get number of iterations.

Implements NOX::Solver::Generic.

References nIter.

Referenced by NOX::Direction::Broyden::compute().

◆ getPreviousSolutionGroup()

const NOX::Abstract::Group & NOX::Solver::LineSearchBased::getPreviousSolutionGroup ( ) const
virtual

Return a reference to the previous solution group.

Implements NOX::Solver::Generic.

References oldSolnPtr.

Referenced by NOX::Direction::Broyden::compute().

◆ getPreviousSolutionGroupPtr()

virtual Teuchos::RCP< const NOX::Abstract::Group > NOX::Solver::LineSearchBased::getPreviousSolutionGroupPtr ( ) const
inlinevirtual

Return a RCP to the previous solution group.

Implements NOX::Solver::Generic.

References oldSolnPtr.

◆ getSolutionGroup()

const NOX::Abstract::Group & NOX::Solver::LineSearchBased::getSolutionGroup ( ) const
virtual

Return a reference to the current solution group.

Implements NOX::Solver::Generic.

References solnPtr.

◆ getSolutionGroupPtr()

virtual Teuchos::RCP< const NOX::Abstract::Group > NOX::Solver::LineSearchBased::getSolutionGroupPtr ( ) const
inlinevirtual

Return a RCP to the solution group.

Implements NOX::Solver::Generic.

References solnPtr.

◆ getSolverStatistics()

Teuchos::RCP< const NOX::SolverStats > NOX::Solver::LineSearchBased::getSolverStatistics ( ) const
virtual

Return a RCP to the solver statistics.

Implements NOX::Solver::Generic.

References globalDataPtr.

◆ getStatus()

NOX::StatusTest::StatusType NOX::Solver::LineSearchBased::getStatus ( ) const
virtual

Returns the current status of the solver.

Implements NOX::Solver::Generic.

References status.

◆ init()

void NOX::Solver::LineSearchBased::init ( )
protectedvirtual

◆ printUpdate()

void NOX::Solver::LineSearchBased::printUpdate ( )
protectedvirtual

◆ reset() [1/3]

void NOX::Solver::LineSearchBased::reset ( )
virtual

Resets the solver for another solve. This resets the counters and status only. Uses the final solution from the last solve as the initial guess for the next solve.

NOTE: All NOX solvers will call reset() automatically at teh beginning of the solve() method. We add the reset() method to the solver interface for the application to call in case the application needs to reset counters and status manually before the next call to solve() is made.

Implements NOX::Solver::Generic.

References globalDataPtr, nIter, status, stepSize, and NOX::StatusTest::Unconverged.

◆ reset() [2/3]

void NOX::Solver::LineSearchBased::reset ( const NOX::Abstract::Vector & initial_guess)
virtual

Resets the solver and sets a new initial guess.

Implements NOX::Solver::Generic.

References globalDataPtr, nIter, solnPtr, status, stepSize, and NOX::StatusTest::Unconverged.

◆ reset() [3/3]

void NOX::Solver::LineSearchBased::reset ( const NOX::Abstract::Vector & initial_guess,
const Teuchos::RCP< NOX::StatusTest::Generic > & test )
virtual

Resets the solver, sets a new status test, and sets a new initial guess.

Implements NOX::Solver::Generic.

References globalDataPtr, nIter, solnPtr, status, stepSize, testPtr, and NOX::StatusTest::Unconverged.

Referenced by solve().

◆ solve()

NOX::StatusTest::StatusType NOX::Solver::LineSearchBased::solve ( )
virtual

Solve the nonlinear problem and return final status.

By "solve", we call iterate() until the NOX::StatusTest value is either NOX::StatusTest::Converged or NOX::StatusTest::Failed.

Implements NOX::Solver::Generic.

References catchThrowsDuringSolve, NOX::StatusTest::Failed, NOX::Utils::fill(), nIter, observer, paramsPtr, reset(), solnPtr, status, step(), NOX::StatusTest::Unconverged, and utilsPtr.

◆ step()

Member Data Documentation

◆ catchThrowsDuringSolve

bool NOX::Solver::LineSearchBased::catchThrowsDuringSolve
protected

Determine if we want to catch and ignore exceptions thrown from the linear solver stack.

Referenced by init(), and solve().

◆ checkType

NOX::StatusTest::CheckType NOX::Solver::LineSearchBased::checkType
protected

Type of check to use for status tests. See NOX::StatusTest for more details.

Referenced by init(), and step().

◆ directionPtr

Teuchos::RCP<NOX::Direction::Generic> NOX::Solver::LineSearchBased::directionPtr
protected

Search Direction.

Referenced by init(), and step().

◆ dirPtr

Teuchos::RCP<NOX::Abstract::Vector> NOX::Solver::LineSearchBased::dirPtr
protected

Current search direction pointer.

Referenced by LineSearchBased(), printUpdate(), and step().

◆ globalDataPtr

Teuchos::RCP<NOX::GlobalData> NOX::Solver::LineSearchBased::globalDataPtr
protected

Pointer to the global data object.

Referenced by getSolverStatistics(), init(), LineSearchBased(), reset(), reset(), reset(), and step().

◆ lineSearchPtr

Teuchos::RCP<NOX::LineSearch::Generic> NOX::Solver::LineSearchBased::lineSearchPtr
protected

Linesearch.

Referenced by init(), and step().

◆ nIter

int NOX::Solver::LineSearchBased::nIter
protected

Number of nonlinear iterations.

Referenced by getNumIterations(), init(), printUpdate(), reset(), reset(), reset(), solve(), and step().

◆ observer

Teuchos::RCP<NOX::Observer> NOX::Solver::LineSearchBased::observer
protected

Pointer to a user defined NOX::Observer object.

Referenced by LineSearchBased(), solve(), and step().

◆ oldSolnPtr

Teuchos::RCP<NOX::Abstract::Group> NOX::Solver::LineSearchBased::oldSolnPtr
protected

Previous solution pointer.

Referenced by getPreviousSolutionGroup(), getPreviousSolutionGroupPtr(), LineSearchBased(), and step().

◆ paramsPtr

Teuchos::RCP<Teuchos::ParameterList> NOX::Solver::LineSearchBased::paramsPtr
protected

Input parameters.

Referenced by getList(), getListPtr(), init(), LineSearchBased(), and solve().

◆ solnPtr

Teuchos::RCP<NOX::Abstract::Group> NOX::Solver::LineSearchBased::solnPtr
protected

◆ status

NOX::StatusTest::StatusType NOX::Solver::LineSearchBased::status
protected

Status of nonlinear solver.

Referenced by getStatus(), init(), printUpdate(), reset(), reset(), reset(), solve(), and step().

◆ stepSize

double NOX::Solver::LineSearchBased::stepSize
protected

Current step.

Referenced by init(), printUpdate(), reset(), reset(), reset(), and step().

◆ testPtr

Teuchos::RCP<NOX::StatusTest::Generic> NOX::Solver::LineSearchBased::testPtr
protected

Stopping test.

Referenced by LineSearchBased(), printUpdate(), reset(), and step().

◆ utilsPtr

Teuchos::RCP<NOX::Utils> NOX::Solver::LineSearchBased::utilsPtr
protected

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