[petsc-users] MatNest error with null matrix blocks
Barry Smith
bsmith at petsc.dev
Fri Jul 4 20:56:03 CDT 2025
You need to pass PETSC_NULL_MAT in those locations, you cannot just pass a Mat that has never been created (that is a different kind of NULL matrix :-). I have added clearer error checking in https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/8526__;!!G_uCfscf7eWS!c7m-laUXAl00bSHNb-ohlO2tKeFMTPNbjzMWPv5thIWU9NSFKiyZzFTUJgVbOqSWRkgYoLYJVkqR6dtPIeyHqig$
Barry
> On Jul 4, 2025, at 10:32 AM, Randall Mackie <rlmackie862 at gmail.com> wrote:
>
> In the process of upgrading our code to version 3.23, we have run into another issue, this time with nest matrices.
>
> In previous versions (well to at least 3.21) it was perfectly fine to pass in null matrix blocks to create a nest matrix. There are situations where we have, for example, only diagonal blocks. That should be allowed and was and worked fine.
>
> In petsc 3.23, that no longer is true, or perhaps we do not know what is the proper way to pass in a null matrix.
>
> The attached example reproduces this with the following error:
>
> [0]PETSC ERROR: Configure options: --force --with-clean=1 --with-scalar-type=complex --with-debugging=1 --with-fortran=1 --download-mpich=1 --with-cxx=0
> [0]PETSC ERROR: #1 PetscObjectReference() at /home/rmackie/PETSc/petsc/src/sys/objects/inherit.c:620
> [0]PETSC ERROR: #2 MatNestSetSubMats_Nest() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1407
> [0]PETSC ERROR: #3 MatNestSetSubMats() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1518
> [0]PETSC ERROR: #4 MatCreateNest() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1800
> [0]PETSC ERROR: #5 matnest_bug_reproducer.F90:48
>
>
> Thanks for helping with this, and thanks for all the work on the Fortran interfaces - I’ve been playing around with your new branch and am excited by all the work!
>
> Randy
> <matnest_bug_reproducer.F90>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20250704/3e6e9c01/attachment.html>
More information about the petsc-users
mailing list