Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Analyze and enforce numerical stability for time-dependent PDE simulations. Use when selecting time steps, choosing explicit/implicit schemes, diagnosing numerical blow-up, checking CFL/Fourier criteria, von Neumann analysis, matrix conditioning, or detecting stiffness in advection/diffusion/reaction problems.
.claude/skills/numerical-stability/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-05 | ✗→✓ | ▲ Improved | — | — |
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-19 | ✗→✓ | ▲ Improved | — | — |
| case-14 | ✗→✓ | ▲ Improved | — | — |
| case-10 | ✗→✓ | ▲ Improved | — | — |
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 dx| 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.stiff, results.recommendation |
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=1e-3.
Agent workflow:
bash python3 scripts/cfl_checker.py --dx 0.01 --dt 1e-4 --diffusivity 1e-3 --dimensions 2 --json
Fo = 1e-3 × 1e-4 / (0.01)² = 1.0Fo ≤ 0.252.5e-5 (to get Fo = 0.25)cfl_checker.pydt or change schemebash# 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 file not found | 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⁶ | Ill-conditioned | Use scaling/preconditioning |
references/stability_criteria.md - Decision thresholds and formulasreferences/common_pitfalls.md - Frequent failure modes and fixesreferences/scheme_catalog.md - Stability properties of common schemes| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 20 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +36 percentage points is the difference between those two pass rates over the 20 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.