From 7d547f81fb51a05831352f91e6e2ba0d717f7cc2 Mon Sep 17 00:00:00 2001 From: Pablo Brubeck Date: Wed, 26 Mar 2025 14:06:07 +0000 Subject: [PATCH] RestrictedFunctionSpace and LinearSolver --- firedrake/linear_solver.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/firedrake/linear_solver.py b/firedrake/linear_solver.py index 1e060ce906..9a5b93f30d 100644 --- a/firedrake/linear_solver.py +++ b/firedrake/linear_solver.py @@ -11,13 +11,16 @@ class LinearSolver(LinearVariationalSolver): @PETSc.Log.EventDecorator() - def __init__(self, A, *, P=None, **kwargs): + def __init__(self, A, *, P=None, restrict=False, **kwargs): """A linear solver for assembled systems (Ax = b) with constant A. :arg A: a :class:`~.MatrixBase` (the operator). :arg P: an optional :class:`~.MatrixBase` to construct any preconditioner from; if none is supplied ``A`` is used to construct the preconditioner. + :kwarg restrict: (optional) If `True`, use restricted function spaces, + that exclude Dirichlet boundary condition nodes, internally for + the test and trial spaces. :kwarg solver_parameters: (optional) dict of solver parameters. :kwarg nullspace: an optional :class:`~.VectorSpaceBasis` (or :class:`~.MixedVectorSpaceBasis` spanning the null space @@ -50,7 +53,8 @@ def __init__(self, A, *, P=None, **kwargs): problem = LinearVariationalProblem(A, self.b, self.x, aP=P, form_compiler_parameters=A.form_compiler_parameters, - constant_jacobian=True) + constant_jacobian=True, + restrict=restrict) super().__init__(problem, **kwargs) self.A = A