Thanks Matthew, Yes, I will give it a try thid evening.
Thak you very much! On Wed, 29 May 2019, 11:32 Matthew Knepley, <knep...@gmail.com> wrote: > On Wed, May 29, 2019 at 3:07 AM Edoardo alinovi via petsc-users < > petsc-users@mcs.anl.gov> wrote: > >> Dear PETSc friends, >> >> Hope you are doing all well. >> >> I have a quick question for you that I am not able to solve by my self. >> Time to time, while testing new code features, it happens that KSP diverges >> but it does not stop automatically and the iterations continue even after >> getting a NaN. >> > > I think you want > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetErrorIfNotConverged.html > > Thanks, > > Matt > > >> In the KSP setup I use the following instruction to set the divergence >> stopping criteria (div = 10000): >> >> call KSPSetTolerances(myksp, rel_tol, abs_tol, div, itmax, ierr) >> >> But is does not help. Looking into the documentation I have found also: >> >> KSPConvergedDefault >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPConvergedDefault.html#KSPConvergedDefault>(KSP >> >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSP.html#KSP> >> ksp,PetscInt >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscInt.html#PetscInt> >> n,PetscReal >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscReal.html#PetscReal> >> rnorm,KSPConvergedReason >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPConvergedReason.html#KSPConvergedReason> >> *reason,void *ctx) >> >> Which I am not calling in the code. Is this maybe the reason of my >> problem? If yes how can I use KSPConvergedDefault >> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPConvergedDefault.html#KSPConvergedDefault> >> in >> FORTRAN? >> >> Thanks, >> >> Edo >> >> ------ >> >> Edoardo Alinovi, Ph.D. >> >> DICCA, Scuola Politecnica, >> Universita' degli Studi di Genova, >> 1, via Montallegro, >> 16145 Genova, Italy >> >> Email: edoardo.alin...@dicca.unige.it >> Tel: +39 010 353 2540 >> Website: https://www.edoardoalinovi.com/ >> >> >> > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > > https://www.cse.buffalo.edu/~knepley/ > <http://www.cse.buffalo.edu/~knepley/> >