<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> Run with -snes_monitor and -ksp_monitor_true_residual and send the output<br><div><br><blockquote type="cite"><div>On Sep 20, 2023, at 9:34 AM, Harry-Arthur Cousin <harry-arthur@hotmail.fr> wrote:</div><br class="Apple-interchange-newline"><div><div class="elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Hello,</div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><br></div><div class="elementToProof ContentPasted2" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">I'm on petsc version 3.4.5.</div><div class="elementToProof ContentPasted2" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof ContentPasted2" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">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.</div><div class="elementToProof ContentPasted2" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof ContentPasted2 ContentPasted4" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">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 (<a href="https://petsc.org/release/faq/#why-is-newton-s-method-snes-not-converging-or-converges-slowly" id="OWA7cfcfa0e-3abb-28b3-fcae-b62d0e24f88b" class="OWAAutoLink ContentPasted3">https://petsc.org/release/faq/#why-is-newton-s-method-snes-not-converging-or-converges-slowly</a>), 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).</div><div class="elementToProof ContentPasted2 ContentPasted4 ContentPasted5 ContentPasted7" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof ContentPasted2 ContentPasted4 ContentPasted5" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof ContentPasted2 ContentPasted4 ContentPasted5 ContentPasted6" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Kind regards,</div><div class="elementToProof ContentPasted2 ContentPasted4 ContentPasted5 ContentPasted6" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;"><br></div><div class="elementToProof ContentPasted2 ContentPasted4 ContentPasted5" style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;">Harry Cousin</div></div></blockquote></div><br></body></html>