aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Haas <roland.haas@physics.gatech.edu>2012-06-28 14:31:29 -0700
committerRoland Haas <roland.haas@physics.gatech.edu>2012-06-28 14:31:29 -0700
commitd826d9a2ffdbf30b8babe8ba5e39074fc1a659da (patch)
treed1b5726a835ea39a0fe56a73386be7493e4b6696
parent2b87163ac7d67d88e7bebb3c08185d2cf887df07 (diff)
Carpet: call POSTREGRID on all finer levels of a regridded level
Carpet assumes that a regridding operation always changes level N and all finer levels so we should call POSTREGRID on all finer levels
-rw-r--r--Carpet/Carpet/src/Evolve.cc10
-rw-r--r--Carpet/Carpet/src/Initialise.cc31
2 files changed, 26 insertions, 15 deletions
diff --git a/Carpet/Carpet/src/Evolve.cc b/Carpet/Carpet/src/Evolve.cc
index 32a2293ac..72526b8a8 100644
--- a/Carpet/Carpet/src/Evolve.cc
+++ b/Carpet/Carpet/src/Evolve.cc
@@ -305,12 +305,10 @@ namespace Carpet {
bool const did_recompose = Recompose (cctkGH, rl, true);
did_any_recompose = did_any_recompose or did_recompose;
- // Do not omit the global mode call when the finest level
- // does not change:
- // if (did_recompose or (did_remove_level and rl == reflevels - 1)) {
- if (did_recompose or
- ((did_remove_level or did_any_recompose) and
- rl == reflevels - 1))
+ // Carpet assumes that a regridding operation always changes "level N
+ // and all finer levels" so we should call POSTREGRID on all finer levels
+ if (did_any_recompose or
+ (did_remove_level and rl == reflevels - 1))
{
BEGIN_MGLEVEL_LOOP (cctkGH) {
ENTER_LEVEL_MODE (cctkGH, rl) {
diff --git a/Carpet/Carpet/src/Initialise.cc b/Carpet/Carpet/src/Initialise.cc
index 7b316e874..44d4eb8b1 100644
--- a/Carpet/Carpet/src/Initialise.cc
+++ b/Carpet/Carpet/src/Initialise.cc
@@ -913,9 +913,13 @@ namespace Carpet {
// Regrid
Checkpoint ("Regrid");
+ int const oldreflevels = reflevels;
bool const did_regrid = Regrid (cctkGH, true, prolongate_initial_data);
+ bool const did_remove_level = reflevels < oldreflevels;
+ assert (not did_remove_level or did_regrid);
if (did_regrid) {
+ bool did_any_recompose = false;
BEGIN_META_MODE (cctkGH) {
bool have_done_global_mode = false;
@@ -926,11 +930,14 @@ namespace Carpet {
for (int rl=0; rl<reflevels; ++rl) {
bool did_recompose = false;
- if (did_regrid) {
- did_recompose = Recompose (cctkGH, rl, prolongate_initial_data);
- }
+ did_recompose = Recompose (cctkGH, rl, prolongate_initial_data);
+ did_any_recompose = did_any_recompose or did_recompose;
- if (did_recompose) {
+ // Carpet assumes that a regridding operation always changes "level N
+ // and all finer levels" so we should call POSTREGRID on all finer levels
+ if (did_any_recompose or
+ (did_remove_level and rl == reflevels - 1))
+ {
BEGIN_MGLEVEL_LOOP (cctkGH) {
ENTER_LEVEL_MODE (cctkGH, rl) {
BeginTimingLevel (cctkGH);
@@ -1094,9 +1101,13 @@ namespace Carpet {
// Regrid
Checkpoint ("Regrid");
+ int const oldreflevels = reflevels;
bool const did_regrid = Regrid (cctkGH, true, prolongate_initial_data);
+ bool const did_remove_level = reflevels < oldreflevels;
+ assert (not did_remove_level or did_regrid);
if (did_regrid) {
+ bool did_any_recompose = false;
BEGIN_META_MODE (cctkGH) {
bool have_done_global_mode = false;
@@ -1106,12 +1117,14 @@ namespace Carpet {
for (int rl=0; rl<reflevels; ++rl) {
- bool did_recompose = false;
- if (did_regrid) {
- did_recompose = Recompose (cctkGH, rl, prolongate_initial_data);
- }
+ bool did_recompose = Recompose (cctkGH, rl, prolongate_initial_data);
+ did_any_recompose = did_any_recompose or did_recompose;
- if (did_recompose) {
+ // Carpet assumes that a regridding operation always changes "level N
+ // and all finer levels" so we should call POSTREGRID on all finer levels
+ if (did_any_recompose or
+ (did_remove_level and rl == reflevels - 1))
+ {
BEGIN_MGLEVEL_LOOP (cctkGH) {
ENTER_LEVEL_MODE (cctkGH, rl) {
BeginTimingLevel (cctkGH);