Skip to content

Commit

Permalink
ODESolvers: fix bug updating pre
Browse files Browse the repository at this point in the history
  • Loading branch information
lwJi committed Sep 20, 2024
1 parent cbcea62 commit 18c1dc9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ODESolvers/src/solve.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,13 @@ extern "C" void ODESolvers_Solve(CCTK_ARGUMENTS) {

// calculate k1
calcrhs(2);
statecomp_t::lincomb(pre, 0.0, reals<1>{1.0}, states<1>{&rhs},
make_valid_int());
const auto k1 = copy_state(rhs, make_valid_int());
calcupdate(2, dt / 2, 0.0, reals<3>{1.0, c2, c1},
states<3>{&old, &k0, &k1});


// calculate k2
calcrhs(3);
const auto k2 = copy_state(rhs, make_valid_int());
Expand All @@ -1004,10 +1007,6 @@ extern "C" void ODESolvers_Solve(CCTK_ARGUMENTS) {
calcupdate(4, dt, 0.0, reals<5>{1.0, c6, c7, c8, c9},
states<5>{&old, &k0, &k1, &k2, &k3});

// update pre with k1
statecomp_t::lincomb(pre, 0.0, reals<1>{1.0}, states<1>{&k1},
make_valid_int());

} else if (CCTK_EQUALS(method, "RKF78")) {

typedef CCTK_REAL T;
Expand Down

0 comments on commit 18c1dc9

Please sign in to comment.