Select and apply numerical differentiation schemes for PDE/ODE discretization. Use when choosing finite difference/volume/spectral schemes, building stencils, handling boundaries, estimating truncation error, or analyzing dispersion and dissipation.
name: differentiation-schemes
description: Select and apply numerical differentiation schemes for PDE/ODE discretization. Use when choosing finite difference/volume/spectral schemes, building stencils, handling boundaries, estimating truncation error, or analyzing dispersion and dissipation.
allowed-tools: Read, Bash, Write, Grep, Glob
Differentiation Schemes
Goal
Provide a reliable workflow to select a differentiation scheme, generate stencils, and assess accuracy for simulation discretization.
Requirements
Python 3.8+
NumPy (for stencil computations)
No heavy dependencies
Inputs to Gather
Input
Description
Example
Derivative order
First, second, etc.
1 or 2
Target accuracy
Order of truncation error
2 or 4
Grid type
Uniform, nonuniform
uniform
Boundary type
Periodic, Dirichlet, Neumann
periodic
Smoothness
Smooth or discontinuous
smooth
Decision Guidance
Scheme Selection Flowchart
Is the field smooth?
├── YES → Is domain periodic?
│ ├── YES → Use central differences or spectral
│ └── NO → Use central interior + one-sided at boundaries
└── NO → Are there shocks/discontinuities?
├── YES → Use upwind, TVD, or WENO
└── NO → Use central with limiters