Dear all

I want to subtract an array at t-dt and t times only at the base grid (refinement level 0),  following http://lists.einsteintoolkit.org/pipermail/users/2013-May/003004.html, I implemented the suggestion in my code as
BEGIN_GLOBAL_MODE(cctkGH) {
  ENTER_LEVEL_MODE(cctkGH, 0) {

 for(int k=0;k<cctk_lsh[2];k++) { 
        for(int j=0;j<cctk_lsh[1];j++) { 
            for(int i=0;i<cctk_lsh[0];i++) { 
                int index= CCTK_GFINDEX3D(cctkGH,i,j,k);
                lres += abs(phi[index]-phi_p[index]);
             }
        }
  }
 } LEAVE_LEVEL_MODE;
} END_GLOBAL_MODE;
However I got a segmentation fault. I think is because of the array index, if I comment
the line

lres += abs(phi[index]-phi_p[index]);

 the code works fine.
My questions are: 1) How can I perform this operation only at the base grid?, 2) How can I get the correct index at the base level? .. any help is very welcome. Thanks.

Erik