NOX::EpetraNew::LinearSystemAztecOO Class Reference

Concrete implementation of NOX::Epetra::LinearSolver for AztecOO. More...

#include <NOX_EpetraNew_LinearSystemAztecOO.H>

Inheritance diagram for NOX::EpetraNew::LinearSystemAztecOO:

[legend]
Collaboration diagram for NOX::EpetraNew::LinearSystemAztecOO:
[legend]
List of all members.

Public Member Functions

 LinearSystemAztecOO (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::EpetraNew::Interface::Required &iReq, Epetra_Vector &cloneVector, NOX::EpetraNew::Scaling *scalingObject=0)
 Constructor with no Operators.
 LinearSystemAztecOO (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::EpetraNew::Interface::Required &iReq, NOX::EpetraNew::Interface::Jacobian &iJac, Epetra_Operator &J, Epetra_Vector &cloneVector, NOX::EpetraNew::Scaling *scalingObject=0)
 Constructor with a user supplied Jacobian Operator only.
 LinearSystemAztecOO (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::EpetraNew::Interface::Required &i, NOX::EpetraNew::Interface::Preconditioner &iPrec, Epetra_Operator &M, Epetra_Vector &cloneVector, NOX::EpetraNew::Scaling *scalingObject=0)
 Constructor with a user supplied Preconditioner Operator only.
 LinearSystemAztecOO (NOX::Parameter::List &printingParams, NOX::Parameter::List &linearSolverParams, NOX::EpetraNew::Interface::Jacobian &iJac, Epetra_Operator &J, NOX::EpetraNew::Interface::Preconditioner &iPrec, Epetra_Operator &M, Epetra_Vector &cloneVector, NOX::EpetraNew::Scaling *scalingObject=0)
virtual ~LinearSystemAztecOO ()
 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 (NOX::Parameter::List &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, NOX::Parameter::List &linearSolverParams, const NOX::Epetra::Vector &input, NOX::Epetra::Vector &result) const
 Apply right preconditiong to the given input vector.
virtual bool createPreconditioner (Epetra_Vector &x, NOX::Parameter::List &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 void reset (NOX::Parameter::List &linearSolverParams)
 Reset the linear solver parameters.
void resetScaling (NOX::EpetraNew::Scaling &scalingObject)
 Sets the diagonal scaling vector(s) used in scaling the linear system. See NOX::EpetraNew::Scaling for details on how to specify scaling of the linear system.
virtual bool computeJacobian (Epetra_Vector &x)
 Compute the Jacobian.
virtual const NOX::EpetraNew::Interface::JacobiangetJacobianInterface () const
 NOX::Interface::Jacobian accessor.
virtual const NOX::EpetraNew::Interface::PreconditionergetPrecInterface () const
 NOX::Interface::Preconditioiner accessor.
virtual const Epetra_OperatorgetJacobianOperator () const
 Jacobian Epetra_Operator accessor.
virtual Epetra_OperatorgetJacobianOperator ()
 Jacobian Epetra_Operator accessor.
virtual const Epetra_OperatorgetPrecOperator () const
 Preconditioner Epetra_Operator accessor (only the base matrix if using an internal preconditioner - aztecoo or ifpack).
virtual const Epetra_OperatorgetGeneratedPrecOperator () const
 Return preconditioner operator generated and stored in AztecOO.
virtual Epetra_OperatorgetGeneratedPrecOperator ()
 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 Epetra_Operator &solveJacOp)
 Set Jacobian operator for solve.
virtual void setPrecOperatorForSolve (const Epetra_Operator &solvePrecOp)
 Set preconditioner operator for solve.

Protected Types

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 }
 Source of the RowMatrix if using an AztecOO native preconditioner.
enum  PreconditionerType {
  None_, AztecOO_, Ifpack_, NewIfpack_,
  ML_, UserDefined_
}

Protected Member Functions

virtual void setAztecOptions (const NOX::Parameter::List &lsParams, AztecOO &aztec) const
 Parse the parameter list and set the corresponding options in the AztecOO solver onject.
virtual bool createJacobianOperator (NOX::Parameter::List &lsParams, NOX::EpetraNew::Interface::Required &iReq, const Epetra_Vector &cloneVector)
 Creates an internally owned Epetra_Operator for the Jacobian.
virtual bool createPrecOperator (NOX::Parameter::List &lsParams, NOX::EpetraNew::Interface::Required &iReq, const Epetra_Vector &cloneVector)
 Creates an internally owned Epetra_Operator for the Preconditioner.
virtual bool checkPreconditionerValidity ()
 Checks to make sure that the supplied operators are valid for the requested preconditioning options set in the parameter list.
