> On May 7, 2023, at 2:22 PM, Edoardo alinovi <[email protected]> wrote: > > Hello Barry, > > Mega! Thank you Berry much for providing me with a working example! I ended > up in writing this: > > call KSPConvergedDefault(ksp, n, rnorm, flag, PETSC_NULL_FUNCTION, > ierr)
This should not work. The argument to KSPConvergedDefault is a context, not a function > if (n<flubioSolvers%itmin) then > flag = 0 > endif > ierr = 0 > > and it looks working but I'll take advantage of your suggestion ;) Is > KSPConvergedDefaultDestroy mandatory? You could pass PETSC_NULL_FUNCTION instead of KSPConvergedDefaultDestroy, but there is no reason to. > > I know it's easy code, but maybe you might have a think to add this control > and expose it as the max number of iterations in KSP. I can tell you it is > very much used, I found myself many times in need to tell the solver to > iterate regardless of the tolerances criteria. It happens for example in the > RANS equation, especially omega. Sometimes they tend to stall and you do want > to tighten the tolerances for a bunch of iters, or you might not know if they > do while iterating! > > Cheers
