NOX
Development
|
The Epetra support code in NOX implements a concrete Group and Vector class using Epetra objects. The user only needs to write an interface that supplies the nonlinear equations in residual form, . Additionally, the user may provide details such as the Jacobian and Preconditioner if using an iterative linear solver. Below, we describe each of these interfaces.
To link your code to NOX using the epetra interface, you must write a concrete class derived from the NOX::Epetra::Interface::Required object. This object defines the method for evaluating the set of nonlinear equations to be solved:
computeF(const Epetra_Vector& x, Epetra_Vector& RHS, const FillType flag) - Computes the set of nonlinear equations, , to be solved by NOX. This method must be supplied by the user.
Additonally if the user wishes to provide a Jacobian operator, they will need to implement a concrete class derived from the NOX::Epetra::Interface::Jacobian object. This object defined the method for evaluating the Jacobian:
computeJacobian(const Epetra_Vector& x, Epetra_Operator& Jac) - this is an optional method that the user can implement if they wish to supply their own evaluation of the Jacobian. If the user does not wish to supply their own Jacobian, they should implement this method so that it throws an error if it is called. This method should update the Jac operator so that subsequent Epetra_Operator::Apply() calls on that operator correspond to the Jacobian at the current solution vector x.
Additonally if the user wishes to provide a preconditioner operator, they will need to implement a concrete class derived from the NOX::Epetra::Interface::Preconditioner object. This object defined the method for evaluating the Preconditioner or a Matrix to be used with an interal preconditioner:
computePreconditioner(const Epetra_Vector& x, Epetra_Operator& M, Teuchos::ParameterList* precParams) - This method allows a user to supply their own preconditioner. The method should compute a preconditioner based upon the solution vector x and store it in the Epetra_Operator M. Subsequent calls to the Epetra_Operator::Apply method will apply this user supplied preconditioner to epetra vectors. The Epetra_Operator M can also be an Epetra_RowMatrix that can be used by internally constructed preconditioner objects such as AztecOO, Ipfack, and ML.
The user can write their own operators for the Jacobian or preconditioner as discussed above, or they can use one of the NOX pre-supplied operators. Available Operators include:
These operators are built automatically by the linear system object depending on the constuctor used.
// NOX headers for an epetra interface #include "NOX.H" #include "NOX_Epetra.H"
The Epetra support in NOX provides a number of tools that allow users to perform complex algorithms. This section lists some of the important features.
See the page NOX Epetra Tutorial for more information on how to use the epetra support group.
The directory Trilinos/packages/nox/test/epetra/1Dfem contains many examples and is the best resource on how to use NOX with Epetra.