Enabled triple (plus) SMBHs

This commit is contained in:
Yohai Meiron 2022-05-19 20:35:24 -04:00
parent fcdafd94a6
commit 633c82b917
4 changed files with 75 additions and 148 deletions

View file

@ -3,6 +3,17 @@
#include <vector>
#include "double3.h"
struct Particle_ref {
Particle_ref(double& m, double3& x, double3& v, double& pot, double3& acc, double3& jrk) :
m(m), x(x), v(v), pot(pot), acc(acc), jrk(jrk) {}
const double& m;
const double3& x;
const double3& v;
double& pot;
double3& acc;
double3& jrk;
};
struct Bbh_gravity {
double pot1, pot2;
double3 a1, a2, adot1, adot2, a_pn1[7], a_pn2[7], adot_pn1[7], adot_pn2[7];
@ -13,8 +24,8 @@ class Black_hole_physics {
public:
Black_hole_physics()
: count(0), c(0) {}
Black_hole_physics(const double m1, const double m2, const int myRank, const int rootRank)
: m1(m1), m2(m2), count(2), c(0), myRank(myRank), rootRank(rootRank) {}
Black_hole_physics(const int count, const int myRank, const int rootRank)
: count(count), c(0), myRank(myRank), rootRank(rootRank) {}
void set_post_newtonian(const double c, const int pn_usage[7])
{
this->c = c;
@ -25,34 +36,23 @@ public:
std::copy(spin1, spin1+3, this->bbh_grav.spin1);
std::copy(spin2, spin2+3, this->bbh_grav.spin2);
}
void set_xv(const double3& x1, const double3& x2, const double3& v1, const double3& v2)
{
this->x1 = x1;
this->x2 = x2;
this->v1 = v1;
this->v2 = v2;
}
void set_softening(const double eps_old, const double eps_new)
{
this->eps_old = eps_old;
this->eps_new = eps_new;
}
void adjust_softening(
double& pot1, double& pot2,
double3& acc1, double3& acc2,
double3& jrk1, double3& jrk2);
void adjust_softening(const std::vector<Particle_ref>& particles);
void adjust_post_newtonian(
const double dt_bh, // pn_usage should be const
double3& acc1, double3& acc2,
double3& jrk1, double3& jrk2);
void write_bh_data(double time_cur, const std::vector<double> &m, const std::vector<double3> &x, const std::vector<double3> &v, const std::vector<double> &pot, const std::vector<double3> &a, const std::vector<double3> &adot, const std::vector<double> &dt);
void write_bh_data(const double time_cur, const int count, const std::vector<double> &m, const std::vector<double3> &x, const std::vector<double3> &v, const std::vector<double> &pot, const std::vector<double3> &a, const std::vector<double3> &adot, const std::vector<double> &dt);
public: //TODO make private
double m1, m2;
/////////////std::vector<double> masses;
int count;
int myRank, rootRank;
double eps_old, eps_new;
double3 x1, v1, x2, v2;
double c;
int pn_usage[7];
Bbh_gravity bbh_grav;
@ -101,4 +101,4 @@ private:
const std::vector<double3> &x, &v;
std::vector<int> inf_event;
FILE *out;
};
};