aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetRegrid2
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2011-04-17 22:55:57 -0400
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:26:08 +0000
commitba0fae0a796d2dd0d23772b254827afaab15c191 (patch)
treeb5a81d32c332b7094a596761f4975579d4a41194 /Carpet/CarpetRegrid2
parenta2f131a50da6372b55007dcd28e8279c14982e24 (diff)
CarpetRegrid2: New debugging parameter add_levels_automatically
Diffstat (limited to 'Carpet/CarpetRegrid2')
-rw-r--r--Carpet/CarpetRegrid2/param.ccl8
-rw-r--r--Carpet/CarpetRegrid2/src/initialise.cc38
-rw-r--r--Carpet/CarpetRegrid2/src/regrid.cc21
3 files changed, 44 insertions, 23 deletions
diff --git a/Carpet/CarpetRegrid2/param.ccl b/Carpet/CarpetRegrid2/param.ccl
index 5f87e9a9a..c45241de9 100644
--- a/Carpet/CarpetRegrid2/param.ccl
+++ b/Carpet/CarpetRegrid2/param.ccl
@@ -73,6 +73,14 @@ CCTK_INT num_centres "Number of refinement centres"
################################################################################
+BOOLEAN add_levels_automatically "Automatically add a new refinement level at each regrid" STEERABLE=always
+{
+} "no"
+
+
+
+################################################################################
+
CCTK_INT num_levels_1 "Number of refinement levels for this centre"
{
1:30 :: ""
diff --git a/Carpet/CarpetRegrid2/src/initialise.cc b/Carpet/CarpetRegrid2/src/initialise.cc
index 789f168e5..12c69410e 100644
--- a/Carpet/CarpetRegrid2/src/initialise.cc
+++ b/Carpet/CarpetRegrid2/src/initialise.cc
@@ -35,25 +35,25 @@ namespace CarpetRegrid2 {
int lsh[2];
getvectorindex2 (cctkGH, "CarpetRegrid2::radii", lsh);
-#define INIT_CENTRE(N) \
- do { \
- if (num_centres >= N) { \
- num_levels[N-1] = num_levels_##N; \
- active [N-1] = active_##N; \
- position_x[N-1] = position_x_##N; \
- position_y[N-1] = position_y_##N; \
- position_z[N-1] = position_z_##N; \
- for (int rl = 0; rl < 30; ++ rl) { \
- int const ind = index2 (lsh, rl, N-1); \
- radius[ind] = radius_##N[rl]; \
- radius_x[ind] = radius_x_##N[rl]; \
- radius_y[ind] = radius_y_##N[rl]; \
- radius_z[ind] = radius_z_##N[rl]; \
- } \
- old_position_x[N-1] = position_x[N-1]; \
- old_position_y[N-1] = position_y[N-1]; \
- old_position_z[N-1] = position_z[N-1]; \
- } \
+#define INIT_CENTRE(N) \
+ do { \
+ if (num_centres >= N) { \
+ num_levels[N-1] = num_levels_##N; \
+ active [N-1] = active_##N; \
+ position_x[N-1] = position_x_##N; \
+ position_y[N-1] = position_y_##N; \
+ position_z[N-1] = position_z_##N; \
+ for (int rl = 0; rl < 30; ++ rl) { \
+ int const ind = index2 (lsh, rl, N-1); \
+ radius[ind] = radius_##N[rl]; \
+ radius_x[ind] = radius_x_##N[rl]; \
+ radius_y[ind] = radius_y_##N[rl]; \
+ radius_z[ind] = radius_z_##N[rl]; \
+ } \
+ old_position_x[N-1] = position_x[N-1]; \
+ old_position_y[N-1] = position_y[N-1]; \
+ old_position_z[N-1] = position_z[N-1]; \
+ } \
} while (0)
INIT_CENTRE( 1);
diff --git a/Carpet/CarpetRegrid2/src/regrid.cc b/Carpet/CarpetRegrid2/src/regrid.cc
index c4c9fa91d..a1989d22b 100644
--- a/Carpet/CarpetRegrid2/src/regrid.cc
+++ b/Carpet/CarpetRegrid2/src/regrid.cc
@@ -1140,11 +1140,12 @@ namespace CarpetRegrid2 {
for (int n = 0; n < num_centres; ++ n) {
if (active[n]) {
CCTK_VInfo (CCTK_THORNSTRING,
- "Centre %d is at position [%g,%g,%g]",
+ "Centre %d is at position [%g,%g,%g] with %d levels",
n + 1,
static_cast <double> (position_x[n]),
static_cast <double> (position_y[n]),
- static_cast <double> (position_z[n]));
+ static_cast <double> (position_z[n]),
+ static_cast <int> (num_levels[n]));
} else {
CCTK_VInfo (CCTK_THORNSTRING,
"Centre %d is not active", n + 1);
@@ -1321,11 +1322,12 @@ namespace CarpetRegrid2 {
for (int n = 0; n < num_centres; ++ n) {
if (active[n]) {
CCTK_VInfo (CCTK_THORNSTRING,
- "Centre %d is at position [%g,%g,%g]",
+ "Centre %d is at position [%g,%g,%g] with %d levels",
n + 1,
static_cast <double> (position_x[n]),
static_cast <double> (position_y[n]),
- static_cast <double> (position_z[n]));
+ static_cast <double> (position_z[n]),
+ static_cast <int> (num_levels[n]));
} else {
CCTK_VInfo (CCTK_THORNSTRING,
"Centre %d is not active", n + 1);
@@ -1343,6 +1345,17 @@ namespace CarpetRegrid2 {
do_recompose = false;
for (int n = 0; n < num_centres; ++ n) {
+ // When debugging, sneakily add a new level, but skip the
+ // initial regrid, and the regrid before the first time step
+ if (add_levels_automatically and cctk_iteration > 1) {
+ num_levels[n] = min (num_levels[n] + 1, maxreflevels);
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Increasing number of levels of centre %d to %d (it=%d)",
+ n + 1,
+ static_cast <int> (num_levels[n]),
+ cctk_iteration);
+ }
+
// Regrid if a region became active or inactive
do_recompose = active[n] != old_active[n];
if (do_recompose) break;