<p dir="ltr"><br>
On Feb 25, 2014 11:49 AM, "Jed Brown" <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
><br>
> Xiangdong <<a href="mailto:epscodes@gmail.com">epscodes@gmail.com</a>> writes:<br>
> > For example, if the values on the 4-by-4 grid are [1,2,3,4; 5,6,7,8;<br>
> > 9,10,11,12; 13,14,15,16]. If I use 4 processors and set m=2, n=2 (or use<br>
> > petsc_decide), then on processor zero, the local portion of the global<br>
> > vector is 1,2,3,4<br>
><br>
> No, PETSc global ordering is different from natural. There is a<br>
> detailed picture of this in the users manual and in most PETSc<br>
> tutorials. Please read that.<br>
><br>
> > while the local vector has value 1,2,5,6. On processor one, the local<br>
> > portion of the global vector is 5,6,7,8; and the local vector is<br>
> > 3,4,7,8. It looks like the global is natural order, while local vector<br>
> > is petsc order.<br>
><br>
> No.<br>
><br>
> ><br>
> ><br>
> ><br>
> >><br>
> >> > 2) DOF. In each cell, I have two unknowns, say ux and uy. One way is to<br>
> >> > store them using one global vector with dof=2. The other way is to create<br>
> >> > two global vectors for each ux and uy with dof=1. Is one approach better<br>
> >> > than the other?<br>
> >><br>
> >> The former is better for memory streaming unless your operations<br>
> >> traverse the grid using only one at a time (and then, it would be better<br>
> >> to rephrase to traverse fewer times, using both values each time).<br>
> >><br>
> ><br>
> > Any examples in petsc tutorials demonstrating the case dof>1? I found most<br>
> > of them are dof=1. For dof>1, are the values stored in a interleaved<br>
> > manner?<br>
><br>
> src/snes/examples/tutorials/ex48.c uses dof=2 and MatSetValuesBlockedStencil.</p>
<p dir="ltr">SNES ex19 uses 4 dof and is much simpler.</p>
<p dir="ltr"> Matt<br>
</p>