The Epetra interface

Step 2a: Implementing the interface

To link your code to NOX using the epetra interface, you must write a concrete class derived from the NOX::Epetra::Interface object. This object defines four methods:

Step 2b: Construct an Epetra Group

Once the interface is written, the user can construct a NOX::Epetra::Group for use with the NOX solvers. All constructors require (1) a parameter list for the printing output, (2) a parameter list for the linear solver options, (3) an initial guess for the solution, and (4) an operator for the Jacobian, J. Optionally (5), the user may supply a second operator, M for the preconditioner.

(1) The printing parameter list is a NOX::Parameter::List that descibes the type of output requested from NOX. See NOX Parameter Reference Page for more details. A simple example is:

  NOX::Parameter::List& printParams = nlParams.sublist("Printing");
  printParams.setParameter("MyPID", MyPID); 
  printParams.setParameter("Output Precision", 3);
  printParams.setParameter("Output Processor", 0);
  printParams.setParameter("Output Information", 
			NOX::Utils::OuterIteration + 
			NOX::Utils::OuterIterationStatusTest + 
			NOX::Utils::InnerIteration +
			NOX::Utils::Parameters + 
			NOX::Utils::Details + 
			NOX::Utils::Warning);
  

(2) The linear solver parameter list is a NOX::Parameter::List object. A list of all parameters available can be found in NOX::Epetra::Group. Below is a simple example of how to use the aztecOO iterative solver in epetra to use GMRES with ilut preconditioning (WARNING - not all preconditioning options are compatible with every Jacobian and preconditioner operator - see NOX::Epetra::Group for more details):

  NOX::Parameter::List& lsParams = newtonParams.sublist("Linear Solver");
  lsParams.setParameter("Aztec Solver", "GMRES");  
  lsParams.setParameter("Max Iterations", 800);  
  lsParams.setParameter("Tolerance", 1e-4);
  lsParams.setParameter("Output Frequency", 50); 
  lsParams.setParameter("Preconditioning", "AztecOO: Jacobian Matrix");
  lsParams.setParameter("Aztec Preconditioner", "ilut"); 
  lsParams.setParameter("Overlap", 2);   
  lsParams.setParameter("Fill Factor", 2);   
  lsParams.setParameter("Drop Tolerance", 1.0e-12);   
  

(3) The initial guess is stored in an Epetra_Vector. Below is an example of creating an Epetra_Vector and setting the initial guess to one. The epetra block map is an epetra object that sets the size of the problem and has information on how the unknowns are distributed across processors. For examples on how to construct this see the examples-epetra directory in the nox source code.

 
  Epetra_Vector initialGuess(EpetraBlockMap); 
  initialGuess.PutScalar(1.0);
  

(4) and (5)The user can write their own operators for the Jacobian or preconditioner or use one of the NOX supplied operators. For example, here are three ways to create a Jacobian operator:

Create the NOX::Epetra::Interface derived object described in Step 2a: Implementing the interface:

  UserInterface interface(.......);
  

Finally, construct the group:

  NOX::Epetra::Group group(printParams, lsParams, interface, initialGuess, J);
  

You are ready to move on to Step 3: Call NOX from your code

Notes on NOX/Epetra:


Generated on Thu Sep 18 12:43:29 2008 for NOX by doxygen 1.3.9.1