classy 3.4.2.0__tar.gz → 3.4.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. {classy-3.4.2.0 → classy-3.4.3.0}/Makefile +1 -1
  2. {classy-3.4.2.0/classy.egg-info → classy-3.4.3.0}/PKG-INFO +1 -1
  3. {classy-3.4.2.0 → classy-3.4.3.0/classy.egg-info}/PKG-INFO +1 -1
  4. {classy-3.4.2.0 → classy-3.4.3.0}/classy.egg-info/SOURCES.txt +4 -0
  5. {classy-3.4.2.0 → classy-3.4.3.0}/include/background.h +9 -0
  6. {classy-3.4.2.0 → classy-3.4.3.0}/include/common.h +4 -3
  7. classy-3.4.3.0/include/evolver_rkdp45.h +54 -0
  8. {classy-3.4.2.0 → classy-3.4.3.0}/include/input.h +7 -0
  9. {classy-3.4.2.0 → classy-3.4.3.0}/include/precisions.h +51 -21
  10. {classy-3.4.2.0 → classy-3.4.3.0}/include/thermodynamics.h +0 -2
  11. {classy-3.4.2.0 → classy-3.4.3.0}/include/transfer.h +2 -1
  12. {classy-3.4.2.0 → classy-3.4.3.0}/python/test_class.py +11 -0
  13. {classy-3.4.2.0 → classy-3.4.3.0}/source/background.c +25 -14
  14. {classy-3.4.2.0 → classy-3.4.3.0}/source/input.c +83 -0
  15. {classy-3.4.2.0 → classy-3.4.3.0}/source/perturbations.c +87 -20
  16. {classy-3.4.2.0 → classy-3.4.3.0}/source/thermodynamics.c +8 -6
  17. {classy-3.4.2.0 → classy-3.4.3.0}/source/transfer.c +26 -2
  18. classy-3.4.3.0/tools/evolver_rkdp45.c +442 -0
  19. {classy-3.4.2.0 → classy-3.4.3.0}/CLASS_rename.py +0 -0
  20. {classy-3.4.2.0 → classy-3.4.3.0}/CPU.py +0 -0
  21. {classy-3.4.2.0 → classy-3.4.3.0}/README.md +0 -0
  22. {classy-3.4.2.0 → classy-3.4.3.0}/__init__.py +0 -0
  23. {classy-3.4.2.0 → classy-3.4.3.0}/classy.egg-info/dependency_links.txt +0 -0
  24. {classy-3.4.2.0 → classy-3.4.3.0}/classy.egg-info/not-zip-safe +0 -0
  25. {classy-3.4.2.0 → classy-3.4.3.0}/classy.egg-info/top_level.txt +0 -0
  26. {classy-3.4.2.0 → classy-3.4.3.0}/external/.DS_Store +0 -0
  27. {classy-3.4.2.0 → classy-3.4.3.0}/external/HMcode/hmcode.c +0 -0
  28. {classy-3.4.2.0 → classy-3.4.3.0}/external/HMcode/hmcode.h +0 -0
  29. {classy-3.4.2.0 → classy-3.4.3.0}/external/Halofit/halofit.c +0 -0
  30. {classy-3.4.2.0 → classy-3.4.3.0}/external/Halofit/halofit.h +0 -0
  31. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/Alpha_inf.dat +0 -0
  32. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/README.md +0 -0
  33. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/R_inf.dat +0 -0
  34. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/energy_injection.c +0 -0
  35. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/energy_injection.h +0 -0
  36. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/fit_swift.dat +0 -0
  37. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/helium.c +0 -0
  38. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/helium.h +0 -0
  39. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/history.c +0 -0
  40. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/history.h +0 -0
  41. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/hydrogen.c +0 -0
  42. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/hydrogen.h +0 -0
  43. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/hyrec.c +0 -0
  44. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/hyrectools.c +0 -0
  45. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/hyrectools.h +0 -0
  46. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/input.dat +0 -0
  47. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/output_xe.dat +0 -0
  48. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/readme.pdf +0 -0
  49. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/two_photon_tables.dat +0 -0
  50. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/two_photon_tables_hires.dat +0 -0
  51. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/wrap_hyrec.c +0 -0
  52. {classy-3.4.2.0 → classy-3.4.3.0}/external/HyRec2020/wrap_hyrec.h +0 -0
  53. {classy-3.4.2.0 → classy-3.4.3.0}/external/RecfastCLASS/wrap_recfast.c +0 -0
  54. {classy-3.4.2.0 → classy-3.4.3.0}/external/RecfastCLASS/wrap_recfast.h +0 -0
  55. {classy-3.4.2.0 → classy-3.4.3.0}/external/bbn/sBBN.dat +0 -0
  56. {classy-3.4.2.0 → classy-3.4.3.0}/external/bbn/sBBN_2017.dat +0 -0
  57. {classy-3.4.2.0 → classy-3.4.3.0}/external/bbn/sBBN_2017_marcucci.dat +0 -0
  58. {classy-3.4.2.0 → classy-3.4.3.0}/external/bbn/sBBN_2025.dat +0 -0
  59. {classy-3.4.2.0 → classy-3.4.3.0}/external/bbn/sBBN_2025_primat.dat +0 -0
  60. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/FIRAS_branching_ratios.dat +0 -0
  61. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/FIRAS_distortions_shapes.dat +0 -0
  62. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/FIRAS_nu_delta_I.dat +0 -0
  63. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/Greens_data.dat +0 -0
  64. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/PIXIE_branching_ratios.dat +0 -0
  65. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/PIXIE_distortions_shapes.dat +0 -0
  66. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/README +0 -0
  67. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/detectors_list.dat +0 -0
  68. {classy-3.4.2.0 → classy-3.4.3.0}/external/distortions/generate_PCA_files.py +0 -0
  69. {classy-3.4.2.0 → classy-3.4.3.0}/external/external_Pk/Pk_example.dat +0 -0
  70. {classy-3.4.2.0 → classy-3.4.3.0}/external/external_Pk/Pk_example_w_tensors.dat +0 -0
  71. {classy-3.4.2.0 → classy-3.4.3.0}/external/external_Pk/README.md +0 -0
  72. {classy-3.4.2.0 → classy-3.4.3.0}/external/external_Pk/generate_Pk_example.py +0 -0
  73. {classy-3.4.2.0 → classy-3.4.3.0}/external/external_Pk/generate_Pk_example_w_tensors.py +0 -0
  74. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/Galli_et_al_2013.dat +0 -0
  75. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/README +0 -0
  76. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/example_chix_file.dat +0 -0
  77. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/example_chiz_file.dat +0 -0
  78. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/example_f_eff_file.dat +0 -0
  79. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/injection.c +0 -0
  80. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/injection.h +0 -0
  81. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/noninjection.c +0 -0
  82. {classy-3.4.2.0 → classy-3.4.3.0}/external/heating/noninjection.h +0 -0
  83. {classy-3.4.2.0 → classy-3.4.3.0}/include/arrays.h +0 -0
  84. {classy-3.4.2.0 → classy-3.4.3.0}/include/class.h +0 -0
  85. {classy-3.4.2.0 → classy-3.4.3.0}/include/dei_rkck.h +0 -0
  86. {classy-3.4.2.0 → classy-3.4.3.0}/include/distortions.h +0 -0
  87. {classy-3.4.2.0 → classy-3.4.3.0}/include/evolver_ndf15.h +0 -0
  88. {classy-3.4.2.0 → classy-3.4.3.0}/include/evolver_rkck.h +0 -0
  89. {classy-3.4.2.0 → classy-3.4.3.0}/include/fourier.h +0 -0
  90. {classy-3.4.2.0 → classy-3.4.3.0}/include/growTable.h +0 -0
  91. {classy-3.4.2.0 → classy-3.4.3.0}/include/harmonic.h +0 -0
  92. {classy-3.4.2.0 → classy-3.4.3.0}/include/hermite3_interpolation_csource.h +0 -0
  93. {classy-3.4.2.0 → classy-3.4.3.0}/include/hermite4_interpolation_csource.h +0 -0
  94. {classy-3.4.2.0 → classy-3.4.3.0}/include/hermite6_interpolation_csource.h +0 -0
  95. {classy-3.4.2.0 → classy-3.4.3.0}/include/hyperspherical.h +0 -0
  96. {classy-3.4.2.0 → classy-3.4.3.0}/include/lensing.h +0 -0
  97. {classy-3.4.2.0 → classy-3.4.3.0}/include/macros_precision.h +0 -0
  98. {classy-3.4.2.0 → classy-3.4.3.0}/include/output.h +0 -0
  99. {classy-3.4.2.0 → classy-3.4.3.0}/include/parallel.h +0 -0
  100. {classy-3.4.2.0 → classy-3.4.3.0}/include/parser.h +0 -0
  101. {classy-3.4.2.0 → classy-3.4.3.0}/include/perturbations.h +0 -0
  102. {classy-3.4.2.0 → classy-3.4.3.0}/include/primordial.h +0 -0
  103. {classy-3.4.2.0 → classy-3.4.3.0}/include/quadrature.h +0 -0
  104. {classy-3.4.2.0 → classy-3.4.3.0}/include/sparse.h +0 -0
  105. {classy-3.4.2.0 → classy-3.4.3.0}/include/svnversion.h +0 -0
  106. {classy-3.4.2.0 → classy-3.4.3.0}/include/trigonometric_integrals.h +0 -0
  107. {classy-3.4.2.0 → classy-3.4.3.0}/main/class.c +0 -0
  108. {classy-3.4.2.0 → classy-3.4.3.0}/pyproject.toml +0 -0
  109. {classy-3.4.2.0 → classy-3.4.3.0}/python/README +0 -0
  110. {classy-3.4.2.0 → classy-3.4.3.0}/python/cclassy.pxd +0 -0
  111. {classy-3.4.2.0 → classy-3.4.3.0}/python/classy.pyx +0 -0
  112. {classy-3.4.2.0 → classy-3.4.3.0}/python/extract_errors.py +0 -0
  113. {classy-3.4.2.0 → classy-3.4.3.0}/python/interface_generator.py +0 -0
  114. {classy-3.4.2.0 → classy-3.4.3.0}/python/setup.py +0 -0
  115. {classy-3.4.2.0 → classy-3.4.3.0}/setup.cfg +0 -0
  116. {classy-3.4.2.0 → classy-3.4.3.0}/setup.py +0 -0
  117. {classy-3.4.2.0 → classy-3.4.3.0}/source/distortions.c +0 -0
  118. {classy-3.4.2.0 → classy-3.4.3.0}/source/fourier.c +0 -0
  119. {classy-3.4.2.0 → classy-3.4.3.0}/source/harmonic.c +0 -0
  120. {classy-3.4.2.0 → classy-3.4.3.0}/source/lensing.c +0 -0
  121. {classy-3.4.2.0 → classy-3.4.3.0}/source/output.c +0 -0
  122. {classy-3.4.2.0 → classy-3.4.3.0}/source/primordial.c +0 -0
  123. {classy-3.4.2.0 → classy-3.4.3.0}/tools/arrays.c +0 -0
  124. {classy-3.4.2.0 → classy-3.4.3.0}/tools/common.c +0 -0
  125. {classy-3.4.2.0 → classy-3.4.3.0}/tools/dei_rkck.c +0 -0
  126. {classy-3.4.2.0 → classy-3.4.3.0}/tools/evolver_ndf15.c +0 -0
  127. {classy-3.4.2.0 → classy-3.4.3.0}/tools/evolver_rkck.c +0 -0
  128. {classy-3.4.2.0 → classy-3.4.3.0}/tools/growTable.c +0 -0
  129. {classy-3.4.2.0 → classy-3.4.3.0}/tools/hermite3_interpolation_csource.h +0 -0
  130. {classy-3.4.2.0 → classy-3.4.3.0}/tools/hermite4_interpolation_csource.h +0 -0
  131. {classy-3.4.2.0 → classy-3.4.3.0}/tools/hermite6_interpolation_csource.h +0 -0
  132. {classy-3.4.2.0 → classy-3.4.3.0}/tools/hyperspherical.c +0 -0
  133. {classy-3.4.2.0 → classy-3.4.3.0}/tools/parser.c +0 -0
  134. {classy-3.4.2.0 → classy-3.4.3.0}/tools/quadrature.c +0 -0
  135. {classy-3.4.2.0 → classy-3.4.3.0}/tools/sparse.c +0 -0
  136. {classy-3.4.2.0 → classy-3.4.3.0}/tools/trigonometric_integrals.c +0 -0
