OpenClaw-Medical-Skills numerical-integration
Select and configure time integration methods for ODE/PDE simulations. Use when choosing explicit/implicit schemes, setting error tolerances, adapting time steps, diagnosing integration accuracy, planning IMEX splitting, or handling stiff/non-stiff coupled systems.
install
source · Clone the upstream repo
git clone https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/numerical-integration" ~/.claude/skills/freedomintelligence-openclaw-medical-skills-numerical-integration && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/FreedomIntelligence/OpenClaw-Medical-Skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/numerical-integration" ~/.openclaw/skills/freedomintelligence-openclaw-medical-skills-numerical-integration && rm -rf "$T"
manifest:
skills/numerical-integration/SKILL.mdsource content
Numerical Integration
Goal
Provide a reliable workflow to select integrators, set tolerances, and manage adaptive time stepping for time-dependent simulations.
Requirements
- Python 3.8+
- NumPy (for some scripts)
- No heavy dependencies for core functionality
Inputs to Gather
| Input | Description | Example |
|---|---|---|
| Problem type | ODE/PDE, stiff/non-stiff | |
| Jacobian available | Can compute ∂f/∂u? | |
| Target accuracy | Desired error level | |
| Constraints | Memory, implicit allowed? | |
| Time scale | Characteristic time | |
Decision Guidance
Choosing an Integrator
Is the problem stiff? ├── YES → Is Jacobian available? │ ├── YES → Use Rosenbrock or BDF │ └── NO → Use BDF with numerical Jacobian └── NO → Is high accuracy needed? ├── YES → Use RK45 or DOP853 └── NO → Use RK4 or Adams-Bashforth
Stiff vs Non-Stiff Detection
| Symptom | Likely Stiff | Action |
|---|---|---|
| dt shrinks to tiny values | Yes | Switch to implicit |
| Eigenvalues span many decades | Yes | Use BDF/Radau |
| Smooth solution, reasonable dt | No | Stay explicit |
Script Outputs (JSON Fields)
| Script | Key Outputs |
|---|---|
| , , |
| , , |
| , , |
| , , |
| , |
Workflow
- Classify stiffness - Check eigenvalue spread or use stiffness_detector
- Choose tolerances - See
references/tolerance_guidelines.md - Select integrator - Run
scripts/integrator_selector.py - Compute error norms - Use
for step acceptancescripts/error_norm.py - Adapt step size - Use
scripts/adaptive_step_controller.py - Plan IMEX/splitting - If mixed stiff/nonstiff, use
scripts/imex_split_planner.py - Validate convergence - Repeat with tighter tolerances
Conversational Workflow Example
User: I'm solving the Allen-Cahn equation with a stiff double-well potential. What integrator should I use?
Agent workflow:
- Check integrator options:
python3 scripts/integrator_selector.py --stiff --jacobian-available --accuracy high --json - Plan the IMEX splitting (diffusion implicit, reaction explicit):
python3 scripts/imex_split_planner.py --stiff-terms diffusion --nonstiff-terms reaction --coupling weak --json - Recommend: Use IMEX-BDF2 with diffusion term implicit, double-well reaction explicit.
Pre-Integration Checklist
- Identify stiffness and dominant time scales
- Set
/rtol
consistent with physics and unitsatol - Confirm integrator compatibility with stiffness
- Use error norm to accept/reject steps
- Verify convergence with tighter tolerance run
CLI Examples
# Select integrator for stiff problem with Jacobian python3 scripts/integrator_selector.py --stiff --jacobian-available --accuracy high --json # Compute scaled error norm python3 scripts/error_norm.py --error 0.01,0.02 --solution 1.0,2.0 --rtol 1e-3 --atol 1e-6 --json # Adaptive step control with PI controller python3 scripts/adaptive_step_controller.py --dt 1e-2 --error-norm 0.8 --order 4 --controller pi --json # Plan IMEX splitting python3 scripts/imex_split_planner.py --stiff-terms diffusion,elastic --nonstiff-terms reaction --coupling strong --json # Estimate splitting error python3 scripts/splitting_error_estimator.py --dt 1e-4 --scheme strang --commutator-norm 50 --target-error 1e-6 --json
Error Handling
| Error | Cause | Resolution |
|---|---|---|
| Invalid tolerances | Use positive values |
| Negative error norm | Check error computation |
| Invalid controller type | Use , , or |
| Empty term list | Specify stiff or nonstiff terms |
Interpretation Guidance
Error Norm Values
| Error Norm | Meaning | Action |
|---|---|---|
| < 1.0 | Step acceptable | Accept, maybe increase dt |
| ≈ 1.0 | At tolerance boundary | Accept with current dt |
| > 1.0 | Step rejected | Reject, reduce dt |
Controller Selection
| Controller | Properties | Best For |
|---|---|---|
| I (integral) | Simple, some overshoot | Non-stiff, moderate accuracy |
| PI (proportional-integral) | Smooth, robust | General use |
| PID | Aggressive adaptation | Rapidly varying dynamics |
IMEX Strategy
| Coupling | Strategy |
|---|---|
| Weak | Simple operator splitting |
| Moderate | Strang splitting |
| Strong | Fully coupled IMEX-RK |
Limitations
- No automatic stiffness detection: Use stiffness_detector from numerical-stability
- Splitting assumes separability: Terms must be cleanly separable
- Jacobian requirement: Some methods need analytical or numerical Jacobian
References
- Integrator options and propertiesreferences/method_catalog.md
- Choosing rtol/atolreferences/tolerance_guidelines.md
- Error norm and adaptation formulasreferences/error_control.md
- Stiff/non-stiff splittingreferences/imex_guidelines.md
- Operator splitting patternsreferences/splitting_catalog.md
- Phase-field specific splitsreferences/multiphase_field_patterns.md
Version History
- v1.1.0 (2024-12-24): Enhanced documentation, decision guidance, examples
- v1.0.0: Initial release with 5 integration scripts