Skip to content

Commit

Permalink
ODESolvers: beautify setting xsi
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 6, 2024
1 parent 265b04a commit 293dcec
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ODESolvers/src/odesolvers_solve_subcycling.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,15 @@ extern "C" void ODESolvers_Solve_Subcycling(CCTK_ARGUMENTS) {
};
// calculate Ys from Ks on the mesh refinement boundary
const auto calcys_rmbnd = [&](const int stage) {
const int num_levels = ghext->num_levels();
active_levels->loop_parallel([&](int patch, int level, int index,
int component, const cGH *local_cctkGH) {
// xsi = ((it-1) / (2^shift_amount)) % 2 ? 0.5 : 0.0;
const int shift_amount = num_levels - 1 - level;
const CCTK_REAL xsi = 0.5 * (((cctk_iteration - 1) >> shift_amount) & 1);
if (level == 0)
return;
const auto &patchdata = ghext->patchdata.at(patch);
const CCTK_REAL xsi = (patchdata.leveldata.at(level).iteration ==
patchdata.leveldata.at(level - 1).iteration)
? 0.5
: 0.0;
update_cctkGH(const_cast<cGH *>(local_cctkGH), cctkGH);
Subcycling::CalcYfFromKcs<rkstages>(const_cast<cGH *>(local_cctkGH),
var_groups, old_groups, ks_groups,
Expand Down

0 comments on commit 293dcec

Please sign in to comment.