@@ -109,7 +109,7 @@ HEADERFILES += $(wildcard ./$(HMCODE)/*.h)
109
109
  %.opp: %.c .base $(HEADERFILES)
110
110
  cd $(WRKDIR);$(CPP) $(OPTFLAG) $(OMPFLAG) $(CCFLAG) $(INCLUDES) -c ../$< -o $*.opp
111
111
 
112
- TOOLS = growTable.o dei_rkck.o sparse.o evolver_rkck.o evolver_ndf15.o arrays.opp parser.o quadrature.o hyperspherical.opp common.o trigonometric_integrals.o
112
+ TOOLS = growTable.o dei_rkck.o sparse.o evolver_rkck.o evolver_ndf15.o evolver_rkdp45.o arrays.opp parser.o quadrature.o hyperspherical.opp common.o trigonometric_integrals.o
113
113
 
114
114
  SOURCE = input.o background.o thermodynamics.o perturbations.opp primordial.opp fourier.o transfer.opp harmonic.opp lensing.opp distortions.o
115
115
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: classy
3
- Version: 3.4.2.0
3
+ Version: 3.4.3.0
4
4
  Summary: Python interface to the Cosmological Boltzmann code CLASS
5
5
  Home-page: http://www.class-code.net
6
6
  Author: Julien Lesgourgues, Thomas Tram, Nils Schöneberg, ... and many more (see webpage)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: classy
3
- Version: 3.4.2.0
3
+ Version: 3.4.3.0
4
4
  Summary: Python interface to the Cosmological Boltzmann code CLASS
5
5
  Home-page: http://www.class-code.net
6
6
  Author: Julien Lesgourgues, Thomas Tram, Nils Schöneberg, ... and many more (see webpage)
@@ -75,6 +75,7 @@ setup.py
75
75
  ./include/distortions.h
76
76
  ./include/evolver_ndf15.h
77
77
  ./include/evolver_rkck.h
78
+ ./include/evolver_rkdp45.h
78
79
  ./include/fourier.h
79
80
  ./include/growTable.h
80
81
  ./include/harmonic.h
@@ -121,6 +122,7 @@ setup.py
121
122
  ./tools/dei_rkck.c
122
123
  ./tools/evolver_ndf15.c
123
124
  ./tools/evolver_rkck.c
125
+ ./tools/evolver_rkdp45.c
124
126
  ./tools/growTable.c
125
127
  ./tools/hermite3_interpolation_csource.h
126
128
  ./tools/hermite4_interpolation_csource.h
@@ -200,6 +202,7 @@ include/dei_rkck.h
200
202
  include/distortions.h
201
203
  include/evolver_ndf15.h
202
204
  include/evolver_rkck.h
205
+ include/evolver_rkdp45.h
203
206
  include/fourier.h
204
207
  include/growTable.h
205
208
  include/harmonic.h
@@ -246,6 +249,7 @@ tools/common.c
246
249
  tools/dei_rkck.c
247
250
  tools/evolver_ndf15.c
248
251
  tools/evolver_rkck.c
252
+ tools/evolver_rkdp45.c
249
253
  tools/growTable.c
250
254
  tools/hermite3_interpolation_csource.h
251
255
  tools/hermite4_interpolation_csource.h
@@ -9,6 +9,9 @@
9
9
  #include "arrays.h"
10
10
  #include "dei_rkck.h"
11
11
  #include "parser.h"
12
+ #include "evolver_ndf15.h"
13
+ #include "evolver_rkck.h"
14
+ #include "evolver_rkdp45.h"
12
15
 
13
16
  /** list of possible parametrisations of the DE equation of state */
14
17
 
@@ -274,6 +277,12 @@ struct background
274
277
  *
275
278
  * having one of these flag set to zero allows to skip the
276
279
  * corresponding contributions, instead of adding null contributions.
280
+ *
281
+ * WARNING: if you add a species whose perturbation equations can
282
+ * be stiff, add its flag to the list in
283
+ * input_select_perturbations_evolver() (input.c). Otherwise the
284
+ * perturbations will be integrated with the explicit evolver
285
+ * rkdp45 by default.
277
286
  */
278
287
 
279
288
 
@@ -15,7 +15,7 @@
15
15
  #ifndef __COMMON__
16
16
  #define __COMMON__
17
17
 
18
- #define _VERSION_ "v3.4.2"
18
+ #define _VERSION_ "v3.4.3"
19
19
 
20
20
  /* @cond INCLUDE_WITH_DOXYGEN */
21
21
 
@@ -379,8 +379,9 @@ struct output;
379
379
  * list of evolver types for integrating perturbations over time
380
380
  */
381
381
  enum evolver_type {
382
- rk, /* Runge-Kutta integrator */
383
- ndf15 /* stiff integrator */
382
+ rk, /* Runge-Kutta Cash-Karp 5(4) explicit integrator with adaptive steps */
383
+ ndf15, /* stiff integrator */
384
+ rkdp45 /* Dormand-Prince 5(4) explicit Runge-Kutta integrator */
384
385
  };
385
386
 
386
387
  /**
@@ -0,0 +1,54 @@
1
+ #ifndef __EVO_RKDP45__
2
+ #define __EVO_RKDP45__
3
+
4
+ #include "common.h"
5
+
6
+ /**************************************************************/
7
+
8
+ /**
9
+ * Boilerplate for C++
10
+ */
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ int evolver_rkdp45(int (*derivs)(double x,
16
+ double * y,
17
+ double * dy,
18
+ void * parameters_and_workspace,
19
+ ErrorMsg error_message),
20
+ double x_ini,
21
+ double x_end,
22
+ double * y,
23
+ int * used_in_output,
24
+ int y_size,
25
+ void * parameters_and_workspace_for_derivs,
26
+ double tolerance,
27
+ double minimum_variation,
28
+ int (*evaluate_timescale)(double x,
29
+ void * parameters_and_workspace,
30
+ double * timescale,
31
+ ErrorMsg error_message),
32
+ double timestep_over_timescale,
33
+ double * x_sampling,
34
+ int x_size,
35
+ int (*output)(double x,
36
+ double y[],
37
+ double dy[],
38
+ int index_x,
39
+ void * parameters_and_workspace,
40
+ ErrorMsg error_message),
41
+ int (*print_variables)(double x,
42
+ double y[],
43
+ double dy[],
44
+ void * parameters_and_workspace,
45
+ ErrorMsg error_message),
46
+ ErrorMsg error_message);
47
+
48
+ #ifdef __cplusplus
49
+ }
50
+ #endif
51
+
52
+ /**************************************************************/
53
+
54
+ #endif
@@ -437,6 +437,13 @@ extern "C" {
437
437
  struct thermodynamics * pth,
438
438
  ErrorMsg errmsg);
