[petsc-users] DMDA and boundary conditions

Barry Smith bsmith at mcs.anl.gov
Sun Oct 15 20:06:12 CDT 2017


> On Oct 15, 2017, at 6:20 PM, zakaryah . <zakaryah at gmail.com> wrote:
> 
> For finite difference methods, using a DMDA with DMDA_BOUNDARY_GHOSTED is great for Dirichlet boundary conditions, because I can just set the Dirichlet values on the ghost points, correct?

   Yes, 
>  It seems to me that the analogous method for Neumann conditions would be to use a reflecting boundary condition, and if the Neumann values are nonzero, these could be added to the constant vector.

   I am not sure what you mean by "added to the constant vector", what constant vector?


>  Is this correct?  Is DMDA_BOUNDARY_MIRROR supposed to do this?

  Yes

  see http://scicomp.stackexchange.com/questions/5355/writing-the-poisson-equation-finite-difference-matrix-with-neumann-boundary-cond


>  Is it implemented yet, or are there plans to implement it soon?

   It is implemented for 2d; if you need 3d you can try to implement it yourself or ask us and we'll look and see how difficult it might be.

>  Otherwise, is there any way to efficiently implement Neumann conditions besides branching with if statements?  

   Yes, this stuff is here to some degree to eliminate all the horrible if checks in user code.

Barry

> Thanks in advance!







More information about the petsc-users mailing list