#include <NOX_Direction_Newton.H>
Public Member Functions | |
Newton (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) | |
Constructor. | |
virtual | ~Newton () |
Destructor. | |
virtual bool | reset (const Teuchos::RCP< NOX::GlobalData > &gd, Teuchos::ParameterList ¶ms) |
Reset direction based on possibly new parameters. | |
virtual bool | compute (NOX::Abstract::Vector &dir, NOX::Abstract::Group &grp, const NOX::Solver::Generic &solver) |
Compute the direction vector, dir , for a specific method given the current group, grp . | |
virtual bool | compute (NOX::Abstract::Vector &dir, NOX::Abstract::Group &grp, const NOX::Solver::LineSearchBased &solver) |
Same as compute(NOX::Abstract::Vector&, NOX::Abstract::Group&, const NOX::Solver::Generic&). | |
Protected Member Functions | |
virtual bool | resetForcingTerm (const NOX::Abstract::Group &soln, const NOX::Abstract::Group &oldSoln, int niter, const NOX::Solver::Generic &solver) |
Private Member Functions | |
void | throwError (const string &functionName, const string &errorMsg) |
Print an error message. | |
Private Attributes | |
Teuchos::RCP< NOX::GlobalData > | globalDataPtr |
Global data pointer. Keep this so the parameter list remains valid. | |
Teuchos::RCP< NOX::Utils > | utils |
Printing Utilities. | |
Teuchos::ParameterList * | paramsPtr |
"Direction" sublist with parameters for the direction vector | |
bool | doRescue |
Determined based on "Rescue Bad %Newton Solve". | |
Teuchos::RCP < NOX::Abstract::Vector > | predRhs |
Vector containing the predicted RHS. | |
Teuchos::RCP < NOX::Abstract::Vector > | stepDir |
Vector containing the computed direction. | |
bool | useAdjustableForcingTerm |
Flag used to determine if adjustable forcing term is being used. | |
double | eta_k |
Current linear solve tolerance. | |
double | eta_min |
Minimum linear solve tolerance. | |
double | eta_max |
Maximum linear solve tolerance. | |
double | eta_initial |
Initial linear solve tolerance. | |
string | method |
Name of the method used for calculating the inexact forcing term. | |
double | alpha |
Parameter used for Type 2 forcing term calculation. | |
double | gamma |
Parameter used for Type 2 forcing term calculation. |
Computes the Newton direction by solving the Newton system.
Here is the n x n Jacobian matrix at the current iterate,
is the n-vector representing the nonlinear function at the current iterate, and
is the n-vector that we are solving for.
If we use an iterative linear solver for the Newton system, then this is called an inexact Newton method. The tolerance used to terminate the linear solve is called the forcing term. The forcing term may be constant, or it may be adjustable. In either case, at iteration we require,
Here is the forcing term for iteration
.
With the following safeguards imposed:
With the following safeguards imposed:
Parameters
"Direction":
"Direction"/"Newton":
"Direction"/"Newton"/"Linear Solver":
Definition at line 182 of file NOX_Direction_Newton.H.
NOX::Direction::Newton::Newton | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) |
NOX::Direction::Newton::~Newton | ( | ) | [virtual] |
bool NOX::Direction::Newton::reset | ( | const Teuchos::RCP< NOX::GlobalData > & | gd, | |
Teuchos::ParameterList & | params | |||
) | [virtual] |
Reset direction based on possibly new parameters.
Implements NOX::Direction::Generic.
Definition at line 64 of file NOX_Direction_Newton.C.
References alpha, doRescue, eta_initial, eta_k, eta_max, eta_min, gamma, globalDataPtr, method, paramsPtr, useAdjustableForcingTerm, and utils.
Referenced by Newton().
bool NOX::Direction::Newton::compute | ( | NOX::Abstract::Vector & | dir, | |
NOX::Abstract::Group & | grp, | |||
const NOX::Solver::Generic & | solver | |||
) | [virtual] |
Compute the direction vector, dir
, for a specific method given the current group, grp
.
The grp
is not const so that we can compute the F vector, the Jacobian matrix, the Newton vector, and so on.
Const access to the solver is used for getting additional information such as the past solution, the iteration number, and so on.
Implements NOX::Direction::Generic.
Definition at line 97 of file NOX_Direction_Newton.C.
References NOX::Abstract::Group::computeF(), NOX::Abstract::Group::computeJacobian(), NOX::Abstract::Group::computeNewton(), NOX::Utils::Details, doRescue, eta_k, NOX::Abstract::Group::getNewton(), NOX::Solver::Generic::getNumIterations(), NOX::Solver::Generic::getPreviousSolutionGroup(), NOX::Abstract::Group::Ok, paramsPtr, resetForcingTerm(), throwError(), useAdjustableForcingTerm, utils, and NOX::Utils::Warning.
Referenced by compute().
bool NOX::Direction::Newton::compute | ( | NOX::Abstract::Vector & | dir, | |
NOX::Abstract::Group & | grp, | |||
const NOX::Solver::LineSearchBased & | solver | |||
) | [virtual] |
Same as compute(NOX::Abstract::Vector&, NOX::Abstract::Group&, const NOX::Solver::Generic&).
Enables direct support for line search based solvers for the purpose of efficiency since the LineSearchBased object has a getStep() function that some directions require.
If it is not redefined in the derived class, it will just call the compute with the NOX::Solver::Generic argument.
Reimplemented from NOX::Direction::Generic.
Definition at line 149 of file NOX_Direction_Newton.C.
References compute().
bool NOX::Direction::Newton::resetForcingTerm | ( | const NOX::Abstract::Group & | soln, | |
const NOX::Abstract::Group & | oldSoln, | |||
int | niter, | |||
const NOX::Solver::Generic & | solver | |||
) | [protected, virtual] |
Called each iteration to reset the forcing term (ie, the convergence tolerance for the linear solver).
Definition at line 157 of file NOX_Direction_Newton.C.
References alpha, NOX::Abstract::Group::applyJacobian(), NOX::Abstract::Vector::clone(), NOX::Utils::Details, eta_initial, eta_k, eta_max, eta_min, gamma, NOX::Abstract::Group::getF(), NOX::Abstract::Group::getNormF(), NOX::Solver::LineSearchBased::getStepSize(), NOX::Abstract::Group::getX(), NOX::Abstract::Group::isJacobian(), method, paramsPtr, predRhs, NOX::ShapeCopy, stepDir, utils, and NOX::Utils::Warning.
Referenced by compute().
void NOX::Direction::Newton::throwError | ( | const string & | functionName, | |
const string & | errorMsg | |||
) | [private] |
Print an error message.
Definition at line 317 of file NOX_Direction_Newton.C.
References NOX::Utils::Error, and utils.
Referenced by compute().
Teuchos::RCP<NOX::GlobalData> NOX::Direction::Newton::globalDataPtr [private] |
Global data pointer. Keep this so the parameter list remains valid.
Definition at line 224 of file NOX_Direction_Newton.H.
Referenced by reset().
Teuchos::RCP<NOX::Utils> NOX::Direction::Newton::utils [private] |
Printing Utilities.
Definition at line 227 of file NOX_Direction_Newton.H.
Referenced by compute(), reset(), resetForcingTerm(), and throwError().
Teuchos::ParameterList* NOX::Direction::Newton::paramsPtr [private] |
"Direction" sublist with parameters for the direction vector
Definition at line 234 of file NOX_Direction_Newton.H.
Referenced by compute(), reset(), and resetForcingTerm().
bool NOX::Direction::Newton::doRescue [private] |
Determined based on "Rescue Bad %Newton Solve".
Definition at line 237 of file NOX_Direction_Newton.H.
Teuchos::RCP<NOX::Abstract::Vector> NOX::Direction::Newton::predRhs [private] |
Vector containing the predicted RHS.
Definition at line 240 of file NOX_Direction_Newton.H.
Referenced by resetForcingTerm().
Teuchos::RCP<NOX::Abstract::Vector> NOX::Direction::Newton::stepDir [private] |
Vector containing the computed direction.
Definition at line 243 of file NOX_Direction_Newton.H.
Referenced by resetForcingTerm().
bool NOX::Direction::Newton::useAdjustableForcingTerm [private] |
Flag used to determine if adjustable forcing term is being used.
Definition at line 246 of file NOX_Direction_Newton.H.
double NOX::Direction::Newton::eta_k [private] |
Current linear solve tolerance.
Definition at line 249 of file NOX_Direction_Newton.H.
Referenced by compute(), reset(), and resetForcingTerm().
double NOX::Direction::Newton::eta_min [private] |
Minimum linear solve tolerance.
Definition at line 252 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().
double NOX::Direction::Newton::eta_max [private] |
Maximum linear solve tolerance.
Definition at line 255 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().
double NOX::Direction::Newton::eta_initial [private] |
Initial linear solve tolerance.
Definition at line 258 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().
string NOX::Direction::Newton::method [private] |
Name of the method used for calculating the inexact forcing term.
Definition at line 261 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().
double NOX::Direction::Newton::alpha [private] |
Parameter used for Type 2 forcing term calculation.
Definition at line 264 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().
double NOX::Direction::Newton::gamma [private] |
Parameter used for Type 2 forcing term calculation.
Definition at line 267 of file NOX_Direction_Newton.H.
Referenced by reset(), and resetForcingTerm().