439
439
 
440
+ int input_select_perturbations_evolver(struct file_content * pfc,
441
+ struct precision * ppr,
442
+ struct background * pba,
443
+ struct thermodynamics * pth,
444
+ struct perturbations * ppt,
445
+ ErrorMsg errmsg);
446
+
440
447
  int input_read_parameters_output(struct file_content * pfc,
441
448
  struct background * pba,
442
449
  struct thermodynamics * pth,
@@ -14,14 +14,14 @@ class_precision_parameter(a_ini_over_a_today_default,double,1.e-14)
14
14
  */
15
15
  class_precision_parameter(background_Nloga,int,40000)
16
16
  /**
17
- * Evolver to be used for thermodynamics (rk, ndf15)
17
+ * Evolver to be used for the background (rk, ndf15, rkdp45)
18
18
  */
19
19
  class_type_parameter(background_evolver,int,enum evolver_type,ndf15)
20
20
  /**
21
21
  * Tolerance of the background integration, giving the allowed relative integration error.
22
22
  * (used by both evolvers)
23
23
  */
24
- class_precision_parameter(tol_background_integration,double,1.e-10)
24
+ class_precision_parameter(tol_background_integration,double,1.e-7)
25
25
  /**
26
26
  * Only relevant for rk evolver: the default integration step is given
27
27
  * by this number multiplied by the timescale defined in
@@ -137,14 +137,14 @@ class_precision_parameter(thermo_Nz_lin,int,20000)
137
137
  */
138
138
  class_precision_parameter(thermo_Nz_log,int,5000)
139
139
  /**
140
- * Evolver to be used for thermodynamics (rk, ndf15)
140
+ * Evolver to be used for thermodynamics (rk, ndf15, rkdp45)
141
141
  */
142
142
  class_type_parameter(thermo_evolver,int,enum evolver_type,ndf15)
143
143
  /**
144
144
  * Tolerance of the relative value of integral during thermodynamical integration
145
145
  * (used by both evolvers)
146
146
  */
147
- class_precision_parameter(tol_thermo_integration,double,1.0e-6)
147
+ class_precision_parameter(tol_thermo_integration,double,1.0e-7)
148
148
  /**
149
149
  * Only relevant for rk evolver: the default integration step is given
150
150
  * by this number multiplied by the timescale defined in
@@ -154,7 +154,7 @@ class_precision_parameter(thermo_integration_stepsize,double,0.1)
154
154
  /**
155
155
  * Smoothing in redshift of the variation rate of \f$ \exp(-\kappa) \f$, g, and \f$ \frac{dg}{d\tau} \f$ that is used as a timescale afterwards
156
156
  */
157
- class_precision_parameter(thermo_rate_smoothing_radius,int,50)
157
+ class_precision_parameter(thermo_rate_smoothing_radius,int,10)
158
158
  /**
159
159
  * Redshift at which CLASS starts to test for too early re-ionization and/or incomplete recombination.
160
160
  */
@@ -230,7 +230,7 @@ class_string_parameter(hyrec_path,"/external/HyRec2020/","hyrec_path") /**< Path
230
230
  */
231
231
 
232
232
  class_precision_parameter(reionization_z_start_max,double,50.0) /**< Maximum starting value in z for reionization */
233
- class_precision_parameter(reionization_sampling,double,1.5e-2) /**< Minimum sampling density in z during reionization */
233
+ class_precision_parameter(reionization_sampling,double,1.e-2) /**< Minimum sampling density in z during reionization */
234
234
  class_precision_parameter(reionization_optical_depth_tol,double,1.0e-4) /**< Relative tolerance on finding the user-given optical depth of reionization given a certain redshift of reionization */
235
235
  class_precision_parameter(reionization_start_factor,double,8.0) /**< Searching optical depth corresponding to the redshift is started from an initial offset beyond z_reionization_start, multiplied by reionization_width */
236
236
 
@@ -248,9 +248,10 @@ class_precision_parameter(z_start_chi_approx,double,2.0e3) /**< Switching redshi
248
248
  class_precision_parameter(k_min_tau0,double,0.1) /**< number defining k_min for the computation of Cl's and P(k)'s (dimensionless): (k_min tau_0), usually chosen much smaller than one */
249
249
 
250
250
  class_precision_parameter(k_max_tau0_over_l_max,double,1.8) /**< number defining k_max for the computation of Cl's (dimensionless): (k_max tau_0)/l_max, usually chosen around two. In v3.2.2: lowered from 2.4 to 1.8, because the high value 2.4 was needed to keep CMB lensing accurate enough. With the new Limber scheme, this will be the case anyway, and k_max can be lowered in other observables in order to speed up the code. */
251
- class_precision_parameter(k_step_sub,double,0.05) /**< step in k space, in units of one period of acoustic oscillation at decoupling, for scales inside sound horizon at decoupling */
251
+ class_precision_parameter(k_max_tau0_above_l_max,double,2500.) /**< number defining k_max for the computation of scalar CMB Cl's (dimensionless): k_max tau_0 = max(k_max_tau0_over_l_max * l_max, l_max + k_max_tau0_above_l_max), where l_max is the input parameter l_max_scalars. The second expression is the larger one at small l_max. It is needed since, below l ~ 3000, the transfer functions still get contributions from wavenumbers above k_max_tau0_over_l_max * l / tau_0. At higher l these contributions are suppressed by diffusion damping. */
252
+ class_precision_parameter(k_step_sub,double,0.08) /**< step in k space, in units of one period of acoustic oscillation at decoupling, for scales inside sound horizon at decoupling */
252
253
  class_precision_parameter(k_step_super,double,0.002) /**< step in k space, in units of one period of acoustic oscillation at decoupling, for scales above sound horizon at decoupling */
253
- class_precision_parameter(k_step_transition,double,0.2) /**< dimensionless number regulating the transition from 'sub' steps to 'super' steps. Decrease for more precision. */
254
+ class_precision_parameter(k_step_transition,double,0.4) /**< dimensionless number regulating the transition from 'sub' steps to 'super' steps. Decrease for more precision. */
254
255
  class_precision_parameter(k_step_super_reduction,double,0.1) /**< the step k_step_super is reduced by this amount in the k-->0 limit (below scale of Hubble and/or curvature radius) */
255
256
 
256
257
  class_precision_parameter(k_per_decade_for_pk,double,10.0) /**< if values needed between kmax inferred from k_oscillations and k_kmax_for_pk, this gives the number of k per decade outside the BAO region*/
@@ -268,6 +269,7 @@ class_precision_parameter(start_small_k_at_tau_c_over_tau_h,double,0.0015) /**<
268
269
  class_precision_parameter(start_large_k_at_tau_h_over_tau_k,double,0.07) /**< largest wavelengths start being sampled when mode is sufficiently outside Hubble scale. This is quantified in terms of the ratio of hubble time scale to wavenumber time scale, \f$ \tau_h/\tau_k \f$ which is roughly equal to (k*tau). Start when this ratio equals start_large_k_at_tau_k_over_tau_h. Decrease this value to start integrating the wavenumbers earlier in time. */
269
270
 
270
271
  class_precision_parameter(start_vectors_at_omega_tau,double,0.01) /**< value of omega*tau which gives an upper value for the starting tau when integrating vector modes. Decrease to start earlier in time*/
272
+ class_precision_parameter(start_isocurvature_at_omega_tau,double,0.01) /**< value of omega*tau which gives an upper value for the starting tau when integrating non-adiabatic scalar modes (cdi, bi, nid, niv), whose initial conditions are series in omega*tau. Decrease to start earlier in time*/
271
273
 
272
274
  /**
273
275
  * when to switch off tight-coupling approximation: first condition:
@@ -285,7 +287,19 @@ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_h,double,0.015)
285
287
  * tight_coupling_trigger_tau_c_over_tau_k.
286
288
  * Decrease this value to switch off earlier in time.
287
289
  */
288
- class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_k,double,0.01)
290
+ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_k,double,0.04)
291
+
292
+ /**
293
+ * The two conditions above, for tensor and vector modes. They are
294
+ * separate from the scalar ones since tensor B modes come from the
295
+ * photon polarisation at last scattering, which the tight-coupling
296
+ * approximation suppresses. Thus, tensor modes need the approximation
297
+ * to be switched off earlier than scalar modes.
298
+ */
299
+ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_h_ten,double,0.015)
300
+ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_k_ten,double,0.01)
301
+ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_h_vec,double,0.015)
302
+ class_precision_parameter(tight_coupling_trigger_tau_c_over_tau_k_vec,double,0.01)
289
303
 
