[petsc-users] degub of computating Jacobian for SNES

WANG, LEI lei.wang at durham.ac.uk
Tue Jul 3 10:20:41 CDT 2018

Thank you very much, Hong!

With the option, I have got the following output. Any further suggestion on fixing this divergence?

One strange thing is that the Jacobian stiffness matrix include ‘nan’. I output the element stiffness matrix and the element degree of freedom before assembly. There is nothing abnormal. But after assembly by
ierr1 = MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr1);
ierr1 = MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY);CHKERRQ(ierr1);
I got some ‘nan’ in the stiffness matrix A. Any idea on this?

Nonlinear solve did not converge due to DIVERGED_FNORM_NAN iterations 0
SNES Object: 1 MPI processes
  type: newtonls
  maximum iterations=40, maximum function evaluations=40
  tolerances: relative=0.0001, absolute=0.0001, solution=1e-08
  total number of linear solver iterations=0
  total number of function evaluations=1
  norm schedule ALWAYS
  SNESLineSearch Object:   1 MPI processes
    type: basic
    maxstep=1.000000e+08, minlambda=1.000000e-12
    tolerances: relative=1.000000e-08, absolute=1.000000e-15, lambda=1.000000e-08
    maximum iterations=40
  KSP Object:   1 MPI processes
    type: gmres
      GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
      GMRES: happy breakdown tolerance 1e-30
    maximum iterations=100, initial guess is zero
    tolerances:  relative=1e-10, absolute=1e-10, divergence=10000.
    left preconditioning
    using DEFAULT norm type for convergence test
  PC Object:   1 MPI processes
    type: lu
    PC has not been set up so information may be incomplete
      LU: out-of-place factorization
      tolerance for zero pivot 2.22045e-14
      matrix ordering: nd
    linear system matrix = precond matrix:
    Mat Object:     1 MPI processes
      type: seqaij
      rows=78, cols=78
      total: nonzeros=3204, allocated nonzeros=46800
      total number of mallocs used during MatSetValues calls =0
        using I-node routines: found 25 nodes, limit used is 5
No. of Iterations: 0
Convergence reason: -4: SNES_DIVERGED_FNORM_NAN

From: Hong [mailto:hzhang at mcs.anl.gov]
Sent: 03 July 2018 15:31
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] degub of computating Jacobian for SNES

Run your code with option '-snes_converged_reason -ksp_converged_reason -ksp_monitor -snes_monitor' to check which solver leads to divergence. Then use option '-snes_view' to check what solver is used.
Dear all

I am using SNES for solving a large nonlinear system for Material Point Method. But it always diverged after server steps, I think there are some bug in the computation of Jacobian matrix. Do anyone have practical approach for identified these bugs in a large matrix? Currently, I saved the matrix to a txt file and load it to Matlab for checking. Is there function for checking Petsc Mat in Petsc itself?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180703/a7489071/attachment-0001.html>

More information about the petsc-users mailing list