phipict.SolverTolerance
- class phipict.SolverTolerance(rtol: float | None = None, atol: float | None = None)[source]
A tolerance specified relative to the right-hand side.
- Parameters:
rtol (float or None) – Relative residual target. The resolved absolute tolerance is
rtol * ||b||_2 / sqrt(n), which makes the solver’s stop test equivalent to||r||_2 < rtol * ||b||_2.atol (float or None) – Absolute floor, in the same RMS units as the solver criterion. Prevents over-solving when the RHS is (near) zero, e.g. the electric potential equation at rest, where
u x e_bis uniform and its divergence vanishes. At least one ofrtol/atolmust be given.
Notes
The resolved tolerance is additionally floored at
PRECISION_FLOOR_FACTOR * eps * ||b||_2 / sqrt(n), below which the solver can only stagnate.Methods
__init__([rtol, atol])resolve(rhs)Return the absolute tolerance to hand to the solver for this RHS.
resolve_batched(rhs, batch_size)Resolve the tolerance separately for every batched environment.
Attributes
atolrtol