00001
00002
00003
00004
00005
00006
00007
00008 #include "brown_dwarf.h"
00009 #include "main_sequence.h"
00010 #include "proto_star.h"
00011
00012 brown_dwarf::brown_dwarf(proto_star & p) : single_star(p) {
00013
00014 delete &p;
00015
00016 real m_tot = get_total_mass();
00017 core_mass = brown_dwarf_core_mass();
00018 envelope_mass = m_tot - core_mass;
00019
00020 last_update_age = 0;
00021 relative_age = 0;
00022
00023 instantaneous_element();
00024 update();
00025
00026 post_constructor();
00027 }
00028
00029 brown_dwarf::brown_dwarf(main_sequence & m) : single_star(m) {
00030
00031 delete &m;
00032
00033 real m_tot = get_total_mass();
00034 core_mass = brown_dwarf_core_mass();
00035 envelope_mass = m_tot - core_mass;
00036
00037
00038 last_update_age = next_update_age;
00039 instantaneous_element();
00040 update();
00041
00042 post_constructor();
00043 }
00044
00045 void brown_dwarf::instantaneous_element() {
00046
00047
00048 luminosity = 938 * pow(relative_mass, 2.64);
00049 if(relative_age>1)
00050 luminosity = 938 * pow(relative_mass, 2.64) / pow(relative_age, 1.3);
00051
00052 if(get_element_type() == Planet) {
00053
00054
00055 real mp_max = cnsts.parameters(maximum_planet_mass);
00056 real y = relative_mass/mp_max;
00057 radius = 1.50*pow(relative_mass, cnsts.mathematics(one_third))
00058 / (1+pow(y, 2));
00059 }
00060 else {
00061
00062 radius = 0.1;
00063 }
00064
00065 core_radius = 0.1*radius;
00066 if(envelope_mass==0)
00067 radius = core_radius;
00068
00069 update();
00070 }
00071
00072 void brown_dwarf::evolve_element(const real end_time) {
00073
00074 real dt = end_time - current_time;
00075 current_time = end_time;
00076 relative_age += dt;
00077
00078 next_update_age = relative_age + cnsts.safety(maximum_timestep);
00079
00080 instantaneous_element();
00081
00082
00083 update();
00084 }
00085
00086 void brown_dwarf::update() {
00087
00088 detect_spectral_features();
00089
00090
00091 effective_radius = radius;
00092
00093 }
00094
00095 real brown_dwarf::brown_dwarf_core_mass() {
00096
00097 return 0.01 * get_total_mass();
00098 }
00099
00100 star* brown_dwarf::subtrac_mass_from_donor(const real dt, real& mdot) {
00101
00102 mdot = relative_mass*dt/get_binary()->get_donor_timescale();
00103
00104 mdot = mass_ratio_mdot_limit(mdot);
00105
00106 if (mdot<=envelope_mass)
00107 envelope_mass -= mdot;
00108 else if (mdot>envelope_mass)
00109 envelope_mass = 0;
00110
00111 return this;
00112 }
00113
00114 real brown_dwarf::add_mass_to_accretor(const real mdot) {
00115
00116 if (mdot<0) {
00117 cerr << "brown_dwarf::add_mass_to_accretor(mdot="
00118 << mdot << ")"<<endl;
00119 cerr << "mdot (" << mdot << ") smaller than zero!" << endl;
00120
00121 return 0;
00122 }
00123
00124 envelope_mass += mdot;
00125 relative_mass = max(relative_mass, get_total_mass());
00126
00127 set_spec_type(Accreting);
00128
00129 return mdot;
00130
00131 }
00132
00133 real brown_dwarf::add_mass_to_accretor(real mdot, const real dt) {
00134
00135 if (mdot<0) {
00136 cerr << "brown_dwarf::add_mass_to_accretor(mdot="
00137 << mdot << ")"<<endl;
00138 cerr << "mdot (" << mdot << ") smaller than zero!" << endl;
00139
00140 mdot = 0;
00141 }
00142
00143 mdot = accretion_limit(mdot, dt);
00144
00145 envelope_mass += mdot;
00146 relative_mass = max(relative_mass, get_total_mass());
00147
00148 set_spec_type(Accreting);
00149
00150 return mdot;
00151 }
00152
00153 real brown_dwarf::accretion_limit(const real mdot, const real dt) {
00154
00155 real eddington = 1.5e-08*cnsts.parameters(solar_radius)*radius*dt;
00156
00157 if(mdot>=eddington)
00158 return eddington;
00159
00160 return mdot;
00161 }
00162
00163
00164 real brown_dwarf::zeta_thermal() {
00165
00166 return 0;
00167 }
00168
00169 star* brown_dwarf::merge_elements(star* str) {
00170
00171 real merger_core = str->get_core_mass();
00172
00173 add_mass_to_accretor(str->get_envelope_mass(),
00174 cnsts.parameters(spiral_in_time));
00175
00176 if (relative_mass < get_total_mass() + merger_core)
00177 relative_mass=get_total_mass() + merger_core;
00178 core_mass += merger_core;
00179
00180 spec_type[Merger]=Merger;
00181 instantaneous_element();
00182
00183 return this;
00184 }
00185
00186 star* brown_dwarf::reduce_mass(const real mdot) {
00187
00188 if (envelope_mass < mdot)
00189 envelope_mass = 0;
00190 else
00191 envelope_mass -= mdot;
00192
00193 return this;
00194 }
00195
00196 real brown_dwarf::gyration_radius_sq() {
00197
00198 return cnsts.parameters(convective_star_gyration_radius_sq);
00199 }
00200
00201
00202 stellar_type brown_dwarf::get_element_type() {
00203
00204 if (relative_mass < cnsts.parameters(maximum_planet_mass))
00205 return Planet;
00206 else
00207 return Brown_Dwarf;
00208 }
00209