#include <NonLinEqSolver.h>
Inheritance diagram for NonLinEqSolver::

NAME: NonLinEqSolver - base class for solvers for systems of nonlinear equations
DESCRIPTION:
The "NonLinEqSolver" hierarchy is a collection of C++ classes for solving systems of nonlinear algebraic equations. In accordance with the Diffpack coding standard, the user dependent code is provided by a base class reference of type "NonLinEqSolverUDC". Various nonlinear solution algorithms are implemented as sublcasses of "NonLinEqSolver", and various parameters needed to initialize the "NonLinEqSolver" hierarchy are collected in a parameter class "NonLinEqSolver_prm". The user''s problem must be coded in terms of a class which is derived from class "NonLinEqSolverUDC".
The base class contains the basic convergence information such as the number of iterations and the estimated ""error"". These parameters are collected in a special "struct" (see class "NonLinEqSolverState") which is returned by the the "getCurrentState" function.
Derived classes, implementing various iterative methods, are responsible for defining appropriate ""error"" estimates. An attribute of class "NonLinEqSolver_prm", the "stopping_criterion" parameter, can be used to indicate different stopping criteria. The virtual function "converged" is responsible for defining and checking convergence criteria.
The virtual function "solve" carries out the steps in the iterative method. Sometimes a user want to change the stopping criterion data and these items are therefore defined as "public" in this base class.
|
|
The constructor takes a "NonLinEqSolver_prm" object as argument and performs the necessary initialization. The "solve" function will in derived classes automatically redimension internal vectors etc. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implements a loop over a continuation parameter "lambda" that can be set on the "NonLinEqSolver_prm" menu (that is, a set of "lambda" values are given on the menu and the "continuationSolve" function runs a loop through this set). Typically, "lambda"=0 is an easy problem, and "lambda"=1 is the problem that one wants to solve. Convergence problems are serious for "lambda"=1, but not for "lambda"=0. The idea is then to obtain good startvalues for nonlinear solvers by using the startvector from the solution for the previous "lambda" value when solving for the next. Usually "lambda" reflects a physical parameter that influences the degree of nonlinearity significantly. Everywhere in the problem class, the programmer can read "NonLinEqSolver getCurrentState().continuation_prm" to see the current "lambda" value. Prior to each internal "solve" call in the "continutationSolve" function, the user''s problem class is given the control in a function "beforeSolveInContinuationMethod". In this function one can read the current "lambda" value (either as the argument or through a "getCurrentState" call) and scale physical parameters such that they correspond to the "lambda" parameter before "solve" starts to solve the nonlinear problem. For example, in a fluid flow problem governed by the Navier-Stokes equations, the Reynolds number may correspond to "lambda". If "Re" is the desired Reynolds number, and "Re_c" is the current Reynolds number used in the computations (i.e., the coefficient in the "integrands" routine), "beforeStartInContinutationMethod" could simply set "Re_c = lambda*Re". The "continuationSolve" is simply a loop over the "lambda" values where one in each iteration calls solve. If divergence occurs, one tries to achieve convergence with a smaller "lambda" value. Hence, more "lambda" values than those given on the menu can appear in the simulation. |
|
|
this is a protected function for use in the iteration loop. The function determines whether the iteration is to be terminated or not. See the man page for class "NonLinEqSolver_prm" for the available convergence criteria. |
|
|
|
|
|
returns a "struct" with several parameters reflecting the state of the solver, that is, the number of iterations, or current iteration number, the name ("enum") of the solution method, the estimated ""error"" etc. |
|
|
if the user has supplied the function "normOfResidual" in his "NonLinEqSolverUDC" derived class, "getResidualNorm" calls the user function, determines if it is really implemented (otherwise the "DUMMY" constant is returned) and stores the norm in the local variable "rnorm". This is the norm of residual of the nonlinear equations. The norm is needed for various convergence estimation as well as in various solution algorithms. Read the warning about implementation of "normOfResidual" in class "NonLinEqSolverUDC". (For use in derived classes only). |
|
|
returns "true" if the norm of the residual is provided (see description of "getResidualNorm"), otherwise the return value is "false". (For use in derived classes only). |
|
|
|
|
|
Reimplemented in NonLinML. |
|
|
Reimplemented in ConjGradNonLin, LinNonLin, NewtonRaphson, SuccessiveSubst, and NonLinML. |
|
|
generates a plot of the convergence history. |
|
|
generates a plot of the residual in some norm. |
|
|
|
|
|
|
|
|
this function is like "ordinarySolve", but a return is performed after each step in the iteration. Hence the user can check the development of the nonlinear iterations. This may be useful is convergence problems occur. The function returns "true" as long as the convergence criteria are not satisified, and "false" when the stopping criteria are satisfied. Note this difference in comparison with "solve". The user must implement the loop, usually in terms of a "while(performSingleStep)" type of construction. Prior to the loop, a call to "initSingleSteps" must be performed. Reimplemented in ConjGradNonLin, LinNonLin, NewtonRaphson, SuccessiveSubst, and NonLinML. |
|
|
solves the nonlinear system. A "true" return value indicates that the iteration scheme converged such that the most recent solution (stored in "nonlinear_sol") satisfied the convergence criteria. If the return value is "false", the convergence criteria were not satisfied. The "solve" function calls "ordinarySolve" (which depends on the method, e.g., Successive Substitution or Newton-Raphson) if not a set of continuation parameter values is given on the menu. In that case, "solve" calls "continuationSolve" (which sets up a loop and calls "ordinarySolve" according to the continuation algorithm). |
|
|
Reimplemented in NonLinML. |
|
|
returns a "bool" value of whether the iteration was successful or not. (For use in derived classes only). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|