NOX
Development
|
A small example based on the NOX::LAPACK Vector and Group is included with NOX; see the file Trilinos/packages/nox/examples/lapack/NOX_SimpleExamples/Rosenbrock.C.
There are four steps to calling the solver.
The first step is to somehow construct an object deriving from the Abstract::Group which contains the initial guess as its x-vector. See Step 2: Create concrete implementations of the NOX::Abstract classes for more details. For example:
Note that the group is not handled as a raw pointer, but is wrapped in a reference counter smart pointer (RCP). RCPs enforce strict memory management in NOX and LOCA and can prevent many errors that users have encountered with objects going out of scope. We use the RCP implementation in the Trilinos package Teuchos. For information on the use of smart pointers, see Teuchos Reference Counted Pointer Beginners Guide.
The NOX::StatusTest objects are used to determine when NOX should terminate the iterative process due to either convergence or failure. For example...
These and other status tests can be combined using the NOX::StatusTest::Combo object. It takes an arbitrary number of status tests and either AND's or OR's them together.
Alternatively, users can build a set of status tests from a Teuchos::ParameterList by using the NOX::StatusTest::Factory object. See NOX::StatusTest::Factory for parameter list arguments and examples.
Finally, the user can create their own status tests, so long as they derive from NOX::StatusTest::Generic.
Here is some sample code.
This test uses an OR combination, meaning that either test registered with the Combo test can trigger termination. The first test requires that the norm of the residual is less that 1.0e-4. If met, NOX will terminate returning a "Converged" result. The second test will trigger NOX to terminate if a maximum number of iterations is reached and return a "Failed" result.
Next, we set up a parameter list containing the information on what types of solvers and so forth should be used.
For a full list of parameters; see NOX Parameter Reference Page.
The last step is to create the solver, passing in the group with the initial guess, the status tests, and the solver parameters.
Please report any issues regarding NOX and LOCA to Bugzilla; see Reporting Bugs and Making Enhancement Requests for more information.
Go on to Step 4: Link your code to NOX.