<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt"><div><div>It doesn't seem like the problem is with the natural ordering. Since in Fig.9 of the manual,</div><div>the highest number of the grid should be the same(30 in fig. 9) for natural and petsc ordering.</div><div>But I get a lower number when I print it.&nbsp;</div><div><br></div><div>I also tried the petsc to natural conversion using the following code, &nbsp;&nbsp;</div><div><div>&nbsp;&nbsp; {</div><div><div>&nbsp;&nbsp; &nbsp;ia[0]=(PetscInt)((k)*(my)*(mx)+(j)*(mx)+(i));</div><div>&nbsp;&nbsp; &nbsp;AOPetscToApplication(ao,1,ia);</div><div>&nbsp;&nbsp;&nbsp; &nbsp;w_localptr[k][j][i] = ia[0];</div><div>PetscPrintf(PETSC_COMM_WORLD,"%d\n",ia[0]);</div><div>}</div><div>But this gives even lower number for the highest index.</div><div><br></div><div>Anyway my goal is to be able to determine the
 global natural index of the&nbsp;</div><div>grid within the for loops in the following way:</div></div></div><div>for (k=zs; k&lt;zs+zm; k++) {</div><div>&nbsp;&nbsp;for (j=ys; j&lt;ys+ym; j++) {</div><div>&nbsp;&nbsp;for (i=xs; i&lt;xs+xm; i++) {</div><div>natural_global_coordinate(k',j',i')=f(k,j,i);</div><div>if natural_global_coord[k'][j'][i'] &gt; half of the grid along x {Do something}</div><div><div>if natural_global_coord[k'][j'][i'] &gt; half of the grid along y {Do something}</div><div>etc..</div></div><div>}}}&nbsp;</div><div>Could you please suggest what would be the simplest way to achieve this.&nbsp;</div><div>Thanks in advance.</div><div><br></div><div><br></div><div><br></div></div><div style="position:fixed"></div>


</div><br>

      </body></html>