DA periodic
Barry Smith
bsmith at mcs.anl.gov
Thu Dec 7 07:33:36 CST 2006
Jianing,
There is no "by hand" in PETSc! All you do is acess the next
set of grid points to via the indices in the usual way. So
in two dimensions to access the values to the "left of x[j][0]
use x[j][-1] to the right of x[j][nx-1] use x[j][nx]. (Recall the
i,j indices are reversed in the C array syntax, nx is the total
number of grid points in the x direction). Here, as an example, I
am talking about periodic in X, same thing is true for y and z.
(If you have a stencil width of 2 you can acess via x[j][-2].
In other words, don't think at all about the periodicity,
just write local loops over the processes domain and everything
will work!
Barry
There is something seriously wrong with PETSc's documentation
on periodic DA's. For some reason everyone seems to think it
has to be hard.
On Thu, 7 Dec 2006, Jianing Shi wrote:
> Thanks for your reply.
>
> > > 2) If I use the periodic type for DA, together with SNES to
> > solve a
> > > system, when I implement the FormFunctionLocal, I need to
> > > explicitly implement the boundary conditions? Or does DA
> > periodic
> > > type has some built-in functionality?
> >
> > I am not sure what boundary conditions you mean. If it is
> > periodic,
> > there should be no conditions on that boundary.
>
> Well, you are right, not "boundary condition". I was thinking about
> some short-range interactions between grid points. What I really
> meant is actually handling the iteractions on the boundary, which
> should be wrapped around periodically. I can implement that by
> hand, though just checking if there was something built-in already.
>
> Jianing
>
>
More information about the petsc-users
mailing list