Nonlinear Problems

Setting up nonlinear problems

Setting up a NonlinearProblem is mostly similar to creating a LinearProblem: one specifies a mesh, equation, boundary conditions, test and unknown functions, and a vector type. There is, however, one additional argument beyond that required for LinearProblem setup: the specification of an initial guess for the solution. The initial guess is an expression, and in fact must be an expression of subtype DiscreteFunction.

Procedures for writing multiple equations and for specifying equation and function ordering are identical with those for linear problems.

Upon creation, a pointer to your NonlinearProblem should be given to a TSF NonlinearOperator object. For example,

NonlinearOperator<double> F = new NonlinearProblem(mesh, eqn, bc, List(vPsi, vOmega),
                               List(psi, omega), u0, vecType);

Solving nonlinear problems

The NonlinearProblem object itself has no solve() method. Rather, the NonlinearOperator is passed as an argument to a nonlinear solver, whose solve() method carries out the solve. Sundance has no built-in nonlinear solvers; you can, in principle, use any nonlinear solver to drive solution of a NonlinearProblem. All the documented examples use the NOX package of nonlinear solvers found within Trilinos. See the page on nonlinear solvers for more information on creating NOX solvers for use with Sundance.

// create a nonlinear problem, wrapping it in a NonlinearOperator object
NonlinearOperator<double> F 
        = new NonlinearProblem(mesh, eqn, bc, List(vPsi, vOmega),
                               List(psi, omega), u0, vecType);

// Read parameters for NOX solver from an XML file
ParameterXMLFileReader reader("../../examples-tutorial/nox.xml");
ParameterList noxParams = reader.getParameters();

// create the NOX solver
NOXSolver solver(noxParams, F);

// do the solve!
NOX::StatusTest::StatusType status = solver.solve();

Note that no solution object is returned. Where, then, is the solution? It is written into the expression u0 that you passed in as an initial guess. Because u0 is an expression, it can be reused in other contexts, visualized, and so on.

Site Contact