Enabled triple (plus) SMBHs
This commit is contained in:
parent
fcdafd94a6
commit
633c82b917
4 changed files with 75 additions and 148 deletions
44
phigrape.cpp
44
phigrape.cpp
|
|
@ -435,11 +435,10 @@ int main(int argc, char *argv[])
|
|||
calc_self_grav(time_cur, N, ind, x, v, pot, a, adot);
|
||||
|
||||
Black_hole_physics black_hole_physics;
|
||||
if (config.live_smbh_count == 1)
|
||||
black_hole_physics = Black_hole_physics(m[0], 0, myRank, rootRank);
|
||||
else if (config.live_smbh_count == 2) {
|
||||
black_hole_physics = Black_hole_physics(m[0], m[1], myRank, rootRank);
|
||||
black_hole_physics.set_xv(x[0], x[1], v[0], v[1]);
|
||||
std::vector<Particle_ref> smbh_list;
|
||||
if (config.live_smbh_count >= 1)
|
||||
black_hole_physics = Black_hole_physics(config.live_smbh_count, myRank, rootRank);
|
||||
else if (config.live_smbh_count >= 2) {
|
||||
if (config.live_smbh_custom_eps >= 0) {
|
||||
#ifdef ETICS
|
||||
double eps = (config.grapite_smbh_star_eps >= 0)?config.grapite_smbh_star_eps:config.eps;
|
||||
|
|
@ -447,13 +446,18 @@ int main(int argc, char *argv[])
|
|||
double eps = config.eps;
|
||||
#endif
|
||||
black_hole_physics.set_softening(eps, config.live_smbh_custom_eps);
|
||||
black_hole_physics.adjust_softening(pot[0], pot[1], a[0], a[1], adot[0], adot[1]);
|
||||
for (int i = 0; i < config.live_smbh_count; i++)
|
||||
smbh_list.emplace_back(m[i], x[i], v[i], pot[i], a[i], adot[i]);
|
||||
black_hole_physics.adjust_softening(smbh_list);
|
||||
}
|
||||
}
|
||||
if (config.binary_smbh_pn) {
|
||||
throw std::runtime_error("This is the triple+ SMBH version, it cannot do PN yet!");
|
||||
#if 0
|
||||
black_hole_physics.set_post_newtonian(config.pn_c, config.pn_usage.data());
|
||||
if (config.pn_usage[6]) black_hole_physics.set_spins(config.smbh1_spin.data(), config.smbh2_spin.data());
|
||||
black_hole_physics.adjust_post_newtonian(dt_min, a[0], a[1], adot[0], adot[1]);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<double> pot_ext(N, 0.);
|
||||
|
|
@ -532,7 +536,7 @@ int main(int argc, char *argv[])
|
|||
Binary_smbh_influence_sphere_output binary_smbh_influence_sphere_output(config.binary_smbh_influence_radius_factor, N, m, x, v, pot, dt);
|
||||
Write_bh_nb_data write_bh_nb_data(config.live_smbh_neighbor_number, config.live_smbh_count, N, m, x, v);
|
||||
if (myRank == rootRank) {
|
||||
if (config.live_smbh_output) black_hole_physics.write_bh_data(time_cur, m, x, v, pot, a, adot, dt);
|
||||
if (config.live_smbh_output) black_hole_physics.write_bh_data(time_cur, config.live_smbh_count, m, x, v, pot, a, adot, dt);
|
||||
if (config.live_smbh_neighbor_output) write_bh_nb_data(time_cur);
|
||||
} /* if (myRank == rootRank) */
|
||||
|
||||
|
|
@ -547,23 +551,23 @@ int main(int argc, char *argv[])
|
|||
active_search.get_active_indices(min_t, t, dt, ind_act, n_act);
|
||||
|
||||
/* Find the BH(s) indices in the active list */
|
||||
int i_bh1=0, i_bh2=1;
|
||||
smbh_list.clear();
|
||||
#ifdef ETICS
|
||||
/* Unlike with the simple active search, with GPU accelerated GRAPite
|
||||
active search, the list of active indices is not sorted. */
|
||||
int n_bh = config.live_smbh_count;
|
||||
if (config.grapite_active_search && (n_bh>0)) {
|
||||
int act_def_grapite_bh_count = 0;
|
||||
int i_bh[n_bh];
|
||||
for (int i=0; i<n_act; i++) {
|
||||
if (ind_act[i]<n_bh) {
|
||||
i_bh[ind_act[i]] = i;
|
||||
if (++act_def_grapite_bh_count == n_bh) break;
|
||||
smbh_list.emplace_back(m[ind_act[i]], x_act_new[i], v_act_new[i], pot_act_new[i], a_act_new[i], adot_act_new[i]);
|
||||
if (act_def_grapite_bh_count++ == n_bh) break;
|
||||
}
|
||||
}
|
||||
i_bh1 = i_bh[0];
|
||||
if (n_bh == 2) i_bh2 = i_bh[1];
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < config.live_smbh_count; i++)
|
||||
smbh_list.emplace_back(m[ind_act[i]], x_act_new[i], v_act_new[i], pot_act_new[i], a_act_new[i], adot_act_new[i]);
|
||||
#endif
|
||||
|
||||
/* predict the active particles positions etc... on all the nodes */
|
||||
|
|
@ -572,10 +576,11 @@ int main(int argc, char *argv[])
|
|||
/* Calculate gravity on active particles */
|
||||
calc_self_grav(min_t, n_act, ind_act, x_act_new, v_act_new, pot_act_new, a_act_new, adot_act_new);
|
||||
|
||||
if (config.live_smbh_count == 2) {
|
||||
black_hole_physics.set_xv(x_act_new[i_bh1], x_act_new[i_bh2], v_act_new[i_bh1], v_act_new[i_bh2]);
|
||||
if (config.live_smbh_custom_eps >= 0) black_hole_physics.adjust_softening(pot_act_new[i_bh1], pot_act_new[i_bh2], a_act_new[i_bh1], a_act_new[i_bh2], adot_act_new[i_bh1], adot_act_new[i_bh2]);
|
||||
if (config.live_smbh_count >= 2) {
|
||||
if (config.live_smbh_custom_eps >= 0) black_hole_physics.adjust_softening(smbh_list);
|
||||
#if 0
|
||||
if (config.binary_smbh_pn) black_hole_physics.adjust_post_newtonian(dt[i_bh1], a_act_new[i_bh1], a_act_new[i_bh2], adot_act_new[i_bh1], adot_act_new[i_bh2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Calculate gravity on active particles due to external forces */
|
||||
|
|
@ -623,10 +628,7 @@ int main(int argc, char *argv[])
|
|||
} /* i */
|
||||
|
||||
/* define the min. dt over all the act. part. and set it also for the BH... */
|
||||
if (config.live_smbh_count > 0) {
|
||||
if (config.live_smbh_count>=1) dt[0] = min_dt;
|
||||
if (config.live_smbh_count==2) dt[1] = min_dt;
|
||||
}
|
||||
for (int i=0; i < config.live_smbh_count; i++) dt[i] = min_dt;
|
||||
|
||||
if (config.binary_smbh_influence_sphere_output && (myRank == rootRank))
|
||||
binary_smbh_influence_sphere_output(ind_act, n_act, timesteps, time_cur);
|
||||
|
|
@ -652,7 +654,7 @@ int main(int argc, char *argv[])
|
|||
if (time_cur >= t_bh) {
|
||||
if (myRank == rootRank) {
|
||||
/* Write BH data... */
|
||||
if (config.live_smbh_output) black_hole_physics.write_bh_data(time_cur, m, x, v, pot, a, adot, dt);
|
||||
if (config.live_smbh_output) black_hole_physics.write_bh_data(time_cur, config.live_smbh_count, m, x, v, pot, a, adot, dt);
|
||||
|
||||
/* Write BH NB data... */
|
||||
if (config.live_smbh_neighbor_output) write_bh_nb_data(time_cur);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue