diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-06-03 03:19:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-06-03 03:19:00 +0000 |
commit | 3920ab36db559670aece85307e4a5ed7e2b9aadb (patch) | |
tree | 9fe3b59943925c294ef86d6065482901804f1329 /Carpet/Carpet/src/Comm.cc | |
parent | ee210ceb1c3e48af997371fc4c397f5812cbcf78 (diff) |
Carpet: Implement fully tapered time evolution
Algorithm from Lehner et al.
Original patch concept by Ian Hawke.
darcs-hash:20060603031952-dae7b-897df898e92d7e5807d1df6ab41e3a5d8869deeb.gz
Diffstat (limited to 'Carpet/Carpet/src/Comm.cc')
-rw-r--r-- | Carpet/Carpet/src/Comm.cc | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/Carpet/Carpet/src/Comm.cc b/Carpet/Carpet/src/Comm.cc index 7e6489386..121ebf706 100644 --- a/Carpet/Carpet/src/Comm.cc +++ b/Carpet/Carpet/src/Comm.cc @@ -1,4 +1,6 @@ +#include <algorithm> #include <cassert> +#include <cmath> #include <cstdlib> #include "cctk.h" @@ -100,7 +102,7 @@ namespace Carpet { } } - if (! CCTK_QueryGroupStorageI (cctkGH, group)) { + if (not CCTK_QueryGroupStorageI (cctkGH, group)) { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Cannot synchronise group \"%s\" because it has no storage", groupname); @@ -115,8 +117,30 @@ namespace Carpet { if (goodgroups.size() > 0) { // prolongate boundaries - if (do_prolongate && reflevel > 0) { - ProlongateGroupBoundaries (cctkGH, cctk_initial_time, goodgroups); + if (reflevel > 0) { + if (do_prolongate) { + bool local_do_prolongate; + if (use_tapered_grids) { + // TODO: Check iteration number instead + CCTK_REAL mytime; + CCTK_REAL parenttime; + if (map == -1) { + mytime = vtt.at(0)->time (0, reflevel, mglevel); + parenttime = vtt.at(0)->time (0, reflevel - 1, mglevel); + } else { + mytime = vtt.at(map)->time (0, reflevel, mglevel); + parenttime = vtt.at(map)->time (0, reflevel - 1, mglevel); + } + bool const in_sync = + abs (mytime - parenttime) < 1.0e-10 * abs (delta_time); + local_do_prolongate = in_sync; + } else { + local_do_prolongate = true; + } + if (local_do_prolongate) { + ProlongateGroupBoundaries (cctkGH, cctk_initial_time, goodgroups); + } + } } // synchronise ghostzones @@ -138,7 +162,7 @@ namespace Carpet { const CCTK_REAL time = (cctkGH->cctk_time - initial_time) / delta_time; - for (comm_state state; ! state.done(); state.step()) { + for (comm_state state; not state.done(); state.step()) { for (int group = 0; group < groups.size(); ++group) { const int g = groups[group]; const int grouptype = CCTK_GroupTypeI (g); @@ -168,7 +192,7 @@ namespace Carpet { assert (groups.size() > 0); - for (comm_state state; ! state.done(); state.step()) { + for (comm_state state; not state.done(); state.step()) { for (int group = 0; group < groups.size(); ++group) { const int g = groups[group]; const int grouptype = CCTK_GroupTypeI (g); |