Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

single_star.h

00001 
00002        //=======================================================//    _\|/_
00003       //  __  _____           ___                    ___       //      /|\ ~
00004      //  /      |      ^     |   \  |         ^     |   \     //          _\|/_
00005     //   \__    |     / \    |___/  |        / \    |___/    //            /|\ ~
00006    //       \   |    /___\   |  \   |       /___\   |   \   // _\|/_
00007   //     ___/   |   /     \  |   \  |____  /     \  |___/  //   /|\ ~
00008  //                                                       //            _\|/_
00009 //=======================================================//              /|\ ~
00010 
00011 /*
00012  *  single_star.h: derived class for single star base element.
00013  *
00014  *.............................................................................
00015  *    version 1:  Jan 1994   Simon F. Portegies Zwart
00016  *    version 2:
00017  *.............................................................................
00018  *     This file includes:
00019  *  1) definition of class estar
00020  *
00021  *.............................................................................
00022  */
00023 #ifndef     _SINGLE_STAR
00024 #   define  _SINGLE_STAR
00025 
00026 #include "star.h"
00027 #include "star_state.h"
00028 
00029 /*-----------------------------------------------------------------------------
00030  *  star  --  the standard class for stellar evolution, with core and envelope
00031  *-----------------------------------------------------------------------------
00032  */
00033 class  single_star : public star
00034     {
00035     protected:
00036        
00037         int   identity;
00038         stellar_type star_type; 
00039         star_type_spec spec_type[no_of_spec_type];
00040 
00041         real  current_time;
00042         real  relative_age;
00043         real  last_update_age;
00044         real  next_update_age;
00045 
00046         real  relative_mass;
00047         real  envelope_mass;         
00048         real  core_mass;         
00049         real  COcore_mass;
00050 
00051         real  radius;
00052         real  core_radius;
00053         real  effective_radius;
00054 
00055         real  luminosity;
00056 
00057         real  velocity;
00058         vec anomal_velocity;
00059         
00060         real birth_mass;
00061         real magnetic_field;            //[log G]
00062         real rotation_period;           //[s]
00063         
00064         real wind_constant;
00065         real accreted_mass;
00066 
00067         star_hist previous;
00068 
00069     public:
00070    
00071         single_star(node*);
00072         single_star(single_star&);
00073         ~single_star()  {}
00074            
00075         int no_of_elements() {return 1;}
00076         star_type_spec get_spec_type(star_type_spec i) {
00077           return spec_type[i];}
00078         
00079         int   get_identity()                    {return identity;}
00080         real  get_previous_current_time() {return previous.current_time;}
00081         real  get_previous_total_mass()   {return previous.envelope_mass
00082                                                 + previous.core_mass;}
00083         real  get_current_time()                {return current_time;}
00084         real  get_relative_age()             {return relative_age;}
00085         real  get_effective_radius()         {return effective_radius;}
00086         real  get_last_update_age()        {return last_update_age;}
00087         real  get_next_update_age()        {return next_update_age;}
00088         real  get_relative_mass()          {return relative_mass;}
00089         real  get_envelope_mass()          {return envelope_mass;}
00090         real  get_core_mass()              {return core_mass;}
00091         real  get_COcore_mass()              {return COcore_mass;}
00092         real  get_core_radius()              {return core_radius;}
00093         real  get_radius()                {return radius;}
00094         real  get_luminosity()             {return luminosity;}
00095         real  get_velocity()            {return velocity;}
00096         vec  get_anomal_velocity()      {return anomal_velocity;}
00097         real  get_magnetic_field()      {return magnetic_field;}
00098         real  get_rotation_period()     {return rotation_period;}
00099         real  get_total_mass()          {return envelope_mass + core_mass;}
00100 
00101         void  set_current_time(real t)          {current_time=t;}
00102         void  set_relative_age(real t)          {relative_age=t;}
00103 
00104         void  set_luminosity(real l)            {luminosity = l;}
00105         void  set_magnetic_field(real b){magnetic_field=b;}
00106         void  set_rotation_period(real p){rotation_period=p;}
00107         void  set_identity(int i)               {identity=i;}
00108         void  set_envelope_mass(const real m) {envelope_mass = m;}
00109         void  set_core_mass(const real m) {core_mass = m;}
00110         void  set_COcore_mass(const real m) {COcore_mass = m;}
00111         void  set_spec_type(star_type_spec s, bool on=true);
00112         void  set_effective_radius(const real r)  {effective_radius=r;}
00113         void  set_last_update_age(const real t) {last_update_age = t;}
00114         void  set_next_update_age(const real t) {next_update_age = t;}
00115         void  set_previous_radius(const real r) {previous.radius = r;}
00116         void  set_velocity(const real v)        {velocity = v;}
00117         void  set_anomal_velocity(const vec v)  {anomal_velocity = v;}
00118 
00119         real  magnitude();              
00120         real  temperature();            
00121 
00122 //        void clean();
00123 
00124         bool low_mass_star();
00125         bool medium_mass_star();
00126         bool high_mass_star();
00127         
00128         void initialize(int, real, real, real, real, real, real);
00129         
00130 //            Time scales
00131         real  nucleair_evolution_timescale();
00132         real  kelvin_helmholds_timescale();
00133         real  dynamic_timescale();
00134         real  main_sequence_time();
00135         real  main_sequence_time(const real);
00136         real  hertzsprung_gap_time(const real);
00137         real  hertzsprung_gap_time(const real, const real);
00138         real  helium_giant_time(const real);
00139         real  helium_giant_time(const real, const real);
00140         real  nucleair_evolution_time();
00141         real  nucleair_evolution_time(const real);
00142         real  base_giant_branch_time(const real);
00143         real  base_giant_branch_time(const real, const real);
00144         real  base_giant_time(const real);
00145         real  base_giant_time(const real, const real);
00146         real  helium_time();
00147         real  get_evolve_timestep();
00148 
00149         real mass_transfer_timescale(mass_transfer_type &type);
00150 
00151 //              Luminosities
00152         real  base_main_sequence_luminosity(const real);
00153         real  base_main_sequence_luminosity();
00154         real  base_giant_branch_luminosity();
00155         real  base_giant_branch_luminosity(const real);
00156         real  giant_luminosity();
00157         real  giant_luminosity(const real);
00158         real  base_agb_luminosity(const real);
00159         real  base_agb_luminosity(const real, const real);
00160         real  agb_luminosity();
00161         real  agb_luminosity(const real);
00162         real  helium_giant_luminosity();
00163         real  helium_giant_luminosity(const real);
00164         real  maximum_luminosity();
00165         real  maximum_luminosity(const real);
00166 
00167         real  bolometric_correction();
00168         bool  remnant() {return false;}   // default: not a remnant.
00169         bool  magnetic() {return false;}  // default: no magnetic stellar wind.
00170         bool  hydrogen_envelope_star() {return true;}
00171         bool  giant_star()             {return false;}
00172         bool  star_with_COcore()       {return false;}   
00173      
00174         real helium_core_radius();
00175         void evolve_core_mass(const real) {}
00176         real final_core_mass();
00177 
00178         void refresh_memory();
00179         void recall_memory();
00180 
00181 //           stellar wind routines.
00182         void update_wind_constant();
00183         void stellar_wind(const real);
00184         real wind_velocity();
00185         real accrete_from_stellar_wind(const real, const real);
00186         
00187 //              Stability rourines.
00188         real zeta_adiabatic();
00189         real zeta_thermal();
00190         real angular_momentum();
00191 
00192 //           radius change for donors/accretors
00193         void adjust_donor_radius(const real);
00194         void adjust_accretor_radius(const real, const real);
00195 
00196 //              Mass transfer routines.
00197         void add_mass_to_core(const real);
00198 
00199         real  add_mass_to_accretor(const real);
00200         real  add_mass_to_accretor(real, const real);
00201 //        star* reduce_mass(const real);
00202         real  rejuvenation_fraction(const real);
00203         void  update_relative_mass(const real);
00204         void  lose_envelope_decent();
00205         star*  merge_elements(star*);
00206         
00207         real mass_ratio_mdot_limit(real);
00208         real accretion_limit(const real, const real);
00209         real expansionA(const real);
00210         real expansionB(const real);
00211 
00212         void update();
00213         void detect_spectral_features();
00214 
00215 //           Input/Output
00216         void read_element();
00217         void put_element();
00218         void dump(ostream&, bool brief = true);
00219         void dump(char*, bool brief = true);
00220         void print_status();
00221         void print_roche();
00222         void put_state();
00223         void put_hrd(ostream &);
00224 
00225         real get_dlogR_dT();
00226 
00227         real tf2_energy_diss(const real);
00228         real tf3_energy_diss(const real);
00229 
00230         real potential_energy();
00231         real kinetic_energy();
00232         real total_energy();
00233         void post_constructor();
00234 
00235 
00236         void star_transformation_story(stellar_type);
00237         void merge_two_stars_story(stellar_type);
00238         void post_supernova_story();
00239         void first_roche_lobe_contact_story(stellar_type);
00240 
00241         virtual  istream& scan_star_story(istream&);
00242         virtual  ostream& print_star_story(ostream&,
00243                                            int short_output = 0);
00244         
00245     };
00246 
00247 // Shorthand for conversion from node pointer to star pointer:
00248 
00249 #define N_SS_PTR ((single_star *)n->get_starbase())
00250 
00251 // note: automatic conversion from star to dyn scaling
00252 
00253 node* mkstar(int, real, stellar_type type=Main_Sequence);
00254 
00255 void extract_story_chapter(stellar_type&, real&, real&,
00256                            real&, real&, real&, 
00257                            real&, real&,
00258                            real&, real&, real&,
00259                            story&);
00260 void extract_line_text(stellar_type&, real&, real&, real&,
00261                        real&, real&, real&, real&, real&,
00262                        real&, real&, story&);
00263 
00264 bool merge_elements(single_star* primary, single_star *secondary);
00265 
00266 void  addstar(node*,
00267               real t_rel=0,
00268               stellar_type type=Main_Sequence,
00269               bool verbose = false);
00270 
00271 void  addstar1(node * b, real t_rel, stellar_type type,
00272                real mf=1, real rf=1, real tf=1);
00273 
00274 
00275 //real get_stellar_radius(const real mass, const real time, stellar_type& type=Main_Sequence);
00276 #endif          // _SINGLE_STAR
00277 
00278 
00279 
00280 
00281 
00282 
00283 
00284 

Generated on Wed Jul 20 12:43:36 2005 for Starlab by  doxygen 1.4.3