10000 KSP preconditioned resid norm 1.027326121286e-13 true resid norm 4.122100161195e-13 ||r(i)||/||b|| 1.256880059386e-03
The residual norms are very small. From the final column we see that the relative decrease in the residual norm was only 1.e-3 meaning the initial linear system residual norm was already very small at the beginning of the linear solve. I suspect you have a very small SNES tolerance? When using matrix-free SNES with complex systems you cannot expect to get really tight convergence. I suggest -snes_rtol 1.e-8 -ksp_atol 1.e-11 But you can try out various values > On Sep 20, 2023, at 10:36 AM, Harry-Arthur Cousin <harry-art...@hotmail.fr> > wrote: > > Will do. The output is very long, I'm sending you the last 20 iteration of > KSP when the nonlinear solver did not converge. That's what i have: > > Linear solve converged due to CONVERGED_ITS iterations 1 > 9980 KSP preconditioned resid norm 7.911586848688e-14 true resid norm > 3.571299151668e-13 ||r(i)||/||b|| 1.088933920648e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9981 KSP preconditioned resid norm 7.773677194223e-14 true resid norm > 3.519061016604e-13 ||r(i)||/||b|| 1.073005857832e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9982 KSP preconditioned resid norm 7.142532169111e-14 true resid norm > 3.536747918236e-13 ||r(i)||/||b|| 1.078398816059e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9983 KSP preconditioned resid norm 6.325819556307e-14 true resid norm > 3.698647905235e-13 ||r(i)||/||b|| 1.127764153463e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9984 KSP preconditioned resid norm 6.119227152008e-14 true resid norm > 3.563406240582e-13 ||r(i)||/||b|| 1.086527273025e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9985 KSP preconditioned resid norm 6.075666963630e-14 true resid norm > 3.710895872549e-13 ||r(i)||/||b|| 1.131498712373e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9986 KSP preconditioned resid norm 5.985095889340e-14 true resid norm > 3.509409502428e-13 ||r(i)||/||b|| 1.070062990062e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9987 KSP preconditioned resid norm 5.243339292054e-14 true resid norm > 3.627159951643e-13 ||r(i)||/||b|| 1.105966579450e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9988 KSP preconditioned resid norm 4.491198445126e-14 true resid norm > 4.006851442317e-13 ||r(i)||/||b|| 1.221739278968e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9989 KSP preconditioned resid norm 4.410245117574e-14 true resid norm > 4.031793308619e-13 ||r(i)||/||b|| 1.229344366950e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9990 KSP preconditioned resid norm 4.072064997637e-13 true resid norm > 4.072064997637e-13 ||r(i)||/||b|| 1.241623710224e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9991 KSP preconditioned resid norm 2.614566817566e-13 true resid norm > 3.327810250174e-13 ||r(i)||/||b|| 1.014691099513e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9992 KSP preconditioned resid norm 2.214885215262e-13 true resid norm > 3.122694737130e-13 ||r(i)||/||b|| 9.521488059891e-04 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9993 KSP preconditioned resid norm 1.937414464538e-13 true resid norm > 2.949371229399e-13 ||r(i)||/||b|| 8.993002937814e-04 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9994 KSP preconditioned resid norm 1.683143904883e-13 true resid norm > 3.116491153488e-13 ||r(i)||/||b|| 9.502572555001e-04 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9995 KSP preconditioned resid norm 1.455417378095e-13 true resid norm > 3.848207009730e-13 ||r(i)||/||b|| 1.173366600951e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9996 KSP preconditioned resid norm 1.254552363609e-13 true resid norm > 3.494786173247e-13 ||r(i)||/||b|| 1.065604153515e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9997 KSP preconditioned resid norm 1.187610795222e-13 true resid norm > 3.364834320451e-13 ||r(i)||/||b|| 1.025980203084e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9998 KSP preconditioned resid norm 1.126887893465e-13 true resid norm > 4.347573700680e-13 ||r(i)||/||b|| 1.325629770605e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 9999 KSP preconditioned resid norm 1.067379754742e-13 true resid norm > 3.907245052617e-13 ||r(i)||/||b|| 1.191368040981e-03 > Linear solve converged due to CONVERGED_ITS iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > 10000 KSP preconditioned resid norm 1.027326121286e-13 true resid norm > 4.122100161195e-13 ||r(i)||/||b|| 1.256880059386e-03 > Linear solve did not converge due to DIVERGED_ITS iterations 10000 > Nonlinear solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 1 > Linear solve converged due to CONVERGED_ITS iterations 1 > > De : Barry Smith <bsm...@petsc.dev <mailto:bsm...@petsc.dev>> > Envoyé : mercredi 20 septembre 2023 16:26 > À : Harry-Arthur Cousin <harry-art...@hotmail.fr > <mailto:harry-art...@hotmail.fr>> > Cc : petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov> > <petsc-users@mcs.anl.gov <mailto:petsc-users@mcs.anl.gov>> > Objet : Re: [petsc-users] Problem with snes: petsc 3.4.5 > > > Run with -snes_monitor and -ksp_monitor_true_residual and send the output > >> On Sep 20, 2023, at 9:34 AM, Harry-Arthur Cousin <harry-art...@hotmail.fr >> <mailto:harry-art...@hotmail.fr>> wrote: >> >> Hello, >> >> I'm on petsc version 3.4.5. >> >> My program has a time loop where I have to solve a non-linear system of the >> form F(X) = D*L*J + I + kappa(X) where X is an unknown vector, D and L are >> diagonal square matrices, J is a vector that can be calculated by solving a >> linear system with X and kappa is a non-linear application. I use the >> "-snes_mf" option to, as I understand it, approximate the Jacobian using >> finite differences. >> >> A first version of my problem could be solved, so I made it more complex by >> changing the values of the matrix L, which used to have the same value on >> the whole diagonal and now has values of the same order of magnitude but >> different. This second version takes longer and doesn't converge after a >> while. I get the message: Nonlinear solve did not converge due to >> DIVERGED_LINEAR_SOLVE. However, when I look at the faq >> (https://petsc.org/release/faq/#why-is-newton-s-method-snes-not-converging-or-converges-slowly), >> it indicates that it's probably a Jacobian problem. What should I do? Do I >> have to calculate the explicit Jacobian? The explicit Jacobian requires the >> inversion of a matrix (due to the linear system for solving J). >> >> >> Kind regards, >> >> Harry Cousin