dynabench.solver

This module contains all different backends for the DynaBench solver.

Classes

BaseSolver(equation, grid, initial_generator)

Base class for all solvers.

PyPDESolver(equation, grid, initial_generator)

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:
generate_filename(t_span: List[float], dt_eval: float, seed: int, hash_truncate: int = 8)[source]
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:
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