[3115] | 1 | #ifndef PKSPECTRUM_SEEN
|
---|
| 2 | #define PKSPECTRUM_SEEN
|
---|
| 3 |
|
---|
| 4 | #include "machdefs.h"
|
---|
| 5 | #include "genericfunc.h"
|
---|
| 6 |
|
---|
| 7 | namespace SOPHYA {
|
---|
| 8 |
|
---|
| 9 | //-----------------------------------------------------------------------------------
|
---|
| 10 | class InitialSpectrum : public GenericFunc {
|
---|
| 11 | public:
|
---|
| 12 | InitialSpectrum(double n,double a=1.);
|
---|
| 13 | InitialSpectrum(InitialSpectrum& pkinf);
|
---|
| 14 | virtual ~InitialSpectrum(void);
|
---|
| 15 | virtual double operator() (double k) {return A_ * pow(k,n_);}
|
---|
| 16 | void SetNorm(double a);
|
---|
| 17 | void SetSlope(double n);
|
---|
| 18 | protected:
|
---|
| 19 | double n_, A_;
|
---|
| 20 | };
|
---|
| 21 |
|
---|
| 22 | //-----------------------------------------------------------------------------------
|
---|
| 23 | class TransfertEisenstein : public GenericFunc {
|
---|
| 24 | public:
|
---|
[3314] | 25 | TransfertEisenstein(double h100,double OmegaCDM0,double OmegaBaryon0,double tcmb,bool nobaryon=false,int lp=0);
|
---|
[3115] | 26 | TransfertEisenstein(TransfertEisenstein& tf);
|
---|
| 27 | virtual ~TransfertEisenstein(void);
|
---|
| 28 | virtual double operator() (double k);
|
---|
| 29 | double KPeak(void);
|
---|
| 30 | void SetNoOscEnv(unsigned short nooscenv=0);
|
---|
[3314] | 31 | void SetReturnPart(unsigned short retpart=0);
|
---|
[3115] | 32 | protected:
|
---|
[3314] | 33 | int lp_;
|
---|
| 34 | double O0_,Oc_,Ob_,h_,tcmb_;
|
---|
| 35 | double th2p7_;
|
---|
[3115] | 36 | double zeq_,keq_,zd_,Req_,Rd_,s_,ksilk_,alphac_,betac_,bnode_,alphab_,betab_;
|
---|
| 37 | double alphag_;
|
---|
[3314] | 38 | double sfit_,kpeak_;
|
---|
[3115] | 39 |
|
---|
| 40 | bool nobaryon_;
|
---|
[3314] | 41 | unsigned short nooscenv_, retpart_;
|
---|
| 42 |
|
---|
[3115] | 43 | double T0tild(double k,double alphac,double betac);
|
---|
[3314] | 44 | void Init_(void);
|
---|
[3318] | 45 | void zero_(void);
|
---|
[3115] | 46 | };
|
---|
| 47 |
|
---|
[3318] | 48 | //-----------------------------------------------------------------------------------
|
---|
| 49 | class TransfertTabulate : public GenericFunc {
|
---|
| 50 | public:
|
---|
| 51 | TransfertTabulate(double h100,double OmegaCDM0,double OmegaBaryon0);
|
---|
| 52 | TransfertTabulate(TransfertTabulate& tf);
|
---|
| 53 | virtual ~TransfertTabulate(void);
|
---|
| 54 | virtual double operator() (double k);
|
---|
| 55 | int NPoints(void) {return k_.size();}
|
---|
| 56 | void SetInterpTyp(int typ=0);
|
---|
| 57 | int ReadCMBFast(string filename);
|
---|
| 58 | protected:
|
---|
| 59 | double Oc_,Ob_,h_;
|
---|
| 60 | double kmin_,kmax_;
|
---|
| 61 | int interptyp_;
|
---|
| 62 | vector<double> k_, tf_;
|
---|
| 63 | };
|
---|
[3115] | 64 |
|
---|
[3318] | 65 |
|
---|
[3115] | 66 | //-----------------------------------------------------------------------------------
|
---|
| 67 | class GrowthFactor : public GenericFunc {
|
---|
| 68 | public:
|
---|
| 69 | GrowthFactor(double OmegaMatter0,double OmegaLambda0);
|
---|
| 70 | GrowthFactor(GrowthFactor& d1);
|
---|
| 71 | virtual ~GrowthFactor(void);
|
---|
| 72 | virtual double operator() (double z);
|
---|
| 73 | protected:
|
---|
| 74 | double O0_,Ol_,Ok_;
|
---|
| 75 | double norm_;
|
---|
| 76 | };
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | //-----------------------------------------------------------------------------------
|
---|
| 80 | class PkSpectrum0 : public GenericFunc {
|
---|
| 81 | public:
|
---|
| 82 | PkSpectrum0(InitialSpectrum& pkinf,TransfertEisenstein& tf);
|
---|
| 83 | PkSpectrum0(PkSpectrum0& pk0);
|
---|
| 84 | virtual ~PkSpectrum0(void);
|
---|
| 85 | virtual double operator() (double z);
|
---|
| 86 | InitialSpectrum& GetPkIni(void) {return pkinf_;}
|
---|
| 87 | TransfertEisenstein& GetTransfert(void) {return tf_;}
|
---|
| 88 | protected:
|
---|
| 89 | InitialSpectrum& pkinf_;
|
---|
| 90 | TransfertEisenstein& tf_;
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 | //-----------------------------------------------------------------------------------
|
---|
| 94 | class PkSpectrumZ : public GenericFunc {
|
---|
| 95 | public:
|
---|
| 96 | PkSpectrumZ(PkSpectrum0& pk0,GrowthFactor& d1,double zref=0.);
|
---|
| 97 | PkSpectrumZ(PkSpectrumZ& pkz);
|
---|
| 98 | virtual ~PkSpectrumZ(void);
|
---|
| 99 | virtual double operator() (double k);
|
---|
| 100 | virtual double operator() (double k,double z);
|
---|
| 101 | inline void SetZ(double z) {zref_ = z;}
|
---|
| 102 | inline double GetZ(void) {return zref_;}
|
---|
| 103 | void SetTypSpec(unsigned short typspec=0);
|
---|
| 104 | inline void SetScale(double scale=1.) {scale_=scale; zold_=-1.;}
|
---|
| 105 | inline double GetScale(void) {return scale_;}
|
---|
| 106 | PkSpectrum0& GetPk0(void) {return pk0_;}
|
---|
| 107 | GrowthFactor& GetGrowthFactor(void) {return d1_;}
|
---|
| 108 | protected:
|
---|
| 109 | PkSpectrum0& pk0_;
|
---|
| 110 | GrowthFactor& d1_;
|
---|
| 111 | double zref_, scale_;
|
---|
| 112 | unsigned short typspec_;
|
---|
| 113 | mutable double zold_, d1old_;
|
---|
| 114 | };
|
---|
| 115 |
|
---|
| 116 | //-----------------------------------------------------------------------------------
|
---|
| 117 | class VarianceSpectrum : public GenericFunc {
|
---|
| 118 | public:
|
---|
| 119 | VarianceSpectrum(GenericFunc& pk,unsigned short typfilter);
|
---|
| 120 | VarianceSpectrum(VarianceSpectrum& pkinf);
|
---|
| 121 | virtual ~VarianceSpectrum(void);
|
---|
| 122 |
|
---|
| 123 | void SetFilter(unsigned short typfilter=0);
|
---|
| 124 | void SetInteg(double dperc=0.1,double dlogkinc=-1.,double dlogkmax=-1.,unsigned short glorder=4);
|
---|
| 125 |
|
---|
| 126 | double Variance(double R,double kmin,double kmax);
|
---|
| 127 |
|
---|
| 128 | // ATTENTION: La fonction a integrer est : f(k)dk = k^3*Pk(k)/(2Pi^2) *filter2(k*R) *dk/k
|
---|
| 129 | virtual double operator() (double k) {return k*k*pk_(k)*Filter2(k*R_)/(2.*M_PI*M_PI);}
|
---|
| 130 | double Filter2(double x);
|
---|
| 131 |
|
---|
| 132 | // Aide a l'integration
|
---|
| 133 | double FindMaximum(double R,double kmin,double kmax,double eps=1.e-3);
|
---|
| 134 | int FindLimits(double R,double high,double &kmin,double &kmax,double eps=1.e-3);
|
---|
| 135 |
|
---|
| 136 | protected:
|
---|
| 137 |
|
---|
| 138 | GenericFunc& pk_;
|
---|
| 139 | unsigned short typfilter_;
|
---|
| 140 | double R_;
|
---|
| 141 |
|
---|
| 142 | double dperc_,dlogkinc_,dlogkmax_;
|
---|
| 143 | unsigned short glorder_;
|
---|
| 144 |
|
---|
| 145 | };
|
---|
| 146 |
|
---|
[3325] | 147 | } // Fin du namespace SOPHYA
|
---|
[3115] | 148 |
|
---|
| 149 | #endif
|
---|