<html><body><div style="font-size: 12pt; font-family: arial, helvetica, sans-serif; direction: null; color: #000000;" data-attr="forced_root_block_attrs">
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">Hello,</div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">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; color: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">I implemented the residual and also compute the Jacobian analytically.</div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">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: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">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: #000000;" data-attr="forced_root_block_attrs"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;" 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; color: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">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: #000000;">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: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">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: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">Thank you very much for your help and suggestions.</div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;"> </div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">Best regards,</div>
<div style="font-size: 12pt; font-family: 'arial' , 'helvetica' , sans-serif; color: #000000;">ALI ALI AHMAD</div>
</div></body></html>