290
304
  /**
291
305
  * when to switch off tight-coupling approximation:
@@ -348,9 +362,9 @@ class_precision_parameter(perturbations_sampling_stepsize,double,0.1)
348
362
  class_precision_parameter(perturbations_sampling_boost_above_age_fraction, double, 1.0)
349
363
  /**
350
364
  * control parameter for the precision of the perturbation integration,
351
- * IMPORTANT FOR SETTING THE STEPSIZE OF NDF15
365
+ * IMPORTANT FOR SETTING THE STEPSIZE OF NDF15 AND RKDP45
352
366
  */
353
- class_precision_parameter(tol_perturbations_integration,double,1.0e-5)
367
+ class_precision_parameter(tol_perturbations_integration,double,1.0e-4)
354
368
  /**
355
369
  * cutoff relevant for controlling stiffness in the PPF scheme. It is
356
370
  * neccessary for the Runge-Kutta evolver, but not for ndf15. However,
@@ -392,7 +406,7 @@ class_precision_parameter(ur_fluid_approximation,int,ufa_CLASS) /**< method for
392
406
  * when to switch off ur (massless neutrinos / ultra-relativistic
393
407
  * relics) fluid approximation
394
408
  */
395
- class_precision_parameter(ur_fluid_trigger_tau_over_tau_k,double,30.0)
409
+ class_precision_parameter(ur_fluid_trigger_tau_over_tau_k,double,20.0)
396
410
  class_precision_parameter(ncdm_fluid_approximation,int,ncdmfa_CLASS) /**< method for non-cold dark matter fluid approximation */
