Numerical instabilities that arise during PDE simulationsare commonly handled by ad-hoc corrective logic embedded directly insidesolver code. This approach couples detection, intervention, and validationconcerns to the numerical integration logic, producing brittle,hard-to-maintain implementations that resist systematic comparison ofalternative correction strategies.This paper introduces the Algorithmic Surgery Protocol (ASP), a softwarearchitectural pattern that treats instability events as first-class computationalevents. ASP wraps an existing PDE solver with a thin externalcontrol layer implementing a structured five-stage protocol: detection,halt, surgery, validation, and resume. The solver remains unmodified andunaware of any intervention; all corrective action is applied externallythrough a well-defined interface.The pattern is solver-agnostic and surgery-agnostic: the correction strategyis a pluggable component that can range from simple field smoothingto full mesh reconnection, depending on the application. A minimal referenceimplementation is provided to demonstrate the architecture on aconcrete PDE system exhibiting spontaneous numerical instability.
Sergey Petrov (Sun,) studied this question.