virtual bool createIfpackPreconditioner (NOX::Parameter::List &p) const
 Allocates the objects required for using ifpack preconditioners (NOX::EpetraNew::Group::ifpackGraph and NOX::EpetraNew::Group::ifpackPreconditioner). This is called from NOX::EpetraNew::Group::computePreconditioner().
virtual bool createNewIfpackPreconditioner (NOX::Parameter::List &p) const
 Allocates the objects required for using the new version of ifpack preconditioners via the Ifpack Create factory. This is called from NOX::EpetraNew::Group::computePreconditioner().
virtual OperatorType getOperatorType (const Epetra_Operator &o)
 Returns the type of operator that is passed into the group constructors.
virtual void throwError (const string &functionName, const string &errorMsg) const
virtual bool checkPreconditionerReuse ()
 Allows reuse of a preconditioner.

Protected Attributes

NOX::Parameter::List printParams
 Printing Parameters List.
const NOX::Utils utils
 Printing Utilities object.
NOX::EpetraNew::Interface::JacobianjacInterfacePtr
 Reference to the user supplied Jacobian interface functions.
OperatorType jacType
 Type of operator for the Jacobian.
Epetra_OperatorjacPtr
 Poniter to the Jacobian operator.
bool ownsJacOperator
 True if this object created and owns the jacobian operator.
NOX::EpetraNew::Interface::PreconditionerprecInterfacePtr
 Reference to the user supplied preconditioner interface functions.
OperatorType precType
 Type of operator for the preconditioner.
Epetra_OperatorprecPtr
 Pointer to the preconditioner operator.
bool ownsPrecOperator
 True if this object created and owns the preconditioner operator.
PreconditionerMatrixSourceType precMatrixSource
PreconditionerType precAlgorithm
AztecOO * aztecSolverPtr
 Aztec solver object.
Ifpack_IlukGraph * ifpackGraphPtr
 Stores the ifpack graph. Mutable since the applyRightPreconditioner() is a const method.
Ifpack_CrsRiluk * ifpackPreconditionerPtr
 Stores the ifpack preconditioner. Mutable since the applyRightPreconditioner() is a const method.
Ifpack_Preconditioner * newIfpackPreconditionerPtr
 Stores the new ifpack preconditioner. Mutable since the applyRightPreconditioner() is a const method.
NOX::EpetraNew::Scalingscaling
 Scaling object supplied by the user.
Epetra_VectortmpVectorPtr
 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".
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.).
Epetra_OperatorsolveJacOpPtr
 Jacobian operator that will be used in solves.

Detailed Description

Concrete implementation of NOX::Epetra::LinearSolver for AztecOO.

This solver provides the linear algebra services provided through the AztecOO parallel iterative linear solver.

The NOX::EpetraNew::LinearSystemAztecOO object provides a flexible and efficient way to interface an Epetra based application code to the Aztec linear solver. This class handles construction of both the preconditioners and AztecOO solver. All options are determined through parameter lists and the basic constructors.

Constructing a Linear System

There are four different constructors that can be used. The difference 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 "Jacbian 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::EpetraNew::Interface::Required, NOX::EpetraNew::Interface::Jacobian, and NOX::EpetraNew::Interface::Preconditioner.

NOX::EpetraNew::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::EpetraNew::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::EpetraNew::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.

"Linear %Solver" sublist parameters

A NOX::ParameterList called linearSolverParams is required in the various constructors and during some method calls such as applyJacobianInverse() and applyRightPreconditioning(). Typically, this list is the "Linear %Solver" sublist found in the nox parameter list. The following parameters can be set in the linear solver sublist and are vaild for the NOX::EpetraNew::LinearSolverAztecOO object:

"Output" sublist

The parameter list passed in during calls to ApplyJacobianInverse() will have an "Output" sublist created that contains the following parameters if the flag "Output %Solver Details" is set to true:


Member Enumeration Documentation

enum NOX::EpetraNew::LinearSystemAztecOO::OperatorType [protected]
 

List of types of epetra objects that can be used for the Jacobian and/or Preconditioner.

Enumeration values:
EpetraOperator  An Epetra_Operator derived object.
EpetraRowMatrix  An Epetra_RowMatrix derived object.
EpetraVbrMatrix  An Epetra_VbrMatrix object.
EpetraCrsMatrix  An Epetra_CrsMatrix object.


Constructor & Destructor Documentation

NOX::EpetraNew::LinearSystemAztecOO::LinearSystemAztecOO NOX::Parameter::List printingParams,
NOX::Parameter::List linearSolverParams,
NOX::EpetraNew::Interface::Required iReq,
Epetra_Vector cloneVector,
NOX::EpetraNew::Scaling scalingObject = 0
 

