Fix converged_reason flag for BNK (BNTR and BNLS)
The -ksp_converged_reason
flag was broken when used with TAO's BNK solvers. In BNK, KSPReset
was used before the linear solve to allow operators to change dimension between nonlinear iterations. However, KSPReset
removes all viewers from the KSP object, so -ksp_converged_reason
is not respected. This fix calls KSPResetFromOptions
after KSPReset
to reinitialize all viewers. This fixes -ksp_converged_reason
, but does mean that file viewers will only contain results from the last nonlinear iteration. Is this the behavior we want? Should we instead have a KSPResetState
that resets all state in the KSP object, but not the viewers? Or should KSPReset
not reset viewers at all?
I've also added a test to verify that -ksp_converged_reason
is being respected. Oddly, this flag seems to slightly change the output from -ksp_monitor
.