PDEBase.jl
PDEBase.jl provides common types and an interface for building discretizers of ModelingToolkit.jl PDESystems. It serves as a foundation for PDE discretization packages in the SciML ecosystem.
Installation
To install PDEBase.jl, use the Julia package manager:
using Pkg
Pkg.add("PDEBase")Purpose
PDEBase.jl is designed to be extended by discretization packages, not used directly for solving PDEs. It provides:
- Abstract types for discretizations, discrete spaces, and differential operators
- Interface functions that discretization packages implement
- Utility functions for symbolic manipulation of PDEs
- Boundary condition handling with a structured type hierarchy
If you want to solve PDEs, use a package built on PDEBase:
- MethodOfLines.jl - Finite difference discretization
Key Concepts
The PDESystem Interface
PDEBase defines how a ModelingToolkit.PDESystem is converted into a discretized system (typically an ODESystem). Key assumptions about the input PDESystem:
- Well-defined domains with finite intervals for all variables
- Consistent dependent variable signatures throughout
- Boundary conditions specified at domain boundaries
- Initial conditions for time-dependent problems
See Developer Extension API for complete details.
The Discretization Workflow
The symbolic_discretize function orchestrates the conversion:
- Preprocessing - Handle complex numbers and array variables
- Parsing - Create a
VariableMapwith all variable information - Boundary parsing - Structure boundary conditions by variable and dimension
- Space construction - Build the discrete grid and variables
- Equation processing - Convert each PDE to discrete equations
- System generation - Combine into the output system
See Discretization Workflow for the complete pipeline.
Type Hierarchy
AbstractDiscretization (from SciMLBase)
├── AbstractEquationSystemDiscretization
└── AbstractOptimizationSystemDiscretization
AbstractDiscreteSpace
└── AbstractCartesianDiscreteSpace
AbstractBoundary
└── AbstractTruncatingBoundary
├── LowerBoundary
├── UpperBoundary
└── AbstractInterfaceBoundary
├── InterfaceBoundary
└── HigherOrderInterfaceBoundaryDocumentation
- Getting Started
- Developer Extension API
- Discretization Workflow
- VariableMap
- Boundary Conditions
- API Reference
Quick Reference
Abstract Types to Extend
| Type | Purpose |
|---|---|
AbstractEquationSystemDiscretization | For ODE/DAE-producing discretizations |
AbstractOptimizationSystemDiscretization | For optimization problems |
AbstractDiscreteSpace | Discrete spatial representation |
AbstractDifferentialDiscretizer | Differential operator handling |
Key Interface Functions
| Function | Purpose |
|---|---|
construct_discrete_space | Build the discrete grid and variables |
construct_differential_discretizer | Prepare derivative approximations |
discretize_equation! | Convert a PDE to discrete equations |
generate_system | Create the final symbolic system |
Exported Utility Functions
| Category | Functions |
|---|---|
| Differential analysis | count_differentials, differential_order, has_derivatives, find_derivative, d_orders |
| Expression manipulation | get_depvars, split_terms, split_additive_terms, subs_alleqs! |
| Variable access | depvars, indvars, all_ivs, ivs, depvar, x2i |
| Boundary utilities | isupper, isinterface, isperiodic, filter_interfaces, haslowerupper, has_interfaces |
Related Packages
- ModelingToolkit.jl - Defines the
PDESystemtype - MethodOfLines.jl - Finite difference discretization built on PDEBase
- DifferentialEquations.jl - Solves the resulting ODE/DAE systems
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.