Improved the new-style config file and its reader

This commit is contained in:
Yohai Meiron 2020-03-15 21:35:53 -04:00
parent 90f070d1fb
commit cd282cc406
3 changed files with 119 additions and 21 deletions

View file

@ -63,7 +63,6 @@ struct Parameters {
double binary_smbh_influence_radius_factor = 3.162277660168379497918067e+03; // R_INF
int live_smbh_neighbor_number = 10; // TODO make sure it's smaller than N? or just warn if it's not
bool binary_smbh_pn = true; // ADD_PN_BH
bool binary_smbh_spin = true; // ADD_SPIN_BH
bool dt_min_warning = true; // DT_MIN_WARNING
} parameters;
@ -659,7 +658,7 @@ void write_bh_data()
{
if (parameters.live_smbh_count == 2) {
out = fopen("bh.dat","a");
out = fopen("bh.dat", "a");
for (int i=0; i < 2; i++) {
// double (*a_pn)[3], (*adot_pn)[3], pot_bh, *a_bh, *adot_bh;
@ -759,7 +758,7 @@ void write_bh_data()
fprintf(out,"\n");
fclose(out);
} else if (parameters.live_smbh_count == 1) {
out = fopen("bh.dat","a");
out = fopen("bh.dat", "a");
tmp_r = sqrt( SQR(x[0][0]) + SQR(x[0][1]) + SQR(x[0][2]) );
tmp_v = sqrt( SQR(v[0][0]) + SQR(v[0][1]) + SQR(v[0][2]) );
tmp_a = sqrt( SQR(a[0][0]) + SQR(a[0][1]) + SQR(a[0][2]) );
@ -782,7 +781,7 @@ void write_bh_nb_data()
int i_bh, nb = parameters.live_smbh_neighbor_number;
double tmp, tmp_r, tmp_v;
out = fopen("bh_nb.dat", "a");
out = fopen("bh_neighbors.dat", "a");
/* 1st BH */
@ -1453,7 +1452,7 @@ void energy_contr()
fflush(stdout);
out = fopen("contr.dat","a");
out = fopen("contr.dat", "a");
fprintf(out,"%.8E \t %.8E %.8E %.8E \t % .8E % .8E % .8E % .8E % .8E \t % .8E % .8E \t % .8E % .8E % .8E \t %.8E %.8E %.8E \n",
time_cur, timesteps, n_act_sum, g6_calls,
E_pot, E_kin, E_pot_ext,
@ -1515,7 +1514,7 @@ int main(int argc, char *argv[])
t_end : end time of calculation
dt_disk : interval of snapshot files output (0xxx.dat)
dt_contr : interval for the energy control output (contr.dat)
dt_bh : interval for BH output (bh.dat & bh_nb.dat)
dt_bh : interval for BH output (bh.dat & bh_neighbors.dat)
eta : parameter for timestep determination
inp_data : name of the input file (data.inp)
*/
@ -1618,11 +1617,11 @@ int main(int argc, char *argv[])
fflush(stdout);
if ((diskstep == 0) && (time_cur == 0.0)) {
out = fopen("contr.dat","w");
out = fopen("contr.dat", "w");
fclose(out);
#ifdef TIMING
out = fopen("timing.dat","w");
out = fopen("timing.dat", "w");
fclose(out);
#endif
@ -1631,11 +1630,11 @@ int main(int argc, char *argv[])
fclose(out);
}
if ((parameters.live_smbh_neighbor_output) && (parameters.live_smbh_count > 0)) {
out = fopen("bh_nb.dat", "w");
out = fopen("bh_neighbors.dat", "w");
fclose(out);
}
if (parameters.binary_smbh_influence_sphere_output) {
out = fopen("bbh.inf","w");
out = fopen("bbh_inf.dat", "w");
fclose(out);
}
@ -2440,7 +2439,7 @@ int main(int argc, char *argv[])
if (parameters.binary_smbh_influence_sphere_output) {
if (myRank == rootRank) {
out = fopen("bbh.inf","a");
out = fopen("bbh_inf.dat", "a");
m_bh1 = m_act[i_bh1];
m_bh2 = m_act[i_bh2];
@ -2600,7 +2599,7 @@ int main(int argc, char *argv[])
/* possible OUT for timing !!! */
#ifdef TIMING
out = fopen("timing.dat","a");
out = fopen("timing.dat", "a");
DT_TOT = DT_ACT_DEF1 + DT_ACT_DEF2 + DT_ACT_DEF3 + DT_ACT_PRED +
DT_ACT_GRAV + DT_EXT_GRAV + DT_GMC_GRAV +