397
411
  /**
398
412
  * when to switch off ncdm (massive neutrinos / non-cold
@@ -403,9 +417,13 @@ class_precision_parameter(ncdm_fluid_trigger_tau_over_tau_k,double,31.0)
403
417
  * whether CMB source functions can be approximated as zero when
404
418
  * visibility function g(tau) is tiny
405
419
  */
406
- class_precision_parameter(neglect_CMB_sources_below_visibility,double,1.0e-3)
420
+ class_precision_parameter(neglect_CMB_sources_below_visibility,double,2.0e-3)
407
421
  /**
408
- * The type of evolver to use: options are ndf15 or rk
422
+ * The type of evolver to use for the perturbations: options are ndf15,
423
+ * rk or rkdp45. If 'evolver' is not set in the input file, ndf15 is
424
+ * used for models with a species or an option that can make the
425
+ * perturbation equations stiff, and rkdp45 for all other models
426
+ * (see input_select_perturbations_evolver() in input.c).
409
427
  */
410
428
  class_type_parameter(evolver,int,enum evolver_type,ndf15)
411
429
 
@@ -441,11 +459,11 @@ class_precision_parameter(l_linstep,int,40) /**< factor for logarithmic spacing
441
459
  class_precision_parameter(l_logstep,double,1.12) /**< maximum spacing of values of l over which Bessel and transfer functions are sampled (so, spacing becomes linear instead of logarithmic at some point) */
442
460
 
443
461
  class_precision_parameter(hyper_x_min,double,1.0e-5) /**< flat case: lower bound on the smallest value of x at which we sample \f$ \Phi_l^{\nu}(x)\f$ or \f$ j_l(x)\f$ */
444
- class_precision_parameter(hyper_sampling_flat,double,8.0) /**< flat case: number of sampled points x per approximate wavelength \f$ 2\pi \f$, should remain >7.5 */
445
- class_precision_parameter(hyper_sampling_curved_low_nu,double,7.0) /**< open/closed cases: number of sampled points x per approximate wavelength \f$ 2\pi/\nu\f$, when \f$ \nu \f$ smaller than hyper_nu_sampling_step */
462
+ class_precision_parameter(hyper_sampling_flat,double,12.0) /**< flat case: number of sampled points x per approximate wavelength \f$ 2\pi \f$, should remain >7.5 */
463
+ class_precision_parameter(hyper_sampling_curved_low_nu,double,8.0) /**< open/closed cases: number of sampled points x per approximate wavelength \f$ 2\pi/\nu\f$, when \f$ \nu \f$ smaller than hyper_nu_sampling_step */
446
464
  class_precision_parameter(hyper_sampling_curved_high_nu,double,3.0) /**< open/closed cases: number of sampled points x per approximate wavelength \f$ 2\pi/\nu\f$, when \f$ \nu \f$ greater than hyper_nu_sampling_step */
447
465
  class_precision_parameter(hyper_nu_sampling_step,double,1000.0) /**< open/closed cases: value of nu at which sampling changes */
448
- class_precision_parameter(hyper_phi_min_abs,double,1.0e-10) /**< small value of Bessel function used in calculation of first point x (\f$ \Phi_l^{\nu}(x) \f$ equals hyper_phi_min_abs) */
466
+ class_precision_parameter(hyper_phi_min_abs,double,1.0e-8) /**< small value of Bessel function used in calculation of first point x (\f$ \Phi_l^{\nu}(x) \f$ equals hyper_phi_min_abs) */
449
467
  class_precision_parameter(hyper_x_tol,double,1.0e-4) /**< tolerance parameter used to determine first value of x */
450
468
  class_precision_parameter(hyper_flat_approximation_nu,double,4000.0) /**< value of nu below which the flat approximation is used to compute Bessel function */
451
469
 
@@ -454,7 +472,7 @@ class_precision_parameter(q_linstep,double,0.45) /**< asymptotic linear
454
472
  (comoving angular diameter distance to
455
473
  recombination), very important for CMB */
456
474
 
457
- class_precision_parameter(q_logstep_spline,double,170.0) /**< initial logarithmic sampling step in q
475
+ class_precision_parameter(q_logstep_spline,double,400.0) /**< initial logarithmic sampling step in q
458
476
  space, in units of \f$ 2\pi/r_a(\tau_{rec})\f$
459
477
  (comoving angular diameter distance to
460
478
  recombination), very important for CMB and LSS */
@@ -485,10 +503,22 @@ class_precision_parameter(q_numstep_transition,double,250.0) /**< number of step
485
503
  class_precision_parameter(q_logstep_limber,double,1.025) /**< new in v3.2.2: in the new 'full limber' scheme, logarithmic step for the k-grid (and q-grid) */
486
504
  class_precision_parameter(k_max_limber_over_l_max_scalars,double,0.001) /**< new in v3.2.2: in the new 'full limber' scheme, the integral runs up to k_max = l_max_scalars times this parameter (units of 1/Mpc) */
487
505
 
488
- class_precision_parameter(transfer_neglect_delta_k_S_t0,double,0.15) /**< for temperature source function T0 of scalar mode, range of k values (in 1/Mpc) taken into account in transfer function: for l < (k-delta_k)*tau0, ie for k > (l/tau0 + delta_k), the transfer function is set to zero */
489
- class_precision_parameter(transfer_neglect_delta_k_S_t1,double,0.04) /**< same for temperature source function T1 of scalar mode */
506
+ /* The scalar CMB transfer function at multipole l is set to zero for wavenumbers
507
+ k > l/r_a(tau_rec) + delta_k(l), with r_a(tau_rec) the comoving angular diameter distance to
508
+ recombination. At larger k, the source function only overlaps with the oscillating tail of
509
+ the Bessel function, and the transfer function is negligible. For each source function X,
510
+ delta_k(l) = transfer_neglect_delta_k_S_X sqrt(l / (l + transfer_neglect_l_half_S_X)).
511
+ It increases with l since at low l the integrand becomes negligible closer to l/r_a(tau_rec)
512
+ than at high l. With transfer_neglect_l_half_S_X = 0, delta_k is the same for all l, as in
513
+ v3.4.2 and earlier versions. */
514
+ class_precision_parameter(transfer_neglect_delta_k_S_t0,double,0.19) /**< for temperature source function T0 of scalar mode, the value of delta_k(l) at large l, in 1/Mpc (see above) */
515
+ class_precision_parameter(transfer_neglect_delta_k_S_t1,double,0.05) /**< same for temperature source function T1 of scalar mode */
490
516
  class_precision_parameter(transfer_neglect_delta_k_S_t2,double,0.15) /**< same for temperature source function T2 of scalar mode */
491
- class_precision_parameter(transfer_neglect_delta_k_S_e,double,0.11) /**< same for polarization source function E of scalar mode */
517
+ class_precision_parameter(transfer_neglect_delta_k_S_e,double,0.165) /**< same for polarization source function E of scalar mode */
518
+ class_precision_parameter(transfer_neglect_l_half_S_t0,double,50.) /**< for temperature source function T0 of scalar mode, the multipole at which delta_k(l) is transfer_neglect_delta_k_S_t0/sqrt(2) (see above) */
519
+ class_precision_parameter(transfer_neglect_l_half_S_t1,double,20.) /**< same for temperature source function T1 of scalar mode */
520
+ class_precision_parameter(transfer_neglect_l_half_S_t2,double,100.) /**< same for temperature source function T2 of scalar mode */
521
+ class_precision_parameter(transfer_neglect_l_half_S_e,double,400.) /**< same for polarization source function E of scalar mode */
492
522
  class_precision_parameter(transfer_neglect_delta_k_V_t1,double,1.0) /**< same for temperature source function T1 of vector mode */
493
523
  class_precision_parameter(transfer_neglect_delta_k_V_t2,double,1.0) /**< same for temperature source function T2 of vector mode */
494
524
  class_precision_parameter(transfer_neglect_delta_k_V_e,double,1.0) /**< same for polarization source function E of vector mode */
@@ -4,8 +4,6 @@
4
4
  #define __THERMODYNAMICS__
5
5
 
6
6
  #include "background.h"
7
- #include "evolver_ndf15.h"
8
- #include "evolver_rkck.h"
9
7
  #include "wrap_hyrec.h"
10
8
  #include "wrap_recfast.h"
11
9
  #include "injection.h"
