dsh-math-calculator 2.0.0 → 2.1.1

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 (58) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.md +52 -10
  3. package/dsh.plugin.json +15 -8
  4. package/lib/awareness.js +16 -13
  5. package/lib/body-catalog.js +488 -0
  6. package/lib/body-scaling.js +288 -0
  7. package/lib/body-taxonomy.js +719 -0
  8. package/lib/detector.js +361 -16
  9. package/lib/empirical-decomposition.js +321 -0
  10. package/lib/format.js +113 -5
  11. package/lib/formula-library-generic.js +226 -0
  12. package/lib/formulas.js +71 -13
  13. package/lib/index.js +623 -77
  14. package/lib/ops/bodies-op.js +368 -0
  15. package/lib/ops/shared.js +64 -4
  16. package/lib/ops/workspace-op.js +19 -1
  17. package/lib/ops/world-op.js +22 -0
  18. package/lib/playbook.js +6 -1
  19. package/lib/precision-report.js +80 -0
  20. package/lib/result-cache.js +144 -0
  21. package/lib/types/awareness.d.ts +10 -4
  22. package/lib/types/body-catalog.d.ts +156 -0
  23. package/lib/types/body-scaling.d.ts +123 -0
  24. package/lib/types/body-taxonomy.d.ts +95 -0
  25. package/lib/types/detector.d.ts +18 -0
  26. package/lib/types/empirical-decomposition.d.ts +107 -0
  27. package/lib/types/format.d.ts +33 -4
  28. package/lib/types/formula-library-generic.d.ts +37 -0
  29. package/lib/types/formulas.d.ts +35 -7
  30. package/lib/types/index.d.ts +16 -0
  31. package/lib/types/ops/bodies-op.d.ts +35 -0
  32. package/lib/types/ops/shared.d.ts +94 -3
  33. package/lib/types/precision-report.d.ts +59 -0
  34. package/lib/types/result-cache.d.ts +78 -0
  35. package/lib/types/workspace.d.ts +24 -0
  36. package/lib/types/world.d.ts +8 -0
  37. package/lib/workspace.js +22 -0
  38. package/lib/world.js +38 -3
  39. package/package.json +1 -1
  40. package/src/awareness.ts +16 -13
  41. package/src/body-catalog.ts +619 -0
  42. package/src/body-scaling.ts +357 -0
  43. package/src/body-taxonomy.ts +806 -0
  44. package/src/detector.ts +403 -15
  45. package/src/empirical-decomposition.ts +411 -0
  46. package/src/format.ts +123 -5
  47. package/src/formula-library-generic.ts +242 -0
  48. package/src/formulas.ts +79 -13
  49. package/src/index.ts +652 -64
  50. package/src/ops/bodies-op.ts +415 -0
  51. package/src/ops/shared.ts +141 -4
  52. package/src/ops/workspace-op.ts +21 -1
  53. package/src/ops/world-op.ts +22 -0
  54. package/src/playbook.ts +6 -1
  55. package/src/precision-report.ts +87 -0
  56. package/src/result-cache.ts +157 -0
  57. package/src/workspace.ts +34 -0
  58. package/src/world.ts +51 -4
