<div dir="ltr"><div dir="ltr">On Fri, Feb 9, 2024 at 7:04 AM Jeremy Theler (External) <<a href="mailto:jeremy.theler-ext@ansys.com">jeremy.theler-ext@ansys.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-2527497476239425950">




<div dir="ltr">
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">Hi all</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">Because of a combination of settings, our code passes through this line:</span></div>
<div><br>
</div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><a href="https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/fieldsplit/fieldsplit.c?ref_type=heads#L692" id="m_-4204144192597017464LPlnk" target="_blank">https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/fieldsplit/fieldsplit.c?ref_type=heads#L692</a></span></div>
<div><br>
</div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">i.e. the matrices associated with each of the sub-KSPs of a fieldsplit are destroyed
 and then re-created later.</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">The thing is that one of these destroyed matrices had a near nullspace attached, which
 is lost because the new matrix does not have it anymore.</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">Is this a bug or are we missing something?</span></div></div></div></blockquote><div><br></div><div>I just want to get a clear picture. You create a PCFIELDSPLIT, set it up, then pull out the matrices and attach a nullspace before the solve. At a later time, you start another solve with this PC, and it has the DIFFERENT_NONZERO_PATTERN flag, so it recreates these matrices and loses your attached nullspace.</div><div><br></div><div>First, does the matrix really change?</div><div><br></div><div>Second, I had the same problem. I added callbacks to DM which allow a nullspace to be automatically attached if you extract a certain subfield. Are you using a DM?</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-2527497476239425950"><div dir="ltr">
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">I'll need some time to come up with a MWE showing how the near nullspace is lost, but
 if its needed I can take a stab at it.</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><br>
</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">--</span></div>
<div><span style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">jeremy</span></div>
<div><br>
</div>
<div>
<div id="m_-4204144192597017464LPBorder_GTaHR0cHM6Ly9naXRsYWIuY29tL3BldHNjL3BldHNjLy0vYmxvYi9tYWluL3NyYy9rc3AvcGMvaW1wbHMvZmllbGRzcGxpdC9maWVsZHNwbGl0LmM:cmVmX3R5cGU9aGVhZHMjTDY5Mg.." style="width:100%;margin-top:16px;margin-bottom:16px;max-width:800px;min-width:424px">
<table id="m_-4204144192597017464LPContainer431171" role="presentation" style="padding:12px 36px 12px 12px;width:100%;border-width:1px;border-style:solid;border-color:rgb(200,200,200);border-radius:2px">
<tbody>
<tr valign="top" style="border-spacing:0px">
<td>
<div id="m_-4204144192597017464LPImageContainer431171" style="margin-right:12px;height:160px;overflow:hidden">
<a id="m_-4204144192597017464LPImageAnchor431171" href="https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/fieldsplit/fieldsplit.c?ref_type=heads#L692" target="_blank"><img id="m_-4204144192597017464LPThumbnailImageId431171" alt="" height="160" style="display: block;" width="160" src="https://gitlab.com/uploads/-/system/project/avatar/13882401/PETSc_RBG-logo.png"></a></div>
</td>
<td style="width:100%">
<div id="m_-4204144192597017464LPTitle431171" style="font-size:21px;font-weight:300;margin-right:8px;font-family:wf_segoe-ui_light,"Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px">
<a id="m_-4204144192597017464LPUrlAnchor431171" href="https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/fieldsplit/fieldsplit.c?ref_type=heads#L692" style="text-decoration:none" target="_blank">src/ksp/pc/impls/fieldsplit/fieldsplit.c · main
 · PETSc / petsc · GitLab</a></div>
<div id="m_-4204144192597017464LPDescription431171" style="font-size:14px;max-height:100px;color:rgb(102,102,102);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif;margin-bottom:12px;margin-right:8px;overflow:hidden">
PETSc, pronounced PET-see (the S is silent), is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations.</div>
<div id="m_-4204144192597017464LPMetadata431171" style="font-size:14px;font-weight:400;color:rgb(166,166,166);font-family:wf_segoe-ui_normal,"Segoe UI","Segoe WP",Tahoma,Arial,sans-serif">
<a href="http://gitlab.com" target="_blank">gitlab.com</a></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
</div>

</div></blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>