forked from EinsteinToolkit/CarpetX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CarpetX: only regrid those fine levels that already catch up
- Loading branch information
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1612,6 +1612,44 @@ int Evolve(tFleshConfig *config) { | |
for (const auto &leveldata : patchdata.leveldata) | ||
iteration = min(iteration, leveldata.iteration); | ||
|
||
int min_active_level = 0; | ||
|
||
if (use_subcycling_wip) { | ||
// Loop over all levels, in batches that combine levels that don't | ||
// subcycle. The level range is [min_level, max_level). | ||
for (int min_level = 0, max_level = min_level + 1; | ||
min_level < ghext->num_levels(); | ||
min_level = max_level, max_level = min_level + 1) { | ||
// Find end of batch | ||
while (max_level < ghext->num_levels()) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
bool level_is_subcycling_level = false; | ||
for (const auto &patchdata : ghext->patchdata) | ||
if (max_level < int(patchdata.leveldata.size())) | ||
level_is_subcycling_level |= | ||
patchdata.leveldata.at(max_level).is_subcycling_level; | ||
if (level_is_subcycling_level) | ||
break; | ||
++max_level; | ||
} | ||
// Skip this batch of levels if it is not active at the current | ||
// iteration | ||
rat64 level_iteration = -1; | ||
for (const auto &patchdata : ghext->patchdata) { | ||
if (min_level < int(patchdata.leveldata.size())) { | ||
level_iteration = patchdata.leveldata.at(min_level).iteration; | ||
break; | ||
} | ||
} | ||
assert(level_iteration != -1); | ||
// Skip those evolved coarse levels when evolving fine levels to catch | ||
// up | ||
if (level_iteration == iteration) { | ||
min_active_level = min_level; | ||
break; | ||
This comment has been minimized.
Sorry, something went wrong.
rhaas80
Collaborator
|
||
} | ||
}; | ||
} | ||
|
||
// TODO: Move regridding into a function | ||
if (regrid_every > 0 && cctkGH->cctk_iteration % regrid_every == 0) { | ||
#pragma omp critical | ||
|
@@ -1644,7 +1682,7 @@ int Evolve(tFleshConfig *config) { | |
} | ||
patchdata.amrcore->SetMaxGridSize(max_grid_sizes_vec); | ||
|
||
patchdata.amrcore->regrid(0, time); | ||
patchdata.amrcore->regrid(min_active_level, time); | ||
This comment has been minimized.
Sorry, something went wrong.
rhaas80
Collaborator
|
||
|
||
const int new_numlevels = patchdata.amrcore->finestLevel() + 1; | ||
const int max_numlevels = patchdata.amrcore->maxLevel() + 1; | ||
|
that condition may actually be wrong since
max_level
is exclusive so the "all levels" ismin_level=0
andmax_level=ghext->num_levels()
.