# 玻尔兹曼求解器

玻尔兹曼求解器是一种数值程序，它在膨胀宇宙中对光子、中微子和物质扰动的线性化爱因斯坦–玻尔兹曼方程进行积分，并由此计算宇宙密度涨落和各向异性的可观测统计量。其标准输出为宇宙微波背景（CMB）的温度与偏振谱 TT、TE、EE 和 BB，透镜势谱，物质功率谱以及转移函数。<sup>[1](https://ar5iv.labs.arxiv.org/html/1104.2932)</sup><sup> • </sup><sup>[2](https://camb.readthedocs.io/en/stable/index.html)</sup> 用 Fortran 编写并配有 Python 封装层的 CAMB，以及用 C 编写的 CLASS，是最常用的求解器，据估计全世界每年执行数千亿次。<sup>[3](https://arxiv.org/html/2509.25110)</sup> 由于参数分析通常需要 \( 10^{4} \) 到 \( 10^{6} \) 次代码求值，运行时间主导了该领域大部分的算法发展史。<sup>[4](https://arxiv.org/html/2104.14568)</sup>

| 关键事实 | 数值 | 来源 |
|---|---|---|
| 输出 | CMB TT/TE/EE/BB 与透镜谱、物质功率谱、转移函数 | <sup>[1](https://ar5iv.labs.arxiv.org/html/1104.2932)</sup><sup> • </sup><sup>[2](https://camb.readthedocs.io/en/stable/index.html)</sup> |
| 每次运行的方程数 | 每个波数模式约 50 个耦合常微分方程，共数百个模式 | <sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup> |
| 关键算法 | 视线积分，将 CPU 时间削减约两个数量级 | <sup>[6](https://doi.org/10.1086/177793)</sup> |
| 代码间精度 | CLASS 与 CAMB 在透镜 CMB 和物质谱上一致到 0.01%；CLASS 约快 2.5 倍 | <sup>[7](https://ar5iv.labs.arxiv.org/html/1104.2934)</sup> |
| 运行时间 | 默认设置下每个模型约 1 秒；高精度下最长约 10 分钟 | <sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup><sup> • </sup><sup>[3](https://arxiv.org/html/2509.25110)</sup> |
| 推断成本 | 每次参数分析需 \( 10^{4} \) 到 \( 10^{6} \) 次求值 | <sup>[8](https://ar5iv.labs.arxiv.org/html/1104.2933)</sup><sup> • </sup><sup>[4](https://arxiv.org/html/2104.14568)</sup> |
| 代码谱系 | CAMB 与 CMBEASY 最初是 CMBFAST 的翻译版本，并非独立代码 | <sup>[9](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)</sup> |

## 工作原理

对每个波数 k，求解器演化按角多极矩 \( \Theta_{l} \) 展开的光子分布（遵循马与伯奇格的约定，\( F_{l} = 4\Theta_{l} \)），同时演化斯托克斯参数的偏振层级 \( G_{l} \)、重子与冷暗物质流体，以及由爱因斯坦方程支配的度规扰动。<sup>[10](https://lesgourg.github.io/class-tour/Tokyo2014/lecture10_perturbations.pdf)</sup> 有质量中微子需要额外的动量空间层级。该系统在两个区间内是刚性的：在复合之前，汤姆孙散射以远短于哈勃时间的时标将光子与重子耦合在一起；而在晚期，光子矩快速振荡。<sup>[11](https://ar5iv.labs.arxiv.org/html/1612.06697)</sup>

视线方法使问题变得可处理：今天的温度各向异性写成一个源项与模型无关的径向本征函数之积的共形时间积分，沿光子过去光锥求值。<sup>[6](https://doi.org/10.1086/177793)</sup> 源项可分解为萨克斯–沃尔夫项、多普勒项、积分萨克斯–沃尔夫项和偏振项，且只需演化和存储到约 \( l = 10 \) 的多极矩。<sup>[10](https://lesgourg.github.io/class-tour/Tokyo2014/lecture10_perturbations.pdf)</sup> 由于源随波长缓慢变化，只需在少数几个点上求值 <sup>[12](https://inspirehep.net/literature/416626)</sup>，而光子层级本身也只需算到较低的多极阶。<sup>[6](https://doi.org/10.1086/177793)</sup> 这就用一个很小的系统取代了暴力层级方法的数千个耦合方程。<sup>[6](https://doi.org/10.1086/177793)</sup><sup> • </sup><sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup>

## 实现方式

一次运行分阶段进行。代码首先演化背景宇宙学和热力学；在 CLASS 中，复合过程默认由 HyRec 处理。<sup>[13](http://class-code.net/)</sup> 然后对数百个解耦波数模式中的每一个，积分约 50 个描述各物种玻尔兹曼层级的耦合微分方程。<sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup> 各代码的积分器不同：CLASS 使用隐式 ndf15 数值微分公式求解器，CAMB 使用 DVERK 自适应龙格–库塔程序（对非刚性系统最为高效），而极简重实现则使用 SciPy 的 LSODA，它在亚当斯方法和刚性 BDF 方法之间切换。<sup>[11](https://ar5iv.labs.arxiv.org/html/1612.06697)</sup><sup> • </sup><sup>[14](https://arxiv.org/pdf/2602.23466)</sup>

**近似方案**在自动检测的时刻开启和关闭。<sup>[1](https://ar5iv.labs.arxiv.org/html/1104.2932)</sup> 对于基础 ΛCDM，CLASS 使用一阶或二阶重子–光子紧耦合近似、一个超相对论流体近似（UFA，一旦 \( k \cdot \tau \) 超过通常在 10 到 50 之间的阈值就把 \( l_{\mathrm{max}} \) 降到 2，换来约 10% 的加速）、一个包含再电离的辐射自由流近似，以及针对非冷遗迹的流体近似。<sup>[8](https://ar5iv.labs.arxiv.org/html/1104.2933)</sup> 源函数 \( S(k,\tau) \) 在扰动积分过程中被制表并传给转移模块。<sup>[1](https://ar5iv.labs.arxiv.org/html/1104.2932)</sup> 最后，将源与径向函数相乘后对时间积分，并对波数求和，得到角功率谱。<sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup>

## 起源

皮布尔斯与余于 1970 年在《天体物理学杂志》上首次对一整套线性爱因斯坦–玻尔兹曼方程进行了数值积分。<sup>[15](https://doi.org/10.1086/150713)</sup> 塞尔雅克于 1994 年提出的双流体近似（同样发表于《天体物理学杂志》）是同一方向上更早的近似步骤。<sup>[16](https://doi.org/10.1086/187601)</sup> 1996 年，塞尔雅克与萨尔达里亚加将其推广为一种在线性扰动论内精确的方法，并在 CMBFAST 中实现，将 CPU 时间削减约两个数量级，在 workstation 上每个模型只需几分钟；该方法发表于《天体物理学杂志》。<sup>[6](https://doi.org/10.1086/177793)</sup>

CMBFAST 的玻尔兹曼演化方程源自 COSMICS——一个 Fortran 软件包，其全精度运行到 \( l \leq 2000 \) 需要数十个 Cray C90 机时，这说明了传统层级方法的代价。<sup>[9](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)</sup><sup> • </sup><sup>[17](https://ar5iv.labs.arxiv.org/html/astro-ph/9506070)</sup> CAMB 与 CMBEASY 最初分别是 CMBFAST 翻译成 Fortran 90 和 C++ 的版本，因此并非独立代码 <sup>[9](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)</sup>；CMBEASY 的论文由迈克尔·多兰于 2005 年发表在《宇宙学与天体粒子物理学杂志》上。<sup>[18](https://doi.org/10.1088/1475-7516/2005/10/011)</sup> CLASS 是第五个公开的爱因斯坦–玻尔兹曼求解器，用另一种语言从零编写，目的是提供一个独立于 CAMB 的工具，以检验参数提取中由玻尔兹曼代码引入的偏差。<sup>[19](https://lesgourg.github.io/class-tour/Cambridge/CLASS_Lecture1_Basics.pdf)</sup><sup> • </sup><sup>[7](https://ar5iv.labs.arxiv.org/html/1104.2934)</sup>

## 变体

CMBFAST 首次包含了 CMB 透镜计算。<sup>[1](https://ar5iv.labs.arxiv.org/html/1104.2932)</sup> CAMB 计算 CMB、透镜、星系计数、暗时代 21 厘米以及物质功率谱和转移函数，数值核心为 Python 封装的 Fortran。<sup>[2](https://camb.readthedocs.io/en/stable/index.html)</sup> CLASS 按不同的物理任务组织为十个模块，用纯 C 编写，并封装在 Python 模块 classy 中。<sup>[19](https://lesgourg.github.io/class-tour/Cambridge/CLASS_Lecture1_Basics.pdf)</sup><sup> • </sup><sup>[13](http://class-code.net/)</sup> 对于有质量中微子，CLASS 加入了一种自适应求积的动量采样算法和哈勃半径内的粘性流体近似，使得有一个有质量中微子时代码只慢 1.5 倍，而其他代码要慢约 4.5 到 5 倍。<sup>[20](https://iopscience.iop.org/article/10.1088/1475-7516/2011/09/032/pdf)</sup> CLASS 的 class_sz 扩展计算 tSZ 和 kSZ 功率谱、晕模型双谱、星系团计数以及 3x2 分析，目标是在每个观测量上低于 0.2 秒。<sup>[21](https://ar5iv.labs.arxiv.org/html/2310.18482)</sup>

**近期求解器**重做了数值核心。gCAMB 是 CAMB 的 GPU 移植版，保留了其全部功能，在高精度设置下总体加速超过 100 倍。<sup>[3](https://arxiv.org/html/2509.25110)</sup> SymBoltz 是一个 Julia 求解器，用隐式常微分方程求解器积分完整的刚性方程，不使用任何近似方案，在标准精度下与成熟代码一致到约 0.1%，在可比精度下运行速度比使用 ndf15 演化器的 CLASS 快 10 倍以上。<sup>[22](https://www.aanda.org/articles/aa/full_html/2026/03/aa57450-25/aa57450-25.html)</sup>

## 应用

**精度。** 在最高精度设置下，CLASS 与 CAMB 在透镜 CMB 和物质功率谱上一致到 \( 10^{-4} \)（0.01%）水平，而在给定精度下 CLASS 约比 CAMB 快 2.5 倍。<sup>[7](https://ar5iv.labs.arxiv.org/html/1104.2934)</sup> 2003 年的一次三代码比较在 \( l = 3000 \) 以内的 CMB 各向异性上达到低于 0.1% 的一致性，在暗物质功率谱上达到 \( 10^{-3} \) 水平。<sup>[9](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)</sup> 运行时间从默认设置下每个模型约 1 秒 <sup>[5](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)</sup> 到高精度下约 10 分钟不等。<sup>[3](https://arxiv.org/html/2509.25110)</sup>

**参数推断。** 一个典型项目需要 \(10^{4}\) 到 \(10^{5}\) 次玻尔兹曼代码执行 <sup>[8](https://ar5iv.labs.arxiv.org/html/1104.2933)</sup>，而大尺度结构分析可达 \(10^{6}\) 次，使线性功率谱成为数据分析的计算瓶颈。<sup>[4](https://arxiv.org/html/2104.14568)</sup> CAMB 和 CLASS 被用于 ACT、SPT、Simons 天文台和 CMB-S4 的分析流程中。<sup>[21](https://ar5iv.labs.arxiv.org/html/2310.18482)</sup> 代码精度直接影响参数偏差：在 CAMB 2008 年前后的默认设置下，对于六参数 ΛCDM，普朗克时代的宇宙学参数可能偏差达零点几个标准差，而优化设置则将任何参数的偏差保持在 0.1 个标准差以下。<sup>[23](https://ar5iv.labs.arxiv.org/html/0903.0382)</sup>

## 局限与替代方案

已知的失效模式包括：CMBFAST 在 \( l < 20 \) 处误差高达 1%，原因是视线积分在复合时期附近的抵消不完美 <sup>[9](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)</sup>；有质量中微子流体近似在 CMB 谱中 \( l = 2750 \) 处仅误差 0.02%，但在三个 1 eV 中微子情形下，对 \( k \in [0.05, 1]\,h\,\mathrm{Mpc}^{-1} \) 的 \( P(k) \) 误差达 1% 到 3%，因此对于物质功率谱建议仅在中微子总质量低于 1 到 2 eV 时使用 <sup>[20](https://iopscience.iop.org/article/10.1088/1475-7516/2011/09/032/pdf)</sup>；透镜势谱收敛缓慢，在 \( l \sim 3000 \) 处要稳定到 10% 需要 \( (k \cdot \tau_{0})_{\mathrm{max}} \) 至少为 15000 <sup>[7](https://ar5iv.labs.arxiv.org/html/1104.2934)</sup>；以及上述默认设置偏差。<sup>[23](https://ar5iv.labs.arxiv.org/html/0903.0382)</sup> 玻尔兹曼求解器是线性理论工具；非线性物质功率通过 HALOFIT 附加，并在 CLASS 的非线性模块中对有质量中微子重新校准和扩展。<sup>[13](http://class-code.net/)</sup>

**扰动论与模拟器**以不同方式用精度换速度。CLASSpt 扩展了 CLASS，为物质和有偏示踪物提供单圈 LSS 有效场论谱，包括红外重求和、反项和 Alcock–Paczynski 效应，每个宇宙学耗时 0.3 秒；该扩展由安东·丘达伊金及其同事于 2020 年发表在《物理评论 D》上。<sup>[24](https://doi.org/10.1103/physrevd.102.063533)</sup> 对谱本身的神经网络模拟器在 \( l = 10^{4} \) 以内达到优于 0.5% 的精度，耗时约 60 毫秒，比高精度 CLASS 或 CAMB 运行快 1000 倍 <sup>[25](https://ar5iv.labs.arxiv.org/html/2303.01591)</sup>；Capse.jl 由马尔科·博尼奇、埃里克·巴克斯特、费德里科·比安基尼和海梅·鲁伊斯-萨帕特罗于 2024 年发表在《开放天体物理学杂志》上，在 Julia 中提供可自动微分的模拟。<sup>[26](https://doi.org/10.21105/astro.2307.14339)</sup> 在求解器内部模拟源函数（如 CosmicNet 所做）可带来 2 到 3 倍的端到端加速；CosmicNet 由贾斯珀·阿尔伯斯及其同事于 2019 年发表在《宇宙学与天体粒子物理学杂志》上。<sup>[27](https://doi.org/10.1088/1475-7516/2019/09/028)</sup> 模拟器需要大约 \( 10^{5} \) 到 \( 10^{6} \) 个训练谱，并且每换一种模型变体都要重新训练。<sup>[3](https://arxiv.org/html/2509.25110)</sup>

## References

1. [The Cosmic Linear Anisotropy Solving System (CLASS) I: Overview](https://ar5iv.labs.arxiv.org/html/1104.2932)
2. [CAMB documentation](https://camb.readthedocs.io/en/stable/index.html)
3. [gCAMB: A GPU-accelerated Boltzmann solver for next-generation cosmological surveys](https://arxiv.org/html/2509.25110)
4. [Accelerating Large-Scale-Structure data analyses by emulating Boltzmann solvers and Lagrangian Perturbation Theory](https://arxiv.org/html/2104.14568)
5. [CMB Codes (Antony Lewis lecture slides)](https://cosmologist.info/notes/Boltzmann_Nov21.pdf)
6. [Uros Seljak, Matias Zaldarriaga (1996). A Line-of-Sight Integration Approach to Cosmic Microwave Background Anisotropies. The Astrophysical Journal.](https://doi.org/10.1086/177793)
7. [The Cosmic Linear Anisotropy Solving System (CLASS) III: Comparison with CAMB for ΛCDM](https://ar5iv.labs.arxiv.org/html/1104.2934)
8. [The Cosmic Linear Anisotropy Solving System (CLASS) II: Approximation schemes](https://ar5iv.labs.arxiv.org/html/1104.2933)
9. [A comparison of cosmological Boltzmann codes: are we ready for high precision cosmology?](https://export.arxiv.org/pdf/astro-ph/0306052v1.pdf)
10. [Lecture 10: The Perturbation module (Lesgourgues, CLASS course)](https://lesgourg.github.io/class-tour/Tokyo2014/lecture10_perturbations.pdf)
11. [The Einstein-Boltzmann Equations Revisited](https://ar5iv.labs.arxiv.org/html/1612.06697)
12. [A Line of sight integration approach to cosmic microwave background anisotropies - INSPIRE record](https://inspirehep.net/literature/416626)
13. [CLASS Home Page](http://class-code.net/)
14. [nanoCMB: a minimal but accurate calculator for the unlensed CMB temperature and polarization power spectra](https://arxiv.org/pdf/2602.23466)
15. [P. J. E. Peebles, J. T. Yu (1970). Primeval Adiabatic Perturbation in an Expanding Universe. The Astrophysical Journal.](https://doi.org/10.1086/150713)
16. [Uros Seljak (1994). A two-fluid approximation for calculating the cosmic microwave background anisotropies. The Astrophysical Journal.](https://doi.org/10.1086/187601)
17. [COSMICS: Cosmological Initial Conditions and Microwave Anisotropy Codes (Ma & Bertschinger 1995)](https://ar5iv.labs.arxiv.org/html/astro-ph/9506070)
18. [Michael Doran (2005). CMBEASY: an object oriented code for the cosmic microwave background. Journal of Cosmology and Astroparticle Physics.](https://doi.org/10.1088/1475-7516/2005/10/011)
19. [Tools for cosmology: the Cosmological Linear Anisotropy Solving System (CLASS) (Lesgourgues lecture slides)](https://lesgourg.github.io/class-tour/Cambridge/CLASS_Lecture1_Basics.pdf)
20. [CLASS IV: efficient implementation of non-cold relics (JCAP 1109 (2011) 032)](https://iopscience.iop.org/article/10.1088/1475-7516/2011/09/032/pdf)
21. [class_sz I: Overview](https://ar5iv.labs.arxiv.org/html/2310.18482)
22. [SymBoltz.jl: A symbolic-numeric, approximation-free, and differentiable linear Einstein–Boltzmann solver (Astronomy & Astrophysics)](https://www.aanda.org/articles/aa/full_html/2026/03/aa57450-25/aa57450-25.html)
23. [Optimising Boltzmann codes for the PLANCK era](https://ar5iv.labs.arxiv.org/html/0903.0382)
24. [Anton Chudaykin and colleagues (2020). Nonlinear perturbation theory extension of the Boltzmann code CLASS. Physical review. D/Physical review. D..](https://doi.org/10.1103/physrevd.102.063533)
25. [High-accuracy emulators for observables in ΛCDM, N_eff, Σm_ν, and w cosmologies (CosmoPower)](https://ar5iv.labs.arxiv.org/html/2303.01591)
26. [Marco Bonici and colleagues (2024). Capse.jl: efficient and auto-differentiable CMB power spectra emulation. The Open Journal of Astrophysics.](https://doi.org/10.21105/astro.2307.14339)
27. [Jasper Albers and colleagues (2019). CosmicNet. Part I. Physics-driven implementation of neural networks within Einstein-Boltzmann Solvers. Journal of Cosmology and Astroparticle Physics.](https://doi.org/10.1088/1475-7516/2019/09/028)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 物质世界与数学 › 天文学 › 宇宙学与天文观测 › Cosmic microwave background

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/boltzmann-solver

English original: https://www.edgepedia.org/boltzmann-solver
