Skip to content

Commit

Permalink
TestSubcyclingMC2: fix unit test for gaussian_noSC
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Apr 28, 2024
1 parent 20a76e0 commit 16678d0
Show file tree
Hide file tree
Showing 28 changed files with 761 additions and 1,512 deletions.
15 changes: 6 additions & 9 deletions ODESolvers/src/odesolvers_solve_subcycling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
// Sync OldState:

// Step 1:
// var = Y1 = old
if (verbose)
CCTK_VINFO("Calculating RHS #1 at t=%g", double(cctkGH->cctk_time));
CallScheduleGroup(cctkGH, "ODESolvers_CalcYfFromKcs1");
Expand All @@ -213,8 +212,6 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
"ODESolvers after calling ODESolvers_RHS");
statecomp_t::lincomb(ks[0], 0, make_array(CCTK_REAL(1)), make_array(&rhs),
make_valid_int());

// Step 2:
// var = Y2 = y0 + h/2 k1
statecomp_t::lincomb(var, 1, make_array(dt / 2), make_array(&rhs),
make_valid_int());
Expand All @@ -223,6 +220,8 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
mark_invalid(dep_groups);
*const_cast<CCTK_REAL *>(&cctkGH->cctk_time) = old_time + dt / 2;
CallScheduleGroup(cctkGH, "ODESolvers_PostStep");

// Step 2:
if (verbose)
CCTK_VINFO("Calculating RHS #2 at t=%g", double(cctkGH->cctk_time));
CallScheduleGroup(cctkGH, "ODESolvers_CalcYfFromKcs2");
Expand All @@ -232,8 +231,6 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
"ODESolvers after calling ODESolvers_RHS");
statecomp_t::lincomb(ks[1], 0, make_array(CCTK_REAL(1)), make_array(&rhs),
make_valid_int());

// Step 3:
// var = Y3 = y0 + h/2 k2
statecomp_t::lincomb(var, 0, make_array(CCTK_REAL(1), dt / 2),
make_array(&old, &rhs), make_valid_int());
Expand All @@ -242,6 +239,8 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
mark_invalid(dep_groups);
*const_cast<CCTK_REAL *>(&cctkGH->cctk_time) = old_time + dt / 2;
CallScheduleGroup(cctkGH, "ODESolvers_PostStep");

// Step 3:
if (verbose)
CCTK_VINFO("Calculating RHS #3 at t=%g", double(cctkGH->cctk_time));
CallScheduleGroup(cctkGH, "ODESolvers_CalcYfFromKcs3");
Expand All @@ -251,8 +250,6 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
"ODESolvers after calling ODESolvers_RHS");
statecomp_t::lincomb(ks[2], 0, make_array(CCTK_REAL(1)), make_array(&rhs),
make_valid_int());

// Step 4:
// var = Y4 = y0 + h k3
statecomp_t::lincomb(var, 0, make_array(CCTK_REAL(1), dt),
make_array(&old, &rhs), make_valid_int());
Expand All @@ -261,6 +258,8 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
mark_invalid(dep_groups);
*const_cast<CCTK_REAL *>(&cctkGH->cctk_time) = old_time + dt;
CallScheduleGroup(cctkGH, "ODESolvers_PostStep");

// Step 4:
if (verbose)
CCTK_VINFO("Calculating RHS #4 at t=%g", double(cctkGH->cctk_time));
CallScheduleGroup(cctkGH, "ODESolvers_CalcYfFromKcs4");
Expand All @@ -270,8 +269,6 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
"ODESolvers after calling ODESolvers_RHS");
statecomp_t::lincomb(ks[3], 0, make_array(CCTK_REAL(1)), make_array(&rhs),
make_valid_int());

// Calculate New State Vector:
// var = y1 = y0 + h/6 k1 + h/3 k2 + h/3 k3 + h/6 k4
statecomp_t::lincomb(
var, 0, make_array(CCTK_REAL(1), dt / 6, dt / 3, dt / 3, dt / 6),
Expand Down
6 changes: 5 additions & 1 deletion TestSubcyclingMC2/schedule.ccl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ SCHEDULE TestSubcyclingMC2_Sync AT postregrid
SYNC: state
} "Synchronize"


SCHEDULE TestSubcyclingMC2_SyncState IN ODESolvers_PostStep
{
LANG: C
SYNC: state
} "Sync old and ks"

SCHEDULE TestSubcyclingMC2_SyncKs IN ODESolvers_CalcYfFromKcs1 BEFORE ODESolvers_Solve_CalcYfFromKcs1
{
Expand Down
4 changes: 4 additions & 0 deletions TestSubcyclingMC2/src/testsubcyclingmc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ extern "C" void TestSubcyclingMC2_Sync(CCTK_ARGUMENTS) {
// do nothing
}

extern "C" void TestSubcyclingMC2_SyncState(CCTK_ARGUMENTS) {
// do nothing
}

extern "C" void TestSubcyclingMC2_SyncKs(CCTK_ARGUMENTS) {
// do nothing
}
Expand Down
4 changes: 2 additions & 2 deletions TestSubcyclingMC2/test/gaussian_noSC.par
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ $ncells = 32
TestSubcyclingMC2::initial_condition = "Gaussian"
TestSubcyclingMC2::gaussian_width = 0.17677669529 # sqrt(2)*W = 0.25

CarpetX::use_subcycling_wip = yes
CarpetX::restrict_during_sync = no
#CarpetX::use_subcycling_wip = yes
#CarpetX::restrict_during_sync = no

CarpetX::poison_undefined_values = no
CarpetX::verbose = no
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Loading

0 comments on commit 16678d0

Please sign in to comment.