[petsc-users] how to exit in SNES iteration

WANG, LEI lei.wang at durham.ac.uk
Fri Jun 29 10:49:03 CDT 2018


This is just what I need. Thanks, Jed.

Cheers
Lei

-----Original Message-----
From: Jed Brown [mailto:jed at jedbrown.org] 
Sent: 29 June 2018 16:25
To: WANG, LEI; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] how to exit in SNES iteration

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