aboutsummaryrefslogtreecommitdiff
path: root/CarpetDev
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-03-18 15:10:52 -0700
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:33 +0000
commit0707cfeb82f565afec604f39202dafcbef889db0 (patch)
tree820f1ac0bc04d5f9827e4e00bf1efccb6d76727e /CarpetDev
parent6b2d5314e79a5547f2fdd1dc4898bdeef74da9f2 (diff)
Re-organise time level handling
Store the current Cactus time (and not a fake Carpet time) in the th "time hiearchy". This removes the now redundant "leveltimes" data structure in Carpet. Add past time levels to th, so that it can store the time for past time levels instead of assuming the time step size is constant. This allows changing the time step size during evolution. Share the time hierarchy between all maps, instead of having one time hierarchy per map. Simplify the time level cycling and time stepping code used during evolution. Improve structure of the code that loops over time levels for certain schedule bins. Introduce a new Carpet variable "timelevel", similar to "reflevel". This also makes it possible to avoid time interpolation for the past time levels during regridding. The past time levels of the fine grid then remain aligned (in time) with the past time levels of the coarse grid. This is controlled by a new parameter "time_interpolation_during_regridding", which defaults to "yes" for backwards compatibility. Simplify the three time level initialisation. Instead of initialising all three time levels by taking altogether three time steps (forwards and backwards), initialise only one past time level by taking one time step backwards. The remaining time level is initialised during the first time step of the evolution, which begins by cycling time levels, which drops the non-initialised last time level anyway. Update Carpet and the mode handling correspondingly. Update the CarpetIOHDF5 checkpoint format correspondingly. Update CarpetInterp, CarpetReduce, and CarpetRegrid2 correspondingly. Update CarpetJacobi and CarpetMG correspondingly.
Diffstat (limited to 'CarpetDev')
-rw-r--r--CarpetDev/CarpetJacobi/src/Jacobi.cc24
-rw-r--r--CarpetDev/CarpetMG/src/mg.cc5
2 files changed, 13 insertions, 16 deletions
diff --git a/CarpetDev/CarpetJacobi/src/Jacobi.cc b/CarpetDev/CarpetJacobi/src/Jacobi.cc
index 0f1149918..b6969b6a5 100644
--- a/CarpetDev/CarpetJacobi/src/Jacobi.cc
+++ b/CarpetDev/CarpetJacobi/src/Jacobi.cc
@@ -23,7 +23,7 @@
namespace Carpet {
// TODO: fix this
- void CycleTimeLevels (const cGH* cctkGH);
+ void CycleTimeLevels (cGH* cctkGH);
void Restrict (const cGH* cctkGH);
};
@@ -202,12 +202,12 @@ namespace CarpetJacobi {
* const_cast<CCTK_REAL *> (& cctkGH->cctk_delta_time) = delta_time;
BEGIN_REFLEVEL_LOOP(cctkGH) {
* const_cast<CCTK_REAL *> (& cctkGH->cctk_time) = global_time;
- for (int m=0; m<maps; ++m) {
- vtt[m]->set_time (reflevel, mglevel, 0);
- vtt[m]->set_delta
- (reflevel, mglevel,
- 1.0 / ipow (maxval (spacereflevelfact), reflevelpower));
+ for (int tl=0; tl<timelevels; ++tl) {
+ tt->set_time (mglevel, reflevel, tl, global_time - tl * delta_time);
}
+ tt->set_delta
+ (mglevel, reflevel,
+ 1.0 / ipow (maxval (spacereflevelfact), reflevelpower));
} END_REFLEVEL_LOOP;
@@ -252,13 +252,11 @@ namespace CarpetJacobi {
if (reflevel <= solve_level && (iter-istep) % do_every == 0) {
// Advance time
- for (int m=0; m<maps; ++m) {
- vtt[m]->advance_time (reflevel, mglevel);
- }
+ tt->advance_time (mglevel, reflevel);
* const_cast<CCTK_REAL *> (& cctkGH->cctk_time)
= (1.0 * (iter - istep + do_every)
/ ipow (maxval (maxspacereflevelfact), reflevelpower));
- CycleTimeLevels (cctkGH);
+ CycleTimeLevels (const_cast<cGH*>(cctkGH));
if (DEBUG) cout << "CJ residual iter " << iter << " reflevel " << reflevel << " time " << cctkGH->cctk_time << flush << endl;
// Advance time levels
@@ -569,10 +567,10 @@ namespace CarpetJacobi {
* const_cast<CCTK_REAL *> (& cctkGH->cctk_delta_time) = delta_time;
BEGIN_REFLEVEL_LOOP(cctkGH) {
* const_cast<CCTK_REAL *> (& cctkGH->cctk_time) = global_time;
- for (int m=0; m<maps; ++m) {
- vtt[m]->set_time (reflevel, mglevel, 0);
- vtt[m]->set_delta (reflevel, mglevel, 1.0 / timereflevelfact);
+ for (int tl=0; tl<timelevels; ++tl) {
+ tt->set_time (mglevel, reflevel, tl, global_time - tl * delta_time);
}
+ tt->set_delta (mglevel, reflevel, 1.0 / timereflevelfact);
} END_REFLEVEL_LOOP;
} END_GLOBAL_MODE;
diff --git a/CarpetDev/CarpetMG/src/mg.cc b/CarpetDev/CarpetMG/src/mg.cc
index d76a10212..07e889e02 100644
--- a/CarpetDev/CarpetMG/src/mg.cc
+++ b/CarpetDev/CarpetMG/src/mg.cc
@@ -1015,7 +1015,6 @@ namespace CarpetMG {
int const tl = 0;
for (comm_state state; !state.done(); state.step()) {
for (int m=0; m<maps; ++m) {
- const CCTK_REAL time = vtt.at(m)->time (tl, reflevel, mglevel);
for (int n=0; n<var.size(); ++n) {
int const vi = var.at(n);
assert (vi >= 0);
@@ -1024,7 +1023,7 @@ namespace CarpetMG {
int const v0 = CCTK_FirstVarIndexI (gi);
assert (v0 >= 0);
arrdata.at(gi).at(m).data.at(vi-v0)->ref_restrict_all
- (state, tl, reflevel, mglevel, time);
+ (state, tl, reflevel, mglevel);
} // for n
} // for m
} // for state
@@ -1040,9 +1039,9 @@ namespace CarpetMG {
{
assert (reflevel > 0);
int const tl = 0;
+ CCTK_REAL const time = tt->get_time (mglevel, reflevel, tl);
for (comm_state state; !state.done(); state.step()) {
for (int m=0; m<maps; ++m) {
- const CCTK_REAL time = vtt.at(m)->time (tl, reflevel, mglevel);
for (int n=0; n<var.size(); ++n) {
int const vi = var.at(n);
assert (vi >= 0);