diff options
author | Aaron LI <aaronly.me@gmail.com> | 2016-05-27 22:47:24 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@gmail.com> | 2016-05-27 22:47:24 +0800 |
commit | ffd178e0bd72562a3c2cff9747b6e656edc881dc (patch) | |
tree | 8800b7b5b2e8bc3df1a6760df5cd54eaaa686702 /mass_profile/cooling_time.cpp | |
parent | 5c35fad9240fb42c1371c721e0b2af7379bd9ea0 (diff) | |
download | chandra-acis-analysis-ffd178e0bd72562a3c2cff9747b6e656edc881dc.tar.bz2 |
Add mass_profile tools
* These tools are mainly use to calculate the total gravitational mass
profile, as well as the intermediate products (e.g., surface
brightness profile fitting, gas density profile, NFW fitting, etc.)
* There are additional tools for calculating the luminosity and flux.
* These tools mainly developed by Junhua GU, and contributed by
Weitian (Aaron) LI, and Zhenghao ZHU.
Diffstat (limited to 'mass_profile/cooling_time.cpp')
-rw-r--r-- | mass_profile/cooling_time.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/mass_profile/cooling_time.cpp b/mass_profile/cooling_time.cpp new file mode 100644 index 0000000..12b869e --- /dev/null +++ b/mass_profile/cooling_time.cpp @@ -0,0 +1,62 @@ +#include <iostream> +#include <fstream> +#include <cmath> +#include "spline.h" + + +using namespace std; +const double kB=1.60217646E-9;//erg/keV +const double pi=atan(1)*4; +int main(int argc,char* argv[]) +{ + if(argc!=6) + { + cerr<<"Usage:"<<argv[0]<<" <rho_fit.dat> <T file> <bolo cooling function file> <dl> <cm_per_pixel>"<<endl; + return -1; + } + double cm_per_pixel=atof(argv[5]); + double dl=atof(argv[4]); + spline<double> cf,t_profile; + ifstream ifs(argv[2]); + for(;;) + { + double x,T; + ifs>>x>>T; + if(!ifs.good()) + { + break; + } + x=x*cm_per_pixel/3.08567758E21;//convert to kpc + t_profile.push_point(x,T); + } + t_profile.gen_spline(0,0); + ifs.close(); + ifs.open(argv[3]); + for(;;) + { + double x,c; + ifs>>x>>c; + if(!ifs.good()) + { + break; + } + x=x*cm_per_pixel/3.08567758E21;//convert to kpc + cf.push_point(x,c); + } + cf.gen_spline(0,0); + + ifs.close(); + ifs.open(argv[1]); + for(;;) + { + double r,ne; + ifs>>r>>ne; + if(!ifs.good()) + { + break; + } + double nh=ne*1.2; + double tcool=3./2.*(ne+nh)*kB*t_profile.get_value(r)/ne/nh/(cf.get_value(r)*4*pi*dl*dl);//s; + cout<<r<<"\t"<<tcool/(24*3600*365*1E9)<<endl; + } +} |