4.4.4. pde.solvers.explicit_mpi module¶
Defines an explicit solver using multiprocessing via MPI
- class ExplicitMPISolver(pde, scheme='euler', decomposition=-1, *, backend='auto', adaptive=False, tolerance=0.0001)¶
class for solving partial differential equations explicitly using MPI
This solver can only be used if MPI is properly installed.
The main idea of the solver is to take the full initial state in the main node (ID 0) and split the grid into roughly equal subgrids. The main node then distributes these subfields to all other nodes and each node creates the right hand side of the PDE for itself (and independently). Each node then advances the PDE independently, ensuring proper coupling to neighboring nodes via special boundary conditions, which exchange field values between sub grids. This is implemented by the
get_boundary_conditions()method of the sub grids, which takes the boundary conditions for the full grid and creates conditions suitable for the specific sub grid on the given node. The trackers (and thus all input and output) are only handled on the main node.
modify_after_step can only be used to do local modifications since the field data supplied to the function is local to each MPI node.
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).
decomposition (list of ints) – Number of subdivision in each direction. Should be a list of length grid.num_axes specifying the number of nodes along this axis. If one value is -1, its value will be determined from the number of available nodes. The default value decomposed the first axis using all available nodes.
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.
- make_stepper(state, dt=None)¶
return a stepper function using an explicit scheme
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
- name = 'explicit_mpi'¶