#include <NOX_Epetra_Group.H>
Inheritance diagram for NOX::Epetra::Group:
Public Types | |
| enum | OperatorType { None, EpetraOperator, EpetraRowMatrix, NoxOperator, NoxFiniteDifferenceRowMatrix, NoxMatrixFreeOperator } |
| List of types of operators that can be used for the Jacobian and/or Preconditioner. More... | |
Public Member Functions | |
| Group (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::Epetra::Interface &i, Epetra_Vector &x, Epetra_Operator &J) | |
| Constructor with Jacobian Operator only. | |
| Group (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::Epetra::Interface &i, NOX::Epetra::Vector &x, Epetra_Operator &J) | |
| Constructor with Jacobian Operator only. | |
| Group (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::Epetra::Interface &i, Epetra_Vector &x, Epetra_Operator &J, Epetra_Operator &M) | |
| Group (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::Epetra::Interface &i, NOX::Epetra::Vector &x, Epetra_Operator &J, Epetra_Operator &M) | |
| Group (const NOX::Epetra::Group &source, NOX::CopyType type=NOX::DeepCopy) | |
| Copy constructor. If type is DeepCopy, takes ownership of valid shared Jacobian and shared preconditioning matrix. | |
| virtual | ~Group () |
| Destructor. | |
| virtual NOX::Abstract::Group & | operator= (const NOX::Abstract::Group &source) |
| Copies the source group into this group. | |
| virtual NOX::Abstract::Group & | operator= (const NOX::Epetra::Group &source) |
| See operator=(const NOX::Abstract::Group&);. | |
| virtual NOX::Abstract::Group * | clone (CopyType type=DeepCopy) const |
| virtual NOX::Epetra::SharedOperator & | getSharedJacobian () |
| Return the SharedJacobian. | |
| virtual NOX::Epetra::SharedOperator & | getSharedPreconditioner () |
| Return the SharedPreconditioner. | |
| virtual NOX::Epetra::Interface & | getUserInterface () |
| Return the userInterface. | |
| virtual void | setLinearSolveScaling (NOX::Epetra::Scaling &scalingObject) |
| Sets the diagonal scaling vector(s) used in scaling the linear system. See NOX::Epetra::Scaling for details on how to specify scaling of the linear system. | |
| virtual OperatorType | getOperatorType (const Epetra_Operator &o) |
| Returns the type of operator that is passed into the group constructors. | |
"Compute" functions. | |
| virtual void | setX (const NOX::Epetra::Vector &y) |
| virtual void | setX (const NOX::Abstract::Vector &y) |
| Set the solution vector x to y. | |
| virtual void | computeX (const NOX::Epetra::Group &grp, const NOX::Epetra::Vector &d, double step) |
| virtual void | computeX (const NOX::Abstract::Group &grp, const NOX::Abstract::Vector &d, double step) |
| Compute x = grp.x + step * d. | |
| virtual NOX::Abstract::Group::ReturnType | computeF () |
| Compute and store F(x). | |
| virtual NOX::Abstract::Group::ReturnType | computeJacobian () |
| Compute and store Jacobian. | |
| virtual NOX::Abstract::Group::ReturnType | computeGradient () |
| Compute and store gradient. | |
| virtual NOX::Abstract::Group::ReturnType | computeNewton (NOX::Parameter::List ¶ms) |
| Compute the Newton direction, using parameters for the linear solve. | |
Jacobian operations. | |
Operations using the Jacobian matrix. These may not be defined in matrix-free scenarios. | |
| virtual NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| virtual NOX::Abstract::Group::ReturnType | applyJacobian (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
| Applies Jacobian to the given input vector and puts the answer in the result. | |
| virtual NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| virtual NOX::Abstract::Group::ReturnType | applyJacobianTranspose (const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
| Applies Jacobian-Transpose to the given input vector and puts the answer in the result. | |
| virtual NOX::Abstract::Group::ReturnType | applyJacobianInverse (NOX::Parameter::List ¶ms, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| virtual NOX::Abstract::Group::ReturnType | applyJacobianInverse (NOX::Parameter::List ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
| Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result. | |
| virtual NOX::Abstract::Group::ReturnType | applyRightPreconditioning (bool useTranspose, NOX::Parameter::List ¶ms, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| virtual NOX::Abstract::Group::ReturnType | applyRightPreconditioning (bool useTranspose, NOX::Parameter::List ¶ms, const NOX::Abstract::Vector &input, NOX::Abstract::Vector &result) const |
| Apply right preconditiong to the given input vector. | |
"Is" functions | |
Checks to see if various objects have been computed. Returns true if the corresponding "compute" function has been called since the last update to the solution vector (via instantiation or computeX). | |
| virtual bool | isF () const |
| Return true if F is valid. | |
| virtual bool | isJacobian () const |
| Return true if the Jacobian is valid. | |
| virtual bool | isGradient () const |
| Return true if the gradient is valid. | |
| virtual bool | isNewton () const |
| Return true if the Newton direction is valid. | |
| virtual bool | isNormNewtonSolveResidual () const |
| Returns true if the value of the Norm of the linear model for a full Newton step ||Js + f|| is valid with respect to the current solution vector. | |
| virtual bool | isPreconditioner () const |
| Returns true if an explicitly constructed preconditioner exists (i.e. one that is computed and saved for further use in multiple calls to applyRightPreconditioner). | |
"Get" functions | |
Note that these function do not check whether or not the vectors are valid. Must use the "Is" functions for that purpose. | |
| virtual const NOX::Abstract::Vector & | getX () const |
| Return solution vector. | |
| virtual const NOX::Abstract::Vector & | getF () const |
| Return F(x). | |
| virtual double | getNormF () const |
| Return 2-norm of F(x). | |
| virtual const NOX::Abstract::Vector & | getGradient () const |
| Return gradient. | |
| virtual const NOX::Abstract::Vector & | getNewton () const |
| Return Newton direction. | |
| virtual NOX::Abstract::Group::ReturnType | getNormLastLinearSolveResidual (double &residual) const |
| Returns the 2-norm of the residual of the linear model used in the Newton solve computation, ||Js+f||. This does not account for line search adjustments to the step length! | |
Protected Types | |
| enum | PrecConstructionType { ExplicitConstruction, ImplicitConstruction } |
| Types that define how the construction of the preconditioner should be handled during a call to createPreconditioner(). More... | |
Protected Member Functions | |
| virtual void | resetIsValid () |
| resets the isValid flags to false | |
"Linear Solver" functions | |
| virtual void | setAztecOptions (const NOX::Parameter::List ¶ms, AztecOO &aztec) const |
| Set any required Aztec options. NOTE: This does not handle all aztec options. They will be added as needed. | |
| virtual bool | checkOperatorConsistency () |
| Checks to make sure that the supplied operators are valid for the requested preconditioning options. | |
| virtual bool | createPreconditioner (PrecConstructionType c, NOX::Parameter::List &p) const |
| Computes a precoditioning matrix based on the current solution vector. It then sets the correct preconditioning object (Operator or Epetra_RowMatrix) in the AztecOO solver object. The first argument tells the method whether or not to enforce explicit construction of the preconditioner so that it is saved for reuse. | |
| virtual bool | createIfpackPreconditioner (NOX::Parameter::List &p) const |
| Allocates the objects required for using ifpack preconditioners (NOX::Epetra::Group::ifpackGraph and NOX::Epetra::Group::ifpackPreconditioner). This is called from NOX::Epetra::Group::computePreconditioner(). | |
| virtual bool | destroyPreconditioner () const |
| Deletes all objects associated with the chosen preconditioner. This is called during linear solves and when the solution vector changes to reset the preconditioner. | |
| virtual bool | destroyAztecSolver () const |
| virtual bool | computeNormNewtonSolveResidual () |
| Computes the 2-norm of the residual of the linear model used in the Newton solve computation, ||Js+f||. | |
Protected Attributes | |
| const NOX::Utils | utils |
| Printing Utilities object. | |
| double | normRHS |
| 2-Norm of RHS | |
| double | normNewtonSolveResidual |
| 2-Norm of the Newton solve residual: ||Js+f|| | |
| NOX::Epetra::Interface & | userInterface |
| Reference to the user supplied interface functions. | |
| OperatorType | jacobianOperatorType |
| Flag that tells the code how the Jacobian operator is implemented. | |
| OperatorType | preconditionerOperatorType |
| Flag that tells the code how the Preconditioning operator is implemented. | |
| string | preconditioner |
| Determines how the preconditioning is handled. | |
| AztecOO * | aztecSolver |
| Aztec solver object used for preconditioning. | |
| Ifpack_IlukGraph * | ifpackGraph |
| If using an IFPACK preconditioner, we must store the IFpack graph. This is mutable since the applyRightPreconditioner() is a const member. | |
| Ifpack_CrsRiluk * | ifpackPreconditioner |
| If using an IFPACK preconditioner, we must store the IFpack preconditioner. | |
| NOX::Epetra::Scaling * | scaling |
| Scaling object supplied by the user. | |
Vectors | |
| NOX::Epetra::Vector * | xVectorPtr |
| Solution vector pointer. | |
| NOX::Epetra::Vector & | xVector |
| Solution vector. | |
| NOX::Epetra::Vector * | RHSVectorPtr |
| Right-hand-side vector (function evaluation). | |
| NOX::Epetra::Vector & | RHSVector |
| Right-hand-side vector pointer (function evaluation). | |
| NOX::Epetra::Vector * | gradVectorPtr |
| Gradient vector pointer(steepest descent vector). | |
| NOX::Epetra::Vector & | gradVector |
| Gradient vector (steepest descent vector). | |
| NOX::Epetra::Vector * | NewtonVectorPtr |
| Newton direction vector pointer. | |
| NOX::Epetra::Vector & | NewtonVector |
| Newton direction vector. | |
| Epetra_Vector * | tmpVectorPtr |
| An extra temporary vector, only allocated if needed. | |
IsValid flags | |
True if the current solution is up-to-date with respect to the currect xVector. | |
| bool | isValidRHS |
| bool | isValidJacobian |
| bool | isValidGrad |
| bool | isValidNewton |
| bool | isValidNormNewtonSolveResidual |
| bool | isValidPreconditioner |
Shared Operators | |
| NOX::Epetra::SharedOperator * | sharedJacobianPtr |
| Pointer to shared Jacobian matrix. | |
| NOX::Epetra::SharedOperator & | sharedJacobian |
| Reference to shared Jacobian matrix. | |
| NOX::Epetra::SharedOperator * | sharedPreconditionerPtr |
| Pointer to shared Preconditioning matrix. | |
| NOX::Epetra::SharedOperator & | sharedPreconditioner |
| Reference to shared Preconditioning matrix. If a Group constructor is used that only supplies a Jacobian (i.e. no separate preconditioning matrix is supplied) then this will point to the Jacobian! | |
This group is set up to use the linear algebra services provided through the Trilinos/Epetra package with AztecOO for the linear solver.
Supplying a Jacobian Operator
A linear solve using this class requires at a minimum that the user supply a Jacobian object derived from the pure virtual Epetra_Operator class. This does not have to be an explicit matrix since Newton-Krylov methods only require the action of the Jacobian on a vector (Jy). The user has five options for providing the Epetra_Operator Jacobian. This operator is passed in to through the group constructor. Depending on the type of object, the user may have to implement additional functions in the NOX::Epetra::Interface object (the user must always implement the computeF() function) to actually fill/evaluate the object at the current solution. Any additional functions are listed below:
"Linear %Solver" sublist parameters
A NOX::ParameterList is supplied in the constructor and during calls to the NOX::Epetra::Group::computeNewton() and NOX::Epetra::Group::applyJacobianInverse(). This parameter list is the "Linear %Solver" sublist. The following parameters can be set in the linear Solver sublist for NOX::Epetra::Groups
"Output" sublist
The parameter list passed into the group during a computeNewton() or ApplyJacobianInverse() will have an "Output" sublist created that contains the following parameters:
|
|
List of types of operators that can be used for the Jacobian and/or Preconditioner.
|
|
|
Types that define how the construction of the preconditioner should be handled during a call to createPreconditioner(). Preconditioners are used in two methods: (1) during linear solves in applyJacobianInverse() and (2) for the method applyRightPreconditioner(). For the applyJacobianInverse() the preconditioner is created and destroyed "implicitly" in the linear solver. The correct operator need only be set in the AztecOO solver and the solver will take care of creation and destruction internally. The opposite is true for applyRightPreconditioner(). Here we must force an "explicit" construction and retention of the preconditioner since there will be multple calls to applyRightPreconditioner() that reuses the same preconditioner. This flag type is used to specify the construction type. |
|
||||||||||||||||||||||||
|
Constructor with Jacobian Operator only. Either there is no preconditioning or the Jacobian will be used for preconditioning. An Epetra_Operator must be supplied for the Jacobian even in Matrix-Free mode. linearSolverParams is the "Linear Solver" sublist of parameter list. |
|
||||||||||||||||||||||||
|
Constructor with Jacobian Operator only. Either there is no preconditioning or the Jacobian will be used for preconditioning. An Epetra_Operator must be supplied for the Jacobian even in Matrix-Free mode. linearSolverParams is the "Linear Solver" sublist of parameter list. |
|
||||||||||||||||||||||||||||
|
Constructor with a separate Jacobian (J) and Preconditioner (M). linearSolverParams is the "Linear %Solver" sublist of parameter list. |
|
||||||||||||||||||||||||||||
|
Constructor with a separate Jacobian (J) and Preconditioner (M). linearSolverParams is the "Linear %Solver" sublist of parameter list. |
|
||||||||||||
|
Applies Jacobian to the given input vector and puts the answer in the result. Computes
where
Reimplemented from NOX::Abstract::Group. |
|
||||||||||||||||
|
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result. Computes
where The "Tolerance" parameter specifies that the solution should be such that
Reimplemented from NOX::Abstract::Group. |
|
||||||||||||
|
Applies Jacobian-Transpose to the given input vector and puts the answer in the result. Computes
where
Reimplemented from NOX::Abstract::Group. |
|
||||||||||||||||||||
|
Apply right preconditiong to the given input vector.
Let
Compute
where If useTranspose is true, then the transpose of the preconditioner is applied:
The transpose preconditioner is currently only required for Tensor methods. The "Tolerance" parameter specifies that the solution should be such that
Reimplemented from NOX::Abstract::Group. |
|
|
Compute and store F(x).
Implements NOX::Abstract::Group. Reimplemented in LOCA::Epetra::Group. |
|
|
Compute and store gradient.
We can pose the nonlinear equation problem
In that case, the gradient (of
Reimplemented from NOX::Abstract::Group. |
|
|
Compute and store Jacobian. Recall that
The Jacobian is denoted by
Reimplemented from NOX::Abstract::Group. Reimplemented in LOCA::Epetra::Group. |
|
|
Compute the Newton direction, using parameters for the linear solve. The Newton direction is the solution, s, of
The parameters are from the "Linear %Solver" sublist of the "Direction" sublist that is passed to solver during construction. The "Tolerance" parameter may be added/modified in the sublist of "Linear Solver" parameters that is passed into this function. The solution should be such that
Reimplemented from NOX::Abstract::Group. |
|
||||||||||||||||
|
Compute x = grp.x + step * d.
Let
Implements NOX::Abstract::Group. |
|
|
Deletes the AztecOO solver object. This is called when the solution vector for the group is changed. The preconditioner is no longer valid so the solver and preconditioner are destroyed by a call to this method. |
|
|
Return 2-norm of F(x). In other words,
Implements NOX::Abstract::Group. |
|
|
Returns the type of operator that is passed into the group constructors. Uses dynamic casting to identify the underlying object type. |
|
|
Return true if the gradient is valid.
Reimplemented from NOX::Abstract::Group. |
|
|
Return true if the Jacobian is valid.
Reimplemented from NOX::Abstract::Group. |
|
|
Return true if the Newton direction is valid.
Reimplemented from NOX::Abstract::Group. |
|
|
Copies the source group into this group.
Implements NOX::Abstract::Group. Reimplemented in LOCA::Epetra::Group. |
|
|
Set the solution vector x to y.
Implements NOX::Abstract::Group. |
|
|
Aztec solver object used for preconditioning. If calling applyRightPreconditioning() and using an AztecOO solver, the AztecOO object must be saved. Previously we created and deleted this object during linear solves. The solver object must be stored so that we don't have to recompute the preconditioner for each call to applyRightPreconditioning(). We only need to recompute the preconditioner when the solution vector and it's corresponding preconditioning matrix is updated. |
|
|
Flag that tells the code how the Jacobian operator is implemented. This flag is set in the constructor by calling the function getJacobianType(). |
|
|
Determines how the preconditioning is handled. This variable is set in the constructors from the "Preconditioning" parameter in the "Linear Solver" sublist. Key in "Linear Solver" sublist: "Preconditioning" Valid Options:
|
|
|
Flag that tells the code how the Preconditioning operator is implemented. This flag is set in the constructor by calling the function getPrecType(). |
1.3.9.1