diff options
author | Ian Hawke <ih@maths.soton.ac.uk> | 2005-03-04 13:45:00 +0000 |
---|---|---|
committer | Ian Hawke <ih@maths.soton.ac.uk> | 2005-03-04 13:45:00 +0000 |
commit | fa2c07b5842d92370dcb1ecdfecaddd81de098f8 (patch) | |
tree | 284bc0add9e2d89489ee1b52e2be128130c4dfa2 | |
parent | 8019074673f2a58fdf20b8fcf865672f51f9c87d (diff) |
CarpetAdaptiveRegrid: Fix checking the child level for errors
Firstly only check the errors of a child level if a grandchild level
exists.
Secondly take the refinement factor into account when calculating
where this error should be placed!
darcs-hash:20050304134516-58c7f-484d0c7d61a089b4eb7f294c427c76bb529d8dde.gz
-rw-r--r-- | CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc index 3199c55e5..8ed7229df 100644 --- a/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc +++ b/CarpetDev/CarpetAdaptiveRegrid/src/CAR.cc @@ -390,10 +390,11 @@ namespace CarpetAdaptiveRegrid { // // Check the error on child level, if such a level exists + // Also only worry if there's a grandchild level. // This should fix the "orphaned grandchild" problem // - if (local_bbss.size() > reflevel+1) { + if (local_bbss.size() > reflevel+2) { CCTK_INT currentml = mglevel; CCTK_INT currentrl = reflevel; @@ -438,9 +439,13 @@ namespace CarpetAdaptiveRegrid { CCTK_INT index = CCTK_GFINDEX3D(cctkGH, i, j, k); CCTK_REAL local_error = abs(error_var_ptr[index]); if (local_error > max_error) { - CCTK_INT ii = i + cctkGH->cctk_lbnd[0] - imin[0]; - CCTK_INT jj = j + cctkGH->cctk_lbnd[1] - imin[1]; - CCTK_INT kk = k + cctkGH->cctk_lbnd[2] - imin[2]; + // Correct for the change in level ! + CCTK_INT ii = (i + cctkGH->cctk_lbnd[0]) / reffact - + imin[0]; + CCTK_INT jj = (j + cctkGH->cctk_lbnd[1]) / reffact - + imin[1]; + CCTK_INT kk = (k + cctkGH->cctk_lbnd[2]) / reffact - + imin[2]; // Check that this point actually intersects with // this box (if this component was actually a // different grid on the same processor, it need not) |