Changeset 3378 in Sophya for trunk/Cosmo/SimLSS/pkspectrum.cc


Ignore:
Timestamp:
Nov 9, 2007, 7:04:12 PM (18 years ago)
Author:
cmv
Message:

modif sur remplissage NTuple/Minos, possibilite de changer les parametres O0,Om,Ol etc... , cmv 09/11/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/pkspectrum.cc

    r3348 r3378  
    5151TransfertEisenstein::TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon,int lp)
    5252  : lp_(lp)
    53   , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h_(h100) , tcmb_(tcmb)
     53  , Oc_(OmegaCDM0) , Ob_(OmegaBaryon0) , h100_(h100) , tcmb_(tcmb)
    5454  , nobaryon_(nobaryon) , nooscenv_(0), retpart_(ALL)
    5555{
     
    6060TransfertEisenstein::TransfertEisenstein(TransfertEisenstein& tf)
    6161  : 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_)
    6363  , nobaryon_(tf.nobaryon_) , nooscenv_(tf.nooscenv_), retpart_(tf.retpart_)
    6464{
     
    6767}
    6868
     69TransfertEisenstein::~TransfertEisenstein(void)
     70{
     71}
     72
    6973void TransfertEisenstein::zero_(void)
    7074{
     
    7882  O0_ = Oc_ + Ob_;
    7983  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;
    8286
    8387
     
    173177}
    174178
    175 TransfertEisenstein::~TransfertEisenstein(void)
    176 {
     179bool 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;
    177194}
    178195
     
    202219}
    203220
     221void TransfertEisenstein::SetPrintLevel(int lp)
     222{
     223 lp_ = lp;
     224}
     225
     226
    204227double TransfertEisenstein::T0tild(double k,double alphac,double betac)
    205228{
    206229  // Formule 10 p 608
    207   //double q = k*th2p7_*th2p7_/(O0_*h_*h_);
     230  //double q = k*th2p7_*th2p7_/(O0_*h100_*h100_);
    208231  double q = k/(13.41*keq_);
    209232  // Formule 20 p 610
     
    220243  //  OU Pour function lissee sans oscillation baryon
    221244  if(nobaryon_  || nooscenv_ == 2) {
    222     double gamma = O0_*h_;
     245    double gamma = O0_*h100_;
    223246    // Calcul de Gamma_eff, formule 30 page 612 (pour fct lissee)
    224247    if( nobaryon_==false && nooscenv_ == 2 )
    225       gamma = O0_*h_*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*sfit_,4.))); // Gamma_eff
     248      gamma = O0_*h100_*(alphag_ + (1.-alphag_)/(1.+pow(0.43*k*sfit_,4.))); // Gamma_eff
    226249    // Formule 28 page 612 : qui est est equivalent a:
    227     //    q = k / h_ * th2p7_*th2p7_ / gamma;
     250    //    q = k / h100_ * th2p7_*th2p7_ / gamma;
    228251    // qui est est equivalent a:
    229252    //    q = k / (13.41 * keq)                   pour Ob=0
     
    231254    // Les resultats sont legerement differents a cause des valeurs approx.
    232255    // des constantes numeriques: on prend comme W.Hu (tf_fit.c)
    233     //double q = k / h_ * th2p7_*th2p7_ / gamma;  // Mpc^-1
    234     double q = k/(13.41*keq_) * (O0_*h_/gamma);  // Mpc^-1
     256    //double q = k / h100_ * th2p7_*th2p7_ / gamma;  // Mpc^-1
     257    double q = k/(13.41*keq_) * (O0_*h100_/gamma);  // Mpc^-1
    235258    // Formules 29 page 612
    236259    double l0 = log(2.*M_E + 1.8*q);
     
    284307
    285308TransfertTabulate::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.)
    287310, interptyp_(0)
    288311{
     
    290313
    291314TransfertTabulate::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_)
    293316, interptyp_(tf.interptyp_) , k_(tf.k_) , tf_(tf.tf_)
    294317{
     
    324347   double k,tc,tb,tf;
    325348   sscanf(line,"%lf %lf %lf",&k,&tc,&tb);
    326    k *= h_;     // convert h^-1 Mpc  ->  Mpc
     349   k *= h100_;     // convert h^-1 Mpc  ->  Mpc
    327350   tf = (Oc_*tc+Ob_*tb)/(Oc_+Ob_);
    328351   if(tf>tmax) tmax = tf;
     
    382405
    383406 return D1z / norm_;
     407}
     408
     409bool 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;
    384424}
    385425
Note: See TracChangeset for help on using the changeset viewer.