Changeset 3381 in Sophya for trunk/Cosmo/SimLSS/pkspectrum.cc
- Timestamp:
- Nov 14, 2007, 7:25:34 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/SimLSS/pkspectrum.cc
r3378 r3381 31 31 InitialSpectrum::~InitialSpectrum(void) 32 32 { 33 }34 35 void InitialSpectrum::SetNorm(double a)36 {37 A_ = a;38 }39 40 void InitialSpectrum::SetSlope(double n)41 {42 n_ = n;43 33 } 44 34 … … 177 167 } 178 168 179 bool TransfertEisenstein::SetParTo(double h100,double OmegaCDM0,double OmegaBaryon0 ,double tcmb,bool nobaryon)169 bool TransfertEisenstein::SetParTo(double h100,double OmegaCDM0,double OmegaBaryon0) 180 170 // Changement des valeurs des parametres (suivi de re-init eventuel) 171 // Si h100,Omega...<=0. alors pas de changement, on garde l'ancienne valeur 181 172 { 182 173 bool haschanged = false; … … 185 176 if(OmegaCDM0>0.) {Oc_ = OmegaCDM0; haschanged = true;} 186 177 if(OmegaBaryon0>0.) {Ob_ = OmegaBaryon0; haschanged = true;} 187 if(tcmb>0.) {tcmb_ = tcmb; haschanged = true;}188 if(nobaryon!=nobaryon_) {nobaryon_ = nobaryon; haschanged = true;}189 178 190 179 // et on recalcule les initialisations … … 371 360 // Pour avoir D(z) = 1/(1+z) faire: OmegaMatter0=1 OmegaLambda0=0 372 361 GrowthFactor::GrowthFactor(double OmegaMatter0,double OmegaLambda0) 373 : O0_(OmegaMatter0) , Ol_(OmegaLambda0) , Ok_(1.-OmegaMatter0-OmegaLambda0)362 : O0_(OmegaMatter0) , Ol_(OmegaLambda0) 374 363 { 375 364 if(OmegaMatter0==0.) { … … 377 366 throw ParmError("GrowthFactor::GrowthFactor: Error badOmegaMatter0 value"); 378 367 } 379 norm_ = 1.; // puisque (*this)(0.) a besoin de norm_380 norm_ = (*this)(0.);381 cout<<"GrowthFactor::GrowthFactor : norm="<<norm_<<endl;382 368 } 383 369 384 370 GrowthFactor::GrowthFactor(GrowthFactor& d1) 385 : O0_(d1.O0_) , Ol_(d1.Ol_) , Ok_(d1.Ok_) , norm_(d1.norm_)371 : O0_(d1.O0_) , Ol_(d1.Ol_) 386 372 { 387 373 } … … 396 382 z += 1.; 397 383 double z2 = z*z, z3 = z2*z; 398 double den = Ol_ + Ok_*z2 + O0_*z3; 384 385 // Calcul de la normalisation (pour z=0 -> growth=1.) 386 double D1z0 = pow(O0_,4./7.) - Ol_ + (1.+O0_/2.)*(1.+Ol_/70.); 387 D1z0 = 2.5*O0_ / D1z0; 388 389 // Calcul du growthfactor pour z 390 double Ok = 1. - O0_ - Ol_; 391 double den = Ol_ + Ok*z2 + O0_*z3; 399 392 double o0z = O0_ *z3 / den; 400 393 double olz = Ol_ / den; 401 394 402 // 4./7. = 0.571429 403 double D1z = pow(o0z,0.571429) - olz + (1.+o0z/2.)*(1.+olz/70.); 395 double D1z = pow(o0z,4./7.) - olz + (1.+o0z/2.)*(1.+olz/70.); 404 396 D1z = 2.5*o0z / z / D1z; 405 397 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; 398 return D1z / D1z0; 399 } 400 401 void GrowthFactor::SetParTo(double OmegaMatter0,double OmegaLambda0) 402 { 403 if(OmegaMatter0>0.) O0_ = OmegaMatter0; 404 Ol_ = OmegaLambda0; 405 } 406 407 bool GrowthFactor::SetParTo(double OmegaMatter0) 408 // idem precedent sans changer OmegaLambda0 409 { 410 if(OmegaMatter0<=0.) return false; 411 O0_ = OmegaMatter0; 412 return true; 424 413 } 425 414 … … 453 442 PkSpectrumZ::PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref) 454 443 : pk0_(pk0) , d1_(d1) , zref_(zref) , scale_(1.) , typspec_(PK) 455 , zold_(-1.) , d1old_(1.)456 444 { 457 445 } … … 459 447 PkSpectrumZ::PkSpectrumZ(PkSpectrumZ& pkz) 460 448 : pk0_(pkz.pk0_) , d1_(pkz.d1_) , zref_(pkz.zref_) , scale_(pkz.scale_) , typspec_(PK) 461 , zold_(pkz.zold_) , d1old_(pkz.d1old_)462 449 { 463 450 } … … 481 468 double PkSpectrumZ::operator() (double k,double z) 482 469 { 483 double d1; 484 if(z == zold_) d1 = d1old_; 485 else {d1 = d1old_ = d1_(z); zold_ = z;} 470 double d1 = d1_(z); 486 471 487 472 double v = pk0_(k) * d1*d1;
Note:
See TracChangeset
for help on using the changeset viewer.