[petsc-users] SNES function domain error

Adrian Croucher a.croucher at auckland.ac.nz
Wed Dec 2 22:09:34 CST 2015


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.)

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