[petsc-users] how to exit in SNES iteration

Jed Brown jed at jedbrown.org
Fri Jun 29 10:24:51 CDT 2018


See SNESSetFunctionDomainError()

"WANG, LEI" <lei.wang at durham.ac.uk> writes:

> Dear all
>
> I am writing a code for nonlinear mechanical problem with SNES. The code often stops inside of the iterations when computing the Jacobian or Function. I would like to force the code exit once some abnormal value appears, but do not know what function to use? I have tried to set the residual norm to a large value, iteration number to a large value, but seems those not work. What should I write in 'if(abnormal) ???' for exiting SNES iteration in the functions FormJacobian or FormFunction?
>
> Cheers
> Lei


More information about the petsc-users mailing list