@@ -0,0 +1,488 @@
1
+ /**
2
+ * 天体目录:恒星、行星、卫星、小天体的代表性样本。
3
+ *
4
+ * ## 为什么需要这个,而不是让作者自己查
5
+ *
6
+ * 写架空世界时最费劲的一步是「先锚一个现实参照物」:我要写一颗潮汐锁定的
7
+ * 红矮星行星,它该多大、多重、多少度?没有参照,数字全靠猜。
8
+ *
9
+ * 本文件收录真实观测值(尽量带来源量级),让作者能:
10
+ * · 直接拿某颗真实天体当基线改(「比开普勒-1649c 再热一点」)
11
+ * · 或看一组同类天体的分布范围,判断自己的设定落在什么分位
12
+ *
13
+ * ## 最关键的设计:区分「物理决定」与「只在地球标定」
14
+ *
15
+ * 这是本项目反复强调的分层。改物理常数(α、G、c)时,不同量必须区别对待:
16
+ *
17
+ * | 类别 | 例 | 改常数时会怎样 |
18
+ * |---|---|---|
19
+ * | `first-principles` | 质量、半径、轨道半径 | **不变**。它们由引力与初始条件决定,与 α 几乎无关 |
20
+ * | `scaled` | 光度、有效温度、寿命 | **变**。由核反应速率与斯特藩-玻尔兹曼决定,依赖 α |
21
+ * | `calibrated` | 行星平衡温度、反照率、温室增温 | **只在地球标定下可信**。超出适用域时本文件只给方向 |
22
+ * | `contingent` | 大气成分、云量、磁场、板块 | **不可推导**。这是历史偶然,不是物理必然 |
23
+ *
24
+ * ⚠️ 最容易犯的错:把 `calibrated` 的数值当成物理定律。
25
+ * 地球反照率 0.30 不是物理常数,是「有云、有海、有冰」的结果——
26
+ * 换一颗行星就完全不同。所以每个 calibrated 条目都写明适用域。
27
+ *
28
+ * ## 收录标准
29
+ *
30
+ * 只收**有可靠观测或可靠理论**的样本,不收「疑似存在的系外行星」。
31
+ * 数值给到有效位数为止,不假装精确——观测误差本来就大。
32
+ *
33
+ * @module dsh-math-calculator/body-catalog
34
+ */
35
+ // ════════════════════════════════════════════════════════════════════
36
+ // 恒星:补齐亮度级(原目录只有 V 主序,这是最大缺口)
37
+ // ════════════════════════════════════════════════════════════════════
38
+ /**
39
+ * 各亮度级的代表性恒星。
40
+ *
41
+ * ## 为什么必须补这一层
42
+ *
43
+ * 原 `star-catalog.ts` 只有主序星(V)。而同样光谱字母的巨星比主序星亮
44
+ * 20—100 倍 —— 作者写「F5-IIIa」时,用 F5V 顶替会让平衡温度差出几百开
45
+ * (实测:0.98 AU 处 257 K vs 576 K,从冰封翻到熔融)。
46
+ *
47
+ * 下面这些是各亮度级里最有名的样本,可直接拿来当参照。
48
+ */
49
+ export const NAMED_STARS = [
50
+ {
51
+ id: 'sun',
52
+ name: '太阳',
53
+ kind: 'star',
54
+ spectralType: 'G2V',
55
+ luminosityClass: 'V',
56
+ summary: '我们的恒星。亮度稳定、紫外温和,是「复杂生命有时间演化」的参照基准。',
57
+ luminositySun: { value: 1, unit: 'L☉', dependence: 'scaled', source: 'IAU 2015 标称值' },
58
+ massSun: { value: 1, unit: 'M☉', dependence: 'first-principles', source: 'IAU 标称' },
59
+ radiusSun: { value: 1, unit: 'R☉', dependence: 'first-principles', source: 'IAU 标称' },
60
+ effectiveTempK: { value: 5772, unit: 'K', dependence: 'scaled', uncertainty: 0.5, source: 'IAU 2015' },
61
+ albedo: undefined,
62
+ notes: '所有「1 倍地球」参数的锚点。注意有效温度 5772 K 与「表面温度 5778 K」略有差别,前者是斯特藩-玻尔兹曼反解值。',
63
+ },
64
+ {
65
+ id: 'proxima-centauri',
66
+ name: '比邻星',
67
+ kind: 'star',
68
+ spectralType: 'M5.5V',
69
+ luminosityClass: 'V',
70
+ summary: '离太阳最近的恒星,深红矮星。极暗、极长寿,但耀斑狂暴。',
71
+ luminositySun: { value: 0.0017, unit: 'L☉', dependence: 'scaled', uncertainty: 0.0002, source: 'Gaia DR2' },
72
+ massSun: { value: 0.122, unit: 'M☉', dependence: 'first-principles', uncertainty: 0.002, source: 'Gaia DR2' },
73
+ radiusSun: { value: 0.154, unit: 'R☉', dependence: 'first-principles', uncertainty: 0.004, source: '干涉测量' },
74
+ effectiveTempK: { value: 3042, unit: 'K', dependence: 'scaled', uncertainty: 50, source: '光谱拟合' },
75
+ notes: '宜居带约 0.03—0.06 AU(只有太阳系的 1/20)。行星会被潮汐锁定,且处于耀斑轰击下——「一面永昼一面永夜 + 大气被剥离」是这类世界的典型难题。',
76
+ },
77
+ {
78
+ id: 'trappist-1',
79
+ name: 'TRAPPIST-1',
80
+ kind: 'star',
81
+ spectralType: 'M8V',
82
+ luminosityClass: 'V',
83
+ summary: '一颗超冷矮星,却有 7 颗类地行星紧绕——系外行星系统的经典样本。',
84
+ luminositySun: { value: 0.000553, unit: 'L☉', dependence: 'scaled', uncertainty: 1e-4, source: 'Gillon 2017' },
85
+ massSun: { value: 0.089, unit: 'M☉', dependence: 'first-principles', uncertainty: 0.006, source: 'Gillon 2017' },
86
+ radiusSun: { value: 0.121, unit: 'R☉', dependence: 'first-principles', uncertainty: 0.003, source: 'Gillon 2017' },
87
+ effectiveTempK: { value: 2566, unit: 'K', dependence: 'scaled', uncertainty: 26, source: 'Gillon 2017' },
88
+ notes: '7 颗行星轨道都在 0.06 AU 以内,全部可能潮汐锁定。这是「紧凑多行星系统」的极端案例。',
89
+ },
90
+ {
91
+ id: 'F5-giant-example',
92
+ name: 'F 型巨星(参考)',
93
+ kind: 'star',
94
+ spectralType: 'F5III',
95
+ luminosityClass: 'III',
96
+ summary: '次巨星/巨星阶段的 F 型星。注意:同样光谱字母,它比 F5V 主序星亮 20—30 倍,半径大 5—10 倍。',
97
+ luminositySun: { value: 25, unit: 'L☉', dependence: 'scaled', uncertainty: 10, source: '光谱型典型值(个体差异大)' },
98
+ massSun: { value: 1.5, unit: 'M☉', dependence: 'first-principles', uncertainty: 0.3, source: '演化模型' },
99
+ radiusSun: { value: 4.5, unit: 'R☉', dependence: 'first-principles', uncertainty: 1.5, source: '光谱型典型值' },
100
+ effectiveTempK: { value: 6500, unit: 'K', dependence: 'scaled', uncertainty: 200, source: '光谱型典型值' },
101
+ notes: '这是最关键的一条:主序星目录里的 F5V(1.4 L☉)绝不能用来代表 F5III(约 25 L☉)。' +
102
+ '在 0.98 AU 处,前者给出平衡温度 257 K(冻结),后者 576 K(铅会熔化)。',
103
+ },
104
+ {
105
+ id: 'K5-giant-example',
106
+ name: 'K 型巨星(参考)',
107
+ kind: 'star',
108
+ spectralType: 'K5III',
109
+ luminosityClass: 'III',
110
+ summary: '橙色巨星。体积巨大、表面温度低但总光度高,宜居带推到几个 AU 之外。',
111
+ luminositySun: { value: 400, unit: 'L☉', dependence: 'scaled', uncertainty: 150, source: '光谱型典型值' },
112
+ massSun: { value: 1.2, unit: 'M☉', dependence: 'first-principles', uncertainty: 0.2, source: '演化模型' },
113
+ radiusSun: { value: 30, unit: 'R☉', dependence: 'first-principles', uncertainty: 10, source: '光谱型典型值' },
114
+ effectiveTempK: { value: 4000, unit: 'K', dependence: 'scaled', uncertainty: 150, source: '光谱型典型值' },
115
+ notes: '比 K5V 主序星亮约 500 倍。作者写「橙色太阳」时若想的是巨星,宜居带在 19—33 AU,不是 0.4—0.7 AU。',
116
+ },
117
+ {
118
+ id: 'betelgeuse-like',
119
+ name: '红超巨星(参宿四类)',
120
+ kind: 'star',
121
+ spectralType: 'M1-2Ia',
122
+ luminosityClass: 'I',
123
+ summary: '濒死的红超巨星。极亮、极不稳定、寿命只有几百万年,随时可能超新星爆发。',
124
+ luminositySun: { value: 1e5, unit: 'L☉', dependence: 'scaled', uncertainty: 5e4, source: '干涉测量 + 模型' },
125
+ massSun: { value: 16, unit: 'M☉', dependence: 'first-principles', uncertainty: 6, source: '演化模型' },
126
+ radiusSun: { value: 760, unit: 'R☉', dependence: 'first-principles', uncertainty: 100, source: '干涉测量' },
127
+ effectiveTempK: { value: 3600, unit: 'K', dependence: 'scaled', uncertainty: 200, source: '光谱拟合' },
128
+ notes: '半径约 760 倍太阳半径 —— 放在太阳位置,表面会伸到火星轨道之外。' +
129
+ '这类星不适合「稳定世界」设定,但适合「末世」「即将爆发的威胁」叙事。',
130
+ },
131
+ {
132
+ id: 'sirius-b-like',
133
+ name: '白矮星(天狼星 B 类)',
134
+ kind: 'star',
135
+ spectralType: 'DA2',
136
+ luminosityClass: 'D',
137
+ summary: '恒星残骸。地球大小却有太阳质量,表面重力是地球的十万倍。',
138
+ luminositySun: { value: 0.056, unit: 'L☉', dependence: 'scaled', source: '天狼星 B 观测值' },
139
+ massSun: { value: 1.02, unit: 'M☉', dependence: 'first-principles', uncertainty: 0.02, source: '天狼星 B 观测值' },
140
+ radiusSun: { value: 0.0084, unit: 'R☉', dependence: 'first-principles', uncertainty: 0.0002, source: '天狼星 B 观测值' },
141
+ effectiveTempK: { value: 25000, unit: 'K', dependence: 'scaled', uncertainty: 500, source: '天狼星 B 观测值' },
142
+ notes: '半径只有约 5800 km(比地球还小)。这类星没有宜居带可言,但它发出的强紫外会' +
143
+ '照亮伴星的行星——写「双星系统」时它是那种「夜里能给行星投下强光的伴星」。',
144
+ },
145
+ ];
146
+ // ════════════════════════════════════════════════════════════════════
147
+ // 行星:太阳系 + 代表性系外行星
148
+ // ════════════════════════════════════════════════════════════════════
149
+ /**
150
+ * 行星样本。
151
+ *
152
+ * 太阳系 8 颗 + 代表性系外行星。数值全部带 dependence 标记:
153
+ * 质量与半径是 first-principles(改常数不会让火星变重),
154
+ * 平衡温度与反照率是 calibrated(只在与观测匹配的大气模型下可信)。
155
+ */
156
+ export const NAMED_PLANETS = [
157
+ // ── 太阳系 ──
158
+ {
159
+ id: 'mercury',
160
+ name: '水星',
161
+ kind: 'planet-terrestrial',
162
+ host: 'sun',
163
+ summary: '最靠内的小行星。没有大气,昼侧可以熔化铅,夜侧接近绝对零度。',
164
+ semiMajorAxisAU: { value: 0.387, unit: 'AU', dependence: 'first-principles', source: 'JPL 星历' },
165
+ massEarth: { value: 0.055, unit: 'M⊕', dependence: 'first-principles', source: 'JPL 星历' },
166
+ radiusEarth: { value: 0.383, unit: 'R⊕', dependence: 'first-principles', source: 'JPL 星历' },
167
+ surfaceGravityG: { value: 0.378, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
168
+ equilibriumTempK: { value: 440, unit: 'K', dependence: 'calibrated', domain: '无大气、黑体近似', source: '辐射平衡理论' },
169
+ surfaceTempK: { value: 700, unit: 'K', dependence: 'calibrated', domain: '无大气岩石表面、实测昼侧', uncertainty: 100, source: '实测昼侧' },
170
+ albedo: { value: 0.088, unit: '', dependence: 'contingent', source: '观测' },
171
+ rotationHours: { value: 1407.6, unit: 'h', dependence: 'first-principles', source: '观测' },
172
+ obliquityDeg: { value: 0.034, unit: '°', dependence: 'contingent', source: '观测' },
173
+ eccentricity: { value: 0.2056, unit: '', dependence: 'contingent', source: 'JPL' },
174
+ pressureAtm: { value: 0, unit: 'atm', dependence: 'contingent', source: '观测' },
175
+ atmosphere: '几乎无(极稀薄外逸层)',
176
+ notes: '无大气 → 昼夜温差可达 600 K。这类世界不可能有液态水,是最干净的「死寂岩石」样本。',
177
+ },
178
+ {
179
+ id: 'venus',
180
+ name: '金星',
181
+ kind: 'planet-terrestrial',
182
+ host: 'sun',
183
+ summary: '失控温室的反面教材。地表 464°C、92 个大气压,比水星更热。',
184
+ semiMajorAxisAU: { value: 0.723, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
185
+ massEarth: { value: 0.815, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
186
+ radiusEarth: { value: 0.949, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
187
+ surfaceGravityG: { value: 0.907, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
188
+ equilibriumTempK: { value: 227, unit: 'K', dependence: 'calibrated', domain: '黑体近似', source: '辐射平衡' },
189
+ surfaceTempK: { value: 737, unit: 'K', dependence: 'calibrated', domain: '92 atm CO₂ 大气、实测地表', uncertainty: 2, source: '探测器实测' },
190
+ albedo: { value: 0.77, unit: '', dependence: 'contingent', source: '观测(硫酸云)' },
191
+ rotationHours: { value: 5832, unit: 'h', dependence: 'first-principles', source: '观测' },
192
+ obliquityDeg: { value: 177.4, unit: '°', dependence: 'contingent', source: '观测' },
193
+ pressureAtm: { value: 92, unit: 'atm', dependence: 'contingent', source: '探测器实测' },
194
+ atmosphere: 'CO₂ 96.5%、N₂ 3.5%',
195
+ notes: '平衡温度只有 227 K(该比地球冷),实际地表 737 K —— 温室增温超过 500 K。' +
196
+ '这是「同样的日照,温室效应能让结论彻底翻转」的极端案例。写 Boss 的荒漠世界时拿它当上限参照。',
197
+ },
198
+ {
199
+ id: 'earth',
200
+ name: '地球',
201
+ kind: 'planet-terrestrial',
202
+ host: 'sun',
203
+ summary: '唯一确认有复杂生命的行星。所有「1 倍」参数的锚点。',
204
+ semiMajorAxisAU: { value: 1, unit: 'AU', dependence: 'first-principles', source: 'IAU 2012' },
205
+ massEarth: { value: 1, unit: 'M⊕', dependence: 'first-principles', source: 'IAU' },
206
+ radiusEarth: { value: 1, unit: 'R⊕', dependence: 'first-principles', source: 'IAU' },
207
+ surfaceGravityG: { value: 1, unit: 'g', dependence: 'first-principles', source: 'wgs84 名义 9.80665 m/s²' },
208
+ equilibriumTempK: { value: 255, unit: 'K', dependence: 'calibrated', domain: '黑体近似、反照率 0.30', source: '辐射平衡' },
209
+ surfaceTempK: { value: 288, unit: 'K', dependence: 'calibrated', domain: '有海有云的温室平衡、实测全球均值', uncertainty: 0.5, source: '实测全球均值' },
210
+ albedo: { value: 0.306, unit: '', dependence: 'contingent', domain: '有云、有海、有冰', source: 'Bond 反照率' },
211
+ rotationHours: { value: 23.934, unit: 'h', dependence: 'first-principles', source: '观测' },
212
+ obliquityDeg: { value: 23.44, unit: '°', dependence: 'contingent', source: '观测' },
213
+ pressureAtm: { value: 1, unit: 'atm', dependence: 'contingent', source: '观测' },
214
+ atmosphere: 'N₂ 78.08%、O₂ 20.95%、Ar 0.93%、CO₂ 0.04%',
215
+ notes: '反照率 0.306 不是物理常数,是「恰好有这么多云和冰」的结果 —— ' +
216
+ '换一颗行星这个数会完全不同,所以它标 contingent 而不是 first-principles。',
217
+ },
218
+ {
219
+ id: 'mars',
220
+ name: '火星',
221
+ kind: 'planet-terrestrial',
222
+ host: 'sun',
223
+ summary: '稀薄 CO₂ 大气的寒冷荒漠。有液态卤水但无地表稳定液态水。',
224
+ semiMajorAxisAU: { value: 1.524, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
225
+ massEarth: { value: 0.107, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
226
+ radiusEarth: { value: 0.532, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
227
+ surfaceGravityG: { value: 0.379, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
228
+ equilibriumTempK: { value: 210, unit: 'K', dependence: 'calibrated', domain: '黑体近似、反照率 0.25', source: '辐射平衡' },
229
+ surfaceTempK: { value: 210, unit: 'K', dependence: 'calibrated', domain: '稀薄 CO₂ 大气、实测全球均值', uncertainty: 10, source: '实测均值' },
230
+ albedo: { value: 0.25, unit: '', dependence: 'contingent', source: '观测' },
231
+ rotationHours: { value: 24.62, unit: 'h', dependence: 'first-principles', source: '观测' },
232
+ obliquityDeg: { value: 25.19, unit: '°', dependence: 'contingent', source: '观测' },
233
+ pressureAtm: { value: 0.006, unit: 'atm', dependence: 'contingent', source: '探测器实测' },
234
+ atmosphere: 'CO₂ 95%、N₂ 3%、Ar 1.6%',
235
+ notes: '均温 210 K 低于水冰点,但仍有液态卤水 —— 所以「温度极端」不等于「不可能有化学」。' +
236
+ '这正是死寂判定里「冻结算 marginal、不算 dead」的由来。',
237
+ },
238
+ {
239
+ id: 'jupiter',
240
+ name: '木星',
241
+ kind: 'planet-gas-giant',
242
+ host: 'sun',
243
+ summary: '最大的行星。气态巨行星,没有固体表面,重力 2.5 g。',
244
+ semiMajorAxisAU: { value: 5.204, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
245
+ massEarth: { value: 317.8, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
246
+ radiusEarth: { value: 11.21, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
247
+ surfaceGravityG: { value: 2.528, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算(参考面)' },
248
+ rotationHours: { value: 9.925, unit: 'h', dependence: 'first-principles', source: '观测' },
249
+ obliquityDeg: { value: 3.13, unit: '°', dependence: 'contingent', source: '观测' },
250
+ pressureAtm: { value: 1, unit: 'atm', dependence: 'contingent', domain: '取 1 atm 等压面', source: '约定' },
251
+ atmosphere: 'H₂ 90%、He 10%',
252
+ notes: '气态巨行星没有「表面」——1 bar 等压面只是约定。写「木星上有陆地」需要先解决浮力问题。' +
253
+ '它的 67 颗卫星里有 4 颗类地大小的(木卫二、三、四、一),是「卫星上可能有生命」的主要候选。',
254
+ },
255
+ {
256
+ id: 'saturn',
257
+ name: '土星',
258
+ kind: 'planet-gas-giant',
259
+ host: 'sun',
260
+ summary: '第二大行星,最壮观的行星环。密度比水还低。',
261
+ semiMajorAxisAU: { value: 9.583, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
262
+ massEarth: { value: 95.2, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
263
+ radiusEarth: { value: 9.45, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
264
+ surfaceGravityG: { value: 1.065, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算(参考面)' },
265
+ rotationHours: { value: 10.66, unit: 'h', dependence: 'first-principles', source: '观测' },
266
+ obliquityDeg: { value: 26.73, unit: '°', dependence: 'contingent', source: '观测' },
267
+ pressureAtm: { value: 1, unit: 'atm', dependence: 'contingent', domain: '取 1 atm 等压面', source: '约定' },
268
+ atmosphere: 'H₂ 96%、He 3%',
269
+ notes: '平均密度只有 687 kg/m³,比水还低 —— 理论上「有足够大的水池它能浮起来」。' +
270
+ '写架空世界时这是「低密度巨型行星」的现实参照。',
271
+ },
272
+ {
273
+ id: 'uranus',
274
+ name: '天王星',
275
+ kind: 'planet-ice-giant',
276
+ host: 'sun',
277
+ summary: '「躺着自转」的冰巨星。轴倾角 98°,两极轮流经历 42 年白昼。',
278
+ semiMajorAxisAU: { value: 19.19, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
279
+ massEarth: { value: 14.5, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
280
+ radiusEarth: { value: 4.01, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
281
+ surfaceGravityG: { value: 0.886, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
282
+ rotationHours: { value: 17.24, unit: 'h', dependence: 'first-principles', source: '观测' },
283
+ obliquityDeg: { value: 97.77, unit: '°', dependence: 'contingent', source: '观测' },
284
+ pressureAtm: { value: 1, unit: 'atm', dependence: 'contingent', domain: '取 1 atm 等压面', source: '约定' },
285
+ atmosphere: 'H₂ 83%、He 15%、CH₄ 2%',
286
+ notes: '轴倾角 98° 意味着它几乎「躺着」公转 —— 每个极区会连续 42 年被照、再 42 年不见太阳。' +
287
+ '这是「极端季节」的现成样本,比双星或偏心轨道更省事就能写出怪季节。',
288
+ },
289
+ {
290
+ id: 'neptune',
291
+ name: '海王星',
292
+ kind: 'planet-ice-giant',
293
+ host: 'sun',
294
+ summary: '最远的行星。风速可达 2100 km/h,是太阳系里最狂暴的天气。',
295
+ semiMajorAxisAU: { value: 30.07, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
296
+ massEarth: { value: 17.1, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
297
+ radiusEarth: { value: 3.88, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
298
+ surfaceGravityG: { value: 1.137, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
299
+ rotationHours: { value: 16.11, unit: 'h', dependence: 'first-principles', source: '观测' },
300
+ obliquityDeg: { value: 28.32, unit: '°', dependence: 'contingent', source: '观测' },
301
+ pressureAtm: { value: 1, unit: 'atm', dependence: 'contingent', domain: '取 1 atm 等压面', source: '约定' },
302
+ atmosphere: 'H₂ 80%、He 19%、CH₄ 1.5%',
303
+ notes: '离太阳 30 AU,接收的辐照只有地球的 1/900,但它的大气活动比木星还剧烈 —— ' +
304
+ '「离恒星远 = 平静」是错的,内部热源让它可以很狂暴。',
305
+ },
306
+ {
307
+ id: 'europa',
308
+ name: '木卫二(欧罗巴)',
309
+ kind: 'moon',
310
+ host: 'jupiter',
311
+ summary: '冰壳之下有全球性液态海洋。可能是太阳系除地球外最有希望有生命的地方。',
312
+ semiMajorAxisAU: { value: 0.004485, unit: 'AU', dependence: 'first-principles', source: 'JPL(木星距 671000 km)' },
313
+ massEarth: { value: 0.008, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
314
+ radiusEarth: { value: 0.245, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
315
+ surfaceGravityG: { value: 0.134, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
316
+ surfaceTempK: { value: 103, unit: 'K', dependence: 'calibrated', domain: '冰壳表面、潮汐加热未计入', uncertainty: 10, source: '实测赤道温度' },
317
+ albedo: { value: 0.67, unit: '', dependence: 'contingent', source: '观测' },
318
+ pressureAtm: { value: 0, unit: 'atm', dependence: 'contingent', source: '几乎无' },
319
+ atmosphere: '极稀薄 O₂(辐射分解产生)',
320
+ tidallyLocked: true,
321
+ notes: '表面 103 K 是冰,但潮汐加热让冰下有液态海洋 —— 这说明「只看表面温度判宜居」会漏掉整个类别。' +
322
+ '潮汐锁定(永朝木星)在这类卫星上是常态。',
323
+ },
324
+ {
325
+ id: 'titan',
326
+ name: '土卫六(泰坦)',
327
+ kind: 'moon',
328
+ host: 'saturn',
329
+ summary: '有厚氮大气和液态甲烷湖。唯一有稠密大气的卫星。',
330
+ semiMajorAxisAU: { value: 0.008168, unit: 'AU', dependence: 'first-principles', source: 'JPL(土星距 1221870 km)' },
331
+ massEarth: { value: 0.0225, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
332
+ radiusEarth: { value: 0.404, unit: 'R⊕', dependence: 'first-principles', source: 'JPL' },
333
+ surfaceGravityG: { value: 0.138, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
334
+ surfaceTempK: { value: 94, unit: 'K', dependence: 'calibrated', domain: '稠密 N₂ 大气、惠更斯号单点实测', uncertainty: 2, source: '惠更斯号实测' },
335
+ pressureAtm: { value: 1.45, unit: 'atm', dependence: 'contingent', source: '惠更斯号实测' },
336
+ atmosphere: 'N₂ 95%、CH₄ 5%',
337
+ tidallyLocked: true,
338
+ notes: '气压比地球还高,但温度只有 94 K —— 有厚大气不代表能住人。' +
339
+ '液态甲烷湖说明「溶剂」不必是水,这是架空世界里「非水生命」的现实依据。',
340
+ },
341
+ {
342
+ id: 'enceladus',
343
+ name: '土卫二(恩克拉多斯)',
344
+ kind: 'moon',
345
+ host: 'saturn',
346
+ summary: '南极有冰喷泉的微小卫星。喷出的水汽说明冰下有海洋。',
347
+ semiMajorAxisAU: { value: 0.00159, unit: 'AU', dependence: 'first-principles', source: 'JPL(土星距 238000 km)' },
348
+ massEarth: { value: 0.000018, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
349
+ radiusEarth: { value: 0.0394, unit: 'R⊕', dependence: 'first-principles', source: 'JPL(252 km)' },
350
+ surfaceGravityG: { value: 0.0113, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
351
+ surfaceTempK: { value: 75, unit: 'K', dependence: 'calibrated', domain: '冰面、南极喷泉区', uncertainty: 5, source: '观测' },
352
+ albedo: { value: 0.81, unit: '', dependence: 'contingent', source: '观测(极高反照率)' },
353
+ tidallyLocked: true,
354
+ notes: '半径只有 252 km,重力 0.011 g —— 在上面跳一下能跳过一座山。',
355
+ },
356
+ // ── 代表性系外行星 ──
357
+ {
358
+ id: 'kepler-1649c',
359
+ name: '开普勒-1649c',
360
+ kind: 'planet-terrestrial',
361
+ host: 'kepler-1649',
362
+ summary: '目前已知最接近地球大小的宜居带系外行星之一(半径 1.06 R⊕)。',
363
+ semiMajorAxisAU: { value: 0.0649, unit: 'AU', dependence: 'first-principles', source: 'NASA 确认 2020' },
364
+ radiusEarth: { value: 1.06, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.1, source: '凌星法' },
365
+ massEarth: undefined,
366
+ equilibriumTempK: { value: 234, unit: 'K', dependence: 'calibrated', uncertainty: 20, domain: '假定地球型反照率', source: '推算' },
367
+ notes: '质量未知(凌星法只给半径)。这提醒一件事:系外行星的很多参数是**推算**不是**实测**,' +
368
+ '写设定时别把推算值当成确定事实。',
369
+ },
370
+ {
371
+ id: 'gj-1132b',
372
+ name: 'GJ 1132b',
373
+ kind: 'planet-terrestrial',
374
+ host: 'gj-1132',
375
+ summary: '一颗受强辐照的类地行星,可能拥有二次大气。',
376
+ semiMajorAxisAU: { value: 0.0153, unit: 'AU', dependence: 'first-principles', source: '观测' },
377
+ massEarth: { value: 1.6, unit: 'M⊕', dependence: 'first-principles', uncertainty: 0.5, source: '径向速度' },
378
+ radiusEarth: { value: 1.16, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.1, source: '凌星法' },
379
+ equilibriumTempK: { value: 580, unit: 'K', dependence: 'calibrated', domain: '假定地球型反照率、无大气修正', uncertainty: 50, source: '推算' },
380
+ notes: '平衡温度 580 K —— 即使有大气也远超水的沸点,是「热岩石行星」。',
381
+ },
382
+ {
383
+ id: '55-cancri-e',
384
+ name: '55 Cancri e',
385
+ kind: 'planet-super-earth',
386
+ host: '55-cancri',
387
+ summary: '超级地球,极靠内。昼侧可能熔岩遍野。',
388
+ semiMajorAxisAU: { value: 0.0154, unit: 'AU', dependence: 'first-principles', source: '观测' },
389
+ massEarth: { value: 8, unit: 'M⊕', dependence: 'first-principles', uncertainty: 1, source: '径向速度' },
390
+ radiusEarth: { value: 1.9, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.1, source: '凌星法' },
391
+ surfaceGravityG: { value: 2.2, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
392
+ equilibriumTempK: { value: 1600, unit: 'K', dependence: 'calibrated', domain: '假定低反照率熔岩表面', uncertainty: 200, source: '推算' },
393
+ notes: '8 倍质量、1.9 倍半径 → 重力 2.2 g。这是「超级地球」的典型:重力偏大,生物形态会完全不同。',
394
+ },
395
+ {
396
+ id: 'gj-1214b',
397
+ name: 'GJ 1214b',
398
+ kind: 'planet-mini-neptune',
399
+ host: 'gj-1214',
400
+ summary: '典型的海王星型小行星:有厚氢氦包层,密度低。',
401
+ semiMajorAxisAU: { value: 0.0149, unit: 'AU', dependence: 'first-principles', source: '观测' },
402
+ massEarth: { value: 6.55, unit: 'M⊕', dependence: 'first-principles', uncertainty: 1, source: '径向速度' },
403
+ radiusEarth: { value: 2.68, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.2, source: '凌星法' },
404
+ surfaceGravityG: { value: 0.91, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
405
+ notes: '注意:质量 6.55 M⊕ 但重力只有 0.91 g(比地球还小)—— 因为它又大又「蓬松」。' +
406
+ '这打破了「质量大 = 重力大」的直觉,写设定时容易搞错。',
407
+ },
408
+ {
409
+ id: 'hd-189733b',
410
+ name: 'HD 189733b',
411
+ kind: 'planet-gas-giant',
412
+ host: 'hd-189733',
413
+ summary: '热木星。离恒星极近,被强烈加热,大气在逃逸。',
414
+ semiMajorAxisAU: { value: 0.0314, unit: 'AU', dependence: 'first-principles', source: '观测' },
415
+ massEarth: { value: 360, unit: 'M⊕', dependence: 'first-principles', uncertainty: 20, source: '径向速度' },
416
+ radiusEarth: { value: 13.2, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.5, source: '凌星法' },
417
+ equilibriumTempK: { value: 1200, unit: 'K', dependence: 'calibrated', domain: '均匀再辐射、零反照率假定', uncertainty: 100, source: '推算' },
418
+ notes: '热木星是「行星可以被恒星烤到膨胀」的证明 —— 半径比木星还大,因为它被加热膨胀了。',
419
+ },
420
+ ];
421
+ // ════════════════════════════════════════════════════════════════════
422
+ // 小天体:矮行星、小行星、柯伊伯带天体
423
+ // ════════════════════════════════════════════════════════════════════
424
+ /** 矮行星与小天体样本。 */
425
+ export const NAMED_SMALL_BODIES = [
426
+ {
427
+ id: 'ceres',
428
+ name: '谷神星',
429
+ kind: 'dwarf-planet',
430
+ host: 'sun',
431
+ summary: '小行星带里最大的天体。可能有地下冰与盐层。',
432
+ semiMajorAxisAU: { value: 2.77, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
433
+ massEarth: { value: 0.00016, unit: 'M⊕', dependence: 'first-principles', source: '观测' },
434
+ radiusEarth: { value: 0.0738, unit: 'R⊕', dependence: 'first-principles', source: '观测(470 km)' },
435
+ surfaceGravityG: { value: 0.029, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
436
+ notes: '重力 0.029 g —— 在上面扔一块石头能绕它飞很远。',
437
+ },
438
+ {
439
+ id: 'pluto',
440
+ name: '冥王星',
441
+ kind: 'dwarf-planet',
442
+ host: 'sun',
443
+ summary: '柯伊伯带矮行星。有稀薄氮大气和氮冰平原。',
444
+ semiMajorAxisAU: { value: 39.48, unit: 'AU', dependence: 'first-principles', source: 'JPL' },
445
+ massEarth: { value: 0.00218, unit: 'M⊕', dependence: 'first-principles', source: 'JPL' },
446
+ radiusEarth: { value: 0.1868, unit: 'R⊕', dependence: 'first-principles', source: '新视野号(1188 km)' },
447
+ surfaceGravityG: { value: 0.063, unit: 'g', dependence: 'first-principles', source: '由 M/R² 算' },
448
+ surfaceTempK: { value: 44, unit: 'K', dependence: 'calibrated', domain: '稀薄 N₂ 大气、新视野号单点实测', uncertainty: 3, source: '新视野号' },
449
+ pressureAtm: { value: 0.00001, unit: 'atm', dependence: 'contingent', source: '观测' },
450
+ atmosphere: 'N₂ 稀薄',
451
+ tidallyLocked: true,
452
+ notes: '和卫星卡戎潮汐锁定成双星系统 —— 这是「行星与卫星互为对方的卫星」的真实例子。',
453
+ },
454
+ {
455
+ id: 'tunguska-class',
456
+ name: '通古斯级撞击体',
457
+ kind: 'asteroid',
458
+ summary: '直径约 60—80 m 的小行星。空中爆炸可摧毁数百平方公里森林。',
459
+ radiusEarth: { value: 0.0000055, unit: 'R⊕', dependence: 'first-principles', uncertainty: 0.000001, source: '通古斯事件反推' },
460
+ notes: '写「天降火球」时的量级参照。直径 60 m 的石头释放约 10—15 兆吨 TNT,' +
461
+ '但不会造成全球灾变 —— 那是 1 km 以上的级别。',
462
+ },
463
+ ];
464
+ /** 全部带名字的天体(恒星 + 行星 + 小天体)。 */
465
+ export const ALL_NAMED_BODIES = [
466
+ ...NAMED_STARS,
467
+ ...NAMED_PLANETS,
468
+ ...NAMED_SMALL_BODIES,
469
+ ];
470
+ /** 按 id 索引。 */
471
+ export const BODY_INDEX = new Map(ALL_NAMED_BODIES.map((body) => [body.id, body]));
472
+ /** 按类别分组(给检索用)。 */
473
+ export function bodiesByKind(kind) {
474
+ return ALL_NAMED_BODIES.filter((body) => body.kind === kind);
475
+ }
476
+ /**
477
+ * 判断某个量在改物理常数后是否该重算。
478
+ *
479
+ * 为什么单独做成函数:作者(和 AI)最容易犯的错就是
480
+ * 「改了 α 之后把行星质量也跟着改」——质量由引力与初始条件决定,
481
+ * 与精细结构常数几乎无关,改了就是篡改设定。
482
+ *
483
+ * @param dependence - 该量的依赖类别
484
+ * @returns 改常数后是否应重算
485
+ */
486
+ export function shouldRescaleOnConstantChange(dependence) {
487
+ return dependence === 'scaled';
488
+ }