<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Patrick,</p>
<p><br>
</p>
<p>Thanks for your recent updates on DMStag. <br>
After getting the Finite Difference Coloring to work with our solver, I was testing that DMCreateFieldDecomposition routine that you added last week.<br>
It seems to work fine when there is only one unknown per location (i.e. one unknown on vertices and/or one unknown on edges <span>and/or</span> one unknown on faces and/or one unknown on elements).
<br>
That being said, when there is more than one unknown in some location (let's say 2 unknowns on vertices for instance), I could not get the ISs for those two unknowns with that routine.
<br>
Should I still rely on <span>PCFieldSplitSetDetectSaddlePoint in this case? <br>
Many thanks once again.</span></p>
<p><span><br>
</span></p>
<p><span>Kind regards,</span></p>
<p><span><br>
</span></p>
<p><span>Zakariae</span><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Patrick Sanan <patrick.sanan@gmail.com><br>
<b>Sent:</b> Tuesday, January 25, 2022 5:36:17 AM<br>
<b>To:</b> Matthew Knepley<br>
<b>Cc:</b> Jorti, Zakariae; petsc-users@mcs.anl.gov; Tang, Xianzhu; Dave May<br>
<b>Subject:</b> [EXTERNAL] Re: [petsc-users] Question about PCFieldSplit</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Here is an MR which intends to introduce some logic to support DMCreateFieldDecomposition(). It doesn't use the PetscSection approach, which might be preferable, but nonetheless is a necessary component so It'd like to get it in, even if it has room for
further optimization. Hopefully this can be followed fairly soon with some more examples and tests using PCFieldSplit itself.<br>
</div>
<div><br>
</div>
<a href="https://gitlab.com/petsc/petsc/-/merge_requests/4740">https://gitlab.com/petsc/petsc/-/merge_requests/4740</a></div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Am Mi., 23. Juni 2021 um 12:15 Uhr schrieb Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>>:<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 Wed, Jun 23, 2021 at 12:51 AM Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" target="_blank">patrick.sanan@gmail.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>Hi Zakariae -
<div><br>
</div>
<div>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><br>
</div>
<div>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><br>
</div>
<div>I'll track it down and see if it can quickly be added to the main branch.</div>
</div>
</blockquote>
<div><br>
</div>
<div>Note that an easy way to keep track of this would be to create a section with the different locations as fields. This Section could then</div>
<div>easily create the ISes, and could automatically interface with PCFIELDSPLIT.</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><br>
</div>
<div>[1]: <a href="https://petsc.org/release/docs/manualpages/Mat/MatCreateSubMatrix.html" target="_blank">https://petsc.org/release/docs/manualpages/Mat/MatCreateSubMatrix.html</a></div>
<div>
<div><br>
<blockquote type="cite">
<div>Am 22.06.2021 um 22:29 schrieb Jorti, Zakariae <<a href="mailto:zjorti@lanl.gov" target="_blank">zjorti@lanl.gov</a>>:</div>
<br>
<div>
<div id="gmail-m_-5733178733423345157gmail-m_-1091354116591157518divtagdefaultwrapper" 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;text-decoration:none;font-size:12pt;font-family:Calibri,Helvetica,sans-serif">
<div style="margin-top:0px;margin-bottom:0px">Hello,</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">I am working on DMStag and I have one dof on vertices (let us call it V), <span style="font-size:12pt">one dof on edges </span><span style="font-size:12pt">(let us call it </span><span style="font-size:12pt">E)</span><span style="font-size:12pt">,
one dof on faces (</span><span style="font-size:12pt">(let us call it </span><span style="font-size:12pt">F)</span><span style="font-size:12pt">) </span><span style="font-size:12pt">and one dof on cells </span><span style="font-size:12pt">(let us call it </span><span style="font-size:12pt">C)</span><span style="font-size:12pt">.</span></div>
<div style="margin-top:0px;margin-bottom:0px">I build<span style="font-size:12pt"> a matrix on this DM, and I </span><font size="3">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">I already asked this question before and the answer I got was I could call <span style="font-size:12pt">PCFieldSplitSetDetectSaddlePoint with the diagonal entries being of the matrix being zero or nonzero. </span></div>
<div style="margin-top:0px;margin-bottom:0px">That worked well. Nonetheless, I am curious to know if<span style="font-size:12pt"> there was another alternative that does not require creating </span><span style="font-size:12pt">a dummy matrix with appropriate diagonal
entries and solving a dummy linear system with this matrix to </span><span style="font-size:12pt">define the splits. </span></div>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"></span></p>
<p style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"></span></p>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">Many thanks.</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">Best regards,</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt"><br>
</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt">Zakariae</span></div>
</div>
<hr style="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;text-decoration:none;display:inline-block;width:840.828px">
<span style="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;text-decoration:none;float:none;display:inline"></span>
<div id="gmail-m_-5733178733423345157gmail-m_-1091354116591157518divRplyFwdMsg" dir="ltr" style="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;text-decoration:none">
<font style="font-size:11pt" face="Calibri, sans-serif"><b>From:</b><span> </span>petsc-users <<a href="mailto:petsc-users-bounces@mcs.anl.gov" target="_blank">petsc-users-bounces@mcs.anl.gov</a>> on behalf of Tang, Qi <<a href="mailto:tangqi@msu.edu" target="_blank">tangqi@msu.edu</a>><br>
<b>Sent:</b><span> </span>Sunday, April 18, 2021 11:51:59 PM<br>
<b>To:</b><span> </span>Patrick Sanan<br>
<b>Cc:</b><span> </span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>; Tang, Xianzhu<br>
<b>Subject:</b><span> </span>[EXTERNAL] Re: [petsc-users] Question about PCFieldSplit</font>
<div> </div>
</div>
<div style="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;text-decoration:none">
<div>Thanks a lot, Patrick. We appreciate your help.</div>
<div><br>
</div>
<div>Qi<br>
<div><br>
</div>
<br>
</div>
<div><br>
<blockquote type="cite">
<div>On Apr 18, 2021, at 11:30 PM, Patrick Sanan <<a href="mailto:patrick.sanan@gmail.com" target="_blank">patrick.sanan@gmail.com</a>> wrote:</div>
<br>
<div>
<div>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>
<div><br>
</div>
<div>You can only use PCFieldSplitSetDetectSaddlePoint when your diagonal entries being zero or non-zero defines the splits correctly. </div>
<div><br>
<blockquote type="cite">
<div>Am 17.04.2021 um 21:09 schrieb Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>>:</div>
<br>
<div>
<div dir="ltr" style="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;text-decoration:none">
<div dir="ltr">On Fri, Apr 16, 2021 at 8:39 PM Jorti, Zakariae via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</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 dir="ltr">
<div id="gmail-m_-5733178733423345157gmail-m_-1091354116591157518gmail-m_7270498382696629604divtagdefaultwrapper" dir="ltr" style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">
<div style="margin-top:0px;margin-bottom:0px">Hello,</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">I have a DMStag grid with one dof on each edge and face center. </div>
<div style="margin-top:0px;margin-bottom:0px">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">In the DMStag examples (ex2.c and ex3.c), the function PCFieldSplitSetDetectSaddlePoint is used to <font size="3">determine those </font><font size="3">fields based on zero diagonal entries. In my case, I have a
Jacobian matrix that does not have </font>zero<font size="3"> diagonal entries. </font></div>
<div style="margin-top:0px;margin-bottom:0px"><font size="3"><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">Can I use that </span></font><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">PCFieldSplitSetDetectSaddlePoint
in this case? </span></div>
<div style="margin-top:0px;margin-bottom:0px"><span 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"><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">Should</span><font size="3"><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif"> I do like this example (</span></font><span 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">https://www.mcs.anl.gov/petsc/petsc-master/src/ksp/ksp/tutorials/ex43.c.html</a>)</span><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">: </span></div>
<div style="margin-top:0px;margin-bottom:0px"><span 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"><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">KSPGetPC(ksp,&pc);</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">PCFieldSplitSetBlockSize(pc,2);</span></div>
<div style="margin-top:0px;margin-bottom:0px"><span 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"><span 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>That will not work.That interface only works for colocated fields that you get from DMDA.<br>
</div>
<div><br>
</div>
<div>Patrick, does DMSTAG use PetscSection? Then the field split would be automatically calculated. If not, does it maintain the</div>
<div>field division so that it could be given to PCFIELDSPLIT as ISes?</div>
<div><br>
</div>
<div> Thanks,</div>
<div><br>
</div>
<div> Matt</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 id="gmail-m_-5733178733423345157gmail-m_-1091354116591157518gmail-m_7270498382696629604divtagdefaultwrapper" dir="ltr" style="font-size:12pt;font-family:Calibri,Helvetica,sans-serif">
<div style="margin-top:0px;margin-bottom:0px">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"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">Thank you.</div>
<div style="margin-top:0px;margin-bottom:0px">Best regards,</div>
<div style="margin-top:0px;margin-bottom:0px"><br>
</div>
<div style="margin-top:0px;margin-bottom:0px">Zakariae</div>
<div><br>
</div>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
--<span> </span><br>
<div dir="ltr">
<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="https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!jbBwV2h9luOW4dtBcNh6n_W1ULQnSVeXpxl0Ef1752s4Hlef-nC2JcmGgSwfag$" target="_blank">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>
</div>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<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>
</div>
</body>
</html>