00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef STARLAB_SCATTER_H
00025 # define STARLAB_SCATTER_H
00026
00027 #ifdef USE_MPI
00028 #include "mpi++.h"
00029 #else
00030 #include "../src/node/dyn/hdyn/sdyn/evolve/localmpi++.h"
00031 #endif
00032
00033 #include "../src/node/dyn/hdyn/sdyn/evolve/scatter_hist.h"
00034 #include "sdyn.h"
00035
00036 #define DATA_COMING_TAG 0
00037 #define DATA_REQUEST_TAG 1
00038 #define WRITE_REQUEST_TAG 2
00039 #define WRITE_READY_TAG 3
00040 #define SEND_HOLD_TAG 4
00041 #define STOP_HOLD_TAG 5
00042
00043 #define N_FINAL 255 // Obscure historical number inherited from scatter3
00044
00045 #define N_INTER 255 // see N_FINAL
00046
00047 #define DYNAMICS 1
00048 #define STABILITY 1
00049 #define K_MAX 2
00050
00051
00052
00053 #if 0
00054 enum intermediate_descriptor {
00055 non_resonance=0, hierarchical_resonance, democratic_resonance,
00056 unknown_intermediate, number_of_intermediate_descriptors
00057 };
00058
00059 enum final_descriptor {
00060 preservation=0, non_preservation, error, stopped, unknown_final,
00061 number_of_final_descriptors
00062 };
00063 #endif
00064
00065
00066
00067 #define CHECK_INTERVAL 20.0
00068 #define DEFAULT_ETA 0.05
00069
00070
00071
00072 #define LARGE_SEPARATION 10.0 // To be determined (e.g. large mass ratios)
00073 #define LARGE_SEPARATION_FACTOR 10.0 // For all mass ratios
00074 #define TIDAL_TOL_FACTOR 1e-6
00075 #define ENERGY_SAFETY_FACTOR 0.01
00076
00077 #define MIN_INITIAL_SEPARATION 10.0
00078 #define MAX_INITIAL_SEPARATION VERY_LARGE_NUMBER
00079
00080 #define ENERGY_TOLERANCE 1e-4 // Maximum absolute energy error allowed
00081 #define MERGER_ENERGY_TOLERANCE 1e-3 // Relax tolerance for *relative* error
00082
00083
00084
00085 class scatter_input {
00086 public:
00087 char init_string[255];
00088
00089 real delta_t;
00090 real eta;
00091 real tidal_tol_factor;
00092 real dt_out;
00093 real dt_snap;
00094 real snap_cube_size;
00095 real cpu_time_check;
00096
00097 int n_experiments;
00098 int seed;
00099 int n_rand;
00100 int n_rand_inc;
00101 int pipe;
00102 int debug;
00103 int verbose;
00104
00105 scatter_input() {
00106
00107 delta_t = dt_out = dt_snap = VERY_LARGE_NUMBER;
00108 eta = 0.02;
00109 tidal_tol_factor = 1.e-6;
00110 snap_cube_size = 10;
00111 cpu_time_check = 3600;
00112 n_experiments = 1;
00113 seed = n_rand = n_rand_inc = pipe = debug = 0;
00114 verbose = 0;
00115 }
00116
00117 friend ostream& operator<<(ostream& s, scatter_input&);
00118 };
00119
00120
00121
00122 typedef struct {
00123 char* init_string;
00124 int n_string;
00125 real mt;
00126 real mp;
00127 real ap;
00128 real peri;
00129 real rho;
00130 real rho_sq_min;
00131 real rho_sq_max;
00132 real v_inf;
00133
00134 real r1;
00135 real r2;
00136 real r3;
00137 real tidal_tol_factor;
00138 int rho_flag;
00139
00140 int ecc_flag;
00141
00142 real ecc;
00143
00144
00145 real eta;
00146
00147
00148
00149
00150
00151
00152 } scatter_profile;
00153
00154
00155
00156 typedef struct {
00157 int index;
00158 real mass;
00159 vec pos;
00160 vec vel;
00161 } body;
00162
00163
00164
00165 void print_bodies(ostream&, body*, int prec = 6);
00166
00167 void initialize_bodies(body *);
00168 void set_kepler_from_sdyn(kepler&, sdyn *, sdyn *);
00169
00170 sdyn* mkscat(int, char**, scatter_profile&);
00171 sdyn* mkscat(char*, scatter_profile&);
00172 sdyn* mkscat(int, char**);
00173 sdyn* mkscat(char*);
00174
00175
00176
00177
00178
00179
00180
00181 typedef struct {
00182
00183 int np_star;
00184 int nt_star;
00185 real v_inf;
00186 real rho;
00187
00188
00189 } initial_state;
00190
00191 void scatter(sdyn* b, real eta,
00192 real delta_t, real dt_out, real cpu_time_check,
00193 real dt_snap, real ttf, real snap_cube_size,
00194 int debug,
00195 scatter_exp &experiment);
00196
00197 void scatter(sdyn* b, scatter_input input,
00198 scatter_exp &experiment);
00199
00200 int extend_or_end_scatter(sdyn * b, real ttf, bool debug);
00201 void ppn(sdyn* b, ostream & s, int level = 0);
00202 void parse_string(char* s, int& argc, char* argv[]);
00203
00204 #endif
00205
00206