#include <NOX_Epetra_LinearSystem_Stratimikos.H>
Inheritance diagram for NOX::Epetra::LinearSystemStratimikos:


Public Member Functions | |
| LinearSystemStratimikos (Teuchos::ParameterList &printingParams, Teuchos::ParameterList &linearSolverParams, const Teuchos::RCP< NOX::Epetra::Interface::Required > &iReq, const Teuchos::RCP< NOX::Epetra::Interface::Jacobian > &iJac, const Teuchos::RCP< Epetra_Operator > &J, const NOX::Epetra::Vector &cloneVector, const Teuchos::RCP< NOX::Epetra::Scaling > scalingObject=Teuchos::null) | |
| Constructor with a user supplied Jacobian Operator. | |
| LinearSystemStratimikos (Teuchos::ParameterList &printingParams, Teuchos::ParameterList &linearSolverParams, const Teuchos::RCP< NOX::Epetra::Interface::Jacobian > &iJac, const Teuchos::RCP< Epetra_Operator > &J, const Teuchos::RCP< NOX::Epetra::Interface::Preconditioner > &iPrec, const Teuchos::RCP< Epetra_Operator > &M, const NOX::Epetra::Vector &cloneVector, const bool &precIsAlreadyInverted=false, const Teuchos::RCP< NOX::Epetra::Scaling > scalingObject=Teuchos::null) | |
| virtual | ~LinearSystemStratimikos () |
| Destructor. | |
| virtual bool | applyJacobian (const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| Applies Jacobian to the given input vector and puts the answer in the result. | |
| virtual bool | applyJacobianTranspose (const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| Applies Jacobian-Transpose to the given input vector and puts the answer in the result. | |
| virtual bool | applyJacobianInverse (Teuchos::ParameterList &linearSolverParams, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) |
| Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result. | |
| virtual bool | applyRightPreconditioning (bool useTranspose, Teuchos::ParameterList &linearSolverParams, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const |
| Apply right preconditiong to the given input vector. | |
| virtual bool | createPreconditioner (const NOX::Epetra::Vector &x, Teuchos::ParameterList &linearSolverParams, bool recomputeGraph) const |
| Explicitly constructs a preconditioner based on the solution vector x and the parameter list p. | |
| 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 | recomputePreconditioner (const NOX::Epetra::Vector &x, Teuchos::ParameterList &linearSolverParams) const |
| Recalculates the preconditioner using an already allocated graph. | |
| virtual PreconditionerReusePolicyType | getPreconditionerPolicy (bool advanceReuseCounter=true) |
| Evaluates the preconditioner policy at the current state. | |
| virtual void | reset (Teuchos::ParameterList &linearSolverParams) |
| Reset the linear solver parameters. | |
| virtual Teuchos::RCP< NOX::Epetra::Scaling > | getScaling () |
| Get the scaling object. | |
| void | resetScaling (const Teuchos::RCP< NOX::Epetra::Scaling > &s) |
| 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 bool | computeJacobian (const NOX::Epetra::Vector &x) |
| Compute the Jacobian. | |
|
virtual Teuchos::RCP< const NOX::Epetra::Interface::Jacobian > | getJacobianInterface () const |
| NOX::Interface::Jacobian accessor. | |
|
virtual Teuchos::RCP< const NOX::Epetra::Interface::Preconditioner > | getPrecInterface () const |
| NOX::Interface::Preconditioiner accessor. | |
| virtual bool | isPreconditionerConstructed () const |
| Indicates whether a preconditioner has been constructed. | |
| virtual bool | hasPreconditioner () const |
| Indicates whether the linear system has a preconditioner. | |
|
virtual Teuchos::RCP< const Epetra_Operator > | getJacobianOperator () const |
| Jacobian Epetra_Operator accessor. | |
| virtual Teuchos::RCP< Epetra_Operator > | getJacobianOperator () |
| Jacobian Epetra_Operator accessor. | |
|
virtual Teuchos::RCP< const Epetra_Operator > | getPrecOperator () const |
| Preconditioner Epetra_Operator accessor (only the base matrix if using an internal preconditioner - aztecoo or ifpack). | |
| virtual Teuchos::RCP< const Epetra_Operator > | getGeneratedPrecOperator () const |
| Return preconditioner operator generated and stored in AztecOO. | |
| virtual Teuchos::RCP< Epetra_Operator > | getGeneratedPrecOperator () |
| Return preconditioner operator generated and stored in AztecOO. | |
| double | getTimeCreatePreconditioner () const |
| Returns the total time (sec.) spent in createPreconditioner(). | |
| double | getTimeApplyJacobianInverse () const |
| Returns the total time (sec.) spent in applyJacobianInverse(). | |
| virtual void | setJacobianOperatorForSolve (const Teuchos::RCP< const Epetra_Operator > &solveJacOp) |
| Set Jacobian operator for solve. | |
| virtual void | setPrecOperatorForSolve (const Teuchos::RCP< const Epetra_Operator > &solvePrecOp) |
| Set preconditioner operator for solve. | |
Protected Types | |
| EpetraOperator | |
| An Epetra_Operator derived object. | |
| EpetraRowMatrix | |
| An Epetra_RowMatrix derived object. | |
| EpetraVbrMatrix | |
| An Epetra_VbrMatrix object. | |
| EpetraCrsMatrix | |
| An Epetra_CrsMatrix object. | |
| UseJacobian | |
| SeparateMatrix | |
| UserDefined_ | |
| enum | OperatorType { EpetraOperator, EpetraRowMatrix, EpetraVbrMatrix, EpetraCrsMatrix } |
| List of types of epetra objects that can be used for the Jacobian and/or Preconditioner. More... | |
| enum | PreconditionerMatrixSourceType { UseJacobian, SeparateMatrix, UserDefined_ } |
Protected Member Functions | |
| virtual bool | createJacobianOperator (Teuchos::ParameterList &printParams, Teuchos::ParameterList &lsParams, const Teuchos::RCP< NOX::Epetra::Interface::Required > &iReq, const NOX::Epetra::Vector &cloneVector) |
| Creates an internally owned Epetra_Operator for the Jacobian. | |
| void | initializeStratimikos (Teuchos::ParameterList &stratParams) |
| Builds the linear op with solve factory. | |
| virtual OperatorType | getOperatorType (const Epetra_Operator &o) |
| Returns the type of operator that is passed into the group constructors. | |
| virtual void | setStratimikosPreconditioner () const |
| virtual void | throwError (const string &functionName, const string &errorMsg) const |
| Sets the epetra Preconditioner operator in the AztecOO object. | |
| virtual void | precError (int error_code, const std::string &nox_function, const std::string &prec_type, const std::string &prec_function) const |
| Prints a warning for ifpack preconditioner failures (error_code != 0). | |
Protected Attributes | |
| NOX::Utils | utils |
| Printing Utilities object. | |
| Teuchos::RCP< NOX::Epetra::Interface::Jacobian > | jacInterfacePtr |
| Reference to the user supplied Jacobian interface functions. | |
| OperatorType | jacType |
| Type of operator for the Jacobian. | |
| Teuchos::RCP< Epetra_Operator > | jacPtr |
| Pointer to the Jacobian operator. | |
| Teuchos::RCP< NOX::Epetra::Interface::Preconditioner > | precInterfacePtr |
| Reference to the user supplied preconditioner interface functions. | |
| OperatorType | precType |
| Type of operator for the preconditioner. | |
| Teuchos::RCP< Epetra_Operator > | precPtr |
| Pointer to the preconditioner operator. | |
| PreconditionerMatrixSourceType | precMatrixSource |
|
Teuchos::RCP< Thyra::LinearOpWithSolveFactoryBase< double > > | lowsFactory |
| Thyra linear op objects. | |
|
Teuchos::RCP< Thyra::LinearOpWithSolveBase< double > > | lows |
|
Teuchos::RCP< const Thyra::LinearOpBase< double > > | linearOp |
| Teuchos::RCP< NOX::Epetra::Scaling > | scaling |
| Scaling object supplied by the user. | |
| Teuchos::RCP< NOX::Epetra::Vector > | tmpVectorPtr |
| An extra temporary vector, only allocated if needed. | |
| double | conditionNumberEstimate |
| bool | isPrecConstructed |
| True if the preconditioner has been computed. | |
| bool | outputSolveDetails |
| If set to true, solver information is printed to the "Output" sublist of the "Linear Solver" list. | |
| bool | zeroInitialGuess |
| Zero out the initial guess for linear solves performed through applyJacobianInverse calls (i.e. zero out the result vector before the linear solve). | |
| bool | manualScaling |
| Stores the parameter "Compute Scaling Manually". | |
| PreconditionerReusePolicyType | precReusePolicy |
| Policy for how to handle the preconditioner between nonlineaer iterations. | |
| int | precQueryCounter |
| Counter for number of times called since reset or construction. | |
| int | maxAgeOfPrec |
| Parameter to determine whether or not to recompute Preconditioner. | |
| Epetra_Time | timer |
| Epetra_Time object. | |
| double | timeCreatePreconditioner |
| Total time spent in createPreconditioner (sec.). | |
| double | timeApplyJacbianInverse |
| Total time spent in applyJacobianInverse (sec.). | |
| Teuchos::RCP< Epetra_Operator > | solvePrecOpPtr |
| Preconditioner operator that will be used in solves. | |
| bool | throwErrorOnPrecFailure |
| If true, any preconditioner error will cause a throw instead of a warning. | |
This solver provides the linear algebra services provided by Trilinos through the Stratimikos linear solver strategies package.
This class handles construction of both the preconditioners and solvers. All options are determined through parameter lists and the basic constructors.
Constructing a Linear System
EDIT THE FOLLOWING FOR STRATIMIKOS Ther between constructors is based on whether the user supplies a Jacobian, a preconditioner, neither or both.
If a Jacobian is not supplied then this object can create an internally constructed Jacobian based on a Finite Difference or Matrif-Free object. The user can specify which type of object to use by setting the parameter "Jacobian Operator" in the parameter list. The choices are "Matrix-Free" or "Finite Difference".
The user can supply their own preconditioner as an Epetra_Operator, or they can supply their own matrix (an Epetra_RowMatrix derived object) that can be used by one of the internal preconditioner libraries (currently aztecoo or ifpack). If they supply their own preconditioner the object must implement the Epetra_Operator::ApplyInverse method. This is the method called during the linear solve to introduce preconditoning into aztecoo. If the user supplies a matrix to be used with an internal preconditioner, it must be derived from the Epetra_RowMatrix class and must implement all functionality in the Epetra_RowMatrix. If a Preconditioner is not supplied, then this object can create an internal preconditioner matrix by finite differencing or it can use the Jacobian operator if the Jacobian derives from the Epetra_RowMatrix class. The user can specify which type of object to use by setting the parameter "Preconditioner Operator" in the parameter list. The choices are "Use Jacobian" or "Finite Difference".
The Jacobian and preconditioner each require an interface to update the state of the operator with respect to the solution vector and any other parameters. There are three interfaces that can be implemented, NOX::Epetra::Interface::Required, NOX::Epetra::Interface::Jacobian, and NOX::Epetra::Interface::Preconditioner.
NOX::Epetra::Interface::Required supplies the computeF() function so codes can tell NOX what the nonlinear equations are. This is the minimum requirement to run nox through the epetra interface. LinearSolverAztecOO requires this in some constructors so that if a Jacobian or preconditoner is not supplied, it will use computeF from the Required interface to estimate the Jacobian or preconditioner via finite differences or directional derivatives.
NOX::Epetra::Interface::Jacobian is used for updating a user supplied Jacobian opertor with respect to the solution vector and any other parameters. It is required only in constructors in which a user supplies a Jacobian operator.
NOX::Epetra::Interface::Preconditioner is used for updating a user supplied preconditioner opertor/matrix with respect to the solution vector and any other parameters. It is required only in constructors in which a user supplies a preconditioner operator.
enum NOX::Epetra::LinearSystemStratimikos::OperatorType [protected] |
List of types of epetra objects that can be used for the Jacobian and/or Preconditioner.
| EpetraOperator | An Epetra_Operator derived object. |
| EpetraRowMatrix | An Epetra_RowMatrix derived object. |
| EpetraVbrMatrix | An Epetra_VbrMatrix object. |
| EpetraCrsMatrix | An Epetra_CrsMatrix object. |
enum NOX::Epetra::LinearSystemStratimikos::PreconditionerMatrixSourceType [protected] |
Source of preconditioner: SeparateMatrix is approximate Jacobian, to do ILU on, e.g. User_Defined_ is just an operator
| NOX::Epetra::LinearSystemStratimikos::LinearSystemStratimikos | ( | Teuchos::ParameterList & | printingParams, | |
| Teuchos::ParameterList & | linearSolverParams, | |||
| const Teuchos::RCP< NOX::Epetra::Interface::Required > & | iReq, | |||
| const Teuchos::RCP< NOX::Epetra::Interface::Jacobian > & | iJac, | |||
| const Teuchos::RCP< Epetra_Operator > & | J, | |||
| const NOX::Epetra::Vector & | cloneVector, | |||
| const Teuchos::RCP< NOX::Epetra::Scaling > | scalingObject = Teuchos::null | |||
| ) |
Constructor with a user supplied Jacobian Operator.
Either there is no preconditioning or the preconditioner will be used/created internally. The Jacobian (if derived from an Epetra_RowMatrix class can be used with an internal preconditioner.
| NOX::Epetra::LinearSystemStratimikos::LinearSystemStratimikos | ( | Teuchos::ParameterList & | printingParams, | |
| Teuchos::ParameterList & | linearSolverParams, | |||
| const Teuchos::RCP< NOX::Epetra::Interface::Jacobian > & | iJac, | |||
| const Teuchos::RCP< Epetra_Operator > & | J, | |||
| const Teuchos::RCP< NOX::Epetra::Interface::Preconditioner > & | iPrec, | |||
| const Teuchos::RCP< Epetra_Operator > & | M, | |||
| const NOX::Epetra::Vector & | cloneVector, | |||
| const bool & | precIsAlreadyInverted = false, |
|||
| const Teuchos::RCP< NOX::Epetra::Scaling > | scalingObject = Teuchos::null | |||
| ) |
Constructor with user supplied separate objects for the Jacobian (J) and Preconditioner (M). linearSolverParams is the "Linear Solver" sublist of parameter list.
| bool NOX::Epetra::LinearSystemStratimikos::applyJacobian | ( | const NOX::Epetra::Vector & | input, | |
| NOX::Epetra::Vector & | result | |||
| ) | const [virtual] |
Applies Jacobian to the given input vector and puts the answer in the result.
Computes
where
is the Jacobian,
is the input vector, and
is the result vector. Returns true if successful.
Implements NOX::Epetra::LinearSystem.
| bool NOX::Epetra::LinearSystemStratimikos::applyJacobianInverse | ( | Teuchos::ParameterList & | linearSolverParams, | |
| const NOX::Epetra::Vector & | input, | |||
| NOX::Epetra::Vector & | result | |||
| ) | [virtual] |
Applies the inverse of the Jacobian matrix to the given input vector and puts the answer in result.
Computes
where
is the Jacobian,
is the input vector, and
is the result vector.
The parameter list contains the linear solver options.
Implements NOX::Epetra::LinearSystem.
| bool NOX::Epetra::LinearSystemStratimikos::applyJacobianTranspose | ( | const NOX::Epetra::Vector & | input, | |
| NOX::Epetra::Vector & | result | |||
| ) | const [virtual] |
Applies Jacobian-Transpose to the given input vector and puts the answer in the result.
Computes
where
is the Jacobian,
is the input vector, and
is the result vector. Returns true if successful.
Implements NOX::Epetra::LinearSystem.
| bool NOX::Epetra::LinearSystemStratimikos::applyRightPreconditioning | ( | bool | useTranspose, | |
| Teuchos::ParameterList & | linearSolverParams, | |||
| const NOX::Epetra::Vector & | input, | |||
| NOX::Epetra::Vector & | result | |||
| ) | const [virtual] |
Apply right preconditiong to the given input vector.
Let
be a right preconditioner for the Jacobian
; in other words,
is a matrix such that
Compute
where
is the input vector and
is the result vector.
If useTranspose is true, then the transpose of the preconditioner is applied:
The transpose preconditioner is currently only required for Tensor methods.
The parameter list contains the linear solver options.
Implements NOX::Epetra::LinearSystem.
| bool NOX::Epetra::LinearSystemStratimikos::createPreconditioner | ( | const NOX::Epetra::Vector & | x, | |
| Teuchos::ParameterList & | linearSolverParams, | |||
| bool | recomputeGraph | |||
| ) | const [virtual] |
Explicitly constructs a preconditioner based on the solution vector x and the parameter list p.
The user has the option of recomputing the graph when a new preconditioner is created. The NOX::Epetra::Group controls the isValid flag for the preconditioner and will control when to call this.
Implements NOX::Epetra::LinearSystem.
| Teuchos::RCP< const Epetra_Operator > NOX::Epetra::LinearSystemStratimikos::getGeneratedPrecOperator | ( | ) | const [virtual] |
Return preconditioner operator generated and stored in AztecOO.
Note: This should only be called if hasPreconditioner() returns true.
Implements NOX::Epetra::LinearSystem.
| NOX::Epetra::LinearSystemStratimikos::OperatorType NOX::Epetra::LinearSystemStratimikos::getOperatorType | ( | const Epetra_Operator & | o | ) | [protected, virtual] |
Returns the type of operator that is passed into the group constructors.
Uses dynamic casting to identify the underlying object type.
| NOX::Epetra::LinearSystem::PreconditionerReusePolicyType NOX::Epetra::LinearSystemStratimikos::getPreconditionerPolicy | ( | bool | advanceReuseCounter = true |
) | [virtual] |
Evaluates the preconditioner policy at the current state.
NOTE: This can change values between nonlienar iterations. It is not a static value.
Implements NOX::Epetra::LinearSystem.
| bool NOX::Epetra::LinearSystemStratimikos::recomputePreconditioner | ( | const NOX::Epetra::Vector & | x, | |
| Teuchos::ParameterList & | linearSolverParams | |||
| ) | const [virtual] |
Recalculates the preconditioner using an already allocated graph.
Use this to compute a new preconditioner while using the same graph for the preconditioner. This avoids deleting and reallocating the memory required for the preconditioner and results in a big speed-up for large-scale jobs.
Implements NOX::Epetra::LinearSystem.
| void NOX::Epetra::LinearSystemStratimikos::setPrecOperatorForSolve | ( | const Teuchos::RCP< const Epetra_Operator > & | solvePrecOp | ) | [virtual] |
Set preconditioner operator for solve.
Note: This should only be called if hasPreconditioner() returns true.
Implements NOX::Epetra::LinearSystem.
| void NOX::Epetra::LinearSystemStratimikos::throwError | ( | const string & | functionName, | |
| const string & | errorMsg | |||
| ) | const [protected, virtual] |
Sets the epetra Preconditioner operator in the AztecOO object.
Makes a call to SetUserOperator. This must be done AFTER the Jacobian matrix/operators is set by setAztecOOJacobian(), otherwise the aztec object may ignore this operation.
1.4.7