additions from PNG-project

This commit is contained in:
AAndrews 2019-07-11 14:27:22 +02:00
parent ec4e895fd8
commit 685cc10cf4
2 changed files with 84 additions and 38 deletions

View File

@ -212,6 +212,43 @@ double CosmoPower::powerHuWiggles(double k)
return normPower * pow(k,n) * T_k * T_k; return normPower * pow(k,n) * T_k * T_k;
} }
double CosmoPower::primordialPowerSpectrum(double k)
{
//Primordial power spectrum, needed for PNG
return normPower * pow(k,n);
}
double CosmoPower::matterTransferFunctionHu(double k)
{
// EISENSTEIN ET HU (1998)
// FULL POWER SPECTRUM WITH BARYONS AND WIGGLES
double k_silk = ehu.k_silk;
double s = ehu.s;
double k_eq = ehu.k_eq;
double alpha_c = ehu.alpha_c;
double beta_c = ehu.beta_c;
double alpha_b = ehu.alpha_b;
double beta_b = ehu.beta_b;
double xx = k * s;
double s_tilde = s * pow(1 + pow(ehu.beta_node / (xx), 3), -1./3);
double f = 1 / (1 + pow(xx / 5.4, 4));
double q = k / (13.41 * k_eq);
double T_c = f * T_tilde_0(q, 1, beta_c) + (1 - f) * T_tilde_0(q, alpha_c, beta_c);
double T_b = (
T_tilde_0(q, 1, 1) / (1 + pow(xx / 5.2, 2)) +
alpha_b / (1 + pow(beta_b / xx, 3)) * exp(-pow(k/k_silk, 1.4))
) * j_0(k * s_tilde);
double T_k = OMEGA_B/OMEGA_0 * T_b + OMEGA_C/OMEGA_0 * T_c;
return T_k;
}
double CosmoPower::powerHuBaryons(double k) double CosmoPower::powerHuBaryons(double k)
{ {
double s = 44.5 * log(9.83 / OmegaEff) / (sqrt(1 + 10 * pow(OMEGA_B * h * h, 0.75))); double s = 44.5 * log(9.83 / OmegaEff) / (sqrt(1 + 10 * pow(OMEGA_B * h * h, 0.75)));
@ -383,6 +420,12 @@ void CosmoPower::setFunction(CosmoFunction f)
updateHuWigglesConsts(); updateHuWigglesConsts();
eval = &CosmoPower::powerHuWiggles; eval = &CosmoPower::powerHuWiggles;
break; break;
case PRIMORDIAL_PS:
eval = &CosmoPower::primordialPowerSpectrum;
break;
case MATTER_TK:
eval = &CosmoPower::matterTransferFunctionHu;
break;
case HU_WIGGLES_ORIGINAL: case HU_WIGGLES_ORIGINAL:
updateHuWigglesOriginal(); updateHuWigglesOriginal();
eval = &CosmoPower::powerHuWigglesOriginal; eval = &CosmoPower::powerHuWigglesOriginal;
@ -414,4 +457,3 @@ void CosmoPower::setNormalization(double A_K)
{ {
normPower = A_K;///power(0.002); normPower = A_K;///power(0.002);
} }

View File

@ -81,6 +81,8 @@ namespace CosmoTool {
enum CosmoFunction { enum CosmoFunction {
POWER_EFSTATHIOU, POWER_EFSTATHIOU,
HU_WIGGLES, HU_WIGGLES,
PRIMORDIAL_PS,
MATTER_TK,
HU_BARYON, HU_BARYON,
OLD_POWERSPECTRUM, OLD_POWERSPECTRUM,
POWER_BARDEEN, POWER_BARDEEN,
@ -111,6 +113,8 @@ namespace CosmoTool {
double powerEfstathiou(double k); double powerEfstathiou(double k);
double powerHuWiggles(double k); double powerHuWiggles(double k);
double primordialPowerSpectrum(double k);
double matterTransferFunctionHu(double k);
double powerHuBaryons(double k); double powerHuBaryons(double k);
double powerOld(double k); double powerOld(double k);
double powerBardeen(double k); double powerBardeen(double k);