From 4ce71a1912ddf9a035a7eabb8fe1107fa0d0e8aa Mon Sep 17 00:00:00 2001 From: knarf Date: Tue, 15 May 2012 05:03:37 +0000 Subject: slitely change the way ADMMass computes corners/edges. This doesn't change results much (as long as domain is centered), but enough for testsuites to be regenerated - and it fixes off-centered domains git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/ADMMass/trunk@50 54511f98-0e4f-0410-826e-eb8b393f5a1e --- src/surface_integral.c | 62 ++++++++++++++--------- test/tov/ADMMass_SurfaceMass[0].asc | 2 +- test/tov/ADMMass_SurfaceMass_Lapse[0].asc | 2 +- test/tov_carpet/ADMMass_SurfaceMass[0]..asc | 2 +- test/tov_carpet/ADMMass_SurfaceMass_Lapse[0]..asc | 2 +- test/tov_carpet/ADMMass_VolumeMass[0]..asc | 2 +- 6 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/surface_integral.c b/src/surface_integral.c index 30b3572..e4b6e0d 100644 --- a/src/surface_integral.c +++ b/src/surface_integral.c @@ -215,36 +215,48 @@ void ADMMass_Surface(CCTK_ARGUMENTS) ds[1] = 0.0; ds[2] = 0.0; - /* Select the points on the surfaces of the requested cube, - paying attention not to compute the corners (and the edges) - more than once. */ - - /* the whole face of the cube */ - if (i == x_min_i) ds[0] = -oneDY*oneDZ; - - /* the whole face of the cube */ - if (i == x_max_i) ds[0] = oneDY*oneDZ; - - /* face, excluding the two corners (and the four edges) that - were already computed above*/ - if ((j == y_min_j) && (i != x_min_i) && (i != x_max_i)) - ds[1] = -oneDX*oneDZ; + /* Select the points on the surfaces of the requested cube */ + CCTK_INT n_bound = 0; + if (i == x_min_i) + { + n_bound++; + ds[0] = -oneDY*oneDZ; + } + if (i == x_max_i) + { + n_bound++; + ds[0] = oneDY*oneDZ; + } - /* face, excluding the other two corners (and the four edges) - that were already computed above*/ - if ((j == y_max_j) && (i != x_min_i) && (i != x_max_i)) + if (j == y_min_j) + { + n_bound++; + ds[1] = -oneDX*oneDZ; + } + if (j == y_max_j) + { + n_bound++; ds[1] = oneDX*oneDZ; + } - /* face, excluding all corners (and edges), since they were - already computed above */ - if ((k == z_min_k) && (j != y_min_j) && (i != x_min_i) && (j != y_max_j) && (i != x_max_i)) + if (k == z_min_k) + { + n_bound++; ds[2] = -oneDX*oneDY; - - /* face, excluding all corners (and edges), since they were - already computed above */ - if ((k == z_max_k) && (j != y_min_j) && (i != x_min_i) && - (j != y_max_j) && (i != x_max_i)) + } + if (k == z_max_k) + { + n_bound++; ds[2] = oneDX*oneDY; + } + + /* Take care of corners and edges */ + if (n_bound == 2) + for (ti=0; ti<3; ti++) + ds[ti] /= 2; + if (n_bound == 3) + for (ti=0; ti<3; ti++) + ds[ti] /= 4; if ((ds[0] != 0.0) || (ds[1] != 0.0) || (ds[2] != 0.0)) { diff --git a/test/tov/ADMMass_SurfaceMass[0].asc b/test/tov/ADMMass_SurfaceMass[0].asc index efb870e..0964add 100644 --- a/test/tov/ADMMass_SurfaceMass[0].asc +++ b/test/tov/ADMMass_SurfaceMass[0].asc @@ -1,2 +1,2 @@ #ADMMass_SurfaceMass[0] v time -0.0000000000000 1.4689042255930 +0.0000000000000 1.4686423912489 diff --git a/test/tov/ADMMass_SurfaceMass_Lapse[0].asc b/test/tov/ADMMass_SurfaceMass_Lapse[0].asc index 8706561..31ff2eb 100644 --- a/test/tov/ADMMass_SurfaceMass_Lapse[0].asc +++ b/test/tov/ADMMass_SurfaceMass_Lapse[0].asc @@ -1,2 +1,2 @@ #ADMMass_SurfaceMass_Lapse[0] v time -0.0000000000000 1.3350129389323 +0.0000000000000 1.3347679137279 diff --git a/test/tov_carpet/ADMMass_SurfaceMass[0]..asc b/test/tov_carpet/ADMMass_SurfaceMass[0]..asc index 58a2490..eccdfb7 100644 --- a/test/tov_carpet/ADMMass_SurfaceMass[0]..asc +++ b/test/tov_carpet/ADMMass_SurfaceMass[0]..asc @@ -1,4 +1,4 @@ # 0D ASCII output created by CarpetIOASCII # -0 0 0 0 0 0 0 0 0 0 0 0 1.46890422559304 +0 0 0 0 0 0 0 0 0 0 0 0 1.4686423912489 diff --git a/test/tov_carpet/ADMMass_SurfaceMass_Lapse[0]..asc b/test/tov_carpet/ADMMass_SurfaceMass_Lapse[0]..asc index 1c9a77f..657c698 100644 --- a/test/tov_carpet/ADMMass_SurfaceMass_Lapse[0]..asc +++ b/test/tov_carpet/ADMMass_SurfaceMass_Lapse[0]..asc @@ -1,4 +1,4 @@ # 0D ASCII output created by CarpetIOASCII # -0 0 0 0 0 0 0 0 0 0 0 0 1.33501293893232 +0 0 0 0 0 0 0 0 0 0 0 0 1.33476791372789 diff --git a/test/tov_carpet/ADMMass_VolumeMass[0]..asc b/test/tov_carpet/ADMMass_VolumeMass[0]..asc index 2bcb8ca..a2efcf3 100644 --- a/test/tov_carpet/ADMMass_VolumeMass[0]..asc +++ b/test/tov_carpet/ADMMass_VolumeMass[0]..asc @@ -1,4 +1,4 @@ # 0D ASCII output created by CarpetIOASCII # -0 0 0 0 0 0 0 0 0 0 0 0 1.31862873803609 +0 0 0 0 0 0 0 0 0 0 0 0 1.31862873803609 -- cgit v1.2.3