@@ -188,7 +188,8 @@ struct transfer {
188
188
  double ** k_power; /**< the transfer source W(tau) S(k,tau) is further multiplied by (k/k_pivot)^k_power, k_power[index_md][index_tt] */
189
189
  double ** k_pivot; /**< pivot wavenumber of the previous factor, k_pivot[index_md][index_tt] */
190
190
  double ** l_limber; /**< the Limber approximation is used for l >= l_limber[index_md][index_tt] (_HUGE_ if never) */
191
- double ** delta_k_neglect; /**< the transfer function is set to zero for l < (q-delta_k_neglect)*r_a(tau_rec), delta_k_neglect[index_md][index_tt] (_HUGE_ if never) */
191
+ double ** delta_k_neglect; /**< the transfer function is set to zero for l < (q-delta_k)*r_a(tau_rec), with delta_k = delta_k_neglect[index_md][index_tt] (_HUGE_ if never), multiplied by sqrt(l/(l+l_half_neglect)) if l_half_neglect is positive */
192
+ double ** l_half_neglect; /**< see delta_k_neglect, l_half_neglect[index_md][index_tt] (0 if delta_k does not depend on l) */
192
193
  short ** has_late_source_cut; /**< can the source be neglected at late times (tau>tau_cut) for l > ppr->transfer_neglect_late_source? has_late_source_cut[index_md][index_tt] */
193
194
  short ** has_full_limber; /**< is the type also computed in the full Limber q-sampling scheme (on the grid q_limber)? has_full_limber[index_md][index_tt] (only for the CMB lensing potential of scalar modes, when ptr->do_lcmb_full_limber is true) */
194
195
 
@@ -509,6 +509,17 @@ class TestClass(unittest.TestCase):
509
509
  'selection': 'tabulated', 'selection_file': '/nonexistent/selection.dat'})
510
510
  self.assertRaises(CosmoSevereError, self.cosmo.compute)
511
511
 
512
+ @attr('test_scenario')
513
+ def test_cmb_tt_at_small_l_max(self):
514
+ """Check that the TT spectrum up to l = 200 is the same for l_max_scalars = 200 and l_max_scalars = 1000"""
515
+ self.cosmo.set({'output': 'tCl', 'l_max_scalars': 200})
516
+ self.cosmo.compute()
517
+ tt_200 = self.cosmo.raw_cl(200)['tt'][2:]
518
+ self.cosmo_newt.set({'output': 'tCl', 'l_max_scalars': 1000})
519
+ self.cosmo_newt.compute()
520
+ tt_1000 = self.cosmo_newt.raw_cl(200)['tt'][2:]
521
+ self.assertLess(np.max(np.abs(tt_200/tt_1000-1.)), 1.e-3)
522
+
512
523
  def has_incompatible_input(self):
513
524
 
514
525
  should_fail = False
