Overview
Thesolvers module provides solver classes that build and solve the matrix systems from problem definitions. Different solver types correspond to different problem types.
Solver Classes
InitialValueSolver
Parameters
- problem (IVP): Initial value problem
- timestepper: Timestepper class (e.g., RK222, RK443, SBDF2)
- ncc_cutoff (float, optional): NCC expansion cutoff (default: 1e-6)
- max_ncc_terms (int, optional): Maximum NCC terms (default: None)
- entry_cutoff (float, optional): Matrix entry cutoff (default: 1e-12)
- matsolver (str or class, optional): Matrix solver to use
Attributes
- state (list of Fields): Problem variables
- sim_time (float): Current simulation time
- iteration (int): Current iteration number
- stop_sim_time (float): Stopping simulation time
- stop_wall_time (float): Stopping wall time
- stop_iteration (int): Stopping iteration
Methods
step(dt) - Advance one timestepExample: Heat Equation
LinearBoundaryValueSolver
Parameters
- problem (LBVP): Linear boundary value problem
- ncc_cutoff (float, optional): NCC expansion cutoff
- matsolver (str or class, optional): Matrix solver
- Other parameters same as InitialValueSolver
Attributes
- state (list of Fields): Problem variables (solution)
- iteration (int): Solve iteration counter
Methods
solve(subproblems=None, rebuild_matrices=False) - Solve the BVPExample: Poisson Equation
NonlinearBoundaryValueSolver
Parameters
Same as LinearBoundaryValueSolverAttributes
- state (list of Fields): Problem variables
- perturbations (list of Fields): Update directions
- iteration (int): Newton iteration counter
Methods
newton_iteration(damping=1) - Perform one Newton iterationExample: Nonlinear Eigenvalue Problem
EigenvalueSolver
Parameters
Same as LinearBoundaryValueSolverAttributes
- state (list of Fields): Eigenvector fields
- eigenvalues (ndarray): Computed eigenvalues
- eigenvectors (ndarray): Computed eigenvectors
- eigenvalue_subproblem (Subproblem): Last solved subproblem
Methods
solve_dense(subproblem, rebuild_matrices=False, left=False) - Dense eigenvalue solveExample: Eigenvalue Problem
Solver Options
Matrix Solvers
Available matrix solvers (specified viamatsolver parameter):
- ‘SuperluNaturalSpsolve’: Default sparse direct solver
- ‘SuperluColamdSpsolve’: COLAMD ordering
- ‘UmfpackSpsolve’: UMFPACK solver
- ‘CsrMatrixSolver’: Generic CSR solver
Matrix Construction Options
- bc_top (bool): Place BCs at top of matrix
- tau_left (bool): Place tau columns at left
- interleave_components (bool): Interleave tensor components
- store_expanded_matrices (bool): Store preconditioned matrices
See Also
- Problems - Problem definitions
- Timesteppers - Time integration schemes
- Evaluator - Output handling
- Field - Field variables