238 lines
8.5 KiB
Markdown
238 lines
8.5 KiB
Markdown
# Feature File Templates
|
|
|
|
This document contains brief summaries for features 6-38. Detailed feature files should be created when you're ready to implement each one, using the detailed examples in features 01-05 and 12 as templates.
|
|
|
|
## How to Use This Document
|
|
|
|
When ready to implement a feature:
|
|
1. Copy the template structure from features/01-bs3-method.md or similar
|
|
2. Fill in the details from the summary below
|
|
3. Add implementation-specific details
|
|
4. Create comprehensive testing requirements
|
|
|
|
---
|
|
|
|
## Feature 06: CallbackSet
|
|
**Description**: Compose multiple callbacks with ordering
|
|
**Dependencies**: Discrete callbacks
|
|
**Effort**: Small
|
|
**Key Points**: Builder pattern, execution priority, enable/disable
|
|
|
|
## Feature 07: Saveat Functionality
|
|
**Description**: Save solution at specific timepoints
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: Interpolation to exact times, dense vs sparse saving, memory efficiency
|
|
|
|
## Feature 08: Solution Derivatives
|
|
**Description**: Access derivatives at any time via interpolation
|
|
**Dependencies**: None
|
|
**Effort**: Small
|
|
**Key Points**: `solution.derivative(t)` interface, use dense output or finite differences
|
|
|
|
## Feature 09: DP8 Method
|
|
**Description**: Dormand-Prince 8th order method
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: 13 stages, very high accuracy, tableau from literature
|
|
|
|
## Feature 10: FBDF Method
|
|
**Description**: Fixed-leading-coefficient BDF multistep method
|
|
**Dependencies**: Linear solver, Nordsieck representation
|
|
**Effort**: Large
|
|
**Key Points**: Variable order (1-5), excellent for very stiff problems, complex state management
|
|
|
|
## Feature 11: Rodas4/Rodas5P
|
|
**Description**: Higher-order Rosenbrock methods
|
|
**Dependencies**: Rosenbrock23
|
|
**Effort**: Medium
|
|
**Key Points**: 4th/5th order accuracy, more stages, better for higher accuracy stiff problems
|
|
|
|
## Feature 13: Default Algorithm Selection
|
|
**Description**: Smart defaults based on problem characteristics
|
|
**Dependencies**: Auto-switching, multiple algorithms
|
|
**Effort**: Medium
|
|
**Key Points**: Analyze tolerance, problem size, choose algorithms automatically
|
|
|
|
## Feature 14: Automatic Initial Stepsize
|
|
**Description**: Algorithm to compute good initial dt
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: Based on Hairer & Wanner algorithm, uses local Lipschitz estimate
|
|
|
|
## Feature 15: PresetTimeCallback
|
|
**Description**: Callbacks at predetermined times
|
|
**Dependencies**: Discrete callbacks
|
|
**Effort**: Small
|
|
**Key Points**: Efficient time-based events, integration with tstops
|
|
|
|
## Feature 16: TerminateSteadyState
|
|
**Description**: Auto-detect when solution reaches steady state
|
|
**Dependencies**: Discrete callbacks
|
|
**Effort**: Small
|
|
**Key Points**: Monitor du/dt, terminate when small enough
|
|
|
|
## Feature 17: SavingCallback
|
|
**Description**: Custom saving logic beyond default
|
|
**Dependencies**: CallbackSet
|
|
**Effort**: Small
|
|
**Key Points**: User-defined save conditions, memory-efficient for large problems
|
|
|
|
## Feature 18: Linear Solver Infrastructure
|
|
**Description**: Generic linear solver interface and dense LU
|
|
**Dependencies**: None
|
|
**Effort**: Large
|
|
**Key Points**:
|
|
- Trait-based design for flexibility
|
|
- Dense LU factorization with partial pivoting
|
|
- Solve Ax = b efficiently
|
|
- Foundation for all implicit methods
|
|
- Consider using nalgebra's built-in LU or implement custom
|
|
|
|
## Feature 19: Jacobian Computation
|
|
**Description**: Finite difference and auto-diff Jacobians
|
|
**Dependencies**: None
|
|
**Effort**: Large
|
|
**Key Points**:
|
|
- Forward finite differences: (f(y+εe_j) - f(y))/ε
|
|
- Epsilon selection: √eps * max(|y_j|, 1)
|
|
- Sparse Jacobian support (future)
|
|
- Integration with AD crates (future)
|
|
|
|
## Feature 20: Low-Storage Runge-Kutta
|
|
**Description**: 2N/3N/4N storage variants for large systems
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: Specialized RK methods that reuse storage, critical for PDEs via method-of-lines
|
|
|
|
## Feature 21: SSP Methods
|
|
**Description**: Strong Stability Preserving RK methods
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: SSPRK22, SSPRK33, SSPRK43, SSPRK53, preserve TVD/monotonicity, for hyperbolic PDEs
|
|
|
|
## Feature 22: Symplectic Integrators
|
|
**Description**: Verlet, Leapfrog, KahanLi for Hamiltonian systems
|
|
**Dependencies**: None (second-order ODE support already exists)
|
|
**Effort**: Medium
|
|
**Key Points**: Preserve energy/symplectic structure, special for p,q formulation
|
|
|
|
## Feature 23: Verner Methods Suite
|
|
**Description**: Complete Verner family (Vern6, Vern8, Vern9)
|
|
**Dependencies**: Vern7
|
|
**Effort**: Medium
|
|
**Key Points**: Different orders for different accuracy needs, all highly efficient
|
|
|
|
## Feature 24: SDIRK Methods
|
|
**Description**: Singly Diagonally Implicit RK (KenCarp3/4/5)
|
|
**Dependencies**: Linear solver, nonlinear solver
|
|
**Effort**: Large
|
|
**Key Points**: IMEX methods, good for semi-stiff problems, L-stable
|
|
|
|
## Feature 25: Exponential Integrators
|
|
**Description**: Exp4, EPIRK4, EXPRB53 for semi-linear stiff
|
|
**Dependencies**: Matrix exponential computation
|
|
**Effort**: Large
|
|
**Key Points**: For du/dt = Lu + N(u), where L is linear stiff part
|
|
|
|
## Feature 26: Extrapolation Methods
|
|
**Description**: Richardson extrapolation with adaptive order
|
|
**Dependencies**: Linear solver
|
|
**Effort**: Large
|
|
**Key Points**: High accuracy from low-order methods, variable order selection
|
|
|
|
## Feature 27: Stabilized Methods
|
|
**Description**: ROCK2, ROCK4, RKC for mildly stiff
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: Extended stability regions, good for PDEs with explicit time-stepping
|
|
|
|
## Feature 28: I Controller
|
|
**Description**: Basic integral controller
|
|
**Dependencies**: None
|
|
**Effort**: Small
|
|
**Key Points**: Simplest adaptive controller, mainly for comparison/testing
|
|
|
|
## Feature 29: Predictive Controller
|
|
**Description**: Advanced predictive step size control
|
|
**Dependencies**: None
|
|
**Effort**: Medium
|
|
**Key Points**: Predicts future error, more sophisticated than PID
|
|
|
|
## Feature 30: VectorContinuousCallback
|
|
**Description**: Multiple simultaneous event detection
|
|
**Dependencies**: CallbackSet
|
|
**Effort**: Medium
|
|
**Key Points**: More efficient than separate callbacks, shared root-finding
|
|
|
|
## Feature 31: PositiveDomain
|
|
**Description**: Enforce positivity constraints
|
|
**Dependencies**: CallbackSet
|
|
**Effort**: Small
|
|
**Key Points**: Ensures solution stays positive, important for physical systems
|
|
|
|
## Feature 32: ManifoldProjection
|
|
**Description**: Project solution onto constraint manifolds
|
|
**Dependencies**: CallbackSet
|
|
**Effort**: Medium
|
|
**Key Points**: For constrained mechanical systems, projection step after integration
|
|
|
|
## Feature 33: Nonlinear Solver Infrastructure
|
|
**Description**: Newton and quasi-Newton methods
|
|
**Dependencies**: Linear solver
|
|
**Effort**: Large
|
|
**Key Points**:
|
|
- Newton's method for implicit stages
|
|
- Line search
|
|
- Convergence criteria
|
|
- Foundation for SDIRK, FIRK methods
|
|
|
|
## Feature 34: Krylov Linear Solvers
|
|
**Description**: GMRES, BiCGStab for large sparse systems
|
|
**Dependencies**: Linear solver infrastructure
|
|
**Effort**: Large
|
|
**Key Points**: Iterative solvers for when LU factorization too expensive
|
|
|
|
## Feature 35: Preconditioners
|
|
**Description**: ILU, Jacobi, custom preconditioners
|
|
**Dependencies**: Krylov solvers
|
|
**Effort**: Large
|
|
**Key Points**: Accelerate Krylov methods, essential for large sparse systems
|
|
|
|
## Feature 36: FSAL Optimization
|
|
**Description**: First-Same-As-Last function evaluation reuse
|
|
**Dependencies**: None
|
|
**Effort**: Small
|
|
**Key Points**: Reduce function evaluations by ~14% for FSAL methods (DP5, Tsit5, etc.)
|
|
|
|
## Feature 37: Custom Norms
|
|
**Description**: User-definable error norms
|
|
**Dependencies**: None
|
|
**Effort**: Small
|
|
**Key Points**: L2, Linf, weighted norms, custom user functions
|
|
|
|
## Feature 38: Step/Stage Limiting
|
|
**Description**: Limit state values during integration
|
|
**Dependencies**: None
|
|
**Effort**: Small
|
|
**Key Points**: Enforce bounds on solution, prevent non-physical values
|
|
|
|
---
|
|
|
|
## Creating Detailed Feature Files
|
|
|
|
When you're ready to work on a feature, create a detailed file following this structure:
|
|
|
|
1. **Overview**: What is it, key characteristics
|
|
2. **Why This Feature Matters**: Motivation, use cases
|
|
3. **Dependencies**: What must be built first
|
|
4. **Implementation Approach**: Algorithm details, design decisions
|
|
5. **Implementation Tasks**: Detailed checklist with subtasks
|
|
6. **Testing Requirements**: Specific tests with expected results
|
|
7. **References**: Papers, Julia code, textbooks
|
|
8. **Complexity Estimate**: Effort and risk assessment
|
|
9. **Success Criteria**: How to know it's done right
|
|
10. **Future Enhancements**: What could be added later
|
|
|
|
See `features/01-bs3-method.md`, `features/02-vern7-method.md`, `features/03-rosenbrock23.md`, etc. for complete examples.
|