I forgot something, you can also use ``SNESLineSearchSetPreCheck()`` and 
``SNESLineSearchSetPostCheck()`` to control properties
of the steps selected by `SNES`.



> On Jun 27, 2022, at 8:23 AM, Merson, Jacob Simon <[email protected]> wrote:
> 
> Wonderful thank you! This is exactly what I was looking for. 
> 
> —
> Jacob Merson
> 
>> On Jun 27, 2022, at 6:17 AM, Barry Smith <[email protected]> wrote:
>> 
>> 
>> You would call SNESSetFunctionDomainError() or SNESSetJacobianDomainError() 
>> from within your function or Jacobian evaluation and then return from the 
>> function. This notifies SNES that the step it attempted is not acceptable to 
>> your functions.
>> 
>> SNES may not be able to recover from its bad step. The simplest attempt to 
>> recover is to have SNES try a shorter step. If the bad steps come from, for 
>> example, negative pressures or other non-physical locations of the step you 
>> can try using SNESVISetVariableBounds()  and friends to tell SNES what steps 
>> to avoid.
>> 
>>  If you have particular cases where SNES cannot recover and you can share 
>> your code we can investigate improving the handling of this feature in SNES. 
>> 
>> Barry
>> 
>>> On Jun 27, 2022, at 1:20 AM, Merson, Jacob Simon <[email protected]> wrote:
>>> 
>>> Hi All,
>>> 
>>> I’m attempting to use the SNES solver with the finite element method. When 
>>> I use the trust region or line search algorithms I’m not currently running 
>>> into any problems and the solution matches a hand-coded newton solver. 
>>> However, when I use other methods like quasi-newton, or 
>>> newton-conjugate-graduent I end up with a guess that makes the element 
>>> Jacobian negative causing issues with the residual (and Jacobian) 
>>> evaluation.
>>> 
>>> For this circumstance is it possible to set an error code that specifies 
>>> that the function evaluation has failed and have SNES try a different step?
>>> 
>>> 
>>> Thanks for the help!
>>> Jacob
>> 

Reply via email to