4.4.4 pde.solvers.crank_nicolson module

Defines a Crank-Nicolson solver

class CrankNicolsonSolver(pde, *, maxiter=100, maxerror=0.0001, explicit_fraction=0, backend='auto')[source]

Bases: SolverBase

Crank-Nicolson solver

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

  • maxiter (int) – The maximal number of iterations per step

  • maxerror (float) – The maximal error that is permitted in each step

  • explicit_fraction (float) – Hyperparameter determinig the fraction of explicit time stepping in the implicit step. explicit_fraction == 0 is the simple Crank-Nicolson scheme, while explicit_fraction == 1 reduces to the explicit Euler method. Intermediate values can improve convergence.

  • 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.

info: dict[str, Any]
name = 'crank-nicolson'