00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _DOUBLE_STAR
00024 # define _DOUBLE_STAR
00025
00026 #include "double_support.h"
00027 #include "main_sequence.h"
00028 #include "single_star.h"
00029
00030 #define MAX_CIRC_ECC 1.e-6 // Maximum eccentricity that will be forced to
00031
00032
00033
00034
00035
00036
00037
00038 class node;
00039 class dyn;
00040 class hdyn;
00041
00042
00043
00044
00045 class double_star : public star
00046 {
00047 protected:
00048 int recursive_counter;
00049
00050 real semi;
00051 real eccentricity;
00052
00053 binary_type bin_type;
00054
00055 int identity;
00056 real binary_age;
00057 real minimal_timestep;
00058
00059 real velocity;
00060
00061 int donor_identity;
00062 stellar_type donor_type;
00063 real donor_timescale;
00064 mass_transfer_type current_mass_transfer_type;
00065
00066 bool first_contact;
00067
00068 double_hist previous;
00069 double_init initial;
00070
00071 private:
00072
00073 public:
00074
00075 double_star(node*);
00076
00077 ~double_star() {}
00078
00079 virtual istream& scan_star_story(istream&);
00080 virtual ostream& print_star_story(ostream&,
00081 int short_output = 0);
00082
00083 int get_identity() {return identity;}
00084 void set_identity(const int i) {identity=i;}
00085 binary_type get_bin_type() {return bin_type;}
00086 binary_type obtain_binary_type();
00087 real get_current_time() {return binary_age;}
00088 real get_eccentricity() {return eccentricity;}
00089 real get_semi() {return semi;}
00090 real get_radius() {return semi*(1-pow(eccentricity, 2));}
00091 real get_velocity() {return velocity;}
00092 real get_effective_radius() {
00093 real r_eff = semi;
00094 return r_eff;
00095 }
00096 mass_transfer_type get_current_mass_transfer_type()
00097 {return current_mass_transfer_type;}
00098
00099 real get_evolve_timestep();
00100
00101 void set_bin_type(binary_type type) {bin_type = type;}
00102 void set_eccentricity(real e) {eccentricity = e;}
00103 void set_velocity(const real v) {velocity = v;}
00104 void set_semi(real a) {semi = a;}
00105 void set_current_time(const real t){binary_age = t;}
00106 void set_relative_age(const real t){binary_age = t;}
00107
00108 void set_first_contact(bool c) {first_contact=c;}
00109
00110 real mass_ratio();
00111 real get_total_mass() {
00112 return get_primary()->get_total_mass()
00113 + get_secondary()->get_total_mass();
00114 }
00115
00116 double_init * get_initial_conditions() {return &initial;}
00117
00118 int no_of_elements() {
00119 return get_primary()->no_of_elements()
00120 + get_secondary()->no_of_elements();}
00121
00122
00123 void initialize(binary_type, real, real, real, int);
00124
00125
00126 void determine_minimal_timestep();
00127 real determine_dt(const real, const real);
00128 real internal_time_step(const real evolve_timestep);
00129
00130
00131 real angular_momentum();
00132 void circularize();
00133 void force_circularization();
00134 void recursive_binary_evolution(real, const real);
00135
00136 void instantaneous_element();
00137 void evolve_element(const real);
00138 void evolve_the_binary(const real);
00139 void try_zero_timestep();
00140
00141 void perform_wind_loss(const real);
00142 void angular_momentum_loss(const real);
00143 void gravrad(const real);
00144 real de_dt_gwr(const real);
00145 real gwr_angular_momentum_loss(const real m_prim,
00146 const real m_sec,
00147 const real sma);
00148
00149 real mb_angular_momentum_loss();
00150 void magnetic_stellar_wind(const real);
00151 void calculate_velocities();
00152 void semi_detached(star*, star*, real);
00153 void contact(star*, star*, real);
00154 void contact_binary(real);
00155
00156
00157
00158
00159
00160 void perform_mass_transfer(const real, star*, star*);
00161 void angular_momentum_envelope_ejection(star*, star*);
00162 void dynamic_mass_transfer();
00163 real mdot_according_to_roche_radius_change(star*, star*);
00164 void adjust_binary_after_wind_loss(star*,
00165 const real, const real);
00166
00167
00168 bool stable(star* st=NULL);
00169 real zeta(star*, star*);
00170 real gyration_radius_sq();
00171
00172
00173 void spiral_in(star*, star*);
00174 void merge_elements(star*, star*);
00175 void double_spiral_in();
00176
00177
00178 void post_sn_companion_velocity(star*, const real);
00179
00180 real get_period();
00181 real roche_radius(star *);
00182 real roche_radius(const real, const real, const real);
00183 real circularization_radius(const real m1, const real m2);
00184
00185
00186 real get_donor_timescale() {return donor_timescale;}
00187 void set_donor_timescale(star*, bool first = false);
00188
00189
00190 void refresh_memory();
00191 void recall_memory();
00192
00193
00194
00195
00196 void dump(ostream &, bool brief = true);
00197 void dump(char*, bool);
00198 void put_element();
00199 void print_status();
00200 void print_roche();
00201 void put_state();
00202 void put_hrd(ostream &);
00203
00204
00205 real potential_energy();
00206 real kinetic_energy();
00207 real total_energy();
00208
00209 void enhance_cluster_profile(cluster_profile&);
00210
00211
00212 bool remnant() {return FALSE;}
00213 real wind_velocity();
00214 real get_core_mass() {return get_total_mass();}
00215 star* reduce_mass(const real);
00216
00217 star* subtrac_mass_from_donor(const real, real&);
00218 void stellar_wind(const real);
00219 real temperature();
00220 real bolometric_correction();
00221 real mass_ratio_mdot_limit(real);
00222 real kelvin_helmholds_timescale();
00223 real nucleair_evolution_timescale();
00224 real dynamic_timescale();
00225 real accretion_limit(const real, const real);
00226 real mass_transfer_timescale(mass_transfer_type &type);
00227 real zeta_adiabatic();
00228 real zeta_thermal();
00229 real add_mass_to_accretor(const real);
00230 real add_mass_to_accretor(real, const real);
00231 real accrete_from_stellar_wind(const real, const real);
00232 void adjust_triple_after_wind_loss(star*,
00233 const real, const real);
00234
00235
00236 star_type_spec get_spec_type(star_type_spec i) {return NAC;}
00237 void set_spec_type(star_type_spec s, bool on=true) {}
00238 stellar_type get_element_type() {return Double;}
00239 void set_rotational_velocity(const real);
00240 void set_previous_radius(const real);
00241 real get_core_radius() {return get_radius();}
00242
00243 bool low_mass_star();
00244 bool medium_mass_star();
00245 bool high_mass_star();
00246
00247 void evolve_core_mass(const real) {}
00248
00249 real orbital_timescale();
00250
00251 void detect_spectral_features() {}
00252 };
00253
00254 double_star * new_double_star(node*,
00255 real, real, real age=0, int id=0,
00256 binary_type type = Detached);
00257
00258 void adddouble(node * b, real time, binary_type=Detached,
00259 bool random_initialization=false,
00260 real a_min=1, real a_max=1.e+6,
00261 real e_min=0, real e_max=1) ;
00262
00263 bool has_dstar(node*);
00264
00265 void add_secondary(node*, real);
00266 void mksecondary(node*, real, real);
00267 void mkrandom_binary(const real lm_min, const real lm_max, const real m_exp,
00268 const real la_min, const real la_max,
00269 const bool e_flag,
00270 real &m_prim, real &m_sec, real &semi,
00271 real &ecc);
00272
00273 real random_exponential_mass(const real m_min,
00274 const real m_max,
00275 const real m_alpha);
00276
00277 #define put_double_star put_node
00278
00279 #endif // _DOUBLE_STAR