00001
00002
00003
00004
00005
00006
00007
00008 #define C_ONLY
00009 #include "scatter3.h"
00010 #include "c_interface.h"
00011
00012 local void print_system(body* system)
00013 {
00014 int i, k;
00015
00016 printf(" system:\n");
00017 for (i = 0; i < 3; i++) {
00018 printf(" %d (%d): mass: %f\n",
00019 i, system[i].index, system[i].mass);
00020 printf(" pos: ");
00021 for (k = 0; k < 3; k++) printf(" %f", system[i].pos[k]);
00022 printf("\n");
00023 printf(" vel: ");
00024 for (k = 0; k < 3; k++) printf(" %f", system[i].vel[k]);
00025 printf("\n");
00026 }
00027 }
00028
00029 void main(int argc, char **argv)
00030 {
00031 int seed = 0;
00032
00033 int n_rand = 0;
00034
00035 real dt_out
00036 = VERY_LARGE_NUMBER;
00037 real dt_snap
00038 = VERY_LARGE_NUMBER;
00039 real snap_cube_size = 10;
00040
00041 real cpu_time_check = 3600;
00042
00043 initial_state3 init;
00044 intermediate_state3 inter;
00045 final_state3 final;
00046
00047 int k;
00048
00049
00050
00051 c_srandinter(seed, n_rand);
00052 c_make_standard_init(&init);
00053 c_initialize_angles(&init, 0, 0, 0.0);
00054
00055 init.v_inf = 0.1;
00056 init.phase.mean_anomaly = c_randinter(0.0, 2*PI);
00057
00058
00059
00060 c_cpu_init();
00061 c_scatter3(&init, &inter, &final, cpu_time_check,
00062 dt_out, dt_snap, snap_cube_size);
00063
00064
00065
00066 printf("Initial state:\n");
00067 printf(" m1 = %f\n", 1-init.m2);
00068 printf(" m2 = %f\n", init.m2);
00069 printf(" m3 = %f\n", init.m3);
00070 printf(" r1 = %f\n", init.r1);
00071 printf(" r2 = %f\n", init.r2);
00072 printf(" r3 = %f\n", init.r3);
00073 printf(" sma = %f\n", init.sma);
00074 printf(" ecc = %f\n", init.ecc);
00075 printf(" v_inf = %f\n", init.v_inf);
00076 printf(" rho = %f\n", init.rho);
00077 printf(" r_init_min = %f\n", init.r_init_min);
00078 printf(" r_init_max = %e\n", init.r_init_max);
00079 printf(" r_init = %f\n", init.r_init);
00080 printf(" r_stop = %e\n", init.r_stop);
00081 printf(" tidal_tol = %e\n", init.tidal_tol_factor);
00082 printf(" eta = %f\n", init.eta);
00083 printf(" phase:\n");
00084 printf(" cos_theta = %f\n", init.phase.cos_theta);
00085 printf(" phi = %f\n", init.phase.phi);
00086 printf(" psi = %f\n", init.phase.psi);
00087 printf(" mean_anomaly = %f\n", init.phase.mean_anomaly);
00088 print_system(init.system);
00089
00090
00091
00092 printf("\nIntermediate state:\n");
00093 printf(" n_osc = %d\n", inter.n_osc);
00094 printf(" n_kepler = %d\n", inter.n_kepler);
00095 printf(" n_stars = %d\n", inter.n_stars);
00096 printf(" index =");
00097 for (k = 0; k < 3; k++ ) printf(" %d", inter.index[k]);
00098 printf("\n");
00099 printf(" r_min =");
00100 for (k = 0; k < 3; k++ ) printf(" %e", inter.r_min[k]);
00101 printf("\n");
00102 printf(" r_min_min = %e\n", inter.r_min_min);
00103 printf(" descriptor = "), fflush(stdout);
00104 c_print_intermediate_descriptor(inter.descriptor);
00105 print_system(inter.system);
00106
00107
00108
00109 printf("\nFinal state:\n");
00110 printf(" sma = %f\n", final.sma);
00111 printf(" ecc = %f\n", final.ecc);
00112 printf(" outer_separation = %f\n", final.outer_separation);
00113 printf(" escaper = %d\n", final.escaper);
00114 printf(" error = %e\n", final.error);
00115 printf(" time = %f\n", final.time);
00116 printf(" n_steps = %d\n", final.n_steps);
00117 printf(" virial_ratio = %f\n", final.virial_ratio);
00118 printf(" descriptor = "), fflush(stdout);
00119 c_print_final_descriptor(final.descriptor);
00120 print_system(final.system);
00121
00122 printf("\nCPU time = %f\n", c_cpu_time());
00123 }