00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef STARLAB_BOUND3_H
00029 # define STARLAB_BOUND3_H
00030
00031 #ifndef C_ONLY
00032 # include "sdyn3.h"
00033 #else
00034 # include "c_stdinc.h"
00035 #endif
00036
00037
00038
00039
00040
00041 #define N_INTER 4
00042
00043 enum intermediate_descriptor3 {
00044 non_resonance, hierarchical_resonance, democratic_resonance,
00045 unknown_intermediate
00046 };
00047
00048 #define N_FINAL 14
00049
00050 enum final_descriptor3 {
00051 preservation, exchange_1, exchange_2, ionization,
00052 merger_binary_1, merger_binary_2, merger_binary_3,
00053 merger_escape_1, merger_escape_2, merger_escape_3,
00054 triple_merger, error, stopped, unknown_final
00055 };
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 typedef struct {
00079 real cos_theta;
00080 real phi;
00081 real psi;
00082 real mean_anomaly;
00083 } phase3;
00084
00085
00086
00087 typedef struct {
00088 int cos_theta;
00089 int phi;
00090 int psi;
00091 int mean_anomaly;
00092 } phase3_flag;
00093
00094
00095
00096
00097
00098 #define CHECK_INTERVAL 20
00099 #define DEFAULT_ETA 0.05
00100
00101
00102
00103 #define LARGE_SEPARATION 10
00104 #define LARGE_SEPARATION_FACTOR 10
00105 #define ENERGY_SAFETY_FACTOR 0.01
00106
00107 #define MIN_INITIAL_SEPARATION 10
00108 #define MAX_INITIAL_SEPARATION VERY_LARGE_NUMBER
00109
00110 #define ENERGY_TOLERANCE 1e-4
00111 #define MERGER_ENERGY_TOLERANCE 1e-3
00112
00113
00114 typedef struct {
00115 real mass;
00116 real pos[3];
00117 real vel[3];
00118 int index;
00119 } body;
00120
00121
00122
00123
00124
00125
00126 typedef struct {
00127 int n_osc;
00128 int n_kepler;
00129 int n_stars;
00130 int index[3];
00131 real r_min[3];
00132 real r_min_min;
00133 enum intermediate_descriptor3 descriptor;
00134 body system[3];
00135 int id;
00136 } intermediate_state3;
00137
00138 typedef struct {
00139 real sma;
00140 real ecc;
00141 real outer_separation;
00142
00143 enum final_descriptor3 descriptor;
00144 int escaper;
00145 real error;
00146 xreal time;
00147 int n_steps;
00148 real virial_ratio;
00149 body system[3];
00150
00151 int id;
00152 } final_state3;
00153
00154
00155
00156 #ifndef C_ONLY
00157
00158
00159
00160 void bound3(initial_state3&, intermediate_state3&, final_state3&,
00161 real cpu_time_check = 3600,
00162 real dt_out = VERY_LARGE_NUMBER,
00163 real dt_snap = VERY_LARGE_NUMBER,
00164 real snap_cube_size = 10,
00165 real dt_print = VERY_LARGE_NUMBER,
00166 sdyn3_print_fp p = NULL);
00167
00168
00169
00170 char * state_string(intermediate_descriptor3);
00171 char * state_string(final_descriptor3);
00172
00173 void print_bodies(ostream&, body*, int prec = 6);
00174 void print_initial(ostream&, initial_state3&,
00175 int bod_flag = 0, int prec = 6);
00176 void print_intermediate(ostream&, intermediate_state3&,
00177 int bod_flag = 0, int prec = 6);
00178 void print_final(ostream&, final_state3&,
00179 int bod_flag = 0, int prec = 6);
00180
00181 void print_bound3_outcome(intermediate_state3&,
00182 final_state3&,
00183 ostream& s = cerr);
00184 void print_bound3_summary(intermediate_state3&,
00185 final_state3&,
00186 real,
00187 ostream& s = cerr);
00188 void print_bound3_report(initial_state3&,
00189 intermediate_state3&,
00190 final_state3&,
00191 real cpu = -1,
00192 bool b = FALSE,
00193 ostream& s = cerr);
00194
00195 void initialize_bodies(body *);
00196 void make_standard_init(initial_state3 &);
00197
00198
00199
00200 void set_orientation(kepler &k, phase3 &p);
00201 sdyn3 * set_up_dynamics(real m2, real m3, kepler & k1, kepler & k3);
00202 void sdyn3_to_system(sdyn3 * root, body * system);
00203
00204
00205
00206 void merge_collisions(sdyn3 * b);
00207
00208 int extend_or_end(sdyn3 * b,
00209 initial_state3& init,
00210 intermediate_state3 * inter = NULL,
00211 final_state3 * final = NULL);
00212
00213 #endif
00214 #endif