aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetReduce/src
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2011-11-09 16:53:20 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 19:54:53 +0000
commit6e464ee12e243b73cfdb1d47e693ce84c8dfd553 (patch)
tree40e2d37e21729d239e80d0048ec933c022f14175 /Carpet/CarpetReduce/src
parent137ab5323ed4fdf28ff07dbccd52e9d27372442e (diff)
CarpetMask: Keep track of the volume that is masked out
Keep track of the volume that is masked out by CarpetMask, and take this volume into account when checking in CarpetReduce that the integral over the simulation domain equals the domain volume.
Diffstat (limited to 'Carpet/CarpetReduce/src')
-rw-r--r--Carpet/CarpetReduce/src/mask_allocate.c3
-rw-r--r--Carpet/CarpetReduce/src/mask_test.c25
2 files changed, 24 insertions, 4 deletions
diff --git a/Carpet/CarpetReduce/src/mask_allocate.c b/Carpet/CarpetReduce/src/mask_allocate.c
index 1219b7b95..c1c28afeb 100644
--- a/Carpet/CarpetReduce/src/mask_allocate.c
+++ b/Carpet/CarpetReduce/src/mask_allocate.c
@@ -17,4 +17,7 @@ MaskBase_AllocateMask (CCTK_ARGUMENTS)
CCTK_EnableGroupStorage (cctkGH, "CarpetReduce::iweight");
CCTK_EnableGroupStorage (cctkGH, "CarpetReduce::one");
+
+ /* Initialise excised cell count */
+ * excised_cells = 0.0;
}
diff --git a/Carpet/CarpetReduce/src/mask_test.c b/Carpet/CarpetReduce/src/mask_test.c
index 82fa4f306..8725291a8 100644
--- a/Carpet/CarpetReduce/src/mask_test.c
+++ b/Carpet/CarpetReduce/src/mask_test.c
@@ -31,7 +31,7 @@ MaskBase_TestMask (CCTK_ARGUMENTS)
assert (weight_var >= 0);
assert (one_var >= 0);
- CCTK_REAL sum_weight;
+ CCTK_REAL sum_weight, all_excised_cells;
{
int const ierr = CCTK_Reduce (cctkGH,
@@ -41,6 +41,16 @@ MaskBase_TestMask (CCTK_ARGUMENTS)
1, one_var);
assert (ierr >= 0);
}
+ {
+ int const ierr = CCTK_ReduceLocalScalar (cctkGH,
+ proc,
+ sum,
+ excised_cells,
+ &all_excised_cells,
+ CCTK_VARIABLE_REAL);
+ assert (ierr >= 0);
+ *excised_cells = all_excised_cells;
+ }
@@ -102,9 +112,14 @@ MaskBase_TestMask (CCTK_ARGUMENTS)
} /* for m */
+ /* Don't count excised regions towards the domain volume */
+ domain_volume -= * excised_cells;
+
if (verbose) {
CCTK_VInfo (CCTK_THORNSTRING,
- "Simulation domain volume: %.17g", (double)domain_volume);
+ "Simulation domain volume: %.17g", (double)domain_volume);
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Additional excised volume: %.17g", (double)*excised_cells);
}
int const there_is_a_problem =
@@ -113,9 +128,11 @@ MaskBase_TestMask (CCTK_ARGUMENTS)
if (there_is_a_problem) {
if (!verbose) {
CCTK_VInfo (CCTK_THORNSTRING,
- "Simulation domain volume: %.15g", (double)domain_volume);
+ "Simulation domain volume: %.17g", (double)domain_volume);
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Additional excised volume: %.17g", (double)*excised_cells);
CCTK_VInfo (CCTK_THORNSTRING,
- "Reduction weight sum: %.15g", (double)sum_weight);
+ "Reduction weight sum: %.17g", (double)sum_weight);
}
CCTK_VWarn (CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,
"Simulation domain volume and reduction weight sum differ");