[petsc-users] Neumann Boundary Condition with DMDACreate3D

Barry Smith bsmith at petsc.dev
Thu Jan 4 12:23:51 CST 2024


   Are you referring to the text?

. `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
                         the ghost point value; not yet implemented for 3d


  Looking at the code for DMSetUp_DA_3D() I see

  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");

which seems (to me) to indicate the mirroring is not done for box stencils but should work for star stencils.

Are you using a star stencil or a box stencil?

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.

  Barry


> On Jan 4, 2024, at 1:08 PM, Gourav Kumbhojkar <gourav.kumbhojkar at gmail.com> wrote:
> 
> Hi,
>  
> 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.
> However, the manual pages say that the Mirror Boundary is not supported for 3D.
> Could you please point me to the right resources to implement no flux boundary condition in 3D domains?
>  
> Regards,
> Gourav K.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240104/26b08b61/attachment.html>


More information about the petsc-users mailing list