提交 33f7d6af 编写于 作者: 三月三net's avatar 三月三net

Python超人-宇宙模拟器

上级 4c67a8b1
...@@ -235,19 +235,22 @@ class HalleyCometSim: ...@@ -235,19 +235,22 @@ class HalleyCometSim:
if not hasattr(self, "comet_peri"): if not hasattr(self, "comet_peri"):
self.comet_peri = d_sun self.comet_peri = d_sun
self.comet_peri_dt = dt.strftime("%Y-%m-%d")
elif d_sun < self.comet_peri: elif d_sun < self.comet_peri:
self.comet_peri = d_sun self.comet_peri = d_sun
self.comet_peri_dt = dt.strftime("%Y-%m-%d")
# 哈雷彗星离太阳最远的点称为 "aphelion of Halley's Comet"(远日点) # 哈雷彗星离太阳最远的点称为 "aphelion of Halley's Comet"(远日点)
if not hasattr(self, "comet_aphel"): if not hasattr(self, "comet_aphel"):
self.comet_aphel = d_sun self.comet_aphel = d_sun
self.comet_aphel_dt = dt.strftime("%Y-%m-%d")
elif d_sun > self.comet_aphel: elif d_sun > self.comet_aphel:
self.comet_aphel = d_sun self.comet_aphel = d_sun
self.comet_aphel_dt = dt.strftime("%Y-%m-%d")
panel_text = "哈雷彗星:\n距离太阳:%.3f AU" % (d_sun / AU) panel_text = "哈雷彗星:\n距离太阳:%.3f AU" % (d_sun / AU)
panel_text += "\n离日最远:%.3f AU" % (self.comet_aphel / AU) panel_text += "\n离日最远:%.3f AU(%s)" % (self.comet_aphel / AU, self.comet_aphel_dt)
panel_text += "\n离日最近:%.3f AU" % (self.comet_peri / AU) panel_text += "\n离日最近:%.3f AU(%s)" % (self.comet_peri / AU, self.comet_peri_dt)
panel_text += "\n距离地球:%.3f AU" % (d_earth / AU) panel_text += "\n距离地球:%.3f AU" % (d_earth / AU)
velocity, _ = get_value_direction_vectors(self.halley_comet.velocity) velocity, _ = get_value_direction_vectors(self.halley_comet.velocity)
panel_text += "\n当前速度:%.3f km/s" % velocity panel_text += "\n当前速度:%.3f km/s" % velocity
...@@ -286,11 +289,42 @@ if __name__ == '__main__': ...@@ -286,11 +289,42 @@ if __name__ == '__main__':
# [3.34, 0, 10.712] 2061-5 # [3.34, 0, 10.712] 2061-5
# [3.34, 0, 10.715] 2061-6-24 # [3.34, 0, 10.715] 2061-6-24
# [3.34, 0, 10.718] 2061-8 # [3.34, 0, 10.718] 2061-8
# init_velocity=[3.34, 0, 10.718],
# init_position=[0, 0.5 * AU, -10 * AU]
# init_velocity=[-3.34, 3, 10.718],
# init_position=[0, -2 * AU, -10 * AU]) \
# 远日点: 35.1 AU(2023年12月9日)
# 近日点: 0.586 AU 上次通过近日点:1986年2月9日 下次通过近日点:2061年7月28日
# 2019年5月6日 34.772
params = HalleyCometParams( params = HalleyCometParams(
start_time='1983-03-20 00:00:00', start_time='1982-09-24 00:00:00',
init_velocity=[3.34, 0, 10.718], init_velocity=[-2.836, 4.705, 8.85],
init_position=[0, 0.5 * AU, -10 * AU] init_position=[0, -5 * AU, -10 * AU]
) )
# start_time='1982-09-24 00:00:00',
# init_velocity=[-2.836, 4.705, 8.85],
# init_position=[0, -5 * AU, -10 * AU]
# 34.801 AU(2019-06-10)
# 35.086 AU(2023-09-01)
# 0.586 AU(1986-02-09)
# start_time='1982-09-24 00:00:00',
# init_velocity=[-2.837, 4.71, 8.852],
# init_position=[0, -5 * AU, -10 * AU]
# 34.840AU34.840 AU(2019-05-10)
# 35.149 AU(2023-10-08)
# 0.586 AU(1986-02-09)
# 35.198 AU(2023-11-07)
# 0.588 AU(1986-02-09)
# start_time='1982-09-24 00:00:00',
# init_velocity=[-2.841, 4.7, 8.86],
# init_position=[0, -5 * AU, -10 * AU]
sim = HalleyCometSim(params) sim = HalleyCometSim(params)
sim.build() sim.build()
......
...@@ -93,8 +93,8 @@ class HalleyCometSim: ...@@ -93,8 +93,8 @@ class HalleyCometSim:
self.halley_comet = HalleComet( self.halley_comet = HalleComet(
# size_scale=4e7, # size_scale=4e7,
size_scale=1e8, size_scale=1e8,
init_velocity=[3.34, 0, 10.718], init_velocity=[-2.836, 4.705, 8.85],
init_position=[0, 0.5 * AU, -10 * AU]) \ init_position=[0, -5 * AU, -10 * AU]) \
.set_light_disable(True) .set_light_disable(True)
self.bodies.append(self.halley_comet) self.bodies.append(self.halley_comet)
......
...@@ -68,8 +68,8 @@ class HalleyCometSim: ...@@ -68,8 +68,8 @@ class HalleyCometSim:
# 每76.1年环绕太阳一周的周期彗星 # 每76.1年环绕太阳一周的周期彗星
self.halley_comet = HalleComet( # size_scale=4e7, self.halley_comet = HalleComet( # size_scale=4e7,
size_scale=1e8, size_scale=1e8,
init_velocity=[3.34, 0, 10.718], init_velocity=[-3.34, 3, 10.718],
init_position=[0, 0.5 * AU, -10 * AU]) \ init_position=[0, -2 * AU, -10 * AU]) \
.set_light_disable(True) .set_light_disable(True)
self.bodies.append(self.halley_comet) self.bodies.append(self.halley_comet)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册