cashocs.nonlinear_solvers.linear_solve#
- cashocs.nonlinear_solvers.linear_solve(
- linear_form: ufl.Form,
- u: fenics.Function,
- bcs: fenics.DirichletBC | list[fenics.DirichletBC],
- ksp_options: _typing.KspOption | None = None,
- preconditioner_form: ufl.Form = None,
- A_tensor: fenics.PETScMatrix | None = None,
- b_tensor: fenics.PETScVector | None = None,
- linear_solver: _utils.linalg.LinearSolver | None = None,
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 (fenics.DirichletBC | list[fenics.DirichletBC]) – The boundary conditions for the problem
ksp_options (_typing.KspOption | None) – The options for the PETSc KSP solver, optional. Default is None, where the linear solver MUMPS is used
preconditioner_form (ufl.Form) – The UFL form for defining the preconditioner. Must be a bilinear form.
A_tensor (fenics.PETScMatrix | None) – A fenics.PETScMatrix for storing the left-hand side of the linear sub-problem.
b_tensor (fenics.PETScVector | None) – A fenics.PETScVector for storing the right-hand side of the linear sub-problem.
linear_solver (_utils.linalg.LinearSolver | None) – The linear solver used to solve the (discretized) linear problem.
- Returns:
The computed solution, this overwrites the input function u.
- Return type:
fenics.Function