@jjlmoya/utils-science 1.43.0 → 1.44.0

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 (30) hide show
  1. package/package.json +1 -1
  2. package/src/category/index.ts +2 -1
  3. package/src/entries.ts +3 -1
  4. package/src/index.ts +1 -0
  5. package/src/tests/locale_completeness.test.ts +2 -2
  6. package/src/tests/tool_validation.test.ts +2 -2
  7. package/src/tool/black-hole-event-horizon-simulator/bibliography.astro +14 -0
  8. package/src/tool/black-hole-event-horizon-simulator/bibliography.ts +16 -0
  9. package/src/tool/black-hole-event-horizon-simulator/black-hole-event-horizon-simulator.css +366 -0
  10. package/src/tool/black-hole-event-horizon-simulator/component.astro +302 -0
  11. package/src/tool/black-hole-event-horizon-simulator/entry.ts +29 -0
  12. package/src/tool/black-hole-event-horizon-simulator/i18n/de.ts +179 -0
  13. package/src/tool/black-hole-event-horizon-simulator/i18n/en.ts +259 -0
  14. package/src/tool/black-hole-event-horizon-simulator/i18n/es.ts +259 -0
  15. package/src/tool/black-hole-event-horizon-simulator/i18n/fr.ts +179 -0
  16. package/src/tool/black-hole-event-horizon-simulator/i18n/id.ts +259 -0
  17. package/src/tool/black-hole-event-horizon-simulator/i18n/it.ts +179 -0
  18. package/src/tool/black-hole-event-horizon-simulator/i18n/ja.ts +179 -0
  19. package/src/tool/black-hole-event-horizon-simulator/i18n/ko.ts +259 -0
  20. package/src/tool/black-hole-event-horizon-simulator/i18n/nl.ts +179 -0
  21. package/src/tool/black-hole-event-horizon-simulator/i18n/pl.ts +259 -0
  22. package/src/tool/black-hole-event-horizon-simulator/i18n/pt.ts +179 -0
  23. package/src/tool/black-hole-event-horizon-simulator/i18n/ru.ts +259 -0
  24. package/src/tool/black-hole-event-horizon-simulator/i18n/sv.ts +179 -0
  25. package/src/tool/black-hole-event-horizon-simulator/i18n/tr.ts +179 -0
  26. package/src/tool/black-hole-event-horizon-simulator/i18n/zh.ts +179 -0
  27. package/src/tool/black-hole-event-horizon-simulator/index.ts +11 -0
  28. package/src/tool/black-hole-event-horizon-simulator/logic.ts +68 -0
  29. package/src/tool/black-hole-event-horizon-simulator/seo.astro +15 -0
  30. package/src/tools.ts +2 -0
