[petsc-users] DMDA and boundary conditions

Jed Brown jed at jedbrown.org
Sun Oct 15 22:04:28 CDT 2017


"zakaryah ." <zakaryah at gmail.com> writes:

> 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.  

If you need inhomogeneous Neumann, you'll have to modify the ghost
value.  MIRROR is really a cheap hack -- for anything more general, you
can use GHOSTED and use whatever algorithm you like to fill in those
ghost values.  Also, rather than think of the Neumann boundary condition
as being a centered first derivative, I like to think about it as
extending the domain of the PDE after imposing some (biased) symmetry.
This gives you a consistent scaling for the equation and doesn't require
a new "stencil".

> 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?

It looks like it is implemented for 3D, at least in the sense that there
are the requisite number of conditionals on DM_BOUNDARY_MIRROR.  You
might just need to remove the stale line at the top that sets an error
claiming that DM_BOUNDARY_MIRROR is not implemented.  Let us know if
that works.


More information about the petsc-users mailing list