Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

sigma3.h

00001        //=======================================================//    _\|/_
00002       //  __  _____           ___                    ___       //      /|\ ~
00003      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00004     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00005    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00006   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00007  //                                                       //            _\|/_
00008 //=======================================================//              /|\ ~
00009 
00010 /*
00011  *  sigma3.h: definitions for determining cross sections
00012  *.............................................................................
00013  *    version 1:  March 1994   Piet Hut & Steve McMillan
00014  *    version 2:
00015  *.............................................................................
00016  *     This file includes:
00017  *  1) definition of state structures
00018  *       ....
00019  *.............................................................................
00020  */
00021 
00022 #ifndef  STARLAB_SIGMA3_H
00023 #  define  STARLAB_SIGMA3_H
00024 
00025 #include  "scatter3.h"
00026 
00027 #define ECC_TOL 2         // Factor by which initial binary periastron must
00028                           // exceed the sum of the component radii. 
00029 
00030 #define RHO_SQ_SCALE 0.5  // Inner disk of radius 1 will be uniformly sampled
00031 #define RHO_SQ_FACTOR 2   // Each new zone doubles the total area
00032 #define N_RHO_ZONE_MAX 20 // Maximum number of rho zones
00033 
00034 #define N_STEP_BIN 10     // Number of time-step bins
00035 #define N_OSC_BIN 15      // Number of oscillation bins
00036 
00037 // Structure describing the high-level profile of a scattering experiment:
00038 
00039 typedef struct {
00040     real m2;                            // mass of binary secondary
00041     real m3;                            // mass of third star
00042     real r1;                            // radius of primary
00043     real r2;                            // radius of secondary
00044     real r3;                            // radius of third star
00045     real v_inf;                         // velocity at infinity
00046     real tidal_tol_factor;              // tidal perturbation at start/stop
00047     int  rho_flag;                      // choice of random or user-specified
00048                                         //      impact parameter
00049     real rho_min;                       // minimum impact parameter
00050     real rho_max;                       // maximum impact parameter
00051     int  ecc_flag;                      // choice random or user-specified
00052                                         //      eccentricity
00053     real ecc;                           // eccentricity if specified by user
00054     phase3_flag phase_flag;             // randomization options for angles
00055     phase3 phase;                       // angles if specified externally
00056     real eta;                           // overall/initial accuracy parameter
00057 
00058     intermediate_descriptor3            // specification of the final state
00059     intermediate_target;
00060     final_descriptor3 final_target1;
00061     final_descriptor3 final_target2;
00062 
00063 } scatter_profile;
00064 
00065 // Structure describing the result of a series of scattering experiments:
00066 
00067 typedef struct {
00068 
00069     // Binning:
00070 
00071     real rho_sq_init;           // squared radius of innermost rho zone
00072     real central_trial_density; // current density of trials in innermost zone
00073 
00074     // Safety zone quantities:
00075 
00076     int  n_hit_tot;             // total number of hits
00077     int  n_hit[N_RHO_ZONE_MAX]; // number of hits per rho^2 zone
00078     int  i_max;                 // i value of the (empty) top zone
00079 
00080     // Diagnostics:
00081 
00082     int  total_trials;
00083     int  total_steps;
00084     int  max_steps;
00085     int  step_counter[N_STEP_BIN];
00086 
00087     int  osc_counter[N_OSC_BIN][N_FINAL];
00088 
00089     // "Real" quantities of interest:
00090 
00091     real rho_max;               // maximum impact parameter (from i_max)
00092     int  trials_per_zone;
00093 
00094     int  n_hits[N_INTER][N_FINAL][N_RHO_ZONE_MAX]; // breakdown of hits by type
00095     real sigma[N_INTER][N_FINAL];         // breakdown of cross-section by type
00096     real sigma_err_sq[N_INTER][N_FINAL]; // breakdown of squared errors by type
00097 
00098     real sigma_total;
00099     real sigma_total_err_sq;
00100 
00101 } sigma_out;
00102 
00103 //-----------------------------------------------------------------------------
00104 
00105 // Standard framework for determining cross-sections:
00106 
00107 typedef  int  (*trial_fp)(initial_state3 &,
00108                           intermediate_state3 &,
00109                           final_state3 &,
00110                           real, real, real);
00111 typedef  void (*stat_fp)(scatter_profile &,
00112                          initial_state3 &,
00113                          intermediate_state3 &,
00114                          final_state3 &,
00115                          int,
00116                          sigma_out &);
00117 typedef  void (*print_fp)(real, sigma_out &, int);
00118 
00119 void get_sigma3(real, scatter_profile &, sigma_out &,
00120                 int debug = 0,
00121                 real cpu_time_check = VERY_LARGE_NUMBER,
00122                 real dt_snap =  VERY_LARGE_NUMBER,
00123                 real snap_cube_size = 0,
00124                 int scatter_summary_flag = 0);
00125 
00126 void get_sigma3(real, scatter_profile &, sigma_out &,
00127                 int, real, real, real, int,
00128                 trial_fp);
00129 void get_sigma3(real, scatter_profile &, sigma_out &,
00130                 int, real, real, real, int,
00131                 stat_fp);
00132 void get_sigma3(real, scatter_profile &, sigma_out &,
00133                 int, real, real, real, int,
00134                 print_fp);
00135 void get_sigma3(real, scatter_profile &, sigma_out &,
00136                 int, real, real, real, int,
00137                 trial_fp, stat_fp);
00138 void get_sigma3(real, scatter_profile &, sigma_out &,
00139                 int, real, real, real, int,
00140                 trial_fp, stat_fp, print_fp);
00141 
00142 // Helpers:
00143 
00144 real zone_area(sigma_out&, int);
00145 real zone_density(sigma_out&, int);
00146 real zone_weight(sigma_out&, int);      // (weight = 1/density, in fact)
00147 
00148 void print_profile(ostream&, scatter_profile&, int prec = 6);
00149 void make_standard_profile(scatter_profile &); // Set up a template profile
00150 void prof_to_init(scatter_profile &, initial_state3 &);
00151 
00152 int  n_coll(int[][N_FINAL][N_RHO_ZONE_MAX], int);
00153 
00154 void counts_to_sigma(sigma_out &);
00155 void print_all_sigma3_counts(sigma_out &, ostream& s = cerr);
00156 void print_sigma3(sigma_out &, real);
00157 void print_sigma3_counts(int[][N_FINAL][N_RHO_ZONE_MAX], int);
00158 void print_sigma3_array(real[][N_FINAL], real, int sqrt_flag = 0);
00159 void print_sigma3_err_array(real[][N_FINAL], real);
00160 void print_sigma3_nonmergers(real[][N_FINAL], real[][N_FINAL], real);
00161 void print_sigma3_mergers(real[][N_FINAL], real[][N_FINAL], real);
00162 
00163 // For use in sigma3, rate3, etc:
00164 
00165 void summarize_scattering_initial(initial_state3 & init,
00166                                   int n_rand,
00167                                   real dt_snap,
00168                                   real snap_cube_size);
00169 
00170 void summarize_scattering_final(intermediate_state3 & inter,
00171                                 final_state3 & final,
00172                                 int level,
00173                                 real cpu);
00174 
00175 void single_scatter_init(scatter_profile & prof,
00176                          real rho_sq_min, real rho_sq_max,
00177                          initial_state3 & init, int & n_rand,
00178                          int scatter_summary,
00179                          real dt_snap, real snap_cube_size);
00180 
00181 int single_scatter(initial_state3 & init,
00182                    intermediate_state3 & inter,
00183                    final_state3 & final,
00184                    real cpu_time_check,
00185                    real dt_snap,
00186                    real snap_cube_size);
00187 
00188 void single_scatter_stats(scatter_profile & prof,
00189                           initial_state3 & init,
00190                           intermediate_state3 & inter,
00191                           final_state3 & final,
00192                           int rho_bin_index,
00193                           sigma_out & out,
00194                           stat_fp acc_stats,
00195                           int result);
00196 
00197 int multiscatter3(scatter_profile & prof, sigma_out & out,
00198                   real rho_sq_min, real rho_sq_max, int rho_zone,
00199                   real dt_snap, real snap_cube_size,
00200                   real cpu_time_check, real cpu_init, real &cpu_save,
00201                   int& scatt_total, real &cpu_total, stat_fp acc_stats,
00202                   int debug, int scatter_summary);
00203 
00204 #endif

Generated on Wed Jul 20 12:43:36 2005 for Starlab by  doxygen 1.4.3