[petsc-dev] indexing for periodic BC

Barry Smith bsmith at mcs.anl.gov
Fri Jun 17 16:00:58 CDT 2011


  Jungho,

    It is possible that list of elements is not correct for periodic boundary conditions; I've never used it. I'm forwarding this to petsc-dev so Matt can check it and see if the elements make sense and what indices they routine (are the local, global? I don't know) if they are local then maybe you don't need to the MatSetValuesStencil() and just call MatSetValuesLocal().

     Barry

On Jun 17, 2011, at 3:54 PM, Jungho Lee wrote:

> Barry,
> 
> (this is a continuation of what I was talking about yesterday.)  I did
> 
> ierr = DMDACreate2d(PETSC_COMM_WORLD,DMDA_BOUNDARY_PERIODIC,DMDA_BOUNDARY_PERIODIC,DMDA_STENCIL_BOX,
> -3,-3,PETSC_DECIDE,PETSC_DECIDE, 1,
> 1,PETSC_NULL,PETSC_NULL,&user.da2);CHKERRQ(ierr);
> 
> and
> 
> ierr = DMDAGetElements(user.da2,&nele,&nen,&ele);CHKERRQ(ierr);
>  for (i=0;i<nele;i++){
>    idx[0]=ele[3*i]; idx[1]=ele[3*i+1]; idx[2]=ele[3*i+2];
>    xx[0]= _coords[2*idx[0]]; yy[0]= _coords[2*idx[0]+1];
>    xx[1]= _coords[2*idx[1]]; yy[1]= _coords[2*idx[1]+1];
>    xx[2]= _coords[2*idx[2]]; yy[2]= _coords[2*idx[2]+1];
>  }
> }
> 
> and looked at idx[0], idx[1], idx[2], xx[0], yy[0], xx[1], yy[1],
> xx[2], yy[2] for each i.  For each element I marked the three vertices
> and their indices. I attach a scanned copy of my hand-drawn pictures,
> which confuses me quite a bit.
> 
> In the pictures, the points (xx[j],yy[j]), j=0,1,2 are highlighted;
> and then I kind of move them around according to the periodicity so
> that the resulting three points form an element. What confuses me is
> the ordering of the nodes and the elements. For instance for the very
> first element i=0, why is it located way up there (as opposed to being
> located at the bottom left corner)? And wouldn't it be more natural
> for node 6 to be node 0 instead? At the bottom of page 2 I have
> pictures of what I would have found natural.
> 
> Thanks,
> Jungho
> <2061_001.tif>




More information about the petsc-dev mailing list