00001
00002
00003
00004
00005
00006 #include "proto_star.h"
00007
00008
00009
00010
00011
00012 void proto_star::instantaneous_element() {
00013
00014
00015
00016
00017
00018
00019
00020 rotation_period = 1000;
00021
00022 real m_tot = core_mass + envelope_mass;
00023 core_mass = m_tot * cnsts.parameters(star_formation_efficiency);
00024 envelope_mass = m_tot - core_mass;
00025
00026 real alpha, beta, gamma, delta;
00027
00028 real log_mass = log10(core_mass);
00029
00030 if (relative_mass > 1.334) {
00031
00032 alpha = 0.1509 + 0.1709*log_mass;
00033 beta = 0.06656 - 0.4805*log_mass;
00034 gamma = 0.007395 + 0.5083*log_mass;
00035 delta = (0.7388*pow(relative_mass, 1.679)
00036 - 1.968*pow(relative_mass, 2.887))
00037 / (1.0 - 1.821*pow(relative_mass, 2.337));
00038
00039 } else {
00040
00041 alpha = 0.08353 + 0.0565*log_mass;
00042 beta = 0.01291 + 0.2226*log_mass;
00043 gamma = 0.1151 + 0.06267*log_mass;
00044 delta = pow(relative_mass, 1.25)
00045 * (0.1148 + 0.8604*relative_mass*relative_mass)
00046 / (0.04651 + relative_mass*relative_mass);
00047 }
00048
00049 luminosity = base_main_sequence_luminosity(core_mass);
00050 core_radius = delta;
00051
00052
00053 radius = 10000*core_radius;
00054 effective_radius = max(effective_radius, radius);
00055
00056 dump(cerr, false);
00057
00058 }
00059
00060
00061
00062 void proto_star::evolve_element(const real end_time) {
00063
00064 real dt = end_time - current_time;
00065 current_time = end_time;
00066 relative_age += dt;
00067
00068 if (relative_age<=next_update_age) {
00069
00070
00071
00072
00073 }
00074 else {
00075 create_zero_age_object();
00076 return;
00077 }
00078
00079 update();
00080 stellar_wind(dt);
00081 }
00082
00083 void proto_star::create_zero_age_object() {
00084
00085
00086
00087
00088
00089
00090
00091
00092 effective_radius = core_radius;
00093
00094 if (core_mass>cnsts.parameters(minimum_main_sequence)) {
00095
00096
00097 create_binary_from_proto_star();
00098 return;
00099 }
00100 else {
00101
00102 star_transformation_story(Brown_Dwarf);
00103 new brown_dwarf(*this);
00104 return;
00105 }
00106 }
00107
00108
00109 void proto_star::stellar_wind(const real dt) {
00110
00111 real wind_mass = wind_constant
00112 * (pow(relative_age/next_update_age,
00113 cnsts.parameters(massive_star_mass_loss_law))
00114 - pow((relative_age-dt)/next_update_age,
00115 cnsts.parameters(massive_star_mass_loss_law)));
00116
00117 if (is_binary_component())
00118 get_binary()->adjust_binary_after_wind_loss(this,
00119 wind_mass, dt);
00120 else
00121 reduce_mass(wind_mass);
00122 }
00123
00124
00125 real proto_star::helium_core_mass() {
00126
00127 real m_core = envelope_mass * cnsts.parameters(star_formation_efficiency);
00128
00129 m_core = min(m_core, get_total_mass());
00130
00131 return m_core;
00132 }
00133
00134 star* proto_star::reduce_mass(const real mdot) {
00135
00136 if (envelope_mass<=mdot) {
00137 envelope_mass = 0;
00138 create_zero_age_object();
00139 }
00140
00141 envelope_mass -= mdot;
00142 return this;
00143 }
00144
00145 star* proto_star::subtrac_mass_from_donor(const real dt, real& mdot) {
00146
00147 real mdot_temp = relative_mass*dt/get_binary()->get_donor_timescale();
00148 mdot = mass_ratio_mdot_limit(mdot_temp);
00149
00150 if (envelope_mass<=mdot) {
00151 mdot = envelope_mass;
00152 envelope_mass = 0;
00153
00154 create_zero_age_object();
00155 }
00156
00157 envelope_mass -= mdot;
00158 return this;
00159 }
00160
00161 void proto_star::adjust_accretor_age(const real mdot, const bool rejuvenate=true) {
00162
00163 return;
00164 }
00165
00166 void proto_star::adjust_next_update_age() {
00167
00168 if (cnsts.parameters(star_formation_timescale)<0)
00169 next_update_age = abs(cnsts.parameters(star_formation_timescale))
00170 * (radius/core_radius) * kelvin_helmholds_timescale();
00171 else
00172 next_update_age = randinter(0., cnsts.parameters(star_formation_timescale));
00173
00174 }
00175
00176 void proto_star::update_wind_constant() {
00177
00178 wind_constant = envelope_mass;
00179 }
00180
00181 real proto_star::zeta_thermal() {
00182
00183 real z = -10;
00184
00185 return z;
00186 }
00187
00188 real proto_star::gyration_radius_sq() {
00189
00190 return cnsts.parameters(convective_star_gyration_radius_sq);
00191 }