Changeset 3378 in Sophya for trunk/Cosmo/SimLSS/pkspectrum.cc
- Timestamp:
- Nov 9, 2007, 7:04:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/pkspectrum.cc
r3348 r3378 51 51 TransfertEisenstein::TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon,int lp) 52 52 : lp_(lp) 53 , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h _(h100) , tcmb_(tcmb)53 , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h100_(h100) , tcmb_(tcmb) 54 54 , nobaryon_(nobaryon) , nooscenv_(0), retpart_(ALL) 55 55 { … … 60 60 TransfertEisenstein::TransfertEisenstein(TransfertEisenstein& tf) 61 61 : lp_(tf.lp_) 62 ,Oc_(tf.Oc_) , Ob_(tf.Ob_) , h _(tf.h_) , tcmb_(tf.tcmb_)62 ,Oc_(tf.Oc_) , Ob_(tf.Ob_) , h100_(tf.h100_) , tcmb_(tf.tcmb_) 63 63 , nobaryon_(tf.nobaryon_) , nooscenv_(tf.nooscenv_), retpart_(tf.retpart_) 64 64 { … … 67 67 } 68 68 69 TransfertEisenstein::~TransfertEisenstein(void) 70 { 71 } 72 69 73 void TransfertEisenstein::zero_(void) 70 74 { … … 78 82 O0_ = Oc_ + Ob_; 79 83 if(nobaryon_) {O0_ = Oc_; Ob_ = 0.;} 80 double H0 = 100. * h _, h2 = h_*h_;81 if(lp_) cout<<"h100="<<h _<<" H0="<<H0<<") Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl;84 double H0 = 100. * h100_, h2 = h100_*h100_; 85 if(lp_) cout<<"h100="<<h100_<<" H0="<<H0<<") Omatter="<<O0_<<" Ocdm="<<Oc_<<" Ob="<<Ob_<<endl; 82 86 83 87 … … 173 177 } 174 178 175 TransfertEisenstein::~TransfertEisenstein(void) 176 { 179 bool TransfertEisenstein::SetParTo(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon) 180 // Changement des valeurs des parametres (suivi de re-init eventuel) 181 { 182 bool haschanged = false; 183 184 if(h100>0.) {h100_ = h100; haschanged = true;} 185 if(OmegaCDM0>0.) {Oc_ = OmegaCDM0; haschanged = true;} 186 if(OmegaBaryon0>0.) {Ob_ = OmegaBaryon0; haschanged = true;} 187 if(tcmb>0.) {tcmb_ = tcmb; haschanged = true;} 188 if(nobaryon!=nobaryon_) {nobaryon_ = nobaryon; haschanged = true;} 189 190 // et on recalcule les initialisations 191 if(haschanged) Init_(); 192 193 return haschanged; 177 194 } 178 195 … … 202 219 } 203 220 221 void TransfertEisenstein::SetPrintLevel(int lp) 222 { 223 lp_ = lp; 224 } 225 226 204 227 double TransfertEisenstein::T0tild(double k,double alphac,double betac) 205 228 { 206 229 // Formule 10 p 608 207 //double q = k*th2p7_*th2p7_/(O0_*h _*h_);230 //double q = k*th2p7_*th2p7_/(O0_*h100_*h100_); 208 231 double q = k/(13.41*keq_); 209 232 // Formule 20 p 610 … … 220 243 // OU Pour function lissee sans oscillation baryon 221 244 if(nobaryon_ || nooscenv_ == 2) { 222 double gamma = O0_*h _;245 double gamma = O0_*h100_; 223 246 // Calcul de Gamma_eff, formule 30 page 612 (pour fct lissee) 224 247 if( nobaryon_==false && nooscenv_ == 2 ) 225 gamma = O0_*h _*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*sfit_,4.))); // Gamma_eff248 gamma = O0_*h100_*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*sfit_,4.))); // Gamma_eff 226 249 // Formule 28 page 612 : qui est est equivalent a: 227 // q = k / h _ * th2p7_*th2p7_ / gamma;250 // q = k / h100_ * th2p7_*th2p7_ / gamma; 228 251 // qui est est equivalent a: 229 252 // q = k / (13.41 * keq) pour Ob=0 … … 231 254 // Les resultats sont legerement differents a cause des valeurs approx. 232 255 // des constantes numeriques: on prend comme W.Hu (tf_fit.c) 233 //double q = k / h _ * th2p7_*th2p7_ / gamma; // Mpc^-1234 double q = k/(13.41*keq_) * (O0_*h _/gamma); // Mpc^-1256 //double q = k / h100_ * th2p7_*th2p7_ / gamma; // Mpc^-1 257 double q = k/(13.41*keq_) * (O0_*h100_/gamma); // Mpc^-1 235 258 // Formules 29 page 612 236 259 double l0 = log(2.*M_E + 1.8*q); … … 284 307 285 308 TransfertTabulate::TransfertTabulate(double h100,double OmegaCDM0,double OmegaBaryon0) 286 : Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h _(h100) , kmin_(1.) , kmax_(-1.)309 : Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h100_(h100) , kmin_(1.) , kmax_(-1.) 287 310 , interptyp_(0) 288 311 { … … 290 313 291 314 TransfertTabulate::TransfertTabulate(TransfertTabulate& tf) 292 : Oc_(tf.Oc_) , Ob_(tf.Ob_) , h _(tf.h_) , kmin_(tf.kmin_) , kmax_(tf.kmax_)315 : Oc_(tf.Oc_) , Ob_(tf.Ob_) , h100_(tf.h100_) , kmin_(tf.kmin_) , kmax_(tf.kmax_) 293 316 , interptyp_(tf.interptyp_) , k_(tf.k_) , tf_(tf.tf_) 294 317 { … … 324 347 double k,tc,tb,tf; 325 348 sscanf(line,"%lf %lf %lf",&k,&tc,&tb); 326 k *= h _; // convert h^-1 Mpc -> Mpc349 k *= h100_; // convert h^-1 Mpc -> Mpc 327 350 tf = (Oc_*tc+Ob_*tb)/(Oc_+Ob_); 328 351 if(tf>tmax) tmax = tf; … … 382 405 383 406 return D1z / norm_; 407 } 408 409 bool GrowthFactor::SetParTo(double OmegaMatter0,double OmegaLambda0) 410 { 411 bool haschanged = false; 412 413 if(OmegaMatter0>0.) {O0_ = OmegaMatter0; haschanged = true;} 414 if(fabs(OmegaLambda0+12345.)>1e-6) {Ol_ = OmegaLambda0; haschanged = true;} 415 416 // et on recalcule les initialisations 417 if(haschanged) { 418 Ok_ = 1. - O0_ - Ol_; 419 norm_ = 1.; // puisque (*this)(0.) a besoin de norm_ 420 norm_ = (*this)(0.); 421 } 422 423 return haschanged; 384 424 } 385 425
Note:
See TracChangeset
for help on using the changeset viewer.