<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Thanks Barry<div><br></div><div>We were confused because the online manual says:</div><div><br></div><div><p>PETSc objects are always automatically initialized when declared so you do not need to (and should not) do</p><pre id="codecell7"><span class="k">type</span><span class="p">(</span><span class="n">tXXX</span><span class="p">)</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">PETSC_NULL_XXX</span>
<span class="n">XXX</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">PETSC_NULL_XXX</span>
</pre><pre id="codecell7"><br></pre><div><div>Randy</div><div><br></div><div><br><blockquote type="cite"><div>On Jul 4, 2025, at 6:56 PM, Barry Smith <bsmith@petsc.dev> wrote:</div><br class="Apple-interchange-newline"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div>   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 <a href="https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/merge_requests/8526__;!!G_uCfscf7eWS!Y7C44Hdmd964boi6gEmciviR7GGeHph-RSlxAgB7oCuxJsPbYDW5gZpHgn5KIJMryLOmkFvMiYX3aDDpI5f6G0AQrg$">https://gitlab.com/petsc/petsc/-/merge_requests/8526</a><div><br></div><div>  Barry</div><div><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Jul 4, 2025, at 10:32 AM, Randall Mackie <rlmackie862@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">In the process of upgrading our code to version 3.23, we have run into another issue, this time with nest matrices.<div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>The attached example reproduces this with the following error:</div><div><br></div><div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[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<o:p></o:p></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[0]PETSC ERROR: #1 PetscObjectReference() at /home/rmackie/PETSc/petsc/src/sys/objects/inherit.c:620<o:p></o:p></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[0]PETSC ERROR: #2 MatNestSetSubMats_Nest() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1407<o:p></o:p></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[0]PETSC ERROR: #3 MatNestSetSubMats() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1518<o:p></o:p></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[0]PETSC ERROR: #4 MatCreateNest() at /home/rmackie/PETSc/petsc/src/mat/impls/nest/matnest.c:1800<o:p></o:p></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;">[0]PETSC ERROR: #5 matnest_bug_reproducer.F90:48</span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><br></span></div><div style="font-size: 12pt; margin: 0in; font-family: Aptos, sans-serif;"><span style="font-size: 11pt;"><br></span></div><div style="margin: 0in;"><span style="font-family: Aptos, sans-serif; font-size: 14.666667px;">Thanks for helping with this, and thanks for all the work on the Fortran </span><font face="Aptos, sans-serif"><span style="font-size: 14.666667px;">interfaces - I’ve been playing around with your new branch and am excited by all the work!</span></font></div><div style="margin: 0in;"><font face="Aptos, sans-serif"><span style="font-size: 14.666667px;"><br></span></font></div><div style="margin: 0in;"><font face="Aptos, sans-serif"><span style="font-size: 14.666667px;">Randy</span></font></div><p class="MsoNormal" style="margin: 0in;"><font face="Aptos, sans-serif"><span style="font-size: 14.666667px;"></span></font></p></div></div><span id="cid:04643F4C-EB8F-498A-B3E0-EDD27C3018D6"><matnest_bug_reproducer.F90></span><meta http-equiv="content-type" content="text/html; charset=us-ascii"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><p class="MsoNormal" style="margin: 0in;"><font face="Aptos, sans-serif"><span style="font-size: 14.666667px;"></span></font></p></div></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></body></html>