Skip to content
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

Sanity check for rebound #20

Open
wants to merge 1 commit into
base: develop
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
19 changes: 19 additions & 0 deletions src/nbody/nbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,25 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
pl.vy = particles_v[i].vel[1];
pl.vz = particles_v[i].vel[2];
reb_simulation_add(reb_sim, pl);

// Verify that what we added still lives
struct reb_particle *pl2 = reb_simulation_particle_by_hash(reb_sim, i + 1);
PARTHENON_REQUIRE(pl2->r == particles_v[i].radius,
"Particle radius is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->m == particles_v[i].GM,
"Particle mass is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->x == particles_v[i].pos[0],
"Particle x is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->y == particles_v[i].pos[1],
"Particle y is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->z == particles_v[i].pos[2],
"Particle z is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->vx == particles_v[i].vel[0],
"Particle vx is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->vy == particles_v[i].vel[1],
"Particle vy is inconsistent at setup!");
PARTHENON_REQUIRE(pl2->vz == particles_v[i].vel[2],
"Particle vz is inconsistent at setup!");
}

reb_simulation_configure_box(reb_sim, box_size, 1, 1, 1);
Expand Down
Loading