[petsc-users] A number of questions about DMDA with SNES and Quasi-Newton methods

zakaryah . zakaryah at gmail.com
Sat Aug 26 17:56:26 CDT 2017

I'm using PETSc's SNES methods to solve PDEs which result from
Euler-Lagrange equations for the strain energy of a 3D displacement field.
There is an additional term in the Lagrangian which describes external
forces which arise from various data sets, and that term contains
nonlinearities (field terms higher than linear). The grid has about 1.6e6
elements, and the displacement field has 3 components at each grid element.

I'm trying to solve a sequence of successively more complicated equations,
and the latest equation is failing to converge on some data sets. In
particular, the methods were successful for the infinitesimal bulk strain
(compression) energy, as well as the full infinitesimal strain energy (bulk
+ shear), but I'm now trying to generalize to the finite strain, as certain
data sets are known to result from displacement fields for which the
infinitesimal strain is a poor approximation.
I'm using a DMDA, closely following example 48, and my preferred solver is

I have read the FAQs "Why is Newton's method not converging?
​" and "
Why is my iterative linear solver not converging?
 which have raised
a number of questions:

Is there documentation for the DMDA/SNES methods somewhere?  I don't
understand these very well.  For example, I am not allocating any matrix
for the global Jacobian, and I believe this prevents me from changing the
line search.  If I'm mistaken I would love to see an example of changing
the line search type while using DMDA/SNES.

I don't know how to interpret the linesearch monitor.  Even for problems
which are converging properly, the linesearch monitor reports "lssucceed=0"
on every iteration.  Is this a problem?

I'm also having trouble understanding the methods for troubleshooting.  I
suspect that I've made an error in the analytical Jacobian, which has a
rather large number of non-zero elements, but I have no idea how to
use -snes_type
test -snes_test_display.  The FAQs mention that some troubleshooting tools
are more useful for small test problems.  How small is small?  When I try
to run the program with -snes_type test -snes_test_display, I get errors

[0]PETSC ERROR: Argument out of range [0]PETSC ERROR: Local index
1076396032 too large 4979879 (max) at 0

The second size is 1 less than the number of field elements, while the
first number seems too large for any aspect of the problem - the Jacobian
has at most 59 non-zero columns per row.

Because I suspect a possible error in the Jacobian, I ran with
-snes_mf_operator -pc_type ksp -ksp_ksp_rtol 1e-12 and observed very
similar failure to converge (diverging residual) as with the explicit
Jacobian. Do I need to set an SNES method which is somehow compatible with
the "matrix-free" approach? If I instead use -snes_mf, the problem seems to
converge, but horrendously slowly (true residual relative decrease by about
1e-5 per iteration).  I suppose this supports my suspicion that the
Jacobian is incorrect but doesn't really suggest a solution.

Is it possible that the analytical Jacobian is correct, but somehow
pathological, which causes the SNES to diverge?  Neither the Jacobian nor
the function have singularities.

Thanks for any help you can provide!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170826/fed725cf/attachment.html>

More information about the petsc-users mailing list