Skip to content

Commit

Permalink
PunctureTracker: checkpoint previous time
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Aug 9, 2024
1 parent a3f055a commit ee52be5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions PunctureTracker/interface.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ USES INCLUDE HEADER: loop_device.hxx

PUBLIC:

CCTK_REAL pt_pre[10] TYPE=scalar
{
pt_pre_t
} "Previous time of punctures"

CCTK_REAL pt_loc[10] TYPE=scalar
{
pt_loc_t pt_loc_x pt_loc_y pt_loc_z
Expand Down
3 changes: 3 additions & 0 deletions PunctureTracker/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SCHEDULE PunctureTracker_Init AT initial
{
LANG: C
OPTIONS: GLOBAL
WRITES: pt_pre
WRITES: pt_loc
WRITES: pt_vel
} "Read initial location of punctures from parameter file"
Expand All @@ -21,6 +22,7 @@ SCHEDULE PunctureTracker_Setup IN PunctureTracker_SetupGroup
{
LANG: C
OPTIONS: GLOBAL
READS: pt_pre
READS: pt_loc
READS: pt_vel
WRITES: BoxInBox::positions
Expand All @@ -31,6 +33,7 @@ SCHEDULE PunctureTracker_Track AT evol AFTER ODESolvers_Solve
LANG: C
OPTIONS: GLOBAL
READS: ADMBaseX::shift(everywhere)
WRITES: pt_pre
WRITES: pt_loc
WRITES: pt_vel
WRITES: BoxInBox::positions
Expand Down
5 changes: 4 additions & 1 deletion PunctureTracker/src/puncture_tracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extern "C" void PunctureTracker_Init(CCTK_ARGUMENTS) {
pt_vel_y[n] = 0.0;
pt_vel_z[n] = 0.0;
}
pt_pre_t[n] = 0.0;
}
}

Expand All @@ -67,12 +68,12 @@ extern "C" void PunctureTracker_Setup(CCTK_ARGUMENTS) {
g_punctures->getVelocity()[0].push_back(pt_vel_x[n]);
g_punctures->getVelocity()[1].push_back(pt_vel_y[n]);
g_punctures->getVelocity()[2].push_back(pt_vel_z[n]);
g_punctures->getPreviousTime().push_back(pt_pre_t[n]);
}
}
}

const int nPunctures = g_punctures->getTime().size();
g_punctures->getPreviousTime().resize(nPunctures);
g_punctures->getBeta()[0].resize(nPunctures);
g_punctures->getBeta()[1].resize(nPunctures);
g_punctures->getBeta()[2].resize(nPunctures);
Expand Down Expand Up @@ -116,6 +117,7 @@ extern "C" void PunctureTracker_Track(CCTK_ARGUMENTS) {
g_punctures->getLocation();
const std::array<std::vector<CCTK_REAL>, Loop::dim> &velocity =
g_punctures->getVelocity();
const std::vector<CCTK_REAL> &previousTime = g_punctures->getPreviousTime();

if (verbose) {
for (int n = 0; n < nPunctures; ++n) {
Expand Down Expand Up @@ -170,6 +172,7 @@ extern "C" void PunctureTracker_Track(CCTK_ARGUMENTS) {
pt_vel_x[i] = velocity[0][i];
pt_vel_y[i] = velocity[1][i];
pt_vel_z[i] = velocity[2][i];
pt_pre_t[i] = previousTime[i];
}

if (track_boxes) {
Expand Down

0 comments on commit ee52be5

Please sign in to comment.