@@ -539,16 +539,21 @@ int background_functions(
539
539
  /* fluid with w(a) and constant cs2 */
540
540
  if (pba->has_fld == _TRUE_) {
541
541
 
542
- /* get rho_fld from vector of integrated variables */
543
- pvecback[pba->index_bg_rho_fld] = pvecback_B[pba->index_bi_rho_fld];
544
-
545
- /* get w_fld from dedicated function */
542
+ /* get w_fld and the integral of 3(1+w_fld)/a from dedicated function */
546
543
  class_call(background_w_fld(pba,a,&w_fld,&dw_over_da,&integral_fld), pba->error_message, pba->error_message);
547
544
  pvecback[pba->index_bg_w_fld] = w_fld;
548
545
 
549
- // Obsolete: at the beginning, we had here the analytic integral solution corresponding to the case w=w0+w1(1-a/a0):
550
- // pvecback[pba->index_bg_rho_fld] = pba->Omega0_fld * pow(pba->H0,2) / pow(a,3.*(1.+pba->w0_fld+pba->wa_fld)) * exp(3.*pba->wa_fld*(a-1.));
551
- // But now everthing is integrated numerically for a given w_fld(a) defined in the function background_w_fld.
546
+ /* get rho_fld from the analytic integral when background_w_fld()
547
+ provides one (CLP), and otherwise from the vector of integrated
548
+ variables. The analytic integral gives rho_fld(a_0) = Omega0_fld
549
+ H0^2 exactly. The numerical integration only gives it up to the
550
+ integration error, which can be large when w(a) varies fast. */
551
+ if (pba->fluid_equation_of_state == CLP) {
552
+ pvecback[pba->index_bg_rho_fld] = pba->Omega0_fld * pow(pba->H0,2) * exp(integral_fld);
553
+ }
554
+ else {
555
+ pvecback[pba->index_bg_rho_fld] = pvecback_B[pba->index_bi_rho_fld];
556
+ }
552
557
 
553
558
  rho_tot += pvecback[pba->index_bg_rho_fld];
554
559
  p_tot += w_fld * pvecback[pba->index_bg_rho_fld];
@@ -1163,7 +1168,8 @@ int background_indices(
1163
1168
  class_define_index(pba->index_bi_rho_dr,pba->has_dr,index_bi,1);
1164
1169
 
1165
1170
  /* -> energy density in fluid */
1166
- class_define_index(pba->index_bi_rho_fld,pba->has_fld,index_bi,1);
1171
+ /* - fluid density, only when w(a) has no analytic integral (see background_w_fld()) */
1172
+ class_define_index(pba->index_bi_rho_fld,(pba->has_fld == _TRUE_) && (pba->fluid_equation_of_state != CLP),index_bi,1);
1167
1173
 
1168
1174
  /* -> scalar field and its derivative wrt conformal time (Zuma) */
1169
1175
  class_define_index(pba->index_bi_phi_scf,pba->has_scf,index_bi,1);
@@ -1888,9 +1894,7 @@ int background_solve(
1888
1894
  /* conformal distance in Mpc (equal to comoving radius in flat case) */
1889
1895
  double conformal_distance;
1890
1896
 
1891
- /* evolvers */
1892
- extern int evolver_rk(EVOLVER_PROTOTYPE);
1893
- extern int evolver_ndf15(EVOLVER_PROTOTYPE);
1897
+ /* evolver */
1894
1898
  int (*generic_evolver)(EVOLVER_PROTOTYPE) = evolver_ndf15;
1895
1899
 
1896
1900
  /* initial and final loga values */
@@ -1957,6 +1961,13 @@ int background_solve(
1957
1961
  printf("%s\n", "Chose ndf15 as generic_evolver");
1958
1962
  }
1959
1963
  break;
1964
+
1965
+ case rkdp45:
1966
+ generic_evolver = evolver_rkdp45;
1967
+ if (pba->background_verbose > 1) {
1968
+ printf("%s\n", "Chose rkdp45 as generic_evolver");
1969
+ }
1970
+ break;
1960
1971
  }
1961
1972
 
1962
1973
  /** - perform the integration */
@@ -2237,7 +2248,7 @@ int background_initial_conditions(
2237
2248
  }
2238
2249
  }
2239
2250
 
2240
- if (pba->has_fld == _TRUE_) {
2251
+ if ((pba->has_fld == _TRUE_) && (pba->fluid_equation_of_state != CLP)) {
2241
2252
 
2242
2253
  /* rho_fld today */
2243
2254
  rho_fld_today = pba->Omega0_fld * pow(pba->H0,2);
@@ -2655,8 +2666,8 @@ int background_derivs(
2655
2666
  dy[pba->index_bi_rho_dr] = -4.*y[pba->index_bi_rho_dr]+pba->Gamma_dcdm/H*y[pba->index_bi_rho_dcdm];
2656
2667
  }
2657
2668
 
2658
- if (pba->has_fld == _TRUE_) {
2659
- /** - Compute fld density \f$ d\rho/dloga = -3 (1+w_{fld}(a)) \rho \f$ */
2669
+ if ((pba->has_fld == _TRUE_) && (pba->fluid_equation_of_state != CLP)) {
2670
+ /** - Compute fld density \f$ d\rho/dloga = -3 (1+w_{fld}(a)) \rho \f$ (only when w(a) has no analytic integral) */
2660
2671
  dy[pba->index_bi_rho_fld] = -3.*(1.+pvecback[pba->index_bg_w_fld])*y[pba->index_bi_rho_fld];
2661
2672
  }
2662
2673
 
@@ -1732,6 +1732,12 @@ int input_read_parameters(struct file_content * pfc,
1732
1732
  errmsg,
1733
1733
  errmsg);
1734
1734
 
1735
+ /** Choose the evolver for the perturbations, unless 'evolver' is set in the input file */
1736
+ class_call(input_select_perturbations_evolver(pfc,ppr,pba,pth,ppt,
1737
+ errmsg),
1738
+ errmsg,
1739
+ errmsg);
1740
+
1735
1741
  return _SUCCESS_;
1736
1742
 
1737
1743
  }
@@ -5237,6 +5243,13 @@ int input_read_parameters_lensing(struct file_content * pfc,
5237
5243
  class_stop(errmsg,"you asked for lensed CMB Cls, but this requires a minimal number of options: 'modes' should include 's', 'output' should include 'tCl' and/or 'pCl', and also, importantly, 'lCl', the CMB lensing potential spectrum.");
5238
5244
  }
5239
5245
  }
5246
+ /* Without lensed Cl's, l_scalar_max is not increased, and we set
5247
+ delta_l_max to zero. Then l_scalar_max - delta_l_max is always
5248
+ the input parameter l_max_scalars (this is used in
5249
+ perturbations_get_k_list()) */
5250
+ else {
5251
+ ppr->delta_l_max = 0;
5252
+ }
5240
5253
 
5241
5254
 
5242
5255
  /** 2) Should the lensed spectra be rescaled (either with just A_L, or otherwise with amplitude, and tilt and pivot scale in k space) */
@@ -5594,6 +5607,76 @@ int input_read_parameters_additional(struct file_content* pfc,
5594
5607
  }
5595
5608
 
5596
5609
 
5610
+ /**
5611
+ * Choose the evolver for the perturbations if the user has not set
5612
+ * 'evolver' in the input file.
5613
+ *
5614
+ * Whether the system of perturbation equations is stiff depends on the
5615
+ * model. With the tight-coupling approximation, the equations of the
5616
+ * standard species are not stiff, and the explicit Dormand-Prince
5617
+ * evolver rkdp45 is faster than ndf15 for the same accuracy. Some
5618
+ * species and options make the system stiff, and an explicit evolver
5619
+ * then has to take very small steps. Thus, we only use rkdp45 when none
5620
+ * of them is present, and keep ndf15 otherwise.
5621
+ *
5622
+ * WARNING: the species and options that can make the system stiff are
5623
+ * listed explicitly below. If you add a new one, you must add it to
5624
+ * that list, otherwise the code will use rkdp45 for it.
5625
+ *
5626
+ * The default value of tol_perturbations_integration has been chosen
5627
+ * for rkdp45. For ndf15, the same value gives a tighter integration.
5628
+ *
5629
+ * @param pfc Input: pointer to local structure
5630
+ * @param ppr Input/Output: pointer to precision structure
5631
+ * @param pba Input: pointer to background structure
5632
+ * @param pth Input: pointer to thermodynamics structure
5633
+ * @param ppt Input: pointer to perturbations structure
5634
+ * @param errmsg Input: Error message
5635
+ * @return the error status
5636
+ */
5637
+
5638
+ int input_select_perturbations_evolver(struct file_content * pfc,
5639
+ struct precision * ppr,
5640
+ struct background * pba,
5641
+ struct thermodynamics * pth,
5642
+ struct perturbations * ppt,
5643
+ ErrorMsg errmsg){
5644
+
5645
+ /** Summary: */
5646
+
5647
+ /** - Define local variables */
5648
+ int flag;
5649
+ int int_param;
5650
+
5651
+ /** - If 'evolver' is set in the input file, keep that choice */
5652
+ class_call(parser_read_int(pfc,"evolver",&int_param,&flag,errmsg),
5653
+ errmsg,
5654
+ errmsg);
5655
+ if (flag == _TRUE_)
5656
+ return _SUCCESS_;
5657
+
5658
+ /** - Keep the default ndf15 if the model has a species or an option
5659
+ that can make the perturbation equations stiff: decaying dark
5660
+ matter, decaying dark radiation, a scalar field, interacting dark
5661
+ matter or dark radiation, perturbed recombination, or vector
5662
+ modes. WARNING: a new species or option of this kind must be
5663
+ added to this list. */
5664
+ if ((pba->has_dcdm == _TRUE_) ||
5665
+ (pba->has_dr == _TRUE_) ||
5666
+ (pba->has_scf == _TRUE_) ||
5667
+ (pba->has_idr == _TRUE_) ||
5668
+ (pba->has_idm == _TRUE_) ||
5669
+ (ppt->has_perturbed_recombination == _TRUE_) ||
5670
+ (ppt->has_vectors == _TRUE_))
5671
+ return _SUCCESS_;
5672
+
5673
+ /** - Otherwise, use the explicit Dormand-Prince evolver rkdp45 */
5674
+ ppr->evolver = rkdp45;
5675
+
5676
+ return _SUCCESS_;
5677
+
5678
+ }
5679
+
5597
5680
  /**
5598
5681
  * Read the parameters of output structure.
5599
5682
  *