//************* // tov_lorenepars_polytrope.C // This interactive code calculates the maximum mass for the sequence of // polytropic models calculated by tov_solver_polytrope. // Next, it prompts for a mass and radius, determines if such a configuration // is on the stable branch for that EOS (below the maximum baryon mass), // and outputs parameters for use with lorene using simple linear interpolation. // // The call is just ./executable, but you will need a file in the form // gam_n.nnn.dat, where "n.nnn" is the value of gamma. // // The output is a file par_eos.d.gam_n.nnn that may be renamed and used // with the Lorene code // // (c)2019 Josh Faber, please consider this either GPL // or CC-BY-SA as far as licensing goes. //***************************************************8 #include #include #include #include #include #include #include double msun = 1.98847e33; double kilometer=1.0e5; double ggrav=6.67408e-8; double speedlight=2.9979e10; int nlines = 800; using namespace std; int main(int argc, char** argv) { cout<<"Enter gamma value"<> gamval; char filename[20]; sprintf(filename,"gam_%.3f.dat",gamval); cout<<"filename? "<> rval >> massgval >> massbval >> compact >> rhoval; if(massbval > massold) { r[i]=rval; massg[i]=massgval; massb[i]=massbval; rhoc[i]=rhoval; massold=massbval; } else { done=1; imax=i-1; } } tovdatfile.close(); cout<<"Maximum mass configuration for k=1:"< Compactness:"<>mns; cout<<"What radius do you want (in km)?"<>rns; double Cns = ggrav*mns*msun/rns/kilometer/speedlight/speedlight; cout<<"That yields a compactness of "<Cmax) { cout<<" That is larger than the maximum allowed compactness, Cmax="<