Skip to content

RestrictedFunctionSpace and LinearSolver #4153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions firedrake/linear_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down