00001
00002
00003
00004
00005 #include "SPZDCH_star.h"
00006
00007 void SPZDCH_star::instantaneous_element() {
00008
00009 luminosity = 1;
00010 effective_radius = radius = 1;
00011 core_radius = 1;
00012
00013 envelope_mass = get_total_mass();
00014 core_mass = 0;
00015
00016 radius = core_radius;
00017
00018 }
00019
00020 void SPZDCH_star::evolve_element(const real end_time) {
00021
00022 real dt = end_time - current_time;
00023 current_time = end_time;
00024 relative_age += dt;
00025
00026 next_update_age = relative_age + cnsts.safety(maximum_timestep);
00027
00028 update();
00029 stellar_wind(dt);
00030 }
00031
00032
00033 void SPZDCH_star::update() {
00034
00035
00036
00037
00038 }
00039
00040 void SPZDCH_star::stellar_wind(const real dt) {
00041
00042 if (!get_use_hdyn())
00043 cerr << " No stellar dynamical information present in SPZDCH_star"
00044 << endl;
00045
00046 int N = the_node->get_root()->n_leaves();
00047
00048 real end_time = 1;
00049 real t_relax = 1;
00050 if (find_qmatch(the_node->get_root()->get_dyn_story(), "t_relax"))
00051 t_relax = getrq(the_node->get_root()->get_dyn_story(), "t_relax");
00052 else if (N>1) {
00053 real total_mass = the_node->get_root()->get_mass();
00054 real potential_energy=1;
00055 if (find_qmatch(the_node->get_root()->get_dyn_story(),
00056 "potential_energy"))
00057 potential_energy = getrq(the_node->get_root()->get_dyn_story(),
00058 "potential_energy");
00059 real r_virial = -0.5 * total_mass * total_mass / potential_energy;
00060 t_relax = 9.62e-2 * sqrt(pow(r_virial, 3) / total_mass)
00061 * N / log10(0.4 * N);
00062 }
00063 else
00064 cerr << "\nwarning: no relaxation time available in SPZDCH_star"
00065 << endl;
00066
00067 real dm = cnsts.parameters(relaxation_driven_mass_loss_constant)
00068 * envelope_mass / t_relax;
00069
00070 real wind_mass = dm * dt;
00071
00072 if (wind_mass >= envelope_mass)
00073 wind_mass = envelope_mass;
00074
00075 if (is_binary_component())
00076 get_binary()->adjust_binary_after_wind_loss(this, wind_mass, dt);
00077 else
00078 reduce_mass(wind_mass);
00079
00080 return;
00081 }
00082
00083 real SPZDCH_star::accretion_limit(const real mdot, const real dt) {
00084
00085 return 0;
00086 }
00087
00088 star* SPZDCH_star::subtrac_mass_from_donor(const real dt, real& mdot) {
00089
00090 mdot = 0;
00091 return this;
00092 }
00093
00094 void SPZDCH_star::adjust_accretor_age(const real mdot,
00095 const bool rejuvenate=true) {
00096
00097 return;
00098
00099 }
00100
00101 real SPZDCH_star::zeta_thermal() {
00102 return 0;
00103 }
00104
00105 star* SPZDCH_star::reduce_mass(const real mdot) {
00106
00107 if (envelope_mass>=mdot) {
00108 envelope_mass -= mdot;
00109
00110 }
00111 else {
00112 cerr << "WARNING: star* SPZDCH_star::reduce_mass(const real mdot="
00113 << mdot<< ")"<< endl;
00114 cerr << "SPZDCH_star has negative mass..." << endl;
00115 envelope_mass = 0;
00116 }
00117
00118
00119 if (envelope_mass<=0) {
00120 cerr << "SPZDCH_star reduced to zero mass at t="
00121 << get_current_time() << endl;
00122 cerr << " last mdot was: " << mdot << endl;
00123 }
00124
00125 return this;
00126 }
00127
00128 void SPZDCH_star::adjust_next_update_age() {
00129
00130
00131 last_update_age = next_update_age;
00132 next_update_age = relative_age + cnsts.safety(maximum_timestep);
00133 }
00134
00135 real SPZDCH_star::gyration_radius_sq() {
00136
00137 return cnsts.parameters(radiative_star_gyration_radius_sq);
00138 }
00139
00140
00141 void SPZDCH_star::update_wind_constant(const real tscale) {
00142
00143 wind_constant = tscale;
00144
00145 }
00146