-
-
Notifications
You must be signed in to change notification settings - Fork 211
Description
The logic in fem.petsc.LinearProblem
is currently the following
- initialize the matrix
A
and vectorb
data structure, in__init__
- assemble the matrix and vector values, in
solve
- call KSP to solve the linear system, in
solve
.
I think this makes sense for most of the cases. However, there is a limit case in which the user would need to interact with the matrix/vector between steps 2 and 3, which is the case of setting a nullspace, doing something like
assert nullspace.test(A)
A.setNullSpace(nullspace)
nullspace.remove(b)
- What we currently do is to do
A.setNullSpace(nullspace)
after step 1. See e.g.dolfinx/python/demo/demo_stokes.py
Line 248 in a6dc610
problem.A.setNullSpace(nsp) A
is still zero. - What we currently do is to do
assert nullspace.test(A)
after step 3. See e.g.dolfinx/python/demo/demo_stokes.py
Line 261 in a6dc610
assert nsp.test(problem.A) dolfinx/python/dolfinx/fem/petsc.py
Line 968 in a6dc610
- We currently cannot have
nullspace.remove(b)
. Again, it would need to happen between steps 2 and 3.
Opening this issue as an enhancement just in case we can work out a slightly modified design, or determine that this is not worth it. I like fem.petsc.LinearProblem
as it currently is and I would refrain from making it much more involved for the end-user just to support this.