Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
beita6969 avatar

Numerical Stability

  • 16 installs
  • 869 repo stars
  • Updated June 8, 2026
  • beita6969/scienceclaw

numerical-stability is a skill that analyzes and enforces numerical stability for time-dependent PDE simulations using CFL, von Neumann, and conditioning checks.

About

This skill analyzes and enforces numerical stability for time-dependent PDE simulations. A developer checks CFL, Fourier, and reaction criteria, runs von Neumann analysis on custom schemes, checks matrix conditioning, and detects stiffness. It diagnoses numerical blow-up and recommends reducing dt or switching schemes. It matters for keeping explicit and implicit simulations stable and defensible.

  • CFL, Fourier, and reaction stability limits with quick-reference formulas
  • Four scripts: CFL checker, von Neumann analyzer, matrix condition, stiffness detector
  • Diagnoses blow-up and recommends dt or scheme changes

Numerical Stability by the numbers

  • 16 all-time installs (skills.sh)
  • Ranked #1,318 of 2,065 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
At a glance

numerical-stability capabilities & compatibility

Free; needs only Python with NumPy for the analysis scripts.

Capabilities
data analysis · debugging
Use cases
data analysis · debugging
Pricing
Free
From the docs

What numerical-stability says it does

Analyze and enforce numerical stability for time-dependent PDE simulations.
SKILL.md
Provide a repeatable checklist and script-driven checks to keep time-dependent simulations stable and defensible.
SKILL.md
Violation**: Fo = 1.0 > 0.25, unstable!
SKILL.md
npx skills add https://github.com/beita6969/scienceclaw --skill numerical-stability

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs16
repo stars869
Last updatedJune 8, 2026
Repositorybeita6969/scienceclaw

What it does

Check CFL, Fourier, and von Neumann stability and diagnose numerical blow-up in PDE simulations.

Who is it for?

Checking CFL and Fourier limits, running von Neumann analysis, and diagnosing simulation blow-up.

Skip if: Implicit-scheme CFL checks, since implicit schemes are unconditionally stable per the docs.

When should I use this skill?

You are selecting a time step, seeing numerical blow-up, or verifying a scheme's stability.

What you get

The developer gets a stability verdict, a recommended time step, and a diagnosis of any instability.

By the numbers

  • 4 stability analysis scripts
  • 6-item pre-simulation checklist
  • Fourier limit Fo <= 0.5 in 1D

Files

SKILL.mdMarkdownGitHub ↗

Numerical Stability

Goal

Provide a repeatable checklist and script-driven checks to keep time-dependent simulations stable and defensible.

Requirements

  • Python 3.8+
  • NumPy (for matrix_condition.py and von_neumann_analyzer.py)
  • See scripts/requirements.txt for dependencies

Inputs to Gather

InputDescriptionExample
Grid spacing dxSpatial discretization0.01 m
Time step dtTemporal discretization1e-4 s
Velocity vAdvection speed1.0 m/s
Diffusivity DThermal/mass diffusivity1e-5 m²/s
Reaction rate kFirst-order rate constant100 s⁻¹
Dimensions1D, 2D, or 3D2
Scheme typeExplicit or implicitexplicit

Decision Guidance

Choosing Explicit vs Implicit

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

Stability Limit Quick Reference

PhysicsNumberExplicit Limit (1D)Formula
AdvectionCFLC ≤ 1C = v·dt/dx
DiffusionFourierFo ≤ 0.5Fo = D·dt/dx²
ReactionReactionR ≤ 1R = k·dt

Multi-dimensional correction: For d dimensions, diffusion limit is Fo ≤ 1/(2d).

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/cfl_checker.pymetrics.cfl, metrics.fourier, recommended_dt, stable
scripts/von_neumann_analyzer.pyresults.max_amplification, results.stable
scripts/matrix_condition.pyresults.condition_number, results.is_symmetric
scripts/stiffness_detector.pyresults.stiffness_ratio, results.stiff, results.recommendation

Workflow

1. Identify dominant physics (advection vs diffusion vs reaction) 2. Run CFL checker with scripts/cfl_checker.py 3. Compare to limits and adjust dt if needed 4. Check stiffness with scripts/stiffness_detector.py if multiple scales 5. Analyze custom schemes with scripts/von_neumann_analyzer.py 6. Check conditioning with scripts/matrix_condition.py for implicit solves 7. Document the stability verdict and recommended time step

Conversational Workflow Example

User: 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: 1. Check stability criteria:

   python3 scripts/cfl_checker.py --dx 0.01 --dt 1e-4 --diffusivity 1e-3 --dimensions 2 --json

2. Interpret results:

  • Fourier number: Fo = 1e-3 × 1e-4 / (0.01)² = 1.0
  • 2D limit: Fo ≤ 0.25
  • Violation: Fo = 1.0 > 0.25, unstable!

3. Recommend fix:

  • Reduce dt to 2.5e-5 (to get Fo = 0.25)
  • Or increase dx, or switch to implicit

Pre-Simulation Stability Checklist

  • [ ] Identify dominant physics and nondimensional groups
  • [ ] Compute CFL/Fourier/Reaction numbers with cfl_checker.py
  • [ ] If explicit and limit violated, reduce dt or change scheme
  • [ ] If stiffness ratio > 1000, select implicit/stiff integrator
  • [ ] For custom schemes, verify amplification factor ≤ 1
  • [ ] Document stability reasoning with inputs and outputs

CLI Examples

# 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 Handling

ErrorCauseResolution
dx and dt must be positiveZero or negative valuesProvide valid positive numbers
No stability criteria appliedMissing velocity/diffusivityProvide at least one physics parameter
Matrix file not foundInvalid pathCheck matrix file exists
Could not compute eigenvaluesSingular or ill-formed matrixCheck matrix validity

Interpretation Guidance

ScenarioMeaningAction
stable: trueAll checked criteria satisfiedProceed with simulation
stable: falseAt least one limit violatedReduce dt or change scheme
stable: nullNo criteria could be appliedProvide more physics inputs
Stiffness ratio > 1000Problem is stiffUse implicit integrator
Condition number > 10⁶Ill-conditionedUse scaling/preconditioning

Limitations

  • Explicit schemes only for CFL/Fourier checks (implicit is unconditionally stable)
  • Von Neumann analysis assumes linear, constant-coefficient, periodic BCs
  • Stiffness detection requires eigenvalue estimates from user

References

  • references/stability_criteria.md - Decision thresholds and formulas
  • references/common_pitfalls.md - Frequent failure modes and fixes
  • references/scheme_catalog.md - Stability properties of common schemes

Version History

  • v1.1.0 (2024-12-24): Enhanced documentation, decision guidance, examples
  • v1.0.0: Initial release with 4 stability analysis scripts

Related skills

FAQ

What are the explicit stability limits?

CFL C <= 1 for advection, Fourier Fo <= 0.5 for diffusion (1/(2d) in d dimensions), and reaction R <= 1.

When should I switch to an implicit scheme?

When the problem is stiff, for example a stiffness ratio above 1000, or when the CFL/Fourier limit needs an impractically small dt.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.