[petsc-users] Accessing array indices in 3D

Matthew Knepley knepley at gmail.com
Tue Nov 30 16:36:10 CST 2010


You need to indicate that the DA is periodic when you create it.

  Matt

On Tue, Nov 30, 2010 at 4:32 PM, khalid ashraf <khalid_eee at yahoo.com> wrote:

> *Thanks Barry. It works fine. Another question, I have a Periodic Boundary*
>
> *condition along x and y. So I want to use the two commented out line below.*
>
> *   for (j=ys; j<ys+ym; j++) {**   for (i=xs; i<xs+xm; i++) {**     if (i<(mx-1))**     {**     Cx=u_localptr[k][j][i+1]-u_localptr[k][j][i];**     }** else**     {**//     Cx=u_localptr[k][j][i]-u_localptr[k][j][0];**     }**     if (j<(my-1))**     {**     Cy=v_localptr[k][j+1][i]-v_localptr[k][j][i];**     }** else**     {*
>
> *** //    Cy=v_localptr[k][j][i]-v_localptr[k][0][i];**     }**
> *
>
> *Is it possible to include these non-local points [k][j][0] or [k][0][i]. Or I have to *
>
> *include the boundary points in the grid ? The same question when forming the A matrix with *
>
> *PBC. How to include the non-neighbour elements within the if statement. *
>
> *
> *
>
> *Thanks.*
>
> *
> *
>
> *Khalid*
>
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20101130/0b2bb6e3/attachment.htm>


More information about the petsc-users mailing list