Skip to content

Testing Pedro code #105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/assist.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@
#include "planets.h"
#include "forces.h"

const int reb_max_messages_length = 1024; // needs to be constant expression for array size
const int reb_max_messages_N = 10;

#define STRINGIFY(s) str(s)
#define str(s) #s

const char* assist_build_str = __DATE__ " " __TIME__; // Date and time build string.
const char* assist_version_str = "1.1.7"; // **VERSIONLINE** This line gets updated automatically. Do not edit manually.
const char* assist_version_str = "1.1.9"; // **VERSIONLINE** This line gets updated automatically. Do not edit manually.
const char* assist_githash_str = STRINGIFY(ASSISTGITHASH);// This line gets updated automatically. Do not edit manually.


Expand Down Expand Up @@ -308,6 +305,7 @@ void assist_init(struct assist_extras* assist, struct reb_simulation* sim, struc
sim->extras_cleanup = assist_extras_cleanup;
sim->additional_forces = assist_additional_forces;
sim->force_is_velocity_dependent = 1;
sim->ri_ias15.adaptive_mode = 1; // Use legacy IAS15 timestepping mode
}

void assist_free_pointers(struct assist_extras* assist){
Expand Down Expand Up @@ -485,11 +483,14 @@ void assist_integrate_or_interpolate(struct assist_extras* ax, double t){
}

double dts = copysign(1., sim->dt_last_done);
if ( !(dts*(sim->t-sim->dt_last_done) < dts*t && dts*t < dts*sim->t) ){
double h = 1.0-(sim->t -t) / sim->dt_last_done;
// KK: this seems to be causing issues for us, I think it needs to be !(isnormal(h))
if ( !(dts*(sim->t-sim->dt_last_done) < dts*t && dts*t < dts*sim->t) && isnormal(h) ){
// Integrate if requested time not in interval of last timestep
reb_simulation_integrate(sim, t);
}
double h = 1.0-(sim->t -t) / sim->dt_last_done;

h = 1.0-(sim->t -t) / sim->dt_last_done;
if (sim->t - t==0.){
memcpy(ax->current_state, sim->particles, sizeof(struct reb_particle)*sim->N);
}else if (h<0.0 || h>=1.0 || !isnormal(h)){
Expand Down Expand Up @@ -580,3 +581,4 @@ static void assist_pre_timestep_modifications(struct reb_simulation* sim){
memcpy(assist->last_state, sim->particles, sizeof(struct reb_particle)*sim->N);
}