Thank you for making your code available.
While running some simulations with the climate code, I noticed that some of the calls to the PETSc solver returned values of
num_iter = 0, rel_residual = 0
for instance, as printed from vcartsn.cpp, iFcartsn3d.cpp, or ellip.cpp if the debugging string "PETSc" is used. After the PETSc solve, the computations continue, as there is no checking for PETSc error.
After looking through the PETSc documentation, in particular
https://petsc.org/main/docs/manualpages/KSP/KSPConvergedReason/
I added a call to KSPGetConvergedReason() and ran the simulation again. For those instances where I had
num_iter = 0, rel_residual = 0
the value from KSPGetConvergedReason() indicated that the PETSc solver had not converged (see the above URL -- a reason <= 0 indicates non-convergence of the PETSc solver). You may consider adding such checks for non-convergence of the solver, so that this is logged and a suitable action is taken (e.g., stop the simulation or try another solver).
Thank you for making your code available.
While running some simulations with the climate code, I noticed that some of the calls to the PETSc solver returned values of
num_iter = 0, rel_residual = 0
for instance, as printed from vcartsn.cpp, iFcartsn3d.cpp, or ellip.cpp if the debugging string "PETSc" is used. After the PETSc solve, the computations continue, as there is no checking for PETSc error.
After looking through the PETSc documentation, in particular
https://petsc.org/main/docs/manualpages/KSP/KSPConvergedReason/
I added a call to KSPGetConvergedReason() and ran the simulation again. For those instances where I had
num_iter = 0, rel_residual = 0
the value from KSPGetConvergedReason() indicated that the PETSc solver had not converged (see the above URL -- a reason <= 0 indicates non-convergence of the PETSc solver). You may consider adding such checks for non-convergence of the solver, so that this is logged and a suitable action is taken (e.g., stop the simulation or try another solver).