Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/underworld3/systems/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2318,6 +2318,30 @@ def _apply_automatic_penalty(self):
# Assigned through the expression, so the latch is untouched and the
# value stays automatic.

def _record_pc_fallback(self, site, *, requested, installed, reason, detail=""):
"""Record one preconditioner fallback / degrade / guard-skip decision.

This mirrors the generic SNES fallback recorder for Python-side Stokes
preconditioner checks. The record is written explicitly rather than
inferred from PETSc options or timings.
"""
if not hasattr(self, "_pc_fallbacks"):
self._pc_fallbacks = {}

self._pc_fallbacks[site] = dict(
requested=requested,
installed=installed,
reason=reason,
detail=detail,
)

@property
def pc_fallbacks(self):
"""Preconditioner fallback records for the current solver state."""
if not hasattr(self, "_pc_fallbacks"):
self._pc_fallbacks = {}
return self._pc_fallbacks

def _check_velocity_preconditioner(self):
"""After setup: did the velocity block fall back off the multigrid?

Expand Down
Loading