Repository navigation
Expand file tree
/
Copy pathtriple_star.C
More file actions
291 lines (217 loc) · 8.79 KB
/
Copy pathtriple_star.C
File metadata and controls
291 lines (217 loc) · 8.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
//
// triple_star.C
//
#include "double_star.h"
#include "single_star.h"
#include "main_sequence.h"
// Mass transfer utilities.
/*
real get_relative_mass() {
return get_primary()->get_relative_mass() + get_secondary()->get_relative_mass();
}
*/
star* double_star::reduce_mass(const real mdot) {
cerr <<"void double_star::reduce_mass(mdot="<<mdot<<")"<<endl;
real envelope_mass = get_primary()->get_envelope_mass()
+ get_secondary()->get_envelope_mass();
if (envelope_mass<=0)
cerr <<"Really in trouble! envelope_mass = "<<envelope_mass<<endl;
/*
if (envelope_mass<=mdot) {
get_primary()->reduce_mass(primary->get_envelope_mass());
secondary->reduce_mass(secondary->get_envelope_mass());
return;
}
*/
cerr<<"reduce_envelope of both components with the fraction: "
<<mdot/envelope_mass<<endl;
return this;
}
star* double_star::subtrac_mass_from_donor(const real dt, real& mdot) {
cerr <<"real double_star::subtrac_mass_from_donor(dt= "<<dt<<")"<<endl;
cerr<<"double_star not allowed to fill Roche-lobe"<<endl;
exit(1);
/*
//real mdot = relative_mass*dt/root->get_donor_timescale();
real mdot = get_total_mass()*dt/root->get_donor_timescale();
// mdot = mass_ratio_mdot_limit(mdot);
real evelope_mass = primary->get_envelope_mass()
+ secondary->get_envelope_mass();
*/
//return 0;
mdot = 0;
return this;
}
real double_star::wind_velocity() {
cerr<<"double_star::wind_velocity()"<<endl;
real v_wind = 2.5*sqrt(cnsts.physics(G)*cnsts.parameters(solar_mass)*get_total_mass()
/ (get_effective_radius()*cnsts.parameters(solar_radius)))
/ cnsts.physics(km_per_s);
return v_wind;
}
void double_star::stellar_wind(const real dt) {
cerr<<"void double_star::stellar_wind(const real "<<dt<<")"<<endl;
perform_wind_loss(dt);
}
real double_star::temperature() {
//cerr<<"real double_star::temperature()"<<endl;
real temp = get_primary()->temperature()
+ get_secondary()->temperature();
return temp;
}
real double_star::bolometric_correction() {
cerr<<"real double_star::bolometric_correction()"<<endl;
real bc = get_primary()->bolometric_correction()
+ get_secondary()->bolometric_correction();
return bc;
}
real double_star::mass_ratio_mdot_limit(real mdot) {
cerr<<"real double_star::mass_ratio_mdot_limit(mdot="<<mdot<<")"<<endl;
real accretor_mass = get_companion()->get_total_mass();
if (accretor_mass<get_total_mass()) {
real mdot_max = get_total_mass() - accretor_mass;
if (mdot>mdot_max) mdot = mdot_max;
}
return mdot;
}
real double_star::kelvin_helmholds_timescale() {
cerr<<"real double_star::kelvin_helmholds_timescale()"<<endl;
return 1;
}
real double_star::nucleair_evolution_timescale() {
cerr<<"real double_star::nucleair_evolution_timescale()"<<endl;
return cnsts.physics(nucleair_efficiency);
}
real double_star::dynamic_timescale() {
cerr<<"real double_star::dynamic_timescale()"<<endl;
return 1;
}
real double_star::accretion_limit(const real mdot, const real dt) {
cerr<<"real double_star::accretion_limit(mdot="<<mdot<<", dt="<<dt<<")"<<endl;
real r_rl = get_binary()->roche_radius(this);
cerr <<"rl "<<r_rl ;
real prim_mdot = get_primary()->accretion_limit(mdot, dt);
real sec_mdot = get_secondary()->accretion_limit(mdot, dt);
cerr<<"mdot_p="<<prim_mdot<<" mdot_s="<<sec_mdot<<endl;
real accretion = prim_mdot + sec_mdot;
return accretion;
}
/*
// Should be inplemented in base_element.h
void double_star::adjust_accretor_radius(const real mdot, const real dt) {
cerr<<"d double_star::adjust_accretor_radius(mdot="<<mdot
<<", dt="<<dt<<")"<<endl;
primary->adjust_accretor_radius(mdot, dt);
secondary->adjust_accretor_radius(mdot, dt);
}
*/
real double_star::mass_transfer_timescale(mass_transfer_type &type) {
cerr<<"real double_star::mass_transfer_timescale()"<<endl;
real mtt_s = get_secondary()->mass_transfer_timescale(type);
real mtt_p = get_primary()->mass_transfer_timescale(type);
real mtt = 1./(1./mtt_p + 1./mtt_s);
return mtt;
}
real double_star::zeta_adiabatic() {
cerr<<"real double_star::zeta_adiabatic()"<<endl;
return 0;
}
real double_star::zeta_thermal() {
cerr<<"real double_star::zeta_thermal()"<<endl;
return 0;
}
real double_star::add_mass_to_accretor(real mdot, bool hydrogen, const real dt) {
cerr<<"real double_star::add_mass_to_accretor(mdot="<<mdot
<<", dt="<<dt<<")"<<endl;
if (bin_type==Merged || bin_type==Disrupted)
return 0;
if (mdot<=0) {
cerr << "double_star::add_mass_to_accretor(mdot=" << mdot << ")"<<endl;
cerr << "mdot (mdot=" << mdot << ", dt="<<dt
<<"): mdot smaller than zero!" << endl;
cerr << "Action: No action!" << endl;
return 0;
}
mass_transfer_type type = Unknown;
real mtt_p = get_primary()->mass_transfer_timescale(type);
real mtt_s = get_secondary()->mass_transfer_timescale(type);
real mtt_b = mass_transfer_timescale(type);
real mdot_p = mdot*mtt_b/mtt_p;
real mdot_s = mdot*mtt_b/mtt_s;
mdot_p = get_primary()->add_mass_to_accretor(mdot_p, dt != 0.0, hydrogen);
mdot_s = get_secondary()->add_mass_to_accretor(mdot_s, dt != 0.0, hydrogen);
real mdot_left = mdot - (mdot_p + mdot_s);
// Spiral in anyway (temporary treatment)
real r_lobe = Starlab::min(get_primary()->get_effective_radius()/semi,
get_secondary()->get_effective_radius()/semi);
real a_spi = semi*(get_primary()->get_total_mass()
/(get_primary()->get_total_mass()+mdot))
/(1. + (2.*mdot_left
/ (cnsts.parameters(common_envelope_efficiency)
* cnsts.parameters(envelope_binding_energy)
* r_lobe*get_secondary()->get_total_mass())));
if (a_spi <= get_primary()->get_effective_radius()
+ get_secondary()->get_effective_radius())
merge_elements(get_primary(), get_secondary());
else
semi = a_spi;
return mdot_p + mdot_s;
}
real double_star::accrete_from_stellar_wind(const real mdot, const real dt) {
// cerr<<"real double_star::accrete_from_stellar_wind(mdot="<<mdot
// <<", dt="<<dt<<")"<<endl;
// Just try to prevent error in star::accrete_from_stellar_wind()
if(bin_type!=Merged && bin_type!=Disrupted) {
real mdot_p = get_primary()->accrete_from_stellar_wind(mdot, dt);
real mdot_s = mdot - mdot_p;
if (mdot_s>0)
get_secondary()->accrete_from_stellar_wind(mdot_s, dt);
}
return 0; // Added by Steve 8/4/97 to satisfy DEC C++
}
void double_star::set_rotational_velocity(const real v) {
cerr<<"void double_star::set_rotational_velocity(v="<<v<<")"<<endl;
}
void double_star::set_previous_radius(const real r) {
//cerr<<"void double_star::set_previous_radius(r="<<r<<")"<<endl;
}
void double_star::adjust_triple_after_wind_loss(star * donor,
const real md_dot,
const real dt) {
cerr <<"void double_star::adjust_triple_after_wind_loss(d="
<<donor<<", m.="<<md_dot<<" dt="<<dt<<"): "<<semi;
if (bin_type!=Merged && bin_type!=Disrupted) {
star* accretor = donor->get_companion();
real M_old = get_total_mass() + md_dot;
real old_donor_mass = donor->get_total_mass() + md_dot;
real old_accretor_mass = accretor->get_total_mass();
cerr<<"m's: "<<M_old<<" "<<old_donor_mass<<" "<<old_accretor_mass
<<" "<<md_dot<<endl;
real ma_dot = accretor->accrete_from_stellar_wind(md_dot, dt);
real M_new = get_total_mass();
real new_donor_mass = donor->get_total_mass();
real new_accretor_mass = accretor->get_total_mass();
cerr<<"M's: "<<M_new<<" "<<new_donor_mass<<" "<<new_accretor_mass
<<" "<<md_dot<<endl;
cerr<<"mdot: "<<md_dot<<" "<<ma_dot<<endl;
if(md_dot>0 && ma_dot>=0) {
real alpha = 1 - ma_dot/md_dot;
semi *= pow(pow(new_donor_mass/old_donor_mass, 1-alpha)
* new_accretor_mass/old_accretor_mass, -2)
* M_old/M_new;
}
}
else {
// base_element * old_d = donor;
donor->reduce_mass(md_dot);
// if (old_d==get_primary()) donor=primary;
// else donor=secondary;
}
cerr<<" a-->"<<semi<<endl;
}
// What is the gyration radius of a binary?
real double_star::gyration_radius_sq() {
cerr << "double_star::gyration_radius_sq()"<<endl;
cerr << "Unknown: return 0"<<endl;
return 0; // Dummy
}