File: SNESConvergedReason.html

package info (click to toggle)
petsc 3.4.2.dfsg1-8.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 129,104 kB
  • ctags: 516,422
  • sloc: ansic: 395,939; cpp: 47,201; python: 34,788; makefile: 17,193; fortran: 16,251; f90: 1,592; objc: 954; sh: 822; xml: 621; java: 381; lisp: 293; csh: 241
file content (89 lines) | stat: -rw-r--r-- 5,753 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/SNES/SNESConvergedReason.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>SNESConvergedReason</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
   <div id="version" align=right><b>petsc-3.4.2 2013-07-02</b></div>
<A NAME="SNESConvergedReason"><H1>SNESConvergedReason</H1></A>
reason a <A HREF="../SNES/SNES.html#SNES">SNES</A> method was said to have converged or diverged 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
typedef enum {/* converged */
              SNES_CONVERGED_FNORM_ABS         =  2, /* ||F|| < atol */
              SNES_CONVERGED_FNORM_RELATIVE    =  3, /* ||F|| < rtol*||F_initial|| */
              SNES_CONVERGED_SNORM_RELATIVE    =  4, /* Newton computed step size small; || delta x || < stol || x ||*/
              SNES_CONVERGED_ITS               =  5, /* maximum iterations reached */
              SNES_CONVERGED_TR_DELTA          =  7,
              /* diverged */
              SNES_DIVERGED_FUNCTION_DOMAIN     = -1, /* the new x location passed the function is not in the domain of F */
              SNES_DIVERGED_FUNCTION_COUNT      = -2,
              SNES_DIVERGED_LINEAR_SOLVE        = -3, /* the linear solve failed */
              SNES_DIVERGED_FNORM_NAN           = -4,
              SNES_DIVERGED_MAX_IT              = -5,
              SNES_DIVERGED_LINE_SEARCH         = -6, /* the line search failed */
              SNES_DIVERGED_INNER               = -7, /* inner solve failed */
              SNES_DIVERGED_LOCAL_MIN           = -8, /* || J^T b || is small, implies converged to local minimum of F() */
              SNES_CONVERGED_ITERATING          =  0} SNESConvergedReason;
</PRE>

<P>
The two most common reasons for divergence are
<pre>
  1) an incorrectly coded or computed Jacobian or
</pre>
<pre>
  2) failure or lack of convergence in the linear system (in this case we recommend
</pre>
<pre>
     testing with -pc_type lu to eliminate the linear solver as the cause of the problem).
</pre>
<P>
<H3><FONT COLOR="#CC3333">Diverged Reasons</FONT></H3>
<DT><B><A HREF="../SNES/SNES_DIVERGED_LOCAL_MIN.html#SNES_DIVERGED_LOCAL_MIN">SNES_DIVERGED_LOCAL_MIN</A> </B> -this can only occur when using the line-search variant of <A HREF="../SNES/SNES.html#SNES">SNES</A>.
The line search wants to minimize Q(alpha) = 1/2 || F(x + alpha s) ||^2_2  this occurs
at Q'(alpha) = s^T F'(x+alpha s)^T F(x+alpha s) = 0. If s is the Newton direction - F'(x)^(-1)F(x) then
you get Q'(alpha) = -F(x)^T F'(x)^(-1)^T F'(x+alpha s)F(x+alpha s); when alpha = 0
Q'(0) = - ||F(x)||^2_2 which is always NEGATIVE if F'(x) is invertible. This means the Newton
direction is a descent direction and the line search should succeed if alpha is small enough.
<br>
<P>
If F'(x) is NOT invertible AND F'(x)^T F(x) = 0 then Q'(0) = 0 and the Newton direction
is NOT a descent direction so the line search will fail. All one can do at this point
is change the initial guess and try again.
<P>
An alternative explanation: Newton's method can be regarded as replacing the function with
its linear approximation and minimizing the 2-norm of that. That is F(x+s) approx F(x) + F'(x)s
so we minimize || F(x) + F'(x) s ||^2_2; do this using Least Squares. If F'(x) is invertible then
s = - F'(x)^(-1)F(x) otherwise F'(x)^T F'(x) s = -F'(x)^T F(x). If F'(x)^T F(x) is NOT zero then there
exists a nontrival (that is F'(x)s != 0) solution to the equation and this direction is
s = - [F'(x)^T F'(x)]^(-1) F'(x)^T F(x) so Q'(0) = - F(x)^T F'(x) [F'(x)^T F'(x)]^(-T) F'(x)^T F(x)
= - (F'(x)^T F(x)) [F'(x)^T F'(x)]^(-T) (F'(x)^T F(x)). Since we are assuming (F'(x)^T F(x)) != 0
and F'(x)^T F'(x) has no negative eigenvalues Q'(0) &lt; 0 so s is a descent direction and the line
search should succeed for small enough alpha.
<P>
Note that this RARELY happens in practice. Far more likely the linear system is not being solved
(well enough?) or the Jacobian is wrong.
<P>
<A HREF="../SNES/SNES_DIVERGED_MAX_IT.html#SNES_DIVERGED_MAX_IT">SNES_DIVERGED_MAX_IT</A> means that the solver reached the maximum number of iterations without satisfying any
convergence criteria. SNES_CONVERGED_ITS means that <A HREF="../SNES/SNESSkipConverged.html#SNESSkipConverged">SNESSkipConverged</A>() was chosen as the convergence test;
thus the usual convergence criteria have not been checked and may or may not be satisfied.
<P>
Developer Notes: this must match finclude/petscsnes.h
<P>
The string versions of these are in <A HREF="../SNES/SNESConvergedReason.html#SNESConvergedReason">SNESConvergedReason</A>, if you change any value here you must
also adjust that array.
<P>
Each reason has its own manual page.
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../SNES/SNESSolve.html#SNESSolve">SNESSolve</A>(), <A HREF="../SNES/SNESGetConvergedReason.html#SNESGetConvergedReason">SNESGetConvergedReason</A>(), <A HREF="../KSP/KSPConvergedReason.html#KSPConvergedReason">KSPConvergedReason</A>, <A HREF="../SNES/SNESSetConvergenceTest.html#SNESSetConvergenceTest">SNESSetConvergenceTest</A>()
<BR><P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/snes/../../include/petscsnes.h.html#SNESConvergedReason">src/snes/../../include/petscsnes.h</A>
<BR><A HREF="./index.html">Index of all SNES routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/snes/examples/tutorials/ex30.c.html">src/snes/examples/tutorials/ex30.c.html</A><BR>
</BODY></HTML>