cashocs.nonlinear_solvers.linear_solver#

Linear solver for linear PDEs.

Functions

linear_solve(linear_form, u, bcs[, ...])

Solves a linear problem.

cashocs.nonlinear_solvers.linear_solver.linear_solve(linear_form, u, bcs, ksp_options=None, preconditioner_form=None, A_tensor=None, b_tensor=None, linear_solver=None)[source]#

Solves a linear problem.

Parameters:
  • linear_form (ufl.Form) – The linear variational form of the problem, i.e., linear_form == 0

  • u (fenics.Function) – The function to be solved for

  • bcs (Union[fenics.DirichletBC, List[fenics.DirichletBC]]) – The boundary conditions for the problem

  • ksp_options (Optional[_typing.KspOption]) – The options for the PETSc KSP solver, optional. Default is None, where the linear solver MUMPS is used

  • A_tensor (Optional[fenics.PETScMatrix]) – A fenics.PETScMatrix for storing the left-hand side of the linear sub-problem.

  • b_tensor (Optional[fenics.PETScVector]) – A fenics.PETScVector for storing the right-hand side of the linear sub-problem.

  • linear_solver (Optional[_utils.linalg.LinearSolver]) – The linear solver used to solve the (discretized) linear problem.

  • preconditioner_form (ufl.Form) –

Returns:

The computed solution, this overwrites the input function u.

Return type:

fenics.Function