4.5.2 pde.solvers.base module
Package that contains base classes for solvers.
Beside the abstract base class SolverBase defining the interfaces, we also
provide AdaptiveSolverBase, which contains methods for adaptive solvers.
Base class for PDE solvers. |
|
Base class for adaptive time steppers. |
|
Indicates that an implicit step did not converge. |
- class AdaptiveSolverBase(pde, *, backend='auto', adaptive=False, tolerance=0.0001)[source]
Bases:
SolverBaseBase class for adaptive time steppers.
- Parameters:
- make_stepper(state, dt=None)[source]
Return a stepper function using an explicit scheme.
- Parameters:
state (
FieldBase) – An example for the state from which the grid and other information can be extracteddt (float) – Time step used (Uses
SolverBase.dt_defaultif None). This sets the initial time step for adaptive solvers.
- Returns:
Function that can be called to advance the state from time t_start to time t_end. The function call signature is (state: numpy.ndarray, t_start: float, t_end: float)
- Return type:
- exception ConvergenceError[source]
Bases:
RuntimeErrorIndicates that an implicit step did not converge.
- class SolverBase(pde, *, backend='auto')[source]
Bases:
objectBase class for PDE solvers.
- Parameters:
pde (
PDEBase) – The partial differential equation that should be solvedbackend (str or
BackendBase) – The backend used for numerical operations
- property backend: BackendBase
The backend for this solver.
- Type:
- classmethod from_name(name, pde, **kwargs)[source]
Create solver class based on its name.
Solver classes are automatically registered when they inherit from
SolverBase. Note that this also requires that the respective python module containing the solver has been loaded before it is attempted to be used.- Parameters:
- Returns:
An instance of a subclass of
SolverBase- Return type:
- make_stepper(state, dt=None)[source]
Return a stepper function using an explicit scheme.
- Parameters:
state (
FieldBase) – An example for the state from which the grid and other information can be extracteddt (float) – Time step used (Uses
SolverBase.dt_defaultif None)
- Returns:
Function that can be called to advance the state from time t_start to time t_end. The function call signature is (state: numpy.ndarray, t_start: float, t_end: float)
- Return type: