[petsc-users] DMDA and boundary conditions

zakaryah . zakaryah at gmail.com
Sun Oct 15 20:52:38 CDT 2017


Thanks for all the answers, Barry!

By constant vector, I just meant the part of the function or Jacobian which
doesn't depend on the state variable.  I am working in 3D - I will have a
look at the code.  To implement, would everything be in da3.c, analogous to
the implementation in da2.c?  In other words - would there be changes in
other source files as well or would they be limited to da3.c?

Thanks again.

On Sun, Oct 15, 2017 at 9:06 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
> > 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!
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171015/63c88bd7/attachment.html>


More information about the petsc-users mailing list