[petsc-users] Non-linear solve: DIVERGED_LINE_SEARCH

Karthikeyan Chockalingam - STFC UKRI karthikeyan.chockalingam at stfc.ac.uk
Thu Sep 7 08:27:53 CDT 2023


Thank you for your response.

I will test the Jacobian.

The linear solve in the second step convergences. Is it possible that Jacobian had been zeroed out?

Best,
Karthik.

From: Matthew Knepley <knepley at gmail.com>
Date: Thursday, 7 September 2 ot023 at 14:19
To: Chockalingam, Karthikeyan (STFC,DL,HC) <karthikeyan.chockalingam at stfc.ac.uk>
Cc: Stefano Zampini <stefano.zampini at gmail.com>, petsc-users at mcs.anl.gov <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] Non-linear solve: DIVERGED_LINE_SEARCH
On Thu, Sep 7, 2023 at 8:49 AM Karthikeyan Chockalingam - STFC UKRI via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
I just noticed that the line search diverges even for the linear Poisson equation (where the Jacobian is a constant). I am not sure, what I am doing wrong.

You need to test the Jacobian. We have facilities for this. Run using

  --snes_test_jacobian

This will tell you at each step whether the Jacobian matches the finite difference approximant. It looks like your Jacobian at the second step is wrong. Is it possible that you are not zeroing out the matrix before adding in updates? That would make the second step wrong.

  Thanks,

     Matt


Best,
Karthik.

From: Chockalingam, Karthikeyan (STFC,DL,HC) <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>>
Date: Thursday, 7 September 2023 at 12:19
To: Stefano Zampini <stefano.zampini at gmail.com<mailto:stefano.zampini at gmail.com>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Non-linear solve: DIVERGED_LINE_SEARCH
I am trying to solve the non-linear scalar problem

-\nabla \cdot \big( (1+u^2)\nabla u\big)=f

Using finite element formulation.



The linear iteration converged – does that mean my Jacobian is correct??



I am hoping the non-linear residual goes down to 1-e11.



Kind regards,

Karthik.


From: Stefano Zampini <stefano.zampini at gmail.com<mailto:stefano.zampini at gmail.com>>
Date: Thursday, 7 September 2023 at 11:49
To: Chockalingam, Karthikeyan (STFC,DL,HC) <karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>>
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov> <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>>
Subject: Re: [petsc-users] Non-linear solve: DIVERGED_LINE_SEARCH
The solver did not diverge.
It was the line search that was not able to make further progress in minimizing the 2-norm of the residual.
This is common in nonlinear solvers. It would help if you tell us what you are trying to solve.
Note that at the first step, your residual norm is already 1.e-6. What kind of accuracy do you want?


Il giorno gio 7 set 2023 alle ore 13:08 Karthikeyan Chockalingam - STFC UKRI via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> ha scritto:
Hello,

The non-linear solution diverged. The final solution seems right and I believe the Jacobian is correct (not 100% certain).

I am not sure if I doing something wrong in the solver setting.



 0 SNES Function norm 3.890991210938e-03

    0 KSP Residual norm 9.037762538598e+00

    1 KSP Residual norm 2.120375403775e-01

    2 KSP Residual norm 5.155439334511e-03

    3 KSP Residual norm 1.394364169369e-04

    4 KSP Residual norm 9.233543407204e-06

  Linear solve converged due to CONVERGED_RTOL iterations 4



      Line search: Using full step: fnorm 3.890991210938e-03 gnorm 7.701511565083e-06

  1 SNES Function norm 7.701511565083e-06

    0 KSP Residual norm 5.630229687829e-03

    1 KSP Residual norm 1.030475601271e-04

    2 KSP Residual norm 2.576454714319e-06

    3 KSP Residual norm 6.669316846898e-08

    4 KSP Residual norm 3.215810984829e-09

  Linear solve converged due to CONVERGED_RTOL iterations 4



      Line search: gnorm after quadratic fit 1.805500533481e-05

      Line search: Cubic step no good, shrinking lambda, current gnorm 2.563759884284e-05 lambda=3.0804668685096816e-02

      Line search: Cubic step no good, shrinking lambda, current gnorm 3.332721829751e-05 lambda=3.0804668685096817e-03

      Line search: Cubic step no good, shrinking lambda, current gnorm 4.102754045833e-05 lambda=3.0804668685096822e-04

      Line search: Cubic step no good, shrinking lambda, current gnorm 4.872893294880e-05 lambda=3.0804668685096822e-05

      Line search: Cubic step no good, shrinking lambda, current gnorm 5.643043250787e-05 lambda=3.0804668685096822e-06

      Line search: Cubic step no good, shrinking lambda, current gnorm 6.413194279696e-05 lambda=3.0804668685096827e-07

      Line search: Cubic step no good, shrinking lambda, current gnorm 7.183345417492e-05 lambda=3.0804668685096828e-08

      Line search: Cubic step no good, shrinking lambda, current gnorm 7.953496567312e-05 lambda=3.0804668685096829e-09

      Line search: Cubic step no good, shrinking lambda, current gnorm 8.723647719173e-05 lambda=3.0804668685096831e-10

      Line search: Cubic step no good, shrinking lambda, current gnorm 9.493798871875e-05 lambda=3.0804668685096832e-11

      Line search: Cubic step no good, shrinking lambda, current gnorm 1.026395002516e-04 lambda=3.0804668685096835e-12

      Line search: Cubic step no good, shrinking lambda, current gnorm 1.103410117889e-04 lambda=3.0804668685096835e-13

      Line search: unable to find good step length! After 12 tries

      Line search: fnorm=7.7015115650831560e-06, gnorm=1.1034101178892401e-04, ynorm=6.2052357872955976e-03, minlambda=9.9999999999999998e-13, lambda=3.0804668685096835e-13, initial slope=-5.9313318983096354e-11

Nonlinear solve did not converge due to DIVERGED_LINE_SEARCH iterations 1


Thank you for your help.

Kind regards,
Karthik.

--
Dr. Karthik Chockalingam
Senior Research Software Engineer
High Performance Systems Engineering Group
Hartree Centre | Science and Technology Facilities Council
karthikeyan.chockalingam at stfc.ac.uk<mailto:karthikeyan.chockalingam at stfc.ac.uk>

 Error! Filename not specified.



--
Stefano


--
What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/<http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230907/a9402d1f/attachment-0001.html>


More information about the petsc-users mailing list