Minor edits
This commit is contained in:
parent
fd33819a7a
commit
7721bc1830
1 changed files with 15 additions and 81 deletions
94
phigrape.cpp
94
phigrape.cpp
|
|
@ -299,7 +299,7 @@ double dt_disk, dt_contr, t_disk=0.0, t_contr=0.0,
|
||||||
dtinv, dt2inv, dt3inv,
|
dtinv, dt2inv, dt3inv,
|
||||||
a0mia1, ad04plad12, ad0plad1,
|
a0mia1, ad04plad12, ad0plad1,
|
||||||
a1abs, adot1abs, a2dot1abs, a3dot1abs,
|
a1abs, adot1abs, a2dot1abs, a3dot1abs,
|
||||||
Timesteps=0.0, n_act_sum=0.0, n_act_distr[N_MAX], g6_calls=0.0, g6_calls_sum=0.0,
|
timesteps=0.0, n_act_sum=0.0, n_act_distr[N_MAX], g6_calls=0.0, g6_calls_sum=0.0,
|
||||||
tmp, tmp_r, tmp_v, tmp_rv, tmp_cpu,
|
tmp, tmp_r, tmp_v, tmp_rv, tmp_cpu,
|
||||||
tmp_pot, tmp_a, tmp_adot,
|
tmp_pot, tmp_a, tmp_adot,
|
||||||
tmp_a_bh, tmp_adot_bh,
|
tmp_a_bh, tmp_adot_bh,
|
||||||
|
|
@ -537,20 +537,6 @@ return - 0 if everything OK
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* RAND_MAX = 2147483647 */
|
|
||||||
/* my_rand : 0.0 - 1.0 */
|
|
||||||
/* my_rand2 : -1.0 - 1.0 */
|
|
||||||
|
|
||||||
double my_rand(void)
|
|
||||||
{
|
|
||||||
return((double)(rand()/(double)RAND_MAX) );
|
|
||||||
}
|
|
||||||
|
|
||||||
double my_rand2(void)
|
|
||||||
{
|
|
||||||
return (double)(2.0)*((rand() - RAND_MAX/2)/(double)RAND_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ETICS
|
#ifdef ETICS
|
||||||
double t_exp, dt_exp=ETICS_DTSCF; // t_exp is just the initial value
|
double t_exp, dt_exp=ETICS_DTSCF; // t_exp is just the initial value
|
||||||
#ifdef ETICS_CEP
|
#ifdef ETICS_CEP
|
||||||
|
|
@ -1557,53 +1543,6 @@ for (i=0; i<ni; i++)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTPOT_SC
|
|
||||||
|
|
||||||
for (i=0; i<ni; i++)
|
|
||||||
{
|
|
||||||
|
|
||||||
x_ij = x_act_new[i][0];
|
|
||||||
y_ij = x_act_new[i][1];
|
|
||||||
z_ij = x_act_new[i][2];
|
|
||||||
|
|
||||||
vx_ij = v_act_new[i][0];
|
|
||||||
vy_ij = v_act_new[i][1];
|
|
||||||
vz_ij = v_act_new[i][2];
|
|
||||||
|
|
||||||
// r2 = eps2;
|
|
||||||
r2 = 0.0;
|
|
||||||
|
|
||||||
r2 += x_ij*x_ij + y_ij*y_ij + z_ij*z_ij; r = sqrt(r2);
|
|
||||||
|
|
||||||
rv_ij = vx_ij*x_ij + vy_ij*y_ij + vz_ij*z_ij;
|
|
||||||
|
|
||||||
M_R = 0.0;
|
|
||||||
pot_out_R = 0.0;
|
|
||||||
|
|
||||||
def_SC_mass(r, &M_R, &pot_out_R); // Mass of GAS inside < r
|
|
||||||
|
|
||||||
/* for accuracy test... */
|
|
||||||
// M_R = 0.0;
|
|
||||||
// pot_out_R = 0.0;
|
|
||||||
|
|
||||||
tmp = M_R / r;
|
|
||||||
|
|
||||||
pot_act_ext[i] -= tmp + pot_out_R;
|
|
||||||
|
|
||||||
tmp /= r2;
|
|
||||||
|
|
||||||
a_act_new[i][0] -= tmp * x_ij;
|
|
||||||
a_act_new[i][1] -= tmp * y_ij;
|
|
||||||
a_act_new[i][2] -= tmp * z_ij;
|
|
||||||
|
|
||||||
adot_act_new[i][0] -= tmp * (vx_ij - 3.0*rv_ij * x_ij/r2);
|
|
||||||
adot_act_new[i][1] -= tmp * (vy_ij - 3.0*rv_ij * y_ij/r2);
|
|
||||||
adot_act_new[i][2] -= tmp * (vz_ij - 3.0*rv_ij * z_ij/r2);
|
|
||||||
|
|
||||||
} /* i */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TIMING
|
#ifdef TIMING
|
||||||
get_CPU_time(&CPU_tmp_real, &CPU_tmp_user, &CPU_tmp_syst);
|
get_CPU_time(&CPU_tmp_real, &CPU_tmp_user, &CPU_tmp_syst);
|
||||||
DT_EXT_GRAV += (CPU_tmp_user - CPU_tmp_user0);
|
DT_EXT_GRAV += (CPU_tmp_user - CPU_tmp_user0);
|
||||||
|
|
@ -1627,7 +1566,7 @@ void energy_contr()
|
||||||
for (i=0; i<N; i++) E_pot_ext += m[i]*pot_ext[i];
|
for (i=0; i<N; i++) E_pot_ext += m[i]*pot_ext[i];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Timesteps == 0.0) {
|
if (timesteps == 0.0) {
|
||||||
rcm_sum = 0.0;
|
rcm_sum = 0.0;
|
||||||
vcm_sum = 0.0;
|
vcm_sum = 0.0;
|
||||||
}
|
}
|
||||||
|
|
@ -1669,7 +1608,7 @@ void energy_contr()
|
||||||
E_tot_corr = E_tot + E_corr;
|
E_tot_corr = E_tot + E_corr;
|
||||||
E_tot_corr_sd = E_tot + E_corr + E_sd;
|
E_tot_corr_sd = E_tot + E_corr + E_sd;
|
||||||
|
|
||||||
if (Timesteps == 0.0) {
|
if (timesteps == 0.0) {
|
||||||
/* initialize the E_tot_0 + etc... */
|
/* initialize the E_tot_0 + etc... */
|
||||||
|
|
||||||
E_tot_0 = E_tot;
|
E_tot_0 = E_tot;
|
||||||
|
|
@ -1697,7 +1636,7 @@ void energy_contr()
|
||||||
DE_tot_corr_sd = E_tot_corr_sd - E_tot_corr_sd_0;
|
DE_tot_corr_sd = E_tot_corr_sd - E_tot_corr_sd_0;
|
||||||
|
|
||||||
printf("%.3E %.3E % .4E %.4E % .4E % .4E % .4E %.2E\n",
|
printf("%.3E %.3E % .4E %.4E % .4E % .4E % .4E %.2E\n",
|
||||||
time_cur, Timesteps,
|
time_cur, timesteps,
|
||||||
E_pot, E_kin, E_pot_ext, E_tot, DE_tot,
|
E_pot, E_kin, E_pot_ext, E_tot, DE_tot,
|
||||||
CPU_time_user-CPU_time_user0);
|
CPU_time_user-CPU_time_user0);
|
||||||
|
|
||||||
|
|
@ -1705,7 +1644,7 @@ void energy_contr()
|
||||||
|
|
||||||
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",
|
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,
|
time_cur, timesteps, n_act_sum, g6_calls,
|
||||||
E_pot, E_kin, E_pot_ext,
|
E_pot, E_kin, E_pot_ext,
|
||||||
E_tot, DE_tot,
|
E_tot, DE_tot,
|
||||||
rcm_mod, vcm_mod,
|
rcm_mod, vcm_mod,
|
||||||
|
|
@ -1715,7 +1654,7 @@ void energy_contr()
|
||||||
|
|
||||||
out = fopen("contr.con","w");
|
out = fopen("contr.con","w");
|
||||||
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",
|
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,
|
time_cur, timesteps, n_act_sum, g6_calls,
|
||||||
E_pot, E_kin, E_pot_ext,
|
E_pot, E_kin, E_pot_ext,
|
||||||
E_tot, DE_tot,
|
E_tot, DE_tot,
|
||||||
rcm_mod, vcm_mod,
|
rcm_mod, vcm_mod,
|
||||||
|
|
@ -2217,7 +2156,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (myRank == rootRank) {
|
if (myRank == rootRank) {
|
||||||
if (tmp_i == 505) {
|
if (tmp_i == 505) {
|
||||||
printf("PN RSDIST: %.8E \t %.8E \n", Timesteps, time_cur);
|
printf("PN RSDIST: %.8E \t %.8E \n", timesteps, time_cur);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
@ -2373,11 +2312,6 @@ int main(int argc, char *argv[])
|
||||||
write_bh_nb_data();
|
write_bh_nb_data();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BH_OUT_NB_EXT
|
|
||||||
/* Write BH NB data... */
|
|
||||||
write_bh_nb_data_ext();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} /* if (myRank == rootRank) */
|
} /* if (myRank == rootRank) */
|
||||||
|
|
||||||
/* Get the Starting time on rootRank */
|
/* Get the Starting time on rootRank */
|
||||||
|
|
@ -2388,7 +2322,7 @@ int main(int argc, char *argv[])
|
||||||
tmp_cpu = CPU_time_real-CPU_time_real0;
|
tmp_cpu = CPU_time_real-CPU_time_real0;
|
||||||
} /* if (myRank == rootRank) */
|
} /* if (myRank == rootRank) */
|
||||||
|
|
||||||
Timesteps = 0.0;
|
timesteps = 0.0;
|
||||||
n_act_sum = 0.0;
|
n_act_sum = 0.0;
|
||||||
|
|
||||||
for (i=1; i<N+1; i++) {
|
for (i=1; i<N+1; i++) {
|
||||||
|
|
@ -2665,7 +2599,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (myRank == rootRank) {
|
if (myRank == rootRank) {
|
||||||
if (tmp_i == 505) {
|
if (tmp_i == 505) {
|
||||||
printf("PN RSDIST: TS = %.8E \t t = %.8E \n", Timesteps, time_cur);
|
printf("PN RSDIST: TS = %.8E \t t = %.8E \n", timesteps, time_cur);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
@ -2831,7 +2765,7 @@ int main(int argc, char *argv[])
|
||||||
if (inf_event[iii] == 0) {
|
if (inf_event[iii] == 0) {
|
||||||
|
|
||||||
fprintf(out,"INF1 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n",
|
fprintf(out,"INF1 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n",
|
||||||
Timesteps, time_cur, i, ind_act[i],
|
timesteps, time_cur, i, ind_act[i],
|
||||||
sqrt(DR2), x_bbhc[0], x_bbhc[1], x_bbhc[2], v_bbhc[0], v_bbhc[1], v_bbhc[2],
|
sqrt(DR2), x_bbhc[0], x_bbhc[1], x_bbhc[2], v_bbhc[0], v_bbhc[1], v_bbhc[2],
|
||||||
m_bh1, x_bh1[0], x_bh1[1], x_bh1[2], v_bh1[0], v_bh1[1], v_bh1[2], pot_act[0],
|
m_bh1, x_bh1[0], x_bh1[1], x_bh1[2], v_bh1[0], v_bh1[1], v_bh1[2], pot_act[0],
|
||||||
m_bh2, x_bh2[0], x_bh2[1], x_bh2[2], v_bh2[0], v_bh2[1], v_bh2[2], pot_act[1],
|
m_bh2, x_bh2[0], x_bh2[1], x_bh2[2], v_bh2[0], v_bh2[1], v_bh2[2], pot_act[1],
|
||||||
|
|
@ -2845,7 +2779,7 @@ int main(int argc, char *argv[])
|
||||||
} else {
|
} else {
|
||||||
if (inf_event[iii] == 1) {
|
if (inf_event[iii] == 1) {
|
||||||
fprintf(out,"INF2 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n",
|
fprintf(out,"INF2 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n",
|
||||||
Timesteps, time_cur, i, ind_act[i],
|
timesteps, time_cur, i, ind_act[i],
|
||||||
sqrt(DR2), x_bbhc[0], x_bbhc[1], x_bbhc[2], v_bbhc[0], v_bbhc[1], v_bbhc[2],
|
sqrt(DR2), x_bbhc[0], x_bbhc[1], x_bbhc[2], v_bbhc[0], v_bbhc[1], v_bbhc[2],
|
||||||
m_bh1, x_bh1[0], x_bh1[1], x_bh1[2], v_bh1[0], v_bh1[1], v_bh1[2], pot_act[0],
|
m_bh1, x_bh1[0], x_bh1[1], x_bh1[2], v_bh1[0], v_bh1[1], v_bh1[2], pot_act[0],
|
||||||
m_bh2, x_bh2[0], x_bh2[1], x_bh2[2], v_bh2[0], v_bh2[1], v_bh2[2], pot_act[1],
|
m_bh2, x_bh2[0], x_bh2[1], x_bh2[2], v_bh2[0], v_bh2[1], v_bh2[2], pot_act[1],
|
||||||
|
|
@ -2929,7 +2863,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
time_cur = min_t;
|
time_cur = min_t;
|
||||||
|
|
||||||
Timesteps += 1.0;
|
timesteps += 1.0;
|
||||||
n_act_sum += n_act;
|
n_act_sum += n_act;
|
||||||
n_act_distr[n_act-1]++;
|
n_act_distr[n_act-1]++;
|
||||||
|
|
||||||
|
|
@ -2980,7 +2914,7 @@ int main(int argc, char *argv[])
|
||||||
100.0*DT_STEVOL/DT_TOT, 100.0*DT_STARDISK/DT_TOT, 100.0*DT_STARDESTR/DT_TOT,
|
100.0*DT_STEVOL/DT_TOT, 100.0*DT_STARDISK/DT_TOT, 100.0*DT_STARDESTR/DT_TOT,
|
||||||
100.0*DT_ACT_REDUCE/DT_TOT,
|
100.0*DT_ACT_REDUCE/DT_TOT,
|
||||||
CPU_time_real-CPU_time_real0, CPU_time_user-CPU_time_user0, CPU_time_syst-CPU_time_syst0,
|
CPU_time_real-CPU_time_real0, CPU_time_user-CPU_time_user0, CPU_time_syst-CPU_time_syst0,
|
||||||
Timesteps, n_act_sum, 57.0*N*n_act_sum/(CPU_time_user-CPU_time_user0)/1.0E+09);
|
timesteps, n_act_sum, 57.0*N*n_act_sum/(CPU_time_user-CPU_time_user0)/1.0E+09);
|
||||||
|
|
||||||
fclose(out);
|
fclose(out);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3043,7 +2977,7 @@ int main(int argc, char *argv[])
|
||||||
/* Write some output for the timestep annalize... */
|
/* Write some output for the timestep annalize... */
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Timesteps = %.0f Total sum of integrated part. = %.0f g6_calls on all nodes = %.0f \n", Timesteps, n_act_sum, g6_calls);
|
printf("timesteps = %.0f Total sum of integrated part. = %.0f g6_calls on all nodes = %.0f \n", timesteps, n_act_sum, g6_calls);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Real Speed = %.3f GFlops \n", 57.0*N*n_act_sum/(CPU_time_user-CPU_time_user0)/1.0E+09);
|
printf("Real Speed = %.3f GFlops \n", 57.0*N*n_act_sum/(CPU_time_user-CPU_time_user0)/1.0E+09);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue