[petsc-users] question about DA

Likun Tan likunt at andrew.cmu.edu
Sat Aug 27 15:10:59 CDT 2011


Dear all,

I have a code which works fine with uniprocessor, but it gets errors with
2 np.

The errors come from the following part:

DAGetCorners(da3D, &xs, &ys, &zs, &m, &n, &p);
DAVecGetArray(da3D, Vtemp, &temp);
for(k=zs; k<zs+p; k++) {
   for(j=ys; j<ys+n; j++)  {
       for(i=xs; i<xs+m; i++)  {
          temp[k][j][i]=f(i,j,k); //function evalution
        }
    }
}
DAGetCorners(da3D, &xs, &ys, &zs, &m, &n, &p);
DAVecGetArray(da3D, VH, &H);
for(k=zs; k<zs+p; k++) {
   for(j=ys; j<ys+n; j++)  {
       for(i=xs; i<xs+m; i++)  {
          H[k][j][i]=f(temp); //function evalution
        }
    }
}
DAGetCorners(da2D, &xs, &ys, 0, &m, &n, 0);
DAVecGetArray(da2D, VS, &S);
for(j=ys; j<ys+n; j++)  {
     for(i=xs; i<xs+m; i++)  {
          S[j][i]=g(temp); //function evalution
     }
}

f(temp) and g(temp) are functions of temp[k][j][i], when i assigned values
to H, there is no error; while when setting values to S using temp, it
gives errors, if using f(i,j,k) to assign values to S, it works fine.

Any suggestions?

best,
LIkun









More information about the petsc-users mailing list