<div dir="ltr">clearly, I meant optimized mode</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 13 lug 2023 alle ore 19:19 Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">In any case, we need to activate PetscCheck in debug mode too. This could have been avoided. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 13 lug 2023 alle ore 18:23 Karin&NiKo <<a href="mailto:niko.karin@gmail.com" target="_blank">niko.karin@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Thank you very much for the information Matt.</div><div>Unfortunately, I do not use DM.... :-(<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 13 juil. 2023 à 13:44, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, Jul 13, 2023 at 5:33 AM Pierre Jolivet <<a href="mailto:pierre.jolivet@lip6.fr" target="_blank">pierre.jolivet@lip6.fr</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>Dear Nicolas,<br><div><br><blockquote type="cite"><div>On 13 Jul 2023, at 10:17 AM, TARDIEU Nicolas <<a href="mailto:nicolas.tardieu@edf.fr" target="_blank">nicolas.tardieu@edf.fr</a>> wrote:</div><br><div><div style="font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">Dear Pierre,</div><div style="font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt"><br></div><div style="font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">You are absolutely right. I was using a --with-debugging=0 (aka release) install and this is definitely an error.<br>Once I used my debug install, I found the way to fix my problem. The solution is in the attached script: I first need to extract the correct block from the PC operator's MatNest and then append the null space to it.</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt">Anyway this is a bit tricky...</div></div></div></blockquote><div><br></div><div>Yep, it’s the same with all “nested” solvers, fieldsplit, ASM, MG, you name it.</div><div>You first need the initial PCSetUp() so that the bare minimum is put in place, then you have to fetch things yourself and adapt it to your needs.</div><div>We had a similar discussion with the MEF++ people last week, there is currently no way around this, AFAIK.</div></div></div></blockquote><div><br></div><div>Actually, I hated this as well, so I built a way around it _if_ you are using a DM to define the problem. Then</div><div>you can set a "nullspace constructor" to make it if the field you are talking about is ever extracted. You use DMSetNullSpaceConstructor(). I do this in SNES ex62 and ex69, and other examples.</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><div><div>Thanks,</div><div>Pierre</div><br><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div id="m_3904031921054776195m_3772358944229346760m_1320618470140022990m_3582794520278951836Signature"><div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif;margin:0px"><font size="3"></font><div style="margin:0px"><font size="3" face="Calibri,sans-serif">Regards,<span> </span></font></div><font size="3"></font><div style="margin:0px"><font face="Calibri,sans-serif"><font size="3">Nicolas<br><br></font></font></div></div></div></div><div id="m_3904031921054776195m_3772358944229346760m_1320618470140022990m_3582794520278951836appendonsend" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"></div><hr style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;display:inline-block;width:867.297px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline"></span><div id="m_3904031921054776195m_3772358944229346760m_1320618470140022990m_3582794520278951836divRplyFwdMsg" dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font style="font-size:11pt" face="Calibri, sans-serif"><b>De :</b><span> </span><a href="mailto:pierre.jolivet@lip6.fr" target="_blank">pierre.jolivet@lip6.fr</a> <<a href="mailto:pierre.jolivet@lip6.fr" target="_blank">pierre.jolivet@lip6.fr</a>><br><b>Envoyé :</b><span> </span>mercredi 12 juillet 2023 19:52<br><b>À :</b><span> </span>TARDIEU Nicolas <<a href="mailto:nicolas.tardieu@edf.fr" target="_blank">nicolas.tardieu@edf.fr</a>><br><b>Cc :</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br><b>Objet :</b><span> </span>Re: [petsc-users] Near null space for a fieldsplit in petsc4py</font><div> </div></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><font size="2"><span style="font-size:11pt"><div><br>> On 12 Jul 2023, at 6:04 PM, TARDIEU Nicolas via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>><span> </span><br>> Dear PETSc team,<br>><span> </span><br>> In the attached example, I set up a block pc for a saddle-point problem in petsc4py. The IS define the unknowns, namely some physical quantity (phys) and a Lagrange multiplier (lags).<br>> I would like to attach a near null space to the physical block, in order to get the best performance from an AMG pc.<span> </span><br>> I have been trying hard, attaching it to the initial block, to the IS but no matter what I am doing, when it comes to "ksp_view", no near null space is attached to the matrix.<br>><span> </span><br>> Could you please help me figure out what I am doing wrong ?<br><br>Are you using a double-precision 32-bit integers real build of PETSc?<br>Is it --with-debugging=0?<br>Because with my debug build, I get the following error (thus explaining why it’s not attached to the KSP).<br>Traceback (most recent call last):<br> File "/Volumes/Data/Downloads/test/test_NullSpace.py", line 35, in <module><br> ns = NullSpace().create(True, [v], comm=comm)<br> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br> File "petsc4py/PETSc/Mat.pyx", line 5611, in petsc4py.PETSc.NullSpace.create<br>petsc4py.PETSc.Error: error code 62<br>[0] MatNullSpaceCreate() at /Volumes/Data/repositories/petsc/src/mat/interface/matnull.c:249<br>[0] Invalid argument<br>[0] Vector 0 must have 2-norm of 1.0, it is 22.3159<br><br>Furthermore, if you set yourself the constant vector in the near null-space, then the first argument of create() must be False, otherwise, you’ll have twice the same vector, and you’ll end up with another error (the vectors in the near null-space must be orthonormal).<br>If things still don’t work after those couple of fixes, please feel free to send an up-to-date reproducer.<br><br>Thanks,<br>Pierre<br><br>> Thanks,<br>> Nicolas<br>><span> </span><br>><span> </span><br>><span> </span><br>><span> </span><br>> Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.<br>><span> </span><br>> Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.<br>><span> </span><br>> Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.<br>> ____________________________________________________<br>><span> </span><br>> This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.<br>><span> </span><br>> If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.<br>><span> </span><br>> E-mail communication cannot be guaranteed to be timely secure, error or virus-free.<br>> <test.tgz><br><br></div></span></font></div><p style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"></p><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br>Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à l'intention exclusive des destinataires et les informations qui y figurent sont strictement confidentielles. Toute utilisation de ce Message non conforme à sa destination, toute diffusion ou toute publication totale ou partielle, est interdite sauf autorisation expresse.</div><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Si vous n'êtes pas le destinataire de ce Message, il vous est interdit de le copier, de le faire suivre, de le divulguer ou d'en utiliser tout ou partie. Si vous avez reçu ce Message par erreur, merci de le supprimer de votre système, ainsi que toutes ses copies, et de n'en garder aucune trace sur quelque support que ce soit. Nous vous remercions également d'en avertir immédiatement l'expéditeur par retour du message.</div><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Il est impossible de garantir que les communications par messagerie électronique arrivent en temps utile, sont sécurisées ou dénuées de toute erreur ou virus.<br>____________________________________________________</div><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">This message and any attachments (the 'Message') are intended solely for the addressees. The information contained in this Message is confidential. Any use of information contained in this Message not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval.</div><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">If you are not the addressee, you may not copy, forward, disclose or use any part of it. If you have received this message in error, please delete it and all copies from your system and notify the sender immediately by return message.</div><div style="margin-top:0px;margin-bottom:0px;font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">E-mail communication cannot be guaranteed to be timely secure, error or virus-free.</div><span id="m_3904031921054776195m_3772358944229346760m_1320618470140022990m_3582794520278951836cid:2AB1ADB4-0D11-4C37-946B-CA70DDEE2CD6"><test_NullSpace.py.gz></span></div></blockquote></div><br></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>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Stefano</div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Stefano</div>