[petsc-users] SNES function domain error

Barry Smith bsmith at mcs.anl.gov
Wed Dec 2 23:43:41 CST 2015


  Set the -snes_stol to be so small that it doesn't trigger this reason?

  We are working on improving the "failure" modes of KSP/SNES so hopefully we'll have a better handle this type of thing in a few months.

 

> On Dec 2, 2015, at 10:09 PM, Adrian Croucher <a.croucher at auckland.ac.nz> wrote:
> 
> hi
> 
> I am trying to use SNESSetFunctionDomainError() to make SNES abort when my solution vector goes out of the function domain. However, it's not always working.
> 
> Specifically, I check the solution in a function called after the linesearch (set using SNESLineSearchSetPostCheck()). If it has gone out of the function domain I call SNESSetFunctionDomainError(). (I also check for phase changes at this point and do variable switching if necessary, which seems to work fine as long as I only use SNESLINESEARCHBASIC.)

   I absolutely do NOT recommend doing variable switching with SNES. Our Newton solvers are not designed with variable switching in mind so you get these absurd limitations like needing SNESLINESEARCHBASIC

   It would be great if someone who understood variable switching would either 1) contribute a Newton that supports variable switching to PETSc or 2) enhance the current SNESSolve_NewtonLS to support variable switching (I don't know which is easier).

  Barry

> 
> This causes the linesearch reason to return SNES_LINESEARCH_FAILED_DOMAIN.
> 
> In SNESSolve_NEWTONLS() (ls.c:251) it checks the linesearch reason, but then also checks if (snes->stol*xnorm > ynorm). If that is true then it resets the snes->reason to SNES_CONVERGED_SNORM_RELATIVE and returns, i.e. it overrides the function domain error. So it thinks everything is fine, even though the 'converged' solution is out of the function domain.
> 
> Is this how it's meant to work? If so, what can I do to ensure the SNES always aborts if the solution goes out of the function domain? At present it's only working if (snes->stol*xnorm <= ynorm) as well.
> 
> Cheers, Adrian
> 
> -- 
> Dr Adrian Croucher
> Senior Research Fellow
> Department of Engineering Science
> University of Auckland, New Zealand
> email: a.croucher at auckland.ac.nz
> tel: +64 (0)9 923 84611
> 



More information about the petsc-users mailing list