-
Notifications
You must be signed in to change notification settings - Fork 34
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
LA: allow to solve block linear systems efficiently #466
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There is not much added value in supporting the case where the assembler block size is greater than one but the matrix block size is one. Matrix update can be simplified by enforcing that the assembler and the matrix have the same block size.
Otherwise PETSc may use a different partitioning when restoring a matrix/vector.
fb5e7d2
to
4e96b7a
Compare
…tations If the system is partitioned, each process can reorder only it's local part of the matrix. This is a limitation of the VecPermute PETSc function that does not support parallel Index Sets with non-local permutations.
ee7a287
to
9da3f6c
Compare
Instead of inheriting from std::iterator, iterator traits are explicitly defined in the class declaration.
…ncil-based linear system
…ith the same name
9da3f6c
to
1b15ad6
Compare
marcocisternino
approved these changes
Jun 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Block matrices represent an important class of problems in numerical linear algebra and offer the possibility of far more efficient iterative solvers than just treating the entire matrix as black box. Following the common linear algebra definition, a block matrix is a matrix divided in a small, problem-size independent (two, three or so) number of very large blocks. These blocks arise naturally from the underlying physics or discretization of the problem, for example, they may be associated with different variables of a physical problem. Under a certain numbering of unknowns the matrix can be written as
where each A_ij is an entire block (see the paragraph "Solving Block Matrices" in the PETSc manual).
When assembling the matrix, a monolithic matrix should be provided. For example, assuming to group the elements of the matrix in five-by-five groups (here, five is the so-called block size of the matrix and usually rises when coupling variables with different meaning, for example pressure, the three components of the velocity and temperature) the assembler will provide the following system:
Internally, the monolithic matrix will be split into blocks. For example, considering two splits, the first one that group together the first four variables and the second one that holds the last variable (i.e., split sizes equal to [4, 1]), the internal split system will be:
where M and N are the number of rows and columns respectively.
The PETSc PCFIELDSPLIT preconditioner is used to solve the split system. There are different split strategies available:
Considering a two-by-two block block matrix
the preconditioned problem will look like
in other words the preconditioner is:
The system is solved efficiently by solving each block independently from the others.
Blocks are solved using a flexible GMRES iterative method. If the system is partitioned each block is preconditioned using the (restricted) additive Schwarz method (ASM). On each block of the ASM preconditioner an incomplete LU factorization (ILU) is used. There is one ASM block per process. If the system is not partitioned it is preconditioned using the incomplete LU factorization (ILU).
Considering a two-by-two block block matrix
the preconditioner is
The system is solved efficiently by first solving with A00, then applying A01 to that solution, removing it from the right hand side of the second block and then solving with A11, in other words
This strategy can be seen as a "block" Gauss-Seidel with the blocks being the splits.
Blocks are solved using a flexible GMRES iterative method. If the system is partitioned each block is preconditioned using the (restricted) additive Schwarz method (ASM). On each block of the ASM preconditioner an incomplete LU factorization (ILU) is used. There is one ASM block per process. If the system is not partitioned it is preconditioned using the incomplete LU factorization (ILU).
Considering a two-by-two block block matrix
the preconditioned problem will look like
in other words the preconditioner is:
The preconditioner is evaluated considering only the diagonal blocks and then the full
system is solved.
The system is solved using a flexible GMRES iterative method. If the system is partitioned each diagonal block is preconditioned using the (restricted) additive Schwarz method (ASM). On each block of the ASM preconditioner an incomplete LU factorization (ILU) is used. There is one ASM block per process. If the system is not partitioned it is preconditioned using the incomplete LU factorization (ILU).