[petsc-users] Ordering of DoFs in submatrices with PCFieldsplit
Blauth, Sebastian
sebastian.blauth at itwm.fraunhofer.de
Wed Nov 19 01:03:20 CST 2025
Dear Matt,
thanks for the clarification. Yes, that makes sense. Basically, I use two approaches for defining the splits in my code, see https://urldefense.us/v3/__https://github.com/sblauth/cashocs/blob/46c0d91467d03a4906b7bde29727b45d4bb0d6d2/cashocs/_utils/linalg.py*L245-L287__;Iw!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7Y_93bJVg$
I think the first one, where the IS is defined, then does exactly what I thought it would do. In the second approach, which I need for nested fieldsplits, I use a DMShell with a Section defined analogously - so I guess the same applies here.
Well, yes I could just reorder the DoFs for the creation of the submatrices - but I usually don't need these sub-functionspaces and would not want to create them every time. I thought of using MatPermute (https://urldefense.us/v3/__https://petsc.org/release/petsc4py/reference/petsc4py.PETSc.Mat.html*petsc4py.PETSc.Mat.permute__;Iw!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YwxbMqnE$ ) with the permutation I get from FEniCS - or is there any reason not to do so?
And thank you very much for the reference. Yes, I am aware of the paper you sent. However I think the function spaces involved in the method make it more or less infeasible for me - usually using Taylor-Hood elements is already very expensive. I usually use a stabilized P1-P1 discretization or try to get the linear Crouzeix–Raviart with elementwise constant pressure working (for slow flows, this works okay, but as I go to higher Reynolds numbers, things become more problematic).
And regarding your question on which operators I am planning to assemble on the pressure space: Basically the pressure mass matrix, pressure convection-diffusion matrix and a pressure Laplacian.
If you have any tips for solving the incompressible Navier Stokes equations (steady state) at higher Reynolds numbers I certainly welcome them. I can also go a bit more into detail of what kind of solution approach I am using - if that is appropriate here.
Thanks a lot and best regards,
Sebastian
--
Dr. Sebastian Blauth
Fraunhofer-Institut für
Techno- und Wirtschaftsmathematik ITWM
Abteilung Transportvorgänge
Fraunhofer-Platz 1, 67663 Kaiserslautern
Telefon: +49 631 31600-4968
sebastian.blauth at itwm.fraunhofer.de
https://urldefense.us/v3/__https://www.itwm.fraunhofer.de__;!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YW0PRsVU$
> -----Original Message-----
> From: Matthew Knepley <knepley at gmail.com>
> Sent: Tuesday, November 18, 2025 5:23 PM
> To: Blauth, Sebastian <sebastian.blauth at itwm.fraunhofer.de>
> Cc: PETSc users list <petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] Ordering of DoFs in submatrices with PCFieldsplit
>
> On Tue, Nov 18, 2025 at 11:12 AM Blauth, Sebastian
> <sebastian.blauth at itwm.fraunhofer.de
> <mailto:sebastian.blauth at itwm.fraunhofer.de> > wrote:
>
> Dear PETSc developers and users,
>
>
>
> I have a question regarding the Fieldsplit preconditioner in PETSc. In
> particular, I want to know how the submatrices there are created from the parent
> matrix. The “obvious” way would be to take the DoF indices of the corresponding
> split and “renumber” them so that the DoFs in the submatrix have the same order
> as the ones of the parent matrix. I did not find any documentation on this and as
> it is at least possible that the DoFs are re-ordered, I wanted to ask this question.
> Obviously, in case the DoFs are re-ordered, how can I get the mapping between
> the DoFs of the parent and the submatrix?
>
>
> Hi Sebastian,
>
> Inside, we call MatCreateSubmatrix(), which takes an IS on each process, and
> selects those global rows, in the order in which they appear in the IS, into a new
> parallel matrix. PCFieldsplitSetIS() can be used to specify those IS, so you can
> control the reordering. Does that make sense?
>
>
> The thing I am wanting to work on is implementing a pressure convection
> diffusion preconditioner with FEniCS for the incompressible Navier-Stokes
> equations.
>
> The parent matrix is assembled via a mixed FEM and then I use PETSc to
> solve the system. I want to assemble the corresponding operators on the pressure
> space from a collapsed (i.e. sub-space of the mixed FEM) function space.
> However, FEniCS re-orders the DoFs there, but I can get a mapping between the
> DoFs so this should not be problematic. However, I am not sure if PETSc also does
> a re-ordering.
>
>
> You can just create an IS with that reordering. What operator are you planning on
> assembling on the pressure space? Have you seen
> https://urldefense.us/v3/__https://arxiv.org/abs/1810.03315?__;!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YE-1UtAk$
>
> Thanks,
>
> Matt
>
>
> Thanks a lot in advance and best regards,
>
> Sebastian
>
>
>
> --
>
> Dr. Sebastian Blauth
>
> Fraunhofer-Institut für
>
> Techno- und Wirtschaftsmathematik ITWM
>
> Abteilung Transportvorgänge
>
> Fraunhofer-Platz 1, 67663 Kaiserslautern
>
> Telefon: +49 631 31600-4968
>
> sebastian.blauth at itwm.fraunhofer.de
> <mailto:sebastian.blauth at itwm.fraunhofer.de>
>
> https://urldefense.us/v3/__https://www.itwm.fraunhofer.de__;!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YW0PRsVU$
> <https://urldefense.us/v3/__https://www.itwm.fraunhofer.de/__;!!G_uCfscf7eW
> S!f_qaoCRxX3prMgl6ev5fvSFQegVfZo84xW9eJTz7uYmLjZiyJFIlm1tlqYrM3LqjOpkE
> oMrIJZo6J63-23-atPBnJn4et_4R-UvZoWlBpHM$>
>
>
>
>
>
> --
>
> What most experimenters take for granted before they begin their experiments is
> infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
>
> https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YQCIJKn8$
> <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ZrZxEenSD9yoVQBgqWHSpGUGp75YsbFopexb0vZKBu8oG5soqUBYoVKVAGETh1eMtV2aO-XjQUFcjY-OdaJUjHL04TxyhunHGM7YUxlQO8E$ >
More information about the petsc-users
mailing list