<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Aptos;
panose-1:2 11 0 4 2 2 2 2 2 4;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.grame
{mso-style-name:grame;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1107577114;
mso-list-template-ids:-2104463980;}
@list l0:level1
{mso-level-start-at:2;
mso-level-tab-stop:.5in;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1
{mso-list-id:1414625373;
mso-list-template-ids:-1092839856;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word;line-break:after-white-space">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">The fix works well. Sorry for the delayed update.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Thanks again.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif">Gourav<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Aptos",sans-serif"><o:p> </o:p></span></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">Gourav Kumbhojkar <gourav.kumbhojkar@gmail.com><br>
<b>Date: </b>Tuesday, January 9, 2024 at 11:50</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">PM<br>
<b>To: </b>Barry Smith <bsmith@petsc.dev><br>
<b>Cc: </b>petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject: </b>Re: [petsc-users] Neumann Boundary Condition with DMDACreate3D<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank you very much for the fix. I’ll also update here as soon as I test it on my application code.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Many thanks.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Gourav</span><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">From:
</span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">Barry Smith <bsmith@petsc.dev><br>
<b>Date: </b>Tuesday, January 9, 2024 at 8:59</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><span style="font-size:12.0pt;font-family:"Aptos",sans-serif;color:black">PM<br>
<b>To: </b>Gourav Kumbhojkar <gourav.kumbhojkar@gmail.com><br>
<b>Cc: </b>petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject: </b>Re: [petsc-users] Neumann Boundary Condition with DMDACreate3D</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Sorry for the delay. The fix is in the git branch </span><b><span style="font-size:12.0pt;font-family:Menlo;color:#C814C9">barry/2024-01-09/fix-mirror-dmda-3d/release
</span></b><span style="font-size:11.0pt"> see also <span class="MsoHyperlink">https://gitlab.com/petsc/petsc/-/merge_requests/7175</span> </span><o:p></o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Barry</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Jan 8, 2024, at 3:44 PM, Gourav Kumbhojkar <gourav.kumbhojkar@gmail.com> wrote:</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">You are right. Attaching the code that I’m using to test this.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">The output matrix is saved in separate ascii files.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">You can use “make noflux” to compile the code.</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Gourav</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:currentcolor currentcolor">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Saturday, January 6, 2024 at 7:08</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">PM<br>
<b>To:<span class="apple-converted-space"> </span></b>Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com">gourav.kumbhojkar@gmail.com</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></b><a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><span class="apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:<span class="apple-converted-space"> </span></b>Re: [petsc-users] Neumann Boundary Condition with DMDACreate3D</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> If the mirror code for star stencil is just wrong in 3d we should simply fix it. Not use some other approach. Can you attach code that tries to do what you need for both 2d (that results in a matrix you
are happy with) and 3d (that results in a matrix that you are not happy with).</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Barry</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Jan 6, 2024, at 7:30 PM, Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com">gourav.kumbhojkar@gmail.com</a>> wrote:</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank<span class="apple-converted-space"> </span><span class="grame">you, Barry</span>. Sorry for the late response.</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Yes, I was referring to the same text. I am using a star stencil. However, I don’t think the mirror condition is implemented for star stencil either.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">TLDR version</span></b><span class="apple-converted-space"><span style="font-size:11.0pt"> </span></span><span style="font-size:11.0pt">of the whole message typed below –</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I think DM_BOUNDARY_GHOSTED is not implemented correctly in 3D. It appears that ghost nodes are mirrored with boundary nodes themselves. They should mirror with the nodes next to boundary.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:11.0pt">Long version</span></b><span class="apple-converted-space"><span style="font-size:11.0pt"> </span></span><span style="font-size:11.0pt">-</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Here’s what I’m trying to do –</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Step 1 - Create a 3D DM</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">ierr<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#DCDCAA">DMDACreate3d</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(PETSC_COMM_WORLD,
DM_BOUNDARY_MIRROR, DM_BOUNDARY_MIRROR, DM_BOUNDARY_MIRROR, DMDA_STENCIL_STAR, num_pts, num_pts, num_pts, PETSC_DECIDE, PETSC_DECIDE, PETSC_DECIDE,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">1</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">1</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">NULL</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">NULL</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">NULL</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">&</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">da);<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#DCDCAA">CHKERRQ</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(ierr);</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Note - num_pts = 4 in my code.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Step 2 – Create a Matrix from DM ( a FDM stiffness matrix)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#DCDCAA">DMCreateMatrix</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(da,<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">&</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">K);</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#DCDCAA">globalKMat</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(K, info);</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">“globalKMat” is a user-defined function. Here’s a snippet from this function:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#C586C0">for</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">int</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">i<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">xs</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;
i<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4"><</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">xs</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">+</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">xm</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">);
i</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">++</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">){</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#C586C0">for</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">int</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">j<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">ys</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;
j<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4"><</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">ys</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">+</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">ym</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">);
j</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">++</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">){</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#C586C0">for</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#569CD6">int</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">k<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">zs</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;
k<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4"><</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">(</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">zs</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">+</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">info</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">zm</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">);
k</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">++</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">){</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> ncols<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">0</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">row</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">i</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">i;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">row</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">j</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">j;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">row</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">.</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">k</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">k;</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[</span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">0</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">i</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">i;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[</span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">0</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">j</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">j;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[</span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">0</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">k</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">k;</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">vals</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[ncols</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">++</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">]<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">-</span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">6.</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#6A9955"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#6A9955">//ncols=1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[ncols].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">i</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">i</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">-</span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">1</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[ncols].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">j</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">j;<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">col</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[ncols].</span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">k</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">k;</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="line-height:13.5pt;background:#1F1F1F"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> <span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#9CDCFE">vals</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">[ncols</span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">++</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">]<span class="apple-converted-space"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#D4D4D4">=</span><span class="apple-converted-space"><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC"> </span></span><span style="font-size:9.0pt;font-family:Menlo;color:#B5CEA8">1.</span><span style="font-size:9.0pt;font-family:Menlo;color:#CCCCCC">;</span><span style="font-size:9.0pt;font-family:Menlo;color:#6A9955">//ncols=2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">There are total 7 “ncols”. Other than the first one all ncols have value 1 (first one is set to -6). As you can see, this step is to only build the FDM stiffness matrix. I use “ADD_VALUES” at the end in the
above function.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Step 3 – View the stiffness matrix to check the values. I use MatView for this.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Here are the results –</span><o:p></o:p></p>
</div>
</div>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l1 level1 lfo1">
3D DM (showing first few rows of the stiffness matrix here, the original matrix is 64x64)-<o:p></o:p></li></ol>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Mat Object: 1 MPI processes</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> type: seqaij</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 0: (0, -3.) (1, 1.) (4, 1.) (16, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 1: (0, 1.) (1, -4.) (2, 1.) (5, 1.) (17, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 2: (1, 1.) (2, -4.) (3, 1.) (6, 1.) (18, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 3: (2, 1.) (3, -3.) (7, 1.) (19, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 4: (0, 1.) (4, -4.) (5, 1.) (8, 1.) (20, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 5: (1, 1.) (4, 1.) (5, -5.) (6, 1.) (9, 1.) (21, 1.)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<ol style="margin-top:0in" start="2" type="1">
<li class="MsoListParagraph" style="margin-top:0in;margin-bottom:0in;mso-list:l0 level1 lfo2">
Repeat the same steps for a 2D DM to show the difference (the entire matrix is now 16x16)<o:p></o:p></li></ol>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Mat Object: 1 MPI processes</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> type: seqaij</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 0: (0, -4.) (1, 2.) (4, 2.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 1: (0, 1.) (1, -4.) (2, 1.) (5, 2.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 2: (1, 1.) (2, -4.) (3, 1.) (6, 2.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 3: (2, 2.) (3, -4.) (7, 2.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 4: (0, 1.) (4, -4.) (5, 2.) (8, 1.)</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">row 5: (1, 1.) (4, 1.) (5, -4.) (6, 1.) (9, 1.)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I suspect that when using “DM_BOUNDARY_MIRROR” in 3D, the ghost node value is added to the boundary node itself, which would explain why row 0 of the stiffness matrix has -3 instead of -6. In principle the
ghost node value should be mirrored with the node next to boundary.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Clearly, there’s no issue with the 2D implementation of the mirror boundary. The row 0 values are -4, 2, and 2 as expected.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Let me know if I should give any other information about this. I also thought about using DM_BOUNDARY_GHOSTED and implement the mirror boundary in 3D from scratch but I would really appreciate some resources
on how to do that.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank you.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Gourav</span><o:p></o:p></p>
</div>
</div>
<div style="margin-left:.5in">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div id="mail-editor-reference-message-container">
<div>
<div style="border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:currentcolor">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">From:<span class="apple-converted-space"> </span></span></b><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>><br>
<b>Date:<span class="apple-converted-space"> </span></b>Thursday, January 4, 2024 at 12:24</span><span style="font-size:12.0pt;font-family:"Arial",sans-serif"> </span><span style="font-size:12.0pt;font-family:"Aptos",sans-serif">PM<br>
<b>To:<span class="apple-converted-space"> </span></b>Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com">gourav.kumbhojkar@gmail.com</a>><br>
<b>Cc:<span class="apple-converted-space"> </span></b><a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><span class="apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
<b>Subject:<span class="apple-converted-space"> </span></b>Re: [petsc-users] Neumann Boundary Condition with DMDACreate3D</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Are you referring to the text?</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">. `DM_BOUNDARY_MIRROR` - the ghost value is the same as the value 1 grid point in; that is, the 0th grid point in the real mesh acts like a mirror to define</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> the ghost point value; not yet implemented for 3d</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Looking at the code for DMSetUp_DA_3D() I see</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> PetscCheck(stencil_type != DMDA_STENCIL_BOX || (bx != DM_BOUNDARY_MIRROR && by != DM_BOUNDARY_MIRROR && bz != DM_BOUNDARY_MIRROR), PetscObjectComm((PetscObject)da), PETSC_ERR_SUP, "Mirror boundary and box
stencil");</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">which seems (to me) to indicate the mirroring is not done for box stencils but should work for star stencils.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Are you using a star stencil or a box stencil?</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I believe the code is not complete for box stencil because the code to determine the location of the "mirrored point" for extra "box points" is messy in 3d and no one wrote it. You can compare DMSetUp_DA_2D()
and DMSetUp_DA_3D() to see what is missing and see if you can determine how to add it for 3d.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> Barry</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">On Jan 4, 2024, at 1:08 PM, Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com">gourav.kumbhojkar@gmail.com</a>> wrote:</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Hi,</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">I am trying to implement a No-flux boundary condition for a 3D domain. I previously modeled a no flux boundary in 2D domain using DMDACreate2D and “PETSC_BOUNDARY_MIRROR” which worked well.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">However, the manual pages say that the Mirror Boundary is not supported for 3D.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Could you please point me to the right resources to implement no flux boundary condition in 3D domains?</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Regards,</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Gourav K.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"><noflux_check.c><makefile></span><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>