Stateful policy for the solver fallback chain.
When the leading stand-alone multigrid (GMG) entry of a chain such as gmg gmres fails, the chain falls back to the Krylov solver. Without memory the next solve pays a full failed GMG attempt again, which is wasteful when the failure is persistent (e.g. a fixed, hard field operator). This policy latches onto the Krylov fallback after a GMG failure and only re-probes GMG every retryInterval solves, reclaiming multigrid's speed whenever the problem becomes tractable again. retryInterval == 1 reproduces the memoryless "always retry GMG first" behaviour; a large value approaches a permanent latch. Optionally, reprobeIters arms an adaptive early re-probe: if the Krylov fallback converges in very few iterations the preconditioner is clearly strong, so GMG alone is likely to succeed and is re-probed on the next solve without waiting for retryInterval.
- Note
- The state is deliberately decoupled from regridding: hold an instance as a host-solver member and do not reset it when the operators are rebuilt (regrids may be far more frequent than the desired re-probe cadence). The counter advances per solve, so the re-probe cadence is measured in solves, not necessarily time steps.
| int EllipticSolverChain::FallbackPolicy::startIndex |
( |
const Vector< SolverType > & |
a_solvers | ) |
|
|
inline |
Start index into a_solvers for this solve, advancing the re-probe counter. Call exactly once per solve.
Returns 0 (include the leading GMG) when unlatched, when the periodic re-probe is due, or when an adaptive early re-probe was armed by a cheap Krylov solve; otherwise returns the index of the first non-GMG solver so the persistently-failing GMG attempt is skipped.
- Parameters
-
| [in] | a_solvers | The configured fallback chain. |
- Returns
- Start index into a_solvers.