<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">"my problem involves nonlinear constraints". Do you mean that you have nonlinear inequality constraints on certain variables (SNESVI only handles bound inequality constraints) so cannot use SNESVI? How do you handle such constraints within SNES then? Is handling them what introduces the discontinuous nature of your SNES?</span></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><br></span></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Barry</span></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><br></span></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><br></span></div><div><span style="font-size: 16px; white-space: break-spaces; color: oklab(0.952331 0.000419 -0.00126); font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: oklab(0.219499 0.002111 -0.007449); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Please do not cross list to both petsc-maint and petsc-users. The questions will be answered the same way if submitted to either list.</span></div><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Aug 24, 2025, at 8:16 PM, Ali ALI AHMAD <ali.ali_ahmad@utt.fr> wrote:</div><br class="Apple-interchange-newline"><div><div><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;" data-attr="forced_root_block_attrs">
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">Hello,</div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">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 style="font-size: 12pt; font-family: arial, helvetica, sans-serif;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">I implemented the residual and also compute the Jacobian analytically.</div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">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;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">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;" data-attr="forced_root_block_attrs"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;" data-attr="forced_root_block_attrs">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;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">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;">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;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">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;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">Thank you very much for your help and suggestions.</div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;"> </div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">Best regards,</div>
<div style="font-size: 12pt; font-family: arial, helvetica, sans-serif;">ALI ALI AHMAD</div>
</div></div></div></blockquote></div><br></body></html>