lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
218 stars 291 forks source link

Weird results for matter power spectrum #203

Open hfei10 opened 6 years ago

hfei10 commented 6 years ago

Hi there,

I've been using CLASS to calculate linear matter power spectrum for NCDM species. However, for some of my NCDM distribution functions, I got really weird results (see below). This is the CDM vs NCDM matter power spectrum, which seems to be OK. 1 However, when I compute P_NCDM/P_CDM, I got values above 1. 2 Me and my colleagues don't believe this is physical(if it is, please explain.). So what could possibly lead to such a problem? Is there a solution to get reasonable results? My NCDM set up is the following: T_ncdm = 100 m_ncdm = 1e4 omega_ncdm = 0.1191762 (which is 0.12038*0.99) The data file I use is NCDM.dat.zip

Your help will be greatly appreciated!

Fei

EElliott1 commented 6 years ago

Hi,

I don't have a solution but I am also perplexed by this, I see the same behaviour when running WDM ncdm only models (and indeed any ncdm only model)

I notice this also looks similar to the 'fuzzy' DM spectra as seen in https://arxiv.org/pdf/1704.07838.pdf

If you manage to solve this please let me know!

Ed

hfei10 commented 6 years ago

Hi, Elliott,

Thanks for sharing the literature. My P(k) plot does look like the fuzzy dark matter spectra, however, they didn't have a problem on the transfer function T(k). But I do notice that on the right panel of Fig. 3 of that paper, they do have the orange line going above 1.

I don't know how to interpret this physically. How can you grow more structure than CDM case? Maybe this is just numerical artifact, and it is so small such that it should be completely neglected?

Since you are having similar problems, have you tried to get rid of the ncdm fluid approximation?

Fei

EElliott1 commented 6 years ago

In terms of getting a reasonable solution for the transfer function, note from the CLASS explanatory file:

8a) Dark energy contributions. At least one out of three conditions must be satisfied: i) 'Omega_Lambda' unspecified. ii) 'Omega_fld' unspecified. iii) 'Omega_scf' set to a negative value. [Will be refered to as unspecified in the following text.] The code will then use the first unspecified component to satisfy the closure equation (sum_i Omega_i) equals (1 + Omega_k) (default: 'Omega_fld' and 'Omega_scf' set to 0 and 'Omega_Lambda' inferred by code

The density parameters must sum to 1, so class will calculate Omega_Lambda and Omega_fld accordingly to fill any gaps, this could cause an increase in large scale power

Ed

hfei10 commented 6 years ago

Hi, Thanks for pointing out this. In my .ini file, I have Omega_Lambda unspecified, and Omega_fld=0, Omega_scf=0, and the output shows -> matched budget equations by adjusting Omega_Lambda = 6.878622e-01 which I think is reasonable. What do you think? Fei

hfei10 commented 6 years ago

Hi Elliot As I have just checked, for both nCDM and CDM case, I have the same adjusted Omega_Lambda in the output. So, I don't think the problem is from adjusting the Omega's. Actually, after setting 'ncdm_fluid_approximation = 3', which means it's not using fluid approximation, things got much better. However, in several of my cases, I got another kind of weird transfer function 2 Now it's the small scales that have the problem. Any thoughts?

Fei

ThomasTram commented 6 years ago

Hi

I cannot reproduce your plot showing the large scale problem. Using the settings

omega_dm=0.1191762
cosmo = {}
for key in ['CDM','WDM']:
    cosmo[key] = Class()
    cosmo[key].set({'output':'dTk mPk','gauge':'Newtonian'})
    if key=='CDM':
        cosmo[key].set({'omega_cdm':omega_dm+0.0})
    elif key=='WDM':
        cosmo[key].set({'omega_cdm':0.0, 'omega_ncdm':omega_dm,'N_ncdm':1,
'm_ncdm':1e4,'T_ncdm':100})
    cosmo[key].compute()

I find image image

This is using the analytic FD distribution. You are not mentioning if you are using a numerically computed distribution function, but guessing that the attached NCDM.zip file from your first post is exactly that, I tried passing it to CLASS which complains on the grounds that it is not sufficiently smooth. So you must have done something to make it work..?

The oscillations in small scales are not physical but are a consequence of using a fluid approximation. As mentioned in one of the above posts it must be turned off for WDM. However, this is not enough. Getting accurate transfer functions on small scales in Boltzmann codes, even for a subdominant species such as massive neutrinos, is an open problem. See e.g. the discussion in Appendix B of http://arxiv.org/pdf/1712.03944.pdf where you may find some settings that can give you sufficient convergence on small scales for your problem.

Cheers, Thomas

hfei10 commented 6 years ago

Hi Thomas,

Thanks for the feedback. The problem I have is all related to the NCDM data file I use. As you said, CLASS complains on the smoothness, however, the distribution function I'm studying is highly non-trivial, and can contain multiple peaks. To make things work, I changed the default settings in "common.h" as follows:

define _QUADRATUREMAX 540

define _QUADRATURE_MAXBG 830

Not sure if this is making things bad, the code can work, but it seems to make it very slow.

The reference you sent looks quite useful. I'll try the settings there and see if things work.

Thank you! Fei

ThomasTram commented 6 years ago

Hi Fei

Your tabulated distribution function only goes to q=8 and this can create problems for the automatic sampling. Here are a few options:

Another option is to use the new non-automatic sampling with qmax set to the qmax of your tabulated function and the number of momentum bins set sufficiently high to resolve your features on a uniform grid.

Cheers, Thomas

allitsa commented 5 years ago

Hi all,

I have a similar problem with my transfer functions for NCDM compared to CDM. As a first step I am also trying to turn off the ncdm fluid approximation to see if that helps, but I cannot find the parameters for that. I was searching for the 'ncdm_fluid_approximation =' parameter you were discussing about in my explanatory.ini parameter file but it is nowhere to be found... Am I doing something really stupid?

Thank you for your help, Aliki

hfei10 commented 5 years ago

Hey allista,

I think you can just write "ncdm_fluid_approximation =3" in your .ini file to see if things work.

allitsa commented 5 years ago

Hi Fei,

I tried that and my result actually is the following (even with the provided PSD_FD_single.dat). Doesn't that look peculiar? Shouldn't the two transfer function be the same in the beginning? When I try to use the pk_ref.pre precision file I get errors related to quadrature (again even for the PSD_FD_singe.dat file). However, I cannot fix them even when I increase the QUADRATURE values in common.h.

Aliki

tranfer_func.pdf