Skip to content

Commit

Permalink
style to avoid large diff
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed Jul 20, 2023
1 parent 1c49cb4 commit 571ff3e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/integrator_ias15.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,22 +616,22 @@ static int reb_integrator_ias15_step(struct reb_simulation* r) {
dt_new = dt_done/safety_factor; // by default, increase timestep a little
}
}

if (fabs(dt_new)<r->ri_ias15.min_dt) dt_new = copysign(r->ri_ias15.min_dt,dt_new);

if (fabs(dt_new/dt_done) < safety_factor) { // New timestep is significantly smaller.
// Reset particles
// Reset particles
for(int k=0;k<N;++k) {
int mk = map[k];
particles[mk].x = x0[3*k+0]; // Set inital position
particles[mk].x = x0[3*k+0]; // Set inital position
particles[mk].y = x0[3*k+1];
particles[mk].z = x0[3*k+2];

particles[mk].vx = v0[3*k+0]; // Set inital velocity
particles[mk].vx = v0[3*k+0]; // Set inital velocity
particles[mk].vy = v0[3*k+1];
particles[mk].vz = v0[3*k+2];

particles[mk].ax = a0[3*k+0]; // Set inital acceleration
particles[mk].ax = a0[3*k+0]; // Set inital acceleration
particles[mk].ay = a0[3*k+1];
particles[mk].az = a0[3*k+2];
}
Expand All @@ -640,9 +640,9 @@ static int reb_integrator_ias15_step(struct reb_simulation* r) {
double ratio = r->dt/r->dt_last_done;
predict_next_step(ratio, N3, er, br, e, b);
}

return 0; // Step rejected. Do again.
}
}
if (fabs(dt_new/dt_done) > 1.0) { // New timestep is larger.
if (dt_new/dt_done > 1./safety_factor) dt_new = dt_done /safety_factor; // Don't increase the timestep by too much compared to the last one.
}
Expand Down

0 comments on commit 571ff3e

Please sign in to comment.