<div dir="ltr"><div class="gmail_default" style="font-size:small">Thanks for all the answers, Barry!</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks again.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 15, 2017 at 9:06 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Oct 15, 2017, at 6:20 PM, zakaryah . <<a href="mailto:zakaryah@gmail.com">zakaryah@gmail.com</a>> wrote:<br>
><br>
> 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?<br>
<br>
</span>   Yes,<br>
<span class="">>  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.<br>
<br>
</span>   I am not sure what you mean by "added to the constant vector", what constant vector?<br>
<span class=""><br>
<br>
>  Is this correct?  Is DMDA_BOUNDARY_MIRROR supposed to do this?<br>
<br>
</span>  Yes<br>
<br>
  see <a href="http://scicomp.stackexchange.com/questions/5355/writing-the-poisson-equation-finite-difference-matrix-with-neumann-boundary-cond" rel="noreferrer" target="_blank">http://scicomp.stackexchange.<wbr>com/questions/5355/writing-<wbr>the-poisson-equation-finite-<wbr>difference-matrix-with-<wbr>neumann-boundary-cond</a><br>
<span class=""><br>
<br>
>  Is it implemented yet, or are there plans to implement it soon?<br>
<br>
</span>   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.<br>
<span class=""><br>
>  Otherwise, is there any way to efficiently implement Neumann conditions besides branching with if statements?<br>
<br>
</span>   Yes, this stuff is here to some degree to eliminate all the horrible if checks in user code.<br>
<br>
Barry<br>
<br>
> Thanks in advance!<br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div><br></div>