Constructor with no Operators.

Jacobian Operator will be constructed internally based on the parameter "Jacobian Operator". Defaults to using a NOX::EpetraNew::MatrixFree object.

NOX::EpetraNew::LinearSystemAztecOO::LinearSystemAztecOO NOX::Parameter::List printingParams,
NOX::Parameter::List linearSolverParams,
NOX::EpetraNew::Interface::Required iReq,
NOX::EpetraNew::Interface::Jacobian iJac,
Epetra_Operator J,
Epetra_Vector cloneVector,
NOX::EpetraNew::Scaling scalingObject = 0
 

Constructor with a user supplied Jacobian Operator only.

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. See the parameter key "Preconditioner Operator" for more details.

NOX::EpetraNew::LinearSystemAztecOO::LinearSystemAztecOO NOX::Parameter::List printingParams,
NOX::Parameter::List linearSolverParams,
NOX::EpetraNew::Interface::Required i,
NOX::EpetraNew::Interface::Preconditioner iPrec,
Epetra_Operator M,
Epetra_Vector cloneVector,
NOX::EpetraNew::Scaling scalingObject = 0
 

Constructor with a user supplied Preconditioner Operator only.

Jacobian operator will be constructed internally based on the parameter "Jacobian Operator" in the parameter list. See the parameter key "Jacobian Operator" for more details. Defaults to using a NOX::EpetraNew::MatrixFree object.

NOX::EpetraNew::LinearSystemAztecOO::LinearSystemAztecOO NOX::Parameter::List printingParams,
NOX::Parameter::List linearSolverParams,
NOX::EpetraNew::Interface::Jacobian iJac,
Epetra_Operator J,
NOX::EpetraNew::Interface::Preconditioner iPrec,
Epetra_Operator M,
Epetra_Vector cloneVector,
NOX::EpetraNew::Scaling scalingObject = 0
 

Constructor with user supplied separate objects for the Jacobian (J) and Preconditioner (M). linearSolverParams is the "Linear %Solver" sublist of parameter list.


Member Function Documentation

bool NOX::EpetraNew::LinearSystemAztecOO::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

\[ v = J u, \]

where $J$ is the Jacobian, $u$ is the input vector, and $v$ is the result vector. Returns true if successful.

Implements NOX::EpetraNew::LinearSystem.

bool NOX::EpetraNew::LinearSystemAztecOO::applyJacobianInverse NOX::Parameter::List 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

\[ v = J^{-1} u, \]

where $J$ is the Jacobian, $u$ is the input vector, and $v$ is the result vector.

The parameter list contains the linear solver options.

Implements NOX::EpetraNew::LinearSystem.

bool NOX::EpetraNew::LinearSystemAztecOO::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

\[ v = J^T u, \]

where $J$ is the Jacobian, $u$ is the input vector, and $v$ is the result vector. Returns true if successful.

Implements NOX::EpetraNew::LinearSystem.

bool NOX::EpetraNew::LinearSystemAztecOO::applyRightPreconditioning bool  useTranspose,
NOX::Parameter::List linearSolverParams,
const NOX::Epetra::Vector input,
NOX::Epetra::Vector result
const [virtual]
 

Apply right preconditiong to the given input vector.

Let $M$ be a right preconditioner for the Jacobian $J$; in other words, $M$ is a matrix such that

\[ JM \approx I. \]

Compute

\[ u = M^{-1} v, \]

where $u$ is the input vector and $v$ is the result vector.

If useTranspose is true, then the transpose of the preconditioner is applied:

\[ u = {M^{-1}}^T v, \]

The transpose preconditioner is currently only required for Tensor methods.

The parameter list contains the linear solver options.

Implements NOX::EpetraNew::LinearSystem.

bool NOX::EpetraNew::LinearSystemAztecOO::checkPreconditionerReuse  )  [protected, virtual]
 

Allows reuse of a preconditioner.

The child object will manage setting of this bool flag. Default implementation is to return false.

Reimplemented from NOX::EpetraNew::LinearSystem.

bool NOX::EpetraNew::LinearSystemAztecOO::createPreconditioner Epetra_Vector x,
NOX::Parameter::List 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::EpetraNew::Group controls the isValid flag for the preconditioner and will control when to call this.

Implements NOX::EpetraNew::LinearSystem.

NOX::EpetraNew::LinearSystemAztecOO::OperatorType NOX::EpetraNew::LinearSystemAztecOO::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.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:40:50 2008 for NOX by doxygen 1.3.9.1