<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Zakariae -<div class=""><br class=""></div><div class="">The usual way to do this is to define an IS (index set) with the degrees of freedom of interest for the rows, and another one for the columns, and then use MatCreateSubmatrix [1] .</div><div class=""><br class=""></div><div class="">There's not a particularly convenient way to create an IS with the degrees of freedom corresponding to a particular "stratum" (i.e. elements, faces, edges, or vertices) of a DMStag, but fortunately I believe we have some code to do exactly this in a development branch. </div><div class=""><br class=""></div><div class="">I'll track it down and see if it can quickly be added to the main branch.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[1]: <a href="https://petsc.org/release/docs/manualpages/Mat/MatCreateSubMatrix.html" class="">https://petsc.org/release/docs/manualpages/Mat/MatCreateSubMatrix.html</a></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 22.06.2021 um 22:29 schrieb Jorti, Zakariae <<a href="mailto:zjorti@lanl.gov" class="">zjorti@lanl.gov</a>>:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hello,</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I am working on DMStag and I have one dof on vertices (let us call it V), <span style="font-size: 12pt;" class="">one dof on edges </span><span style="font-size: 12pt;" class="">(let us call it </span><span style="font-size: 12pt;" class="">E)</span><span style="font-size: 12pt;" class="">, one dof on faces (</span><span style="font-size: 12pt;" class="">(let us call it </span><span style="font-size: 12pt;" class="">F)</span><span style="font-size: 12pt;" class="">) </span><span style="font-size: 12pt;" class="">and one dof on cells </span><span style="font-size: 12pt;" class="">(let us call it </span><span style="font-size: 12pt;" class="">C)</span><span style="font-size: 12pt;" class="">.</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I build<span style="font-size: 12pt;" class=""> a matrix on this DM, and I </span><font size="3" class="">was </font>wondering if there was a way to get blocks (or sub matrices) of this matrix corresponding to specific degrees of freedom, for example rows corresponding to V dofs and columns corresponding to E dofs.</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I already asked this question before and the answer I got was I could call <span style="font-size: 12pt;" class="">PCFieldSplitSetDetectSaddlePoint with the diagonal entries being of the matrix being zero or nonzero. </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">That worked well. Nonetheless, I am curious to know if<span style="font-size: 12pt;" class=""> there was another alternative that does not require creating </span><span style="font-size: 12pt;" class="">a dummy matrix with appropriate diagonal entries and solving a dummy linear system with this matrix to </span><span style="font-size: 12pt;" class="">define the splits. </span></div><p style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""></span></p><p style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""></span></p><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Many thanks.</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Best regards,</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class="">Zakariae</span></div></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 840.828125px;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" class="">petsc-users-bounces@mcs.anl.gov</a>> on behalf of Tang, Qi <<a href="mailto:tangqi@msu.edu" class="">tangqi@msu.edu</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Sunday, April 18, 2021 11:51:59 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Patrick Sanan<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>; Tang, Xianzhu<br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>[EXTERNAL] Re: [petsc-users] Question about PCFieldSplit</font><div class=""> </div></div><div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class="">Thanks a lot, Patrick. We appreciate your help.</div><div class=""><br class=""></div><div class="">Qi<br class=""><div class=""><br class=""></div><br class="Apple-interchange-newline"></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Apr 18, 2021, at 11:30 PM, Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" class="">patrick.sanan@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">We have this functionality in a branch, which I'm working on cleaning up to get to master. It doesn't use PETScSection. Sorry about the delay!<br class=""><div class=""><br class=""></div><div class="">You can only use PCFieldSplitSetDetectSaddlePoint when your diagonal entries being zero or non-zero defines the splits correctly. </div><div class=""><br class=""><blockquote type="cite" class=""><div class="">Am 17.04.2021 um 21:09 schrieb Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>>:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div dir="ltr" class="">On Fri, Apr 16, 2021 at 8:39 PM Jorti, Zakariae via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>> wrote:<br class=""></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div id="gmail-m_7270498382696629604divtagdefaultwrapper" dir="ltr" class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;"><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hello,</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I have a DMStag grid with one dof on each edge and face center. </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I want to use a PCFieldSplit preconditioner on a Jacobian matrix that I assume is already split but I am not sure how to determine the fields. </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">In the DMStag examples (ex2.c and ex3.c), the function PCFieldSplitSetDetectSaddlePoint is used to <font size="3" class="">determine those </font><font size="3" class="">fields based on zero diagonal entries. In my case, I have a Jacobian matrix that does not have </font>zero<font size="3" class=""> diagonal entries. </font></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="3" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">Can I use that </span></font><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">PCFieldSplitSetDetectSaddlePoint in this case? </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">If not, how should I do? </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">Should</span><font size="3" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;"> I do like this example (</span></font><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;"><a href="https://urldefense.com/v3/__https://www.mcs.anl.gov/petsc/petsc-master/src/ksp/ksp/tutorials/ex43.c.html__;!!HXCxUKc!jbBwV2h9luOW4dtBcNh6n_W1ULQnSVeXpxl0Ef1752s4Hlef-nC2JcnksFSO3Q$" target="_blank" class="">https://www.mcs.anl.gov/petsc/petsc-master/src/ksp/ksp/tutorials/ex43.c.html</a>)</span><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">: </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">const PetscInt Bfields[1] = {0},Efields[1] = {1};</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">KSPGetPC(ksp,&pc);</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">PCFieldSplitSetBlockSize(pc,2);</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">PCFieldSplitSetFields(pc,"B",1,Bfields,Bfields); PCFieldSplitSetFields(pc,"E",1,Efields,Efields); </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;">where my B unknowns are defined on face centers and E unknowns are defined on edge centers?</span></div></div></div></blockquote><div class="">That will not work.That interface only works for colocated fields that you get from DMDA.<br class=""></div><div class=""><br class=""></div><div class="">Patrick, does DMSTAG use PetscSection? Then the field split would be automatically calculated. If not, does it maintain the</div><div class="">field division so that it could be given to PCFIELDSPLIT as ISes?</div><div class=""><br class=""></div><div class=""> Thanks,</div><div class=""><br class=""></div><div class=""> Matt</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class=""><div id="gmail-m_7270498382696629604divtagdefaultwrapper" dir="ltr" class="" style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;"><div style="margin-top: 0px; margin-bottom: 0px;" class="">One last thing, I do not know which field comes first. Is it the one defined for face dofs or edge dofs.</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Thank you.</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Best regards,</div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Zakariae</div><div class=""><br class="webkit-block-placeholder"></div></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div dir="ltr" class="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div><div class=""><br class=""></div><div class=""><a href="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!jbBwV2h9luOW4dtBcNh6n_W1ULQnSVeXpxl0Ef1752s4Hlef-nC2JcmGgSwfag$" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a></div></div></div></div></div></div></div></div></div></blockquote></div></div></div></blockquote></div></div></div></blockquote></div><br class=""></div></body></html>