<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> Ok, I now understand what you are reporting and am working on a fix. <div><br></div><div> From the manual pages I see</div><div><br></div><div><div> DMBoundaryType - Describes the choice for the filling of ghost cells on physical domain boundaries.</div><div><br></div><div> Values:</div><div>+ `DM_BOUNDARY_NONE` - no ghost nodes</div><div>. `DM_BOUNDARY_GHOSTED` - ghost vertices/cells exist but aren't filled; you can put values into them and then apply a stencil that uses those ghost locations</div><div>. `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</div><div> the ghost point value; not yet implemented for 3d</div><div><br></div><div> ....</div><div><br></div><div> Developer Note:</div><div> Should `DM_BOUNDARY_MIRROR` have the same meaning with DMDA_Q0, that is a staggered grid? In that case should the ghost point have the same value</div><div> as the 0th grid point where the physical boundary serves as the mirror?</div><div><br></div><div> I assume you are working with a "vertex valued" stencil as opposed to the cell-centered values where mirror possibly has a different interpretation?</div><div><br></div><div><br><blockquote type="cite"><div>On Jan 8, 2024, at 3:44 PM, Gourav Kumbhojkar <gourav.kumbhojkar@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">You are right. Attaching the code that I’m using to test this.<o:p></o:p></span></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">The output matrix is saved in separate ascii files.<o:p></o:p></span></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">You can use “make noflux” to compile the code.<o:p></o:p></span></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Gourav<o:p></o:p></span></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div id="mail-editor-reference-message-container"><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; border-image: none; padding: 3pt 0in 0in;"><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 12pt; font-family: Aptos, sans-serif;">From:<span class="Apple-converted-space"> </span></span></b><span style="font-size: 12pt; font-family: Aptos, sans-serif;">Barry Smith <<a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">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: 12pt; font-family: Arial, sans-serif;"> </span><span style="font-size: 12pt; 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" style="color: blue; text-decoration: underline;">gourav.kumbhojkar@gmail.com</a>><br><b>Cc:<span class="Apple-converted-space"> </span></b><a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a><span class="Apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a>><br><b>Subject:<span class="Apple-converted-space"> </span></b>Re: [petsc-users] Neumann Boundary Condition with DMDACreate3D<o:p></o:p></span></p></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> 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).<o:p></o:p></span></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Barry<o:p></o:p></span></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><br><br><o:p></o:p></span></div><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">On Jan 6, 2024, at 7:30 PM, Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com" style="color: blue; text-decoration: underline;">gourav.kumbhojkar@gmail.com</a>> wrote:<o:p></o:p></span></div></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div><div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Thank<span class="apple-converted-space"> </span><span class="grame">you, Barry</span>. Sorry for the late response.</span><o:p></o:p></div></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 11pt;">TLDR version</span></b><span class="apple-converted-space"><span style="font-size: 11pt;"> </span></span><span style="font-size: 11pt;">of the whole message typed below –</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 11pt;">Long version</span></b><span class="apple-converted-space"><span style="font-size: 11pt;"> </span></span><span style="font-size: 11pt;">-</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Here’s what I’m trying to do –</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Step 1 - Create a 3D DM</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">ierr<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(220, 220, 170);">DMDACreate3d</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(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: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">NULL</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">NULL</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">NULL</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">&</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">da);<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(220, 220, 170);">CHKERRQ</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(ierr);</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Note - num_pts = 4 in my code.</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Step 2 – Create a Matrix from DM ( a FDM stiffness matrix)</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(220, 220, 170);">DMCreateMatrix</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(da,<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">&</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">K);</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(220, 220, 170);">globalKMat</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(K, info);</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">“globalKMat” is a user-defined function. Here’s a snippet from this function:</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(197, 134, 192);">for</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">int</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">i<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">xs</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">; i<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);"><</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">xs</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">+</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">xm</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">); i</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">++</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">){</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(197, 134, 192);">for</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">int</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">j<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">ys</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">; j<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);"><</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">ys</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">+</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">ym</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">); j</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">++</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">){</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(197, 134, 192);">for</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(86, 156, 214);">int</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">k<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">zs</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">; k<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);"><</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">(</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">zs</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">+</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">info</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">zm</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">); k</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">++</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">){</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> ncols<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">;</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">row</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">i</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">i;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">row</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">j</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">j;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">row</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">k</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">k;</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">i</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">i;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">j</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">j;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">0</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">k</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">k;</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">vals</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[ncols</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">++</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">]<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">-</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">6.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">;</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(106, 153, 85);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(106, 153, 85);">//ncols=1</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[ncols].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">i</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">i</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">-</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">1</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[ncols].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">j</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">j;<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">col</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[ncols].</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">k</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">k;</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif; line-height: 13.5pt; background: rgb(31, 31, 31);"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> <span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(156, 220, 254);">vals</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">[ncols</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">++</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">]<span class="apple-converted-space"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(212, 212, 212);">=</span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);"> </span></span><span style="font-size: 9pt; font-family: Menlo; color: rgb(181, 206, 168);">1.</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(204, 204, 204);">;</span><span style="font-size: 9pt; font-family: Menlo; color: rgb(106, 153, 85);">//ncols=2</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Step 3 – View the stiffness matrix to check the values. I use MatView for this.</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Here are the results –</span><o:p></o:p></div></div><ol start="1" type="1" style="margin-bottom: 0in; margin-top: 0in;"><li class="MsoListParagraph" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">3D DM (showing first few rows of the stiffness matrix here, the original matrix is 64x64)-<span style="font-size: 10pt;"><o:p></o:p></span></li></ol><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Mat Object: 1 MPI processes</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> type: seqaij</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 0: (0, -3.) (1, 1.) (4, 1.) (16, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 1: (0, 1.) (1, -4.) (2, 1.) (5, 1.) (17, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 2: (1, 1.) (2, -4.) (3, 1.) (6, 1.) (18, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 3: (2, 1.) (3, -3.) (7, 1.) (19, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 4: (0, 1.) (4, -4.) (5, 1.) (8, 1.) (20, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 5: (1, 1.) (4, 1.) (5, -5.) (6, 1.) (9, 1.) (21, 1.)</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><ol start="2" type="1" style="margin-bottom: 0in; margin-top: 0in;"><li class="MsoListParagraph" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">Repeat the same steps for a 2D DM to show the difference (the entire matrix is now 16x16)<span style="font-size: 10pt;"><o:p></o:p></span></li></ol><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Mat Object: 1 MPI processes</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> type: seqaij</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 0: (0, -4.) (1, 2.) (4, 2.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 1: (0, 1.) (1, -4.) (2, 1.) (5, 2.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 2: (1, 1.) (2, -4.) (3, 1.) (6, 2.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 3: (2, 2.) (3, -4.) (7, 2.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 4: (0, 1.) (4, -4.) (5, 2.) (8, 1.)</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">row 5: (1, 1.) (4, 1.) (5, -4.) (6, 1.) (9, 1.)</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Thank you.</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Gourav</span><o:p></o:p></div></div><div style="margin-left: 0.5in;"><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div></div><div id="mail-editor-reference-message-container"><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-image: none; padding: 3pt 0in 0in; border-color: currentcolor;"><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 12pt; font-family: Aptos, sans-serif;">From:<span class="apple-converted-space"> </span></span></b><span style="font-size: 12pt; font-family: Aptos, sans-serif;">Barry Smith <<a href="mailto:bsmith@petsc.dev" style="color: blue; text-decoration: underline;">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: 12pt; font-family: Arial, sans-serif;"> </span><span style="font-size: 12pt; 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" style="color: blue; text-decoration: underline;">gourav.kumbhojkar@gmail.com</a>><br><b>Cc:<span class="apple-converted-space"> </span></b><a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a><span class="apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">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 style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Are you referring to the text?</span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">. `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></div></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> the ghost point value; not yet implemented for 3d</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Looking at the code for DMSetUp_DA_3D() I see</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> 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></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Are you using a star stencil or a box stencil?</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Barry</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 10pt; font-family: Calibri, sans-serif;"> <o:p></o:p></p><blockquote style="margin-top: 5pt; margin-bottom: 5pt;"><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">On Jan 4, 2024, at 1:08 PM, Gourav Kumbhojkar <<a href="mailto:gourav.kumbhojkar@gmail.com" style="color: blue; text-decoration: underline;">gourav.kumbhojkar@gmail.com</a>> wrote:</span><o:p></o:p></div></div></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div><div><div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Hi,</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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></div></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">However, the manual pages say that the Mirror Boundary is not supported for 3D.</span><o:p></o:p></div></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Could you please point me to the right resources to implement no flux boundary condition in 3D domains?</span><o:p></o:p></div></div></div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> </span><o:p></o:p></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Regards,</span><o:p></o:p></div></div></div><div><div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Gourav K.</span><o:p></o:p></div></div></div></div></div></blockquote></div></div></div></div></div></div></div></blockquote></div><div style="margin: 0in; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div></div></div></div></div><span id="cid:BBEFF736-B7D2-4194-BF27-46CC0F8AFBD9"><noflux_check.c></span><span id="cid:26DC0327-D21F-431E-ABA9-1DA47B5D4405"><makefile></span></div></blockquote></div><br></div></body></html>