/simulacion-numerica:numerical-stabilityfrom Simulación numérica
Analyzes numerical stability for time-dependent PDE simulations by checking CFL and Fourier criteria, performing von Neumann stability analysis, detecting stiffness, evaluating matrix conditioning, and recommending explicit vs implicit time-stepping schemes.
Ships in Simulación numérica. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Provide a repeatable checklist and script-driven checks to keep time-dependent simulations stable and defensible.
scripts/requirements.txt for dependencies| Input | Description | Example |
|---|---|---|
Grid spacing dx | Spatial discretization | 0.01 m |
Time step dt | Temporal discretization | 1e-4 s |
Velocity v | Advection speed | 1.0 m/s |
Diffusivity D | Thermal/mass diffusivity | 1e-5 m²/s |
Reaction rate k | First-order rate constant | 100 s⁻¹ |
| Dimensions | 1D, 2D, or 3D | 2 |
| Scheme type | Explicit or implicit | explicit |
Is the problem stiff (fast + slow dynamics)?
├── YES → Use implicit or IMEX scheme
│ └── Check conditioning with matrix_condition.py
└── NO → Is CFL/Fourier satisfied with reasonable dt?
├── YES → Use explicit scheme (cheaper per step)
└── NO → Consider implicit or reduce dt (grid refinement requires a coupled timestep reduction)
| Physics | Number | Explicit Limit (1D) | Formula |
|---|---|---|---|
| Advection | CFL | C ≤ 1 | C = v·dt/dx |
| Diffusion | Fourier | Fo ≤ 0.5 | Fo = D·dt/dx² |
| Reaction | Reaction | R ≤ 1 | R = k·dt |
Multi-dimensional correction: For d dimensions, diffusion limit is Fo ≤ 1/(2d).
| Script | Key Outputs |
|---|---|
scripts/cfl_checker.py | metrics.cfl, metrics.fourier, recommended_dt, stable |
scripts/von_neumann_analyzer.py | results.max_amplification, results.stable |
scripts/matrix_condition.py | results.condition_number, results.is_symmetric |
scripts/stiffness_detector.py | results.stiffness_ratio, results.real_part_stiffness_ratio, results.imag_dominated, results.stiff, results.recommendation, results.warning |
scripts/cfl_checker.pydt if neededscripts/stiffness_detector.py if multiple scalesscripts/von_neumann_analyzer.pyscripts/matrix_condition.py for implicit solvesUser: My phase-field simulation is blowing up after 100 steps. I'm using explicit Euler with dx=0.01, dt=1e-4, and diffusivity D=1.0.
Agent workflow:
python3 scripts/cfl_checker.py --dx 0.01 --dt 1e-4 --diffusivity 1.0 --dimensions 2 --json
Fo = 1.0 × 1e-4 / (0.01)² = 1.0Fo ≤ 0.252.5e-5 (the tool's recommended_dt, giving Fo = 0.25)cfl_checker.pydt or change scheme# Check CFL/Fourier for 2D diffusion-advection
python3 scripts/cfl_checker.py --dx 0.1 --dt 0.01 --velocity 1.0 --diffusivity 0.1 --dimensions 2 --json
# Von Neumann analysis for custom 3-point stencil
python3 scripts/von_neumann_analyzer.py --coeffs 0.2,0.6,0.2 --dx 1.0 --nk 128 --json
# Detect stiffness from eigenvalue estimates
python3 scripts/stiffness_detector.py --eigs=-1,-1000 --json
# Check matrix conditioning for implicit system
python3 scripts/matrix_condition.py --matrix A.npy --norm 2 --json
| Error | Cause | Resolution |
|---|---|---|
dx and dt must be positive | Zero or negative values | Provide valid positive numbers |
No stability criteria applied | Missing velocity/diffusivity | Provide at least one physics parameter |
Matrix not found: <path> | Invalid path | Check matrix file exists |
Could not compute eigenvalues | Singular or ill-formed matrix | Check matrix validity |
| Scenario | Meaning | Action |
|---|---|---|
stable: true | All checked criteria satisfied | Proceed with simulation |
stable: false | At least one limit violated | Reduce dt or change scheme |
stable: null | No criteria could be applied | Provide more physics inputs |
| Stiffness ratio > 1000 | Problem is stiff | Use implicit integrator |
| Condition number > 10⁸ | Poorly-conditioned (status: poorly-conditioned) | Preconditioning likely needed |
| Condition number > 10¹⁰ | Ill-conditioned (status: ill-conditioned) | Use scaling/preconditioning |
Conditioning thresholds assume IEEE double precision: solving loses roughly
log10(κ)significant digits, and a matrix becomes numerically singular nearκ ≈ 1/eps ≈ 4.5e15. The> 10⁸/> 10¹⁰cutoffs (matchingmatrix_condition.pystatus) leave ample margin; well-conditioned-for-double FEM matrices (κ up to ~10⁶–10⁷) reportstatus: ok.
Do not declare a scheme/time step "stable" until each applicable item below is satisfied with a recorded value from the scripts, not a mental estimate.
cfl_checker.py --json and recorded metrics.cfl, metrics.fourier, and/or metrics.reaction against the reported limits.* (explicit defaults: CFL ≤ 1, Fo ≤ 1/(2d), R ≤ 1), with stable: true and the intended criteria present in criteria_applied.criteria_applied is non-empty and stable is not null — i.e. at least one physics parameter (--velocity/--diffusivity/--reaction-rate) was actually supplied so a real check ran, not a silent no-op.--dx (anisotropic grids: smallest dx/dy/dz) and re-ran cfl_checker.py after any mesh refinement, since Fo ∝ dt/dx² makes the limit highly sensitive to dx.dt is below the limit, recorded the tool's recommended_dt (and the --safety factor used) so the margin to the stability boundary is explicit and reproducible.von_neumann_analyzer.py --json and confirmed results.max_amplification ≤ 1 (stable: true); noted k_at_max and resolved any even-length-stencil warning.stiffness_detector.py --json and recorded real_part_stiffness_ratio, imag_dominated, and stiff; only chose BDF/Radau when stiff: true on the real-part ratio (not on magnitude alone) and there is no warning.matrix_condition.py --json and recorded condition_number and status; treated poorly-conditioned (>1e8) / ill-conditioned (>1e10) as a flag to scale/precondition before trusting the solve.| Tempting shortcut | Why it's wrong / what to do |
|---|---|
"Implicit scheme, so any dt is fine." | Unconditional stability is not accuracy. cfl_checker.py reports stable: true with relaxed (infinite) limits for --scheme implicit and even adds a note to "check accuracy" — a large dt still ruins temporal error. Size dt for accuracy, not just stability. |
| "It ran 100 steps without crashing, so the setup is stable." | Late-time blow-up from round-off, conservation loss, or marginal Fo is common. Completion ≠ correctness — record metrics.fourier/metrics.cfl vs limits.* and confirm stable: true before trusting the run. |
"The 1D Fourier limit is 0.5, so Fo ≤ 0.5 is safe." | The explicit diffusion limit is Fo ≤ 1/(2d) — 0.25 in 2D, 0.167 in 3D. Pass the real --dimensions; cfl_checker.py tightens diffusion_limit automatically, and using 0.5 in 2D/3D is an instability. |
| "Stiffness ratio is huge, so use BDF/Radau." | The magnitude stiffness_ratio is misleading for oscillatory/advective/Hamiltonian spectra. Check imag_dominated and real_part_stiffness_ratio: if imag_dominated: true the detector returns stiff: false with a warning — prefer symplectic/leapfrog or a CFL-sized A-stable scheme, not implicit stiff solvers. |
"I tightened dt, so the old mesh's dt still works after refining dx." | Fo ∝ dt/dx²: halving dx quadruples Fo. Reusing a pre-refinement dt reintroduces a violation. Recompute with cfl_checker.py after every mesh change. |
| "The matrix solved, so its conditioning is fine." | A solve can return numbers while silently losing ~log10(κ) digits. Record condition_number/status from matrix_condition.py; poorly-conditioned/ill-conditioned means scale or precondition before trusting the result. |
dx, dt, and safety are validated as finite positive numbers before any computation; velocity, diffusivity, and reaction_rate, when supplied, are validated as finite--dimensions is restricted to {1, 2, 3} (cfl_checker.py raises and exits 2 otherwise)--eigs) are capped at 10,000 entries and validated as finite numbers--coeffs) are capped at 10,000 entries and validated as finite floatsmatrix_condition.py reads a single matrix file (.npy or text) specified by --matrix; no directory traversal beyond the given pathnp.load() is called with allow_pickle=False to prevent arbitrary code execution via crafted .npy files (matrix_condition.py, stiffness_detector.py)cfl_checker.py, von_neumann_analyzer.py, matrix_condition.py, stiffness_detector.py) with explicit argument listseval(), exec(), or dynamic code generationshell=True)--json) produces structured, parseable results without shell-interpretable contentstiff verdict is based on scale separation among genuinely decaying modes (Re(λ) < 0); the magnitude ratio is still reported as stiffness_ratio. Imaginary-axis-dominated spectra (oscillatory/advection/Hamiltonian) are flagged via imag_dominated and a warning, and are NOT classified as stiff — for those, prefer symplectic/leapfrog or an A-stable scheme sized by the CFL limit, not BDF/Radau.references/stability_criteria.md - Decision thresholds and formulasreferences/common_pitfalls.md - Frequent failure modes and fixesreferences/scheme_catalog.md - Stability properties of common schemesv1.2.3 (2026-10-19): Use a combined explicit stability budget, reject nonfinite inputs, and serialize undefined diagnostics explicitly.
v1.2.2 (2026-06-24): Added a "Verification checklist" (7 evidence-based items tied to the four scripts' JSON outputs) and a "Common pitfalls & rationalizations" table (6 rows) to make stability verdicts reproducible and guard against false-confidence shortcuts
v1.2.0 (2026-06-23): Corrected the phase-field worked example (genuinely unstable Fo=1.0 with D=1.0); fixed eval case 1 Fourier value; reconciled conditioning thresholds and error-message docs with the scripts; real-part-based stiffness classification with imaginary-dominated detection; enforced documented input/file-size/dimension safeguards
v1.1.0 (2024-12-24): Enhanced documentation, decision guidance, examples
v1.0.0: Initial release with 4 stability analysis scripts
The explicit checker assumes forward Euler, upwind advection, uniform Cartesian centered diffusion, and linear decay. For an unsplit update it tests the sum of normalized component loads, not separate conditions alone. The scalar velocity must represent the total absolute directional speed for multidimensional advection. The default reaction bound ensures positivity and is conservative relative to absolute stability. Custom limits require a separately justified component discretization. Negative diffusion/growth and unspecified implicit integrators return no certificate. Refining dx requires reducing dt.
For final explanations, read component_checks and scientific_interpretation.
Do not confuse a combined failure with an individual-limit failure: C=0.4 and
Fo=0.32 each satisfy their separate limits (1 and 0.5), while C+2Fo=1.04 fails
the combined monotonicity bound. 0.32 is less than 0.5.
For a final report that does not introduce model-generated arithmetic claims,
use the deterministic explanation renderer
with trusted, input-verified tool JSON. Unsupported or missing evidence must
remain unresolved.
CHANGELOG.md (opens in a new tab)evals/evals.json (opens in a new tab)evals/files/fem_stiffness_spd.npy (opens in a new tab)references/common_pitfalls.md (opens in a new tab)references/scheme_catalog.md (opens in a new tab)references/stability_criteria.md (opens in a new tab)scripts/cfl_checker.py (opens in a new tab)scripts/matrix_condition.py (opens in a new tab)scripts/requirements.txt (opens in a new tab)scripts/stiffness_detector.py (opens in a new tab)scripts/von_neumann_analyzer.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
17 skills in this plugin
/benchmark-and-mms-plannerPlan verification and validation campaigns for simulation codes using manufactured solutions, canonical benchmark problems, grid/time refinement, uncertainty propagation, and pass/fail acceptance criteria. Use when an agent needs to prove a solver, model, or result is trustworthy rather than only plausible.
/convergence-studyPerform spatial and temporal convergence analysis for solution verification — compute observed convergence orders from grid or timestep refinement studies, apply Richardson extrapolation to estimate discretization error, and calculate the Grid Convergence Index (GCI) per ASME V&V 20 standards. Use when verifying that a numerical solution converges at the expected rate, estimating the error on the finest mesh, checking whether grids are in the asymptotic range, or preparing formal verification reports, even if the user only asks "is my mesh fine enough" or "how accurate is my solution."
/differentiation-schemesSelect and apply numerical differentiation schemes for PDE and ODE discretization — generate finite-difference stencils at arbitrary order and accuracy, choose between central, upwind, compact (Pade), and spectral methods, handle boundary stencils, and estimate truncation error scaling. Use when discretizing spatial derivatives, picking a scheme for advection- or diffusion-dominated problems, building custom stencils for nonstandard operators, or comparing dispersion and dissipation properties of candidate schemes, even if the user just says "how do I approximate this derivative" or "my solution is too diffusive."
/linear-solversSelect and configure linear solvers for Ax=b systems arising in numerical simulations — choose between direct (LU, Cholesky) and iterative (CG, GMRES, BiCGSTAB, MINRES) methods, analyze sparsity patterns and matrix conditioning, recommend preconditioners (AMG, ILU, IC), apply row/column scaling, and diagnose convergence stagnation from residual histories. Use when setting up a linear solve for FEM/FVM assembly, debugging slow or stalled Krylov iterations, choosing a preconditioner for SPD or nonsymmetric systems, or investigating ill-conditioning, even if the user only says "my solver is slow" or "GMRES won't converge."
/md-analysis-plannerPlan molecular dynamics post-processing for materials simulations, including RDF, MSD and diffusion, VACF/VDOS, coordination numbers, bond-angle distributions, stress-strain curves, equilibration detection, PBC unwrapping, and trajectory format choices. Use before writing MD analysis scripts or trusting trajectory-derived results.
/mesh-generationPlan and evaluate mesh generation for numerical simulations — estimate grid resolution from physics scales (interface width, boundary layers, wavelengths), check aspect ratios and skewness against quality thresholds, choose between structured, unstructured, and adaptive mesh refinement strategies, and compute grid sizing for 1D/2D/3D domains. Use when setting up a new mesh, diagnosing poor solver convergence caused by mesh quality, deciding how many points to place across a phase-field interface or boundary layer, or preparing a mesh convergence study, even if the user only asks "what resolution do I need" or "why is my solver failing."
2 plugins ship this exact skill · first indexed Oct 22, 2026
npx claudepluginhub lagzgabrielmuller-dot/kit-ingenieria-3d --plugin simulacion-numericaOther plugins' skills for the same job