- Timestamp:
- Aug 24, 2007, 5:00:00 PM (18 years ago)
- Location:
- trunk/Cosmo/SimLSS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/pkspectrum.cc
r3246 r3314 48 48 /////////////////////////////////////////////////////////// 49 49 50 // From Eisenstein & Hu ApJ 496:605-614 1998 April 1 51 TransfertEisenstein::TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon) 52 : Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h_(h100) , tcmb_(tcmb) 53 , nobaryon_(nobaryon) , nooscenv_(0) 54 { 55 if(nobaryon_ == false && Ob_>0.) Init_With_Baryons(); 56 else Init_Without_Baryon(); 50 // From Eisenstein & Hu ApJ 496:605-614 1998 April 1 (ou astro-ph/9709112) 51 TransfertEisenstein::TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon,int lp) 52 : lp_(lp) 53 , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h_(h100) , tcmb_(tcmb) 54 , nobaryon_(nobaryon) , nooscenv_(0), retpart_(0) 55 { 56 zero_(); 57 Init_(); 57 58 } 58 59 59 60 TransfertEisenstein::TransfertEisenstein(TransfertEisenstein& tf) 60 : Oc_(tf.Oc_) , Ob_(tf.Ob_) , h_(tf.h_) , tcmb_(tf.tcmb_) 61 , nobaryon_(tf.nobaryon_) , nooscenv_(tf.nooscenv_) 62 { 63 if(nobaryon_ == false && Ob_>0.) Init_With_Baryons(); 64 else Init_Without_Baryon(); 65 } 66 67 void TransfertEisenstein::Init_With_Baryons(void) 68 { 69 int lp = 1; 70 71 nobaryon_ = false; 61 : lp_(tf.lp_) 62 ,Oc_(tf.Oc_) , Ob_(tf.Ob_) , h_(tf.h_) , tcmb_(tf.tcmb_) 63 , nobaryon_(tf.nobaryon_) , nooscenv_(tf.nooscenv_), retpart_(tf.retpart_) 64 { 65 zero_(); 66 Init_(); 67 } 68 69 void TransfertEisenstein::Init_(void) 70 { 71 72 72 O0_ = Oc_ + Ob_; 73 if(lp) cout<<"h100="<<h_<<" Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl; 73 if(nobaryon_) {O0_ = Oc_; Ob_ = 0.;} 74 if(lp_) cout<<"h100="<<h_<<" Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl; 74 75 75 76 double H0 = 100. * h_, h2 = h_*h_; 76 77 78 if(tcmb_<0.) tcmb_ = T_CMB_Par; 77 79 th2p7_ = tcmb_/2.7; 78 80 double th2p7P4 = th2p7_*th2p7_*th2p7_*th2p7_; 81 if(lp_) cout<<"tcmb = "<<tcmb_<<" K = "<<th2p7_<<" *2.7K "<<endl; 79 82 80 83 // Formule 2 p 606 81 84 zeq_ = 2.50e4 * O0_ * h2 / th2p7P4; 82 if(lp) cout<<"zeq = "<<zeq_<<endl;85 if(lp_) cout<<"zeq = "<<zeq_<<" (redshift of matter-radiation equality)"<<endl; 83 86 84 87 // Formule 3 p 607 … … 86 89 // keq_ = sqrt(2.*O0_*H0*H0*zeq_) / SpeedOfLight_Cst; 87 90 keq_ = 7.46e-2 * O0_ * h2 / (th2p7_*th2p7_); 88 if(lp) cout<<"keq = "<<keq_<<" Mpc^-1"<<endl; 91 if(lp_) cout<<"keq = "<<keq_<<" Mpc^-1 (scale of equality)"<<endl; 92 93 // On s'arrete ici si pas de baryons 94 if(nobaryon_) return; 89 95 90 96 // Formule 4 p 607 91 97 double b1_eq4 = 0.313*pow(O0_*h2,-0.419)*(1. + 0.607*pow(O0_*h2,0.674)); 92 98 double b2_eq4 = 0.238*pow(O0_*h2,0.223); 93 doublezd_ = 1291. * pow(O0_*h2,0.251) / (1.+0.659* pow(O0_*h2,0.828))94 * (1. + b1_eq4*pow(Ob_*h2,b2_eq4));95 if(lp) cout<<"zd = "<<zd_<<endl;96 97 // Formule 5 page 607 99 zd_ = 1291. * pow(O0_*h2,0.251) / (1.+0.659* pow(O0_*h2,0.828)) 100 * (1. + b1_eq4*pow(Ob_*h2,b2_eq4)); 101 if(lp_) cout<<"zd = "<<zd_<<" (Redshift of drag epoch)"<<endl; 102 103 // Formule 5 page 607 (R = 3*rho_baryon/4*rho_gamma) 98 104 Req_ = 31.5*Ob_*h2 / th2p7P4 * (1.e3/zeq_); 105 //WARNING: W.Hu code (tf_fit.c) en des-accord avec l'article: zd -> (1+zd) 99 106 Rd_ = 31.5*Ob_*h2 / th2p7P4 * (1.e3/zd_); 100 if(lp) cout<<"Req = "<<Req_<<" Rd = "<<Rd_<<endl; 107 //in tf_fit.c: Rd_ = 31.5*Ob_*h2 / th2p7P4 * (1.e3/(1.+zd_)); 108 if(lp_) { 109 cout<<"Req = "<<Req_<<" Rd = "<<Rd_ 110 <<" (Photon-baryon ratio at equality/drag epoch)"<<endl; 111 cout<<"Sound speed at equality "<<1./sqrt(3.*(1.+Req_)) 112 <<", at drag "<<1./sqrt(3.*(1.+Rd_))<<" in unit of C"<<endl; 113 } 101 114 102 115 // Formule 6 p 607 103 116 s_ = 2./(3.*keq_) * sqrt(6./Req_) 104 117 * log( (sqrt(1.+Rd_) + sqrt(Rd_+Req_)) / (1.+sqrt(Req_)) ); 105 if(lp) cout<<"s = "<<s_<<" Mpc"<<endl;118 if(lp_) cout<<"s = "<<s_<<" Mpc (sound horizon at drag epoch)"<<endl; 106 119 107 120 // Formule 7 page 607 108 121 ksilk_ = 1.6*pow(Ob_*h2,0.52)*pow(O0_*h2,0.73) * (1. + pow(10.4*O0_*h2,-0.95)); 109 if(lp) cout<<"ksilk = "<<ksilk_<<" Mpc^-1"<<endl;122 if(lp_) cout<<"ksilk = "<<ksilk_<<" Mpc^-1 (silk damping scale)"<<endl; 110 123 111 124 // Formules 10 page 608 … … 116 129 double b2 = pow(0.395*O0_*h2,-0.0266); 117 130 betac_ = 1 / ( 1. + b1*(pow(Oc_/O0_,b2) - 1.) ); 131 if(lp_) cout<<"alphac = "<<alphac_<<" betac = "<<betac_ 132 <<" (CDM suppression/log shift)"<<endl; 118 133 119 134 // Formule 23 page 610 120 135 bnode_ = 8.41 * pow(O0_*h2,0.435); 121 if(lp) cout<<"bnode = "<<bnode_<<endl;136 if(lp_) cout<<"bnode = "<<bnode_<<" (sound horizon shift)"<<endl; 122 137 123 138 // Formule 14 page 608 139 //WARNING: W.Hu code (tf_fit.c) en des-accord avec l'article: (1+zeq) -> zeq 124 140 double y = (1.+zeq_)/(1.+zd_); 141 //in tf_fit.c: double y = zeq_/(1.+zd_); 125 142 double s1py = sqrt(1.+y); 126 143 double Gy = y*( -6.*s1py + (2.+3.*y)*log((s1py+1.)/(s1py-1.)) ); … … 130 147 betab_ = 0.5 + Ob_/O0_ 131 148 + (3.-2.*Ob_/O0_) * sqrt(pow(17.2*O0_*h2,2.) + 1.); 149 if(lp_) cout<<"alphab = "<<alphab_<<" betab = "<<betab_ 150 <<" (Baryon suppression/envelope shift)"<<endl; 132 151 133 152 // Formule 31 page 612 … … 135 154 - 0.328*log(431.*O0_*h2)*Ob_/O0_ 136 155 + 0.38*log(22.3*O0_*h2)*pow(Ob_/O0_,2.); 137 138 // --- Pour la positon du premier pic acoustique 139 // Formule 26 page 611 140 double s_peak = 44.5*log(9.83/(O0_*h2)) / sqrt(1.+10.*pow(Ob_*h2,3./4.)); // Mpc 141 // Formule 25 page 611 142 kpeak_ = 5*M_PI/(2.*s_peak) * (1.+0.217*O0_*h2); // 1/Mpc 143 if(lp) cout<<"for 1er peak: s="<<s_peak<<" kpeak="<<kpeak_<<endl; 156 if(lp_) cout<<"alphag = "<<alphag_<<" (gamma suppression in approximate TF)"<<endl; 157 158 // The approximate value of the sound horizon, formule 26 page 611 159 sfit_ = 44.5*log(9.83/(O0_*h2)) / sqrt(1.+10.*pow(Ob_*h2,3./4.)); // Mpc 160 if(lp_) cout<<"sfit="<<sfit_<<" Mpc (fit to sound horizon)"<<endl; 161 162 // La positoin du premier pic acoustique, formule 25 page 611 163 kpeak_ = 5*M_PI/(2.*sfit_) * (1.+0.217*O0_*h2); // 1/Mpc 164 if(lp_) cout<<"kpeak="<<kpeak_<<" Mpc^-1 (fit to wavenumber of first peak)"<<endl; 144 165 145 166 return; 146 167 } 147 168 148 void TransfertEisenstein::Init_Without_Baryon(void)149 {150 int lp = 1;151 152 nobaryon_ = true;153 O0_ = Oc_;154 if(lp) cout<<"Omatter="<<O0_<<" Ocdm="<<Oc_<<endl;155 th2p7_ = tcmb_/2.7;156 }157 158 169 TransfertEisenstein::~TransfertEisenstein(void) 159 170 { … … 161 172 162 173 void TransfertEisenstein::SetNoOscEnv(unsigned short nooscenv) 163 // To obtain the non-oscillatory part of the spectrum164 // nooscenv = 0 : use the baryon oscillatory part of transfert function 174 // To obtain an approximate form of the non-oscillatory part of the transfert function 175 // nooscenv = 0 : use the baryon oscillatory part of transfert function (full tf) 165 176 // nooscenv = 1 : use approx. paragraph 3.3 p610 (middle of right column) 177 // Replace j0(k*stilde) -> [1+(k*stilde)^4]^(-1/4) 166 178 // nooscenv = 2 : use formulae 29+30+31 page 612 167 { 168 if(nooscenv>2) { 169 cout<<"TransfertEisenstein::SetNoOscEnv: Error bad nooscenv value: "<<nooscenv<<endl; 170 throw ParmError("TransfertEisenstein::SetNoOscEnv: Error bad nooscenv value"); 171 } 172 nooscenv_ = nooscenv; 179 // The value of an approximate transfer function that captures 180 // the non-oscillatory part of a partial baryon transfer function. 181 // In other words, the baryon oscillations are left out, 182 // but the suppression of power below the sound horizon is included. 183 { 184 if(nooscenv!=1 && nooscenv!=2) nooscenv = 0; 185 nooscenv_ = nooscenv; 186 } 187 188 void TransfertEisenstein::SetReturnPart(unsigned short retpart) 189 // To return only baryon or CDM part part of transfert function 190 // retpart = 1 : return only CDM part of transfert function 191 // retpart = 2 : return only Baryon part of transfert function 192 // retpart = anything else: return only full transfert function 193 // WARNING: only relevant for nobaryon_=false AND nooscenv!=2 194 { 195 if(retpart!=1 && retpart!=2) retpart = 0; 196 retpart_ = retpart; 173 197 } 174 198 … … 192 216 if(nobaryon_ || nooscenv_ == 2) { 193 217 double gamma = O0_*h_; 194 // Formule 30 page 612 (pour fct lissee)218 // Calcul de Gamma_eff, formule 30 page 612 (pour fct lissee) 195 219 if( nobaryon_==false && nooscenv_ == 2 ) 196 gamma = O0_*h_*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*s_,4.))); 197 // Formule 28 page 612 198 double q = k / h_ * th2p7_*th2p7_/gamma; // Mpc^-1 220 gamma = O0_*h_*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*sfit_,4.))); // Gamma_eff 221 // Formule 28 page 612 : qui est est equivalent a: 222 // q = k / h_ * th2p7_*th2p7_ / gamma; 223 // qui est est equivalent a: 224 // q = k / (13.41 * keq) pour Ob=0 225 // q = k / (13.41 * keq) * (O0*h/Gamma) pour le spectre lisse 226 // Les resultats sont legerement differents a cause des valeurs approx. 227 // des constantes numeriques: on prend comme W.Hu (tf_fit.c) 228 //double q = k / h_ * th2p7_*th2p7_ / gamma; // Mpc^-1 229 double q = k/(13.41*keq_) * (O0_*h_/gamma); // Mpc^-1 199 230 // Formules 29 page 612 200 231 double l0 = log(2.*M_E + 1.8*q); … … 203 234 } 204 235 236 // --- Pour CDM + Baryons 205 237 // --- CDM 206 238 double f = 1. / (1. + pow(k*s_/5.4,4.)); 207 239 double Tc = f*T0tild(k,1.,betac_) + (1.-f)*T0tild(k,alphac_,betac_); 240 if(retpart_ == 1) return Tc; 208 241 209 242 // --- Baryons 210 243 // Formule 22 page 610 211 double st k, ksbnode = k*s_/bnode_;212 if(ksbnode<0.001) st k=s_ * ksbnode;213 else st k = s_ / pow(1. + pow(1./ksbnode,3.), 1/.3);244 double stilde, ksbnode = k*s_/bnode_; 245 if(ksbnode<0.001) stilde =s_ * ksbnode; 246 else stilde = s_ / pow(1. + pow(1./ksbnode,3.), 1./3.); 214 247 // Formule 21 page 610 215 248 double j0kst = 0.; 216 if(nooscenv_ == 1) j0kst = pow(1.+pow(k*stk,4.) , -1./4.); //lissee sans oscillation baryon 217 else { 218 double x = k*stk; 249 if(nooscenv_ == 1) { 250 j0kst = pow(1.+pow(k*stilde,4.) , -1./4.); //lissee sans oscillation baryon 251 } else { 252 double x = k*stilde; 219 253 if(x<0.01) j0kst = 1. - x*x/6.*(1.-x*x/20.); 220 254 else j0kst = sin(x)/x; 221 // //if(k>0.038&&k<0.07) cout<<"k="<<k<<" stk="<<stk<<" x="<<x<<endl;255 //cout<<"DEBUG: k="<<k<<" stilde="<<stilde<<" x="<<x<<" j0kst="<<j0kst<<endl; 222 256 } 223 257 double Tb = T0tild(k,1.,1.) / (1. + pow(k*s_/5.2,2.)); 224 Tb += alphab_/(1.+pow(betab_/(k*s_),3.)) * exp(-pow(k/ksilk_,1 /4.));258 Tb += alphab_/(1.+pow(betab_/(k*s_),3.)) * exp(-pow(k/ksilk_,1.4)); 225 259 Tb *= j0kst; 260 if(retpart_ == 2) return Tb; 226 261 227 262 // --- Total … … 528 563 lkfind = lkmin; 529 564 for(int i=0;i<=n;i++) { 530 if( (*this)(pow(10,lkfind)) >= high ) break; //cmvbug565 if( (*this)(pow(10,lkfind)) >= high ) break; 531 566 lkfind = lkmin + i*dlk; 532 567 } … … 548 583 lkfind=lkmax; 549 584 for(int i=0;i<=n;i++) { 550 if( (*this)(pow(10,lkfind)) >= high ) break; //cmvbug585 if( (*this)(pow(10,lkfind)) >= high ) break; 551 586 lkfind -= dlk; 552 587 lkfind = lkmax - i*dlk; -
trunk/Cosmo/SimLSS/pkspectrum.h
r3115 r3314 23 23 class TransfertEisenstein : public GenericFunc { 24 24 public: 25 TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false );25 TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false,int lp=0); 26 26 TransfertEisenstein(TransfertEisenstein& tf); 27 27 virtual ~TransfertEisenstein(void); … … 29 29 double KPeak(void); 30 30 void SetNoOscEnv(unsigned short nooscenv=0); 31 void SetReturnPart(unsigned short retpart=0); 31 32 protected: 32 double O0_,Oc_,Ob_,h_,tcmb_,th2p7_; 33 int lp_; 34 double O0_,Oc_,Ob_,h_,tcmb_; 35 double th2p7_; 33 36 double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_; 34 37 double alphag_; 35 double kpeak_;38 double sfit_,kpeak_; 36 39 37 40 bool nobaryon_; 38 unsigned short nooscenv_; 41 unsigned short nooscenv_, retpart_; 42 39 43 double T0tild(double k,double alphac,double betac); 40 void Init_With_Baryons(void); 41 void Init_Without_Baryon(void); 44 void Init_(void); 45 inline void zero_(void) 46 {th2p7_=zeq_=keq_=zd_=Req_=Rd_=s_=ksilk_=alphac_=betac_=bnode_= 47 alphab_=betab_=alphag_=sfit_=kpeak_=0.;} 42 48 }; 43 49
Note:
See TracChangeset
for help on using the changeset viewer.