<div dir="ltr"><div dir="ltr">On Sun, Aug 24, 2025 at 8:16 PM Ali ALI AHMAD <<a href="mailto:ali.ali_ahmad@utt.fr">ali.ali_ahmad@utt.fr</a>> wrote:</div><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Hello,</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I am currently working with PETSc to solve a nonlinear system. My function is piecewise continuous (so it can be discontinuous), and its derivative (Jacobian) is also piecewise continuous.</div></div></blockquote><div><br></div><div>I am not aware of any convergence framework for piecewise continuous functions. They are not technically computable, meaning you could have to compute for a very very long time, and still not get an accurate output (since you have the jump). This also means that the derivative is not computable, and you can have arbitrarily large errors near the discontinuity. I don't see how you could prove convergence here, but maybe someone else knows something I don't.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I implemented the residual and also compute the Jacobian analytically.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">When the discontinuities are small, both Inexact Newton and NewtonTR (with scaled Newton direction) converge without problem.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">However, for test cases with larger discontinuities, sometimes the solver converges, but in other cases it fails to converge.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I initially tried <vinewtonssls,vinewtonrsls> , but I cannot use them in my case, because my problem involves nonlinear constraints.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">So my question is: how does PETSc handle such situations internally (piecewise continuous objective/residual functions)?</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">And is there a recommended strategy within PETSc to deal with nonlinear solvers when and are discontinuous?</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">I would like to continue working with PETSc and I am looking for a robust method to treat this type of problem.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Thank you very much for your help and suggestions.</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"> </div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Best regards,</div>
<div style="font-size:12pt;font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">ALI ALI AHMAD</div>
</div></blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!Yg82hvg9sA6Ah-__bPQ_4r_664JidfkOdAY-N29Pk73B45u5wi_E81N7EdOpAQF40CXZXuaKdfFg1YI-V58r$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>