You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: galpy/util/wez_ias15.c
+13-7
Original file line number
Diff line number
Diff line change
@@ -252,6 +252,12 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
252
252
}
253
253
254
254
longndt= (long) (init_dt/dt);
255
+
inttimestep_sign;
256
+
if(init_dt>0){
257
+
timestep_sign=1;
258
+
} else {
259
+
timestep_sign=-1;
260
+
}
255
261
256
262
doubleto=*t;
257
263
// Handle KeyboardInterrupt gracefully
@@ -277,13 +283,13 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
277
283
}
278
284
279
285
//WHILE THERE IS TIME REMAINING, INTEGRATE A DYNAMIC TIMESTEP FORWARD AND SUBTRACT FROM THE TIME REMAINING
280
-
doubletime_remaining=init_dt;
281
-
286
+
doubletime_remaining=fabs(init_dt);
287
+
282
288
while(time_remaining>0) {
283
289
doubleto_temp;
284
-
doubledt_temp; //keeping an extra dt variable in case I want to change my dynamic strategy, I take the min of time remaining and dt, so not sure how taking the time remaining might effect the next dynamic time step
285
-
if (time_remaining<dt){
286
-
dt_temp=time_remaining;
290
+
doubledt_temp;
291
+
if (time_remaining<fabs(dt)){
292
+
dt_temp=timestep_sign*time_remaining;
287
293
} else {
288
294
dt_temp=dt;
289
295
}
@@ -359,12 +365,12 @@ void wez_ias15(void (*func)(double t, double *q, double *a, int nargs, struct po
0 commit comments