dynabench.solver
This module contains all different backends for the DynaBench solver.
Classes
|
Base class for all solvers. |
|
Solver class for solving PDEs using the py-pde library. |
- class dynabench.solver.BaseSolver(equation: BaseEquation, grid: Grid, initial_generator: InitialCondition, parameters: dict = {}, **kwargs)[source]
Bases:
object
Base class for all solvers.
- Parameters:
equation (dynabench.equation.BaseEquation) – The equation to solve.
grid (dynabench.grid.Grid) – The grid on which the equation is to be solved.
initial_generator (dynabench.initial.InitialCondition) – The initial condition generator from which the initial condition is to be generated.
parameters (dict, default {}) – Dictionary of parameters for the solver.
- solve(random_state: int = 42, t_span: List[float] = [0, 1], dt_eval: float = 0.1, out_dir: str = 'data/raw')[source]
Solve the equation.
- Parameters:
random_state (int, default 42) – The random state to use for the initial condition.
t_span (List[float], default [0, 1]) – The time span for the solution.
t_eval (List[float], default None) – The time points at which the solution is to be evaluated.
- Returns:
The solution of the equation.
- Return type:
np.ndarray
- class dynabench.solver.PyPDESolver(equation: BaseEquation, grid: Grid, initial_generator: InitialCondition, parameters: dict = {}, **kwargs)[source]
Bases:
BaseSolver
Solver class for solving PDEs using the py-pde library.
- Parameters:
equation (dynabench.equation.BaseEquation) – The equation to solve.
grid (dynabench.grid.Grid) – The grid on which the equation is to be solved.
initial_generator (dynabench.initial.InitialCondition) – The initial condition generator from which the initial condition is to be generated.
parameters (dict, default {}) – Dictionary of parameters for the solver. See the documentation of py-pde and scipy’s solve_ivp for more information.
- solve(random_state: int = 42, t_span: List[float] = [0, 1], dt_eval: float = 0.1, out_dir: str = 'data/raw')[source]
Solve the equation.
- Parameters:
random_state (int, default 42) – The random state to use for the initial condition.
t_span (List[float], default [0, 1]) – The time span for the solution.
t_eval (List[float], default None) – The time points at which the solution is to be evaluated.
- Returns:
The solution of the equation.
- Return type:
np.ndarray