@@ -0,0 +1,179 @@
1
+ import { bibliography } from '../bibliography';
2
+ import type { ToolLocaleContent } from '../../../types';
3
+
4
+ const slug = 'black-hole-event-horizon-simulator';
5
+ const title = '黑洞事件视界模拟器:施瓦西半径、光子球与时间膨胀';
6
+ const description = '通过交互式的质量、轨道距离、时间膨胀、光子球、逃逸速度和施瓦西半径计算,探索黑洞的事件视界。';
7
+
8
+ const howTo = [
9
+ {
10
+ name: '选择黑洞质量',
11
+ text: '移动质量滑块,从恒星质量黑洞到超大质量黑洞,实时观察施瓦西半径的变化。',
12
+ },
13
+ {
14
+ name: '将探测器移至视界附近',
15
+ text: '以施瓦西半径为单位设置距离,比较安全的外部轨道、光子球区域以及事件视界的边缘。',
16
+ },
17
+ {
18
+ name: '检查相对论效应',
19
+ text: '观察逃逸速度、引力时间膨胀、红移和轨道周期,了解在视界附近直觉为何失效。',
20
+ },
21
+ {
22
+ name: '比较关键半径',
23
+ text: '利用事件视界、光子球和ISCO的参考环,理解非旋转黑洞周围的不同物理边界。',
24
+ },
25
+ ];
26
+
27
+ const faq = [
28
+ {
29
+ question: '什么是黑洞的事件视界?',
30
+ answer: '事件视界是逃逸速度达到光速的边界。一旦物体跨越此界限,包括光在内的任何信号都无法返回外部宇宙。',
31
+ },
32
+ {
33
+ question: '施瓦西半径意味着什么?',
34
+ answer: '施瓦西半径是针对非旋转、不带电黑洞定义的事件视界半径。该半径与质量成正比,即质量加倍,视界半径也加倍。',
35
+ },
36
+ {
37
+ question: '什么是光子球?',
38
+ answer: '光子球位于1.5倍施瓦西半径处,是光线能够以不稳定轨道绕黑洞运行的区域。微小的扰动即会导致光子逃逸或坠入黑洞。',
39
+ },
40
+ {
41
+ question: '什么是ISCO?',
42
+ answer: 'ISCO是"最内层稳定圆形轨道"(Innermost Stable Circular Orbit)的缩写。对于非旋转黑洞,它位于3倍施瓦西半径(即6倍引力半径)处,是有质量粒子能维持的最后稳定轨道。',
43
+ },
44
+ {
45
+ question: '为什么时间膨胀在视界附近会显著增加?',
46
+ answer: '在施瓦西时空中,处于更强引力场中的时钟相对于远处观测者走得更慢。随着探测器接近事件视界,时间膨胀因子趋近于零。',
47
+ },
48
+ {
49
+ question: '这个模拟器能模拟旋转黑洞吗?',
50
+ answer: '不能。本模拟器基于施瓦西度规,假设黑洞不旋转且不带电。真实的黑洞多为旋转黑洞,其自转会改变视界大小、ISCO位置及吸积盘动力学。',
51
+ },
52
+ {
53
+ question: '为什么超大质量黑洞的潮汐力反而较小?',
54
+ answer: '视界处的潮汐梯度随黑洞质量的增加而减小。小型黑洞会在视界附近剧烈撕裂物体,而超大质量黑洞在此处的局部潮汐力相对温和。',
55
+ },
56
+ {
57
+ question: '这是真实的黑洞照片吗?',
58
+ answer: '这是一个教育示意图,而非光线追踪模拟。光环和吸积盘按施瓦西半径缩放,旨在让用户直观比较不同的物理区域。',
59
+ },
60
+ ];
61
+
62
+ export const content: ToolLocaleContent = {
63
+ slug,
64
+ title,
65
+ description,
66
+ ui: {
67
+ visualTitle: '事件视界场图',
68
+ visualCaption: '探测器在缩放后的施瓦西时空中移动。明亮的参考环标记了视界、光子球和最内层稳定圆形轨道。',
69
+ controlsTitle: '黑洞控制',
70
+ eventHorizon: '事件视界',
71
+ photonSphere: '光子球',
72
+ isco: 'ISCO',
73
+ rsLabel: '施瓦西半径',
74
+ diameterLabel: '直径',
75
+ timeLabel: '时间膨胀',
76
+ redshiftLabel: '红移',
77
+ statusSafe: '位于稳定轨道区外',
78
+ statusPhoton: '位于光子球区内',
79
+ statusInside: '视界内',
80
+ diameter: '视界直径',
81
+ lightCrossing: '光穿行时间',
82
+ timeDilation: '相对远处观测者的时钟速率',
83
+ redshift: '引力红移',
84
+ mass: '黑洞质量',
85
+ distance: '探测器距离',
86
+ speed: '轨道速度',
87
+ escapeVelocity: '逃逸速度',
88
+ orbitalPeriod: '轨道周期',
89
+ tidalGradient: '潮汐梯度',
90
+ kilometerUnit: '公里',
91
+ millisecondUnit: '毫秒',
92
+ secondUnit: '秒',
93
+ lightSpeedUnit: '% c',
94
+ tidalUnit: 'g/m',
95
+ solarMassesUnit: '太阳质量',
96
+ rsUnit: 'Rs',
97
+ zeroKilometers: '0 km',
98
+ zeroMilliseconds: '0 ms',
99
+ zeroMultiplier: '0x',
100
+ zeroLightSpeed: '0% c',
101
+ zeroTidal: '0 g/m',
102
+ initialMassOutput: '10 太阳质量',
103
+ initialDistanceOutput: '3.0 Rs',
104
+ initialSpeedOutput: '32% c',
105
+ },
106
+ seo: [
107
+ {
108
+ type: 'title',
109
+ text: '黑洞事件视界模拟器:施瓦西半径、光子球与时间膨胀',
110
+ level: 2,
111
+ },
112
+ {
113
+ type: 'paragraph',
114
+ html: '本模拟器将施瓦西黑洞的核心概念转化为交互式视觉模型。通过调整黑洞质量、移动探测器,用户可以直观比较事件视界、光子球、最内层稳定圆形轨道、逃逸速度、引力红移及时间膨胀的响应关系。',
115
+ },
116
+ {
117
+ type: 'paragraph',
118
+ html: '本工具专为天文爱好者、物理教师及科普探索者设计,通过将数值与空间图表结合,帮助用户理解黑洞的本质:事件视界并非物质表面,为何光子具有特殊的不稳定轨道,以及为何稳定的圆周运动在视界外停止。',
119
+ },
120
+ {
121
+ type: 'title',
122
+ text: '事件视界半径的计算方法',
123
+ level: 3,
124
+ },
125
+ {
126
+ type: 'paragraph',
127
+ html: '对于非旋转、不带电黑洞,其事件视界半径即为<strong>施瓦西半径</strong>。计算公式为<strong>Rs = 2GM / c^2</strong>,其中G为万有引力常数,M为质量,c为光速。1个太阳质量对应的施瓦西半径约为2.95公里。',
128
+ },
129
+ {
130
+ type: 'paragraph',
131
+ html: '施瓦西半径与质量呈线性关系,因此10倍太阳质量的黑洞半径约为29.5公里;而像人马座A*那样400万倍太阳质量的黑洞,其半径约为1180万公里。模拟器采用对数滑块,方便用户同时探索恒星级与超大质量黑洞。',
132
+ },
133
+ {
134
+ type: 'table',
135
+ headers: ['区域', '施瓦西半径倍数', '含义'],
136
+ rows: [
137
+ ['事件视界', '1.0 Rs', '逃逸速度等于光速的单向边界'],
138
+ ['光子球', '1.5 Rs', '光线可在此做不稳定的圆周运动'],
139
+ ['ISCO', '3.0 Rs', '有质量粒子的最内层稳定圆轨道'],
140
+ ['弱引力场', '6 Rs及以上', '引力较弱,轨道易于维持稳定'],
141
+ ],
142
+ },
143
+ ],
144
+ faq,
145
+ bibliography,
146
+ howTo,
147
+ schemas: [
148
+ {
149
+ '@context': 'https://schema.org',
150
+ '@type': 'SoftwareApplication',
151
+ name: title,
152
+ description,
153
+ applicationCategory: 'ScientificApplication',
154
+ operatingSystem: 'Any',
155
+ },
156
+ {
157
+ '@context': 'https://schema.org',
158
+ '@type': 'FAQPage',
159
+ mainEntity: faq.map((item) => ({
160
+ '@type': 'Question',
161
+ name: item.question,
162
+ acceptedAnswer: {
163
+ '@type': 'Answer',
164
+ text: item.answer,
165
+ },
166
+ })),
167
+ },
168
+ {
169
+ '@context': 'https://schema.org',
170
+ '@type': 'HowTo',
171
+ name: title,
172
+ step: howTo.map((step) => ({
173
+ '@type': 'HowToStep',
174
+ name: step.name,
175
+ text: step.text,
176
+ })),
177
+ },
178
+ ],
179
+ };
@@ -0,0 +1,11 @@
1
+ import { blackHoleEventHorizonSimulator } from './entry';
2
+ import type { ToolDefinition } from '../../types';
3
+
4
+ export * from './entry';
5
+
6
+ export const BLACK_HOLE_EVENT_HORIZON_SIMULATOR_TOOL: ToolDefinition = {
7
+ entry: blackHoleEventHorizonSimulator,
8
+ Component: () => import('./component.astro'),
9
+ SEOComponent: () => import('./seo.astro'),
10
+ BibliographyComponent: () => import('./bibliography.astro'),
11
+ };
@@ -0,0 +1,68 @@
1
+ export interface BlackHoleInput {
2
+ massSolar: number;
3
+ distanceMultiplier: number;
4
+ orbitalSpeedFraction: number;
5
+ }
6
+
7
+ export interface BlackHoleResult {
8
+ schwarzschildRadiusKm: number;
9
+ diameterKm: number;
10
+ lightCrossingMs: number;
11
+ photonSphereKm: number;
12
+ iscoKm: number;
13
+ orbitRadiusKm: number;
14
+ escapeVelocityFraction: number;
15
+ timeDilationFactor: number;
16
+ orbitalPeriodMs: number;
17
+ tidalGradientEarthGPerMeter: number;
18
+ gravitationalRedshift: number;
19
+ status: 'inside-horizon' | 'photon-sphere' | 'stable-orbit';
20
+ }
21
+
22
+ const solarSchwarzschildRadiusKm = 2.95325008;
23
+ const lightSpeedKmPerSecond = 299792.458;
24
+ const gravitationalConstant = 6.6743e-11;
25
+ const solarMassKg = 1.98847e30;
26
+ const earthGravity = 9.80665;
27
+
28
+ function clamp(value: number, min: number, max: number) {
29
+ return Math.max(min, Math.min(max, value));
30
+ }
31
+
32
+ function eventHorizonStatus(distanceMultiplier: number): BlackHoleResult['status'] {
33
+ if (distanceMultiplier <= 1) return 'inside-horizon';
34
+ if (distanceMultiplier < 1.5) return 'photon-sphere';
35
+ return 'stable-orbit';
36
+ }
37
+
38
+ export function simulateEventHorizon(input: BlackHoleInput): BlackHoleResult {
39
+ const massSolar = clamp(input.massSolar, 3, 10000000000);
40
+ const distanceMultiplier = clamp(input.distanceMultiplier, 1.02, 12);
41
+ const speedFraction = clamp(input.orbitalSpeedFraction, 0.05, 0.99);
42
+ const schwarzschildRadiusKm = massSolar * solarSchwarzschildRadiusKm;
43
+ const orbitRadiusKm = schwarzschildRadiusKm * distanceMultiplier;
44
+ const relativityTerm = Math.max(0.0001, 1 - schwarzschildRadiusKm / orbitRadiusKm);
45
+ const escapeVelocityFraction = Math.sqrt(schwarzschildRadiusKm / orbitRadiusKm);
46
+ const timeDilationFactor = Math.sqrt(relativityTerm);
47
+ const orbitalCircumferenceKm = 2 * Math.PI * orbitRadiusKm;
48
+ const orbitalPeriodMs = orbitalCircumferenceKm / (speedFraction * lightSpeedKmPerSecond) * 1000;
49
+ const radiusMeters = orbitRadiusKm * 1000;
50
+ const massKg = massSolar * solarMassKg;
51
+ const tidalGradientEarthGPerMeter = 2 * gravitationalConstant * massKg / radiusMeters ** 3 / earthGravity;
52
+ const gravitationalRedshift = 1 / timeDilationFactor - 1;
53
+
54
+ return {
55
+ schwarzschildRadiusKm,
56
+ diameterKm: schwarzschildRadiusKm * 2,
57
+ lightCrossingMs: schwarzschildRadiusKm / lightSpeedKmPerSecond * 1000,
58
+ photonSphereKm: schwarzschildRadiusKm * 1.5,
59
+ iscoKm: schwarzschildRadiusKm * 3,
60
+ orbitRadiusKm,
61
+ escapeVelocityFraction,
62
+ timeDilationFactor,
63
+ orbitalPeriodMs,
64
+ tidalGradientEarthGPerMeter,
65
+ gravitationalRedshift,
66
+ status: eventHorizonStatus(distanceMultiplier),
67
+ };
68
+ }
@@ -0,0 +1,15 @@
1
+ ---
2
+ import { SEORenderer } from '@jjlmoya/utils-shared';
3
+ import { blackHoleEventHorizonSimulator } from './index';
4
+ import type { KnownLocale } from '../../types';
5
+
6
+ interface Props {
7
+ locale?: KnownLocale;
8
+ }
9
+
10
+ const { locale = 'en' } = Astro.props;
11
+ const content = await blackHoleEventHorizonSimulator.i18n[locale]?.();
12
+ if (!content) return null;
13
+ ---
14
+
15
+ {content.seo?.length > 0 && <SEORenderer content={{ locale, sections: content.seo }} />}
package/src/tools.ts CHANGED
@@ -25,6 +25,7 @@ import { CONWAY_LIFE_RULE_LAB_TOOL } from './tool/conway-life-rule-lab/index';
25
25
  import { CRYSTAL_LATTICE_STRUCTURE_FINDER_TOOL } from './tool/crystal-lattice-structure-finder/index';
26
26
  import { FERMI_PARADOX_FILTER_LAB_TOOL } from './tool/fermi-paradox-filter-lab/index';
27
27
  import { EPIDEMIC_SIR_SIMULATOR_TOOL } from './tool/epidemic-sir-simulator/index';
28
+ import { BLACK_HOLE_EVENT_HORIZON_SIMULATOR_TOOL } from './tool/black-hole-event-horizon-simulator/index';
28
29
 
29
30
  export const ALL_TOOLS: ToolDefinition[] = [
30
31
  COLONY_COUNTER_TOOL,
@@ -52,4 +53,5 @@ export const ALL_TOOLS: ToolDefinition[] = [
52
53
  CRYSTAL_LATTICE_STRUCTURE_FINDER_TOOL,
53
54
  FERMI_PARADOX_FILTER_LAB_TOOL,
54
55
  EPIDEMIC_SIR_SIMULATOR_TOOL,
56
+ BLACK_HOLE_EVENT_HORIZON_SIMULATOR_TOOL,
55
57
  ];