-
-
Notifications
You must be signed in to change notification settings - Fork 198
dolfinx.fem.petsc.LinearProblem
for nest and block systems
#3684
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
base: main
Are you sure you want to change the base?
Conversation
Looks like a reasonable interface to me. The only issue I see: what if the user wants a MatNest assembly? |
MatNest can't be used for direct solves (as far as I am aware). Edit: |
Context: firedrakeproject/firedrake#431 (comment) |
I do understand that, but in principle the user could choose something different from
that is compatible with MatNest. I do understand that it will be a kind of advanced user that probably will have no trouble to set up the KSP object on their own, but still it would feel odd to have Nest-compatible SNES and Nest-incompatible linear solver. |
On MatNest + LU/MUMPS, try it and see what happens? We could simply return an error message if the user wants a nest solve and passes no KSP options - clearly this requires problem specific help that we cannot automate. Passing |
The logic around |
I've made "kind" input to I've added a test that check that all modes work in serial/parallel (here we can use mumps+nest as it can invert each of the systems individually). |
LinearProblem
dolfinx.fem.petsc.LinearProblem
for nest and block systems
Looking at his more closely, it's not clear to me what need this change addresses. Block/nest systems are usually constructed to support block-type preconditioners. But, it's not obvious that the changes support this. E.g., how should the standard block-preconditioned solvers implemented in the Stokes demo be implemented via the |
For mixed dimensional/submesh problems, one has to use blocked problems (either manually or through
We can of course add a |
I've now added the option to pass in a preconditioner to the LinearProblem at construction. |
With the unification of
create_*
,assemble_*
andassign
for various PETSc operators, I suggest we letLinearProblem
support non-blocked and blocked problems, i.e.For now, I've chosen to force the user to specify
u
for blocked problems, as it is hard extract the correct function spaces (dolfinx.fem.FunctionSpace
, python class) from the nested list of forms with the current functions (extract_function_spaces
work on the C++ function-spaces).This also introduces an immediate solution vector
_x
, in the same fashion as within the proposed SNES solver.It also adds the option of sending in a preconditioner to LinearProblem, as a
ufl.Form
or a nested sequence of Forms, which is then set to the krylov-solver.