Is there already an implemented approach to do something similar with SNESMonitorSet() when using SNESSolve()? I want to avoid writing such monitors within the residual function as I am using quasi-Newton methods which evaluate the residual multiple times per iteration.
I wonder if a solution similar to the TS approach might introduce conflicts here since the current implementation already uses SNESConvergenceTest()?
Ok, but wouldn’t a naive copy of the TS monitor logic introduce an issue here, since the custom convergence monitor is linked to the syntax monitor = …? Are there any examples I can test with that use a custom convergence test?
That’s a good point. I’m not sure why the current code use the variable name monitor for something else that… setting a custom monitor. There should be a new named parameter, so then it would be possible to have both a custom monitor and convergence test.
OK. I’ll draft a PR that repurposes monitor = ... for its stated purpose and adds a new optional parameter convergence = ... to support custom convergence tests. This will obviously break anything that uses custom SNES convergence monitors through the existing interface, however.