Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

core_mass.C

Go to the documentation of this file.
00001 #include "node.h"
00002 #include "single_star.h"
00003 #include "main_sequence.h"
00004 
00005 
00006 void dump_core_mass(single_star* str, char * filename) {
00007 
00008   ofstream s(filename, ios::app|ios::out);
00009   if (!s) cerr << "error: couldn't create file "<<filename<<endl;
00010   
00011   s << str->get_current_time() 
00012     <<" "<< str->get_core_mass()
00013     <<" "<< str->temperature()
00014     <<" "<< str->get_luminosity()
00015     <<" "<< str->get_radius()
00016     <<" "<< str->get_element_type()
00017     <<endl;      
00018   
00019   s.close();
00020 }
00021 
00022 
00023 #ifdef TOOLBOX
00024 
00025 void main(int argc, char ** argv) {
00026     int id=1,n=4;
00027     int  c;
00028     real mf=1,rf=1, tf=1;
00029     real m=1.;
00030     stellar_type type = Main_Sequence;
00031     real t_start = 0;
00032     real t_end   = 10000;
00033     real time = 0;
00034 
00035 
00036     extern char *poptarg;
00037     int  pgetopt(int, char **, char *);
00038 
00039     while ((c = pgetopt(argc, argv, "m:n:")) != -1)
00040         switch(c)
00041             {
00042             case 'm': m = atof(poptarg);
00043                       break;
00044             case 'n': n = atoi(poptarg);
00045                       break;
00046             }
00047 
00048     mf = m;
00049     node *b  = mknode(1);
00050     b->get_starbase()->set_stellar_evolution_scaling(mf, rf, tf);
00051     addstar(b, t_start, type);
00052 
00053     single_star* str = (single_star*)b->get_oldest_daughter()->get_starbase();
00054     t_end = str->nucleair_evolution_time();
00055     cerr<<"t_end"<<t_end<<endl;
00056     do {
00057       int i=0;
00058       str = (single_star*)b->get_oldest_daughter()->get_starbase();
00059       real t_next= str->get_next_update_age();
00060 //      cerr << "t_next,time"<<t_next<<" "<<time<<endl;
00061 //      real dt=(t_next-time)/n;
00062       real dt= 0.1 * str->get_evolve_timestep();
00063       cerr << "dt = " << dt << endl;
00064       if (dt<=0.) cerr<<"dt <0 !!!!!!!!!!!!!!!!!!!!!!!"<<endl;
00065 //      cerr<<"dt"<<dt<<endl;
00066 //      for(i=0;i<n;i++) {
00067         time+=dt;
00068 //      cerr<<"time"<<time<<endl;
00069         b->get_oldest_daughter()->get_starbase()->evolve_element(time);
00070         str = (single_star*)b->get_oldest_daughter()->get_starbase();
00071         dump_core_mass(str, "m_core.dat");
00072 //      }
00073 //      dt=.001;
00074 //      time+=dt;
00075 //      b->get_oldest_daughter()->get_starbase()->evolve_element(time);
00076 //      str = (single_star*)b->get_oldest_daughter()->get_starbase();
00077 //      dump_core_mass(str, "m_core.dat");
00078     } while (time<=t_end);
00079 }
00080 
00081 #endif

Generated at Sun Feb 24 09:56:56 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001