Skip to content

Commit

Permalink
Implementation of HMcode 2020 and moving of HMcode/Halofit to externa…
Browse files Browse the repository at this point in the history
…l directories (as well as a minor bugfix in tools/arrays.c) (#208)

This commit combines a number of previous commits performed by @lesgourg and @schoeneberg, but in a way that keeps the git history clean and pristine. In particular, the commits included here include (but aren't limited to):

 - schoeneberg (11 April 2022): 7440e659d42c14302491dba56ef58b09461c36f3
   Moved Halofit and HMcode to external module

 - schoeneberg (11 April 2022): 8ea79ac2b072af6e95828c078e784d69020c0b86
   Initial HMcode 2020 implementation

 - schoeneberg (a few commits): 9e981c8c7efeb22186ec48c2fac1c259efd83216, f5a8bb6af8804fa08784e35ab1fad7c02965120d, 1184318eb0ab4f1939e86300f13c317f4a74d2a3, 381750969cf47659341598e793f9954802b89184
   MOSTLY BUGFIXES::
   Correcting some compilation issues,
   Fixed HMcode dark energy correction being incorrect,
   Re-implementation of #113 fixing #102,
   Missing change to last commit about negative dimensions

 - schoeneberg (26 April 2023): 7cf4d3e1cfa6a21fc1f63b599717b16ab76e6080
   Removed hmcode functionality from the python wrapper

 - schoeneberg (27 April 2023): 337b87092fa704861ce83711a2febd9c61e76267, 8e9b960c3c9e3ceade9bf16ba306cebc4b34ef45
   Merge branch 'devel' into class_nonlinear, Missing additions after merge

 - Sefa76, santiagocasas (12 Jul 2023): b48acf542192318008ad3228517e8be654d54d86, 2078711c61a7e235b9941a10597c14e19766f391
   Added funktion to get f_cb from Classy, underscore

 - lsgourg (18 Jan 2024): 247088a
   fixed bug in setup.py

 - lesgourg (14 Feb 2024): 539ea2d1c2d6faed8490aede797a8bff4423da18
   updated explanatory.ini with new HMcode 2020 parameters; made input more consistent for these parameters

 - lesgourg (20 Feb 2024): 59b663250189541c660c4b93e886af960e369b14
   Merge devel up to v3.2.2 into class_nonlinear

 - lesgourg (22 May 2024): c48f4e638a3b191d58078c60027cccb68c7a86b4
   added comments. Moved declaration of fourier_hmcode.c to hmcode.h

 - lesgourg (3-4 Dec 2024): d301d63fc8640eed55f619b467c1176327e3e7f0, 92570f9f5a1e1b113689f9769e6fd1c42c3a17ab, 15c8557a1e852ee4bcc4f54ed13b0470510c44e7, 6ec9833a91ee5da6d97ed05d803e8f84d5c100ba, 7b627101db46c703a0bca23be5587c4b1a235a9c, dd74b486e4baa48aa0547cc0e6bc02ee65130f72, a8e89b57154880dafba939b8f8d44ea4f8de769b, 18f46f30eb2e799ce227ecbab123c229365e5c74, eb8d891230c3273aa703cfa957ff9ea20e4d77cc, c511c5060b389350c8b332ba094e1ae4cb1ba08f
   MOSTLY MERGES::
   Merge tag 'v3.2.3' into class_nonlinear,
   class_nonlinear working with v3.2.3 (parallelised, tested),
   Merge tag 'v3.2.4' into class_nonlinear,
   class_nonlinear working with v3.2.4 (tested; hmcode functions removed from classy just like in previous class_nonlinear, because these functions are defined in external and not in fourier),
   Merge tag 'v3.2.5' into class_nonlinear,
   fourier_workspace moved and renamed hmcode_workspace,
   all hmcode structures and functions renamed hmcode_,
   polished presentation of all hmcode functions,
   renamed halofit function halofit_ instead of fourier_halofit_,
   final polish on hmcode

 - lesgourg (4-17 Dec 2024): 2028ae5ca8b982fac2d975c0da4e325ae7d5e195, 4d90890f7b19264b9f8391f4efbffe1fdd2b8ee2, 479aaca8597d0c13f744810ef737fb57c8a44312, 4e1b6a324ec29487ce19adb1a5e7dee1b38c56bd, 4dd1c3c611fd6573302519d9373a05c6a15a23a8
   MOSTLY DEWIGGLE/ANALYTIC DEWIGGLE::
   prepared things to have pk_l_nw computed inside fourier module
   dewiggled spectrum now computed and stored in fourier module, using the method of HMcode but the structures of Oneloop. TODO: check that it agrees with other HMcode implementation and if yes, switch from one to the other (the old one is still the one used by HMcode)
   analytic pk now computed and stored in fourier structure in fourier_init. TODO: use this single calculation inside Hmcode
   P_analytic computed, stored and splined in fourier_init(). Wiggle and nowiggle spectra computed twice, at different times: in fourier for storage, and in HMcode for internal use; both calculations use with the same functions and avoid redundancy.
   small renamings, comemnts and one bugfix in fourier.c

 - lesgourg (17 Dec 2024): 4bc577b87a0815ccc64eaca8a2b0c9c505cee52f
   Merge branch 'devel' into class_nonlinear

 - lesgourg (18 Dec 2024): a8df4a6c79a443e184b36e2e665906b9064aee67, 5a4d11d8a51044fcbfa02bcd1df3d6d4e081622f
   corrected one sign in array_integrate_spline_table_line_to_line(), only tiny impact for thermodynamics
   corrected the mistake in the formula for spline integration everywhere in arrays.c

 - lesgourg (7,14 Jan 2025): 6ea2e911f970df686fe950cc48e2841fe2a5b872, 5ee599786cf0b72176a19cbeed81731e90011a20
   MOSTLY DEWIGGLE::
   Einsenstein_Hu now normalised, with no impact on smoothing; pk_analytic_nowiggle can be requested with flag mPk_an_nw, written in out put fiels, accessible in classy through pk_analytic_nw(k)
   analytic and numerical nowiggle spectra can now be outputed independently of using Hmcode with the input flags analytic_nowiggle=yes, numerical_nowiggle=yes

 - lesgourg (14 Jan 2025): ac8a02c1ccd96eee497dee13e060e6edc1bdd731
   version number updated to 3.3.0

 - lesgourg (14-15 Jan 2025): d18033422759152e9f82785d9e2ec10ca26c3f6c, b9351585fea3b93f20ffc9cfe3a32eba1904e808, fe7eed6f76225238c92f76b305865d263c3ed712, 73703f9b7791729e0d54fbc4723efb7c9fe4a03f
   MOSTLY BUGFIXES::
   small correction in input.c,
   corrected small comments,
   corrected small bug in fourier.c leading to rare segfaults,
   suppressed tiny memory leak

 - schoeneberg (30 Jan 2025): 65f57f490d967f20fbdfea92fc76b12eabd81422, a2b246f43529f8d1ecb00b068d97d7ee6984f6c3, 62190a978ecb74d5c139d685a70373e54d13ee5f, 55b8fb71644497fffaebf69bde76a2c7cd293b59, 159051e24d3b2c6085eb13cdba2297c5b8b9938a, 3947a904b13b938d4c57e19db4588144fa72f33a
   MOSTLY CLEANING::
   Simplified parameter reading for HMcode by using the class_read_flag macros,
   Spring cleanup: removing unnecessary flat setting in input, simplifying a few lines in output,
   Just whitespace and typo corrections,
   The spline gets atutomatically turned into _SPLINE_NATURAL_ (which works for 2 points) if only 2 points are included. So no need to worry about this line,
   Further spring cleaning,
   Further spring cleaning

Co-authored-by: schoeneberg <[email protected]>
  • Loading branch information
lesgourg and schoeneberg authored Feb 5, 2025
1 parent 049df32 commit a2111e2
Show file tree
Hide file tree
Showing 18 changed files with 4,902 additions and 2,686 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ LDFLAG = -g -fPIC
HYREC = external/HyRec2020
RECFAST = external/RecfastCLASS
HEATING = external/heating
HALOFIT = external/Halofit
HMCODE = external/HMcode

########################################################
###### IN PRINCIPLE THE REST SHOULD BE LEFT UNCHANGED ##
Expand Down Expand Up @@ -91,6 +93,16 @@ EXTERNAL += hyrectools.o helium.o hydrogen.o history.o wrap_hyrec.o energy_injec
HEADERFILES += $(wildcard ./$(HYREC)/*.h)
endif

vpath %.c $(HALOFIT)
INCLUDES += -I../$(HALOFIT)
EXTERNAL += halofit.o
HEADERFILES += $(wildcard ./$(HALOFIT)/*.h)

vpath %.c $(HMCODE)
INCLUDES += -I../$(HMCODE)
EXTERNAL += hmcode.opp
HEADERFILES += $(wildcard ./$(HMCODE)/*.h)

%.o: %.c .base $(HEADERFILES)
cd $(WRKDIR);$(CC) $(OPTFLAG) $(OMPFLAG) $(CCFLAG) $(INCLUDES) -c ../$< -o $*.o

Expand Down
59 changes: 53 additions & 6 deletions explanatory.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
# - 'lCl' for CMB lensing potential Cls,
# - 'nCl' (or 'dCl') for density number count Cls,
# - 'sCl' for galaxy lensing potential Cls,
# - 'mPk' for total matter power spectrum P(k) infered from gravitational
# potential,
# - 'mPk' for the matter power spectrum P(k) (then, depending on other options,
# the code will return the linear and/or non-linear spectra,
# for total matter and/or for clustering matter, and also possibly dewiggled),
# - 'dTk' (or 'mTk') for density transfer functions for each species,
# - 'vTk' for velocity transfer function for each species
# - 'sd' for spectral distortions
Expand Down Expand Up @@ -770,14 +771,30 @@ chi_type = CK_2004
# otherwise leave blank (default: blank, linear P(k) and Cls)
non_linear =

# 1.a) if you chose Halofit, and you have Omega0_fld != 0. (i.e. you
# 1.a) if you chose Halofit:

# 1.a.1) if you have Omega0_fld != 0. (i.e. you
# set Omega_lambda=0.) & wa_fld != 0., then you might want to use the
# pk equal method of 0810.0190 and 1601.07230 by setting this flag to
# 'yes' (default: set to 'no')
pk_eq =

# 1.b) if you chose HMcode:
# In HMcode you can specify a baryonic feedback model (otherwise only DM is used).
# 1.a.2) minimum value of k_max in 1/Mpc used internally inside
# Halofit to compute a few integrals. Should never be too small,
# otherwise these integrals would not converge. (default: 5 1/Mpc)
halofit_min_k_max =

# 1.b) if you chose HMcode:

# 1.b.1) choose the version among:
# - '2015' or '2016' (just '15' or '16' also works) for HMcode 2016 by Mead et al. (arXiv 1602.02154)
# - '2020' (just '20' also works) for HMcode 2020 by Mead et al. (arXiv 2009.01858)
# - '2020_baryonic_feedback' for HMcode 2020 by Mead et al. (arXiv 2009.01858) with baryonic feedback
# (defualt: 2020)
hmcode_version =

# 1.b.2) if you choose '2015' or '2016': baryonic feedback parameters 'eta_0' and 'c_min'
# In HMcode 2016 you can specify a baryonic feedback model (otherwise only DM is used).
# Each model depends on two parameters: the minimum concentration "c_min" from the
# Bullock et al. 2001 mass-concentration relation and the halo bloating parameter "eta_0"
# introduced in Mead et al. 2015. In Mead et al. 2015 the parameters c_min and eta_0 are fitted
Expand All @@ -795,11 +812,41 @@ pk_eq =
# or leave blank and pass manually the value of either 'eta_0' or 'c_min'
# (the other one will then be fixed according to equation (30) in Mead et al. 2015),
# or pass manually the two values of 'eta_0' and 'c_min'
# (default: 'feedback model' set to 'nl_emu_dmonly')
# (default: 'feedback model' set to 'emu_dmonly')
feedback model =
eta_0 =
c_min =

# 1.b.3) if you choose '2020_baryonic_feedback', single feedback model
# parameter 'log10T_heat_hmcode' (default: 7.8)
log10T_heat_hmcode =

# 1.b.4) minimum value of k_max in 1/Mpc used internally inside
# HMcode to compute a few integrals. Should never be too small,
# otherwise these integrals would not converge. (default: 5 1/Mpc)
hmcode_min_k_max =

# 1.b.5) if you chose HMcode, set the redshift value at which the Dark
# Energy correction is evaluated - this needs to be at early times,
# when dark Energy is totally subdominant (default: 10)
z_infinity =

# 1.b.6) if you chose HMcode, number of k points for the de-wiggling (default: 512)
nk_wiggle =

# 2) Control on the output of the nowiggle spectrum (assuming you required 'mPk')

# 2.a) do you want to enforce the calculation and output of an analytic
# approximation to the nowiggle linear power spectrum, even when this is not
# required by the chosen non-linear method? (default: no)
analytic_nowiggle =

# 2.b) do you want to enforce the calculation and output of the
# nowiggle linear power spectrum, obtained by fuiltering/smoothing the
# full spectrum, even when this is not required by the chosen
# non-linear method? (default: no)
numerical_nowiggle =

# ----------------------------
# ----> Primordial parameters:
# ----------------------------
Expand Down
Loading

0 comments on commit a2111e2

Please sign in to comment.