// Calculate the power spectrum at k based on the run parameters // ============================================================= double PowerSpec(double k) { double power; switch (WhichSpectrum) { case 0: power = Norm * pow(k, PrimordialIndex) * TransferFunc(k) * TransferFunc(k); break; case 1: power = PowerSpec_Tabulated(k); break; default: power = PowerSpec_EH(k); break; } return power; }
double PowerSpec(double k) { double power, alpha, Tf; switch (WhichSpectrum) { case 1: power = PowerSpec_EH(k); break; case 2: power = PowerSpec_Tabulated(k); break; default: power = PowerSpec_Efstathiou(k); break; } if(WDM_On == 1) { /* Eqn. (A9) in Bode, Ostriker & Turok (2001), assuming gX=1.5 */ alpha = 0.048 * pow((Omega - OmegaBaryon) / 0.4, 0.15) * pow(HubbleParam / 0.65, 1.3) * pow(1.0 / WDM_PartMass_in_kev, 1.15); Tf = pow(1 + pow(alpha * k * (3.085678e24 / UnitLength_in_cm), 2 * 1.2), -5.0 / 1.2); power *= Tf * Tf; } #if defined(MULTICOMPONENTGLASSFILE) && defined(DIFFERENT_TRANSFER_FUNC) if(Type == 2) { power = PowerSpec_DM_2ndSpecies(k); } #endif power *= pow(k, PrimordialIndex - 1.0); return power; }