4.4.3. pde.solvers.explicit module

Defines an explicit solver supporting various methods

class ExplicitSolver(pde, scheme='euler', *, backend='auto', adaptive=False, tolerance=0.0001)[source]

Bases: SolverBase

class for solving partial differential equations explicitly

Parameters
  • pde (PDEBase) – The instance describing the pde that needs to be solved

  • scheme (str) – Defines the explicit scheme to use. Supported values are ‘euler’ and ‘runge-kutta’ (or ‘rk’ for short).

  • backend (str) – Determines how the function is created. Accepted values are ‘numpy` and ‘numba’. Alternatively, ‘auto’ lets the code decide for the most optimal backend.

  • adaptive (bool) – When enabled, the time step is adjusted during the simulation using the error tolerance set with tolerance.

  • tolerance (float) – The error tolerance used in adaptive time stepping. This is used in adaptive time stepping to choose a time step which is small enough so the truncation error of a single step is below tolerance.

dt_max: float = 10000000000.0

maximal time step that the adaptive solver will use

Type

float

dt_min: float = 1e-10

minimal time step that the adaptive solver will use

Type

float

info: Dict[str, Any]
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 extracted

  • dt (float) – Time step of the explicit stepping. If None, this solver specifies 1e-3 as a default value.

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

Callable[[FieldBase, float, float], float]

name = 'explicit'