Moved SMBH de-softening to a function (still not pretty) and improved init script
This commit is contained in:
parent
56abe820c3
commit
d9e3aea243
2 changed files with 100 additions and 47 deletions
98
phigrape.cpp
98
phigrape.cpp
|
|
@ -666,6 +666,54 @@ void binary_smbh_influence_sphere_output(int i_bh1, int i_bh2, int ind_act[], do
|
|||
|
||||
}
|
||||
|
||||
void adjust_bsmbh_softening(const double eps, const double eps_bh, const int i_bh1, const int i_bh2, const double m_act[], const double3 x_act_new[], const double3 v_act_new[], double pot_act_new[], double3 a_act_new[], double3 adot_act_new[])
|
||||
{
|
||||
double m_bh1 = m_act[i_bh1];
|
||||
double m_bh2 = m_act[i_bh2];
|
||||
|
||||
double3 x_bh1 = x_act_new[i_bh1];
|
||||
double3 v_bh1 = v_act_new[i_bh1];
|
||||
|
||||
double3 x_bh2 = x_act_new[i_bh2];
|
||||
double3 v_bh2 = v_act_new[i_bh2];
|
||||
|
||||
// calculate and "minus" the BH <-> BH softened pot, acc & jerk
|
||||
|
||||
double tmp_i;
|
||||
tmp_i = calc_force_n_BH(m_bh1, x_bh1, v_bh1,
|
||||
m_bh2, x_bh2, v_bh2,
|
||||
eps,
|
||||
&pot_bh1, a_bh1, adot_bh1,
|
||||
&pot_bh2, a_bh2, adot_bh2);
|
||||
|
||||
pot_act_new[i_bh1] -= pot_bh1;
|
||||
pot_act_new[i_bh2] -= pot_bh2;
|
||||
|
||||
a_act_new[i_bh1] -= a_bh1;
|
||||
a_act_new[i_bh2] -= a_bh2;
|
||||
|
||||
adot_act_new[i_bh1] -= adot_bh1;
|
||||
adot_act_new[i_bh2] -= adot_bh2;
|
||||
|
||||
// calculate and "plus" the new BH <-> BH unsoftened pot, acc, jerk
|
||||
|
||||
tmp_i = calc_force_n_BH(m_bh1, x_bh1, v_bh1,
|
||||
m_bh2, x_bh2, v_bh2,
|
||||
eps_bh,
|
||||
&pot_bh1, a_bh1, adot_bh1,
|
||||
&pot_bh2, a_bh2, adot_bh2);
|
||||
|
||||
pot_act_new[i_bh1] += pot_bh1;
|
||||
pot_act_new[i_bh2] += pot_bh2;
|
||||
|
||||
a_act_new[i_bh1] += a_bh1;
|
||||
a_act_new[i_bh2] += a_bh2;
|
||||
|
||||
adot_act_new[i_bh1] += adot_bh1;
|
||||
adot_act_new[i_bh2] += adot_bh2;
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int name_proc, n_proc=1, myRank=0, rootRank=0, cur_rank,
|
||||
|
|
@ -1306,6 +1354,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
for (int i=0; i<n_act; i++) {
|
||||
int j_act = ind_act[i];
|
||||
// NOTICE much of these are just not needed!
|
||||
m_act[i] = m[j_act];
|
||||
x_act[i] = x[j_act];
|
||||
v_act[i] = v[j_act];
|
||||
|
|
@ -1370,48 +1419,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (config->live_smbh_count == 2) {
|
||||
if (config->live_smbh_custom_eps >= 0) {
|
||||
m_bh1 = m_act[i_bh1];
|
||||
m_bh2 = m_act[i_bh2];
|
||||
|
||||
x_bh1 = x_act_new[i_bh1];
|
||||
v_bh1 = v_act_new[i_bh1];
|
||||
|
||||
x_bh2 = x_act_new[i_bh2];
|
||||
v_bh2 = v_act_new[i_bh2];
|
||||
|
||||
// calculate and "minus" the BH <-> BH softened pot, acc & jerk
|
||||
|
||||
tmp_i = calc_force_n_BH(m_bh1, x_bh1, v_bh1,
|
||||
m_bh2, x_bh2, v_bh2,
|
||||
eps,
|
||||
&pot_bh1, a_bh1, adot_bh1,
|
||||
&pot_bh2, a_bh2, adot_bh2);
|
||||
|
||||
pot_act_new[i_bh1] -= pot_bh1;
|
||||
pot_act_new[i_bh2] -= pot_bh2;
|
||||
|
||||
a_act_new[i_bh1] -= a_bh1;
|
||||
a_act_new[i_bh2] -= a_bh2;
|
||||
|
||||
adot_act_new[i_bh1] -= adot_bh1;
|
||||
adot_act_new[i_bh2] -= adot_bh2;
|
||||
|
||||
// calculate and "plus" the new BH <-> BH unsoftened pot, acc, jerk
|
||||
|
||||
tmp_i = calc_force_n_BH(m_bh1, x_bh1, v_bh1,
|
||||
m_bh2, x_bh2, v_bh2,
|
||||
config->live_smbh_custom_eps,
|
||||
&pot_bh1, a_bh1, adot_bh1,
|
||||
&pot_bh2, a_bh2, adot_bh2);
|
||||
|
||||
pot_act_new[i_bh1] += pot_bh1;
|
||||
pot_act_new[i_bh2] += pot_bh2;
|
||||
|
||||
a_act_new[i_bh1] += a_bh1;
|
||||
a_act_new[i_bh2] += a_bh2;
|
||||
|
||||
adot_act_new[i_bh1] += adot_bh1;
|
||||
adot_act_new[i_bh2] += adot_bh2;
|
||||
adjust_bsmbh_softening(eps, config->live_smbh_custom_eps, i_bh1, i_bh2, m_act, x_act_new, v_act_new, pot_act_new, a_act_new, adot_act_new);
|
||||
}
|
||||
|
||||
if (config->binary_smbh_pn) {
|
||||
|
|
@ -1498,11 +1506,9 @@ int main(int argc, char *argv[])
|
|||
v_act[i] = v_act_new[i];
|
||||
a_act[i] = a_act_new[i];
|
||||
adot_act[i] = adot_act_new[i];
|
||||
|
||||
|
||||
/* END copy of everything */
|
||||
|
||||
|
||||
|
||||
} /* i */
|
||||
|
||||
/* define the min. dt over all the act. part. and set it also for the BH... */
|
||||
|
|
@ -1515,7 +1521,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (config->binary_smbh_influence_sphere_output && (myRank == rootRank)) {
|
||||
//TODO clean up this mass. We don't want to have all these _act arrays; they are only needed for this lame function.
|
||||
binary_smbh_influence_sphere_output(i_bh1, i_bh2, ind_act, m_act, x_act, v_act, pot_act, dt_act, n_act, timesteps, time_cur, config->binary_smbh_influence_radius_factor, inf_event);
|
||||
binary_smbh_influence_sphere_output(i_bh1, i_bh2, ind_act, m_act, x_act_new, v_act_new, pot_act_new, dt_act, n_act, timesteps, time_cur, config->binary_smbh_influence_radius_factor, inf_event);
|
||||
}
|
||||
|
||||
/* Return back the new coordinates + etc... of active part. to the global data... */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue