当前位置: 首页 > news >正文

压强随着时间的变化

import numpy as np
import matplotlib.pyplot as plt# 参数设置
L = 50  # 长度 (m)
D = 4   # 直径 (m)
d = 0.01  # 洞的直径 (m)
P0 = 101300  # 初始压力 (Pa)
P_final = 0.3 * P0  # 最终压力 (Pa)
R = 287  # 理想气体常数 (J/(kg·K))
T = 20 + 273.15  # 温度 (K)
M = 0.029  # 空气的摩尔质量 (kg/mol)# 计算空间站体积和洞的横截面积
V = np.pi * (D / 2) ** 2 * L  # 体积 (m^3)
S = np.pi * (d / 2) ** 2  # 洞的横截面积 (m^2)# 时间设置
dt = 0.1  # 时间步长 (s)
t_max = 10000  # 最大时间 (s)
t = np.arange(0, t_max, dt)# 初始化压力数组
P = np.zeros_like(t)
P[0] = P0# 欧拉法求解
first_choice = True
for n in range(1, len(t)):current_P = P[n-1]# 确保 P(t) 和 P0 之间有足够的差距来进行有效计算if current_P < P0:dP_dt = -S * np.sqrt((2 * R * T / M) * (P0 - current_P) * current_P) / Velse:dP_dt = -0.01  # 如果 pressure 大于初始压力,设为0P[n] = current_P + dP_dt * dtif P[n] < P_final and first_choice:# print(dP_dt)print("t=", n*dt/60/60, "h")first_choice = False# 绘图
plt.plot(t, P / 1000, label='Pressure (kPa)')  # 转换为 kPa
plt.axhline(y=P_final / 1000, color='r', linestyle='--', label='Final Pressure (0.3 atm)')
plt.xlabel('Time (s)')
plt.ylabel('Pressure (kPa)')
plt.title('Pressure vs Time in Space Station')
plt.grid()
plt.legend()
plt.show()

不同直径的洞降低至0.3个大气压所需要的时间

import numpy as np
import matplotlib.pyplot as plt
plt.style.use('default')
# 参数设置
L = 50  # 长度 (m)
D = 4   # 直径 (m)
d = 0.01  # 洞的直径 (m)
P0 = 101300  # 初始压力 (Pa)
P_final = 0.3 * P0  # 最终压力 (Pa)
R = 287  # 理想气体常数 (J/(kg·K))
T = 20 + 273.15  # 温度 (K)
M = 0.029  # 空气的摩尔质量 (kg/mol)# 计算空间站体积和洞的横截面积
V = np.pi * (D / 2) ** 2 * L  # 体积 (m^3)# 时间设置
dt = 0.01  # 时间步长 (s)
t_max = 10000  # 最大时间 (s)
t = np.arange(0, t_max, dt)# 初始化压力数组
P = np.zeros_like(t)
P[0] = P0# 欧拉法求解
def get_result(S):for n in range(1, len(t)):current_P = P[n-1]# 确保 P(t) 和 P0 之间有足够的差距来进行有效计算if current_P < P0:dP_dt = -S * np.sqrt((2 * R * T / M) * (P0 - current_P) * current_P) / Velse:dP_dt = -0.01  # 如果 pressure 大于初始压力,设为0P[n] = current_P + dP_dt * dtif P[n] < P_final:return n*dtresult = {}
for d in np.linspace(0.01, 0.1, num=100):S = np.pi * (d / 2) ** 2  # 洞的横截面积 (m^2)time_stamp = get_result(S)result[d *100] = time_stamp# 绘图
plt.plot(result.keys() , result.values(),label = 'Final Pressure (0.3 atm)')
plt.xlabel('d(cm)')
plt.ylabel('Time (s)')
plt.legend()
plt.title('Time vs d in Space Station')
plt.grid()
plt.show()
http://www.lryc.cn/news/475708.html

相关文章:

  • 2024年大厂AI大模型面试题精选与答案解析
  • Linux开发讲课47--- 详解 Linux 中的虚拟文件系统
  • 全球银行常用英语
  • 新160个crackme -090-tc.12
  • Swagger文档-Unable to scan documentation context default报错
  • SpringKafka生产者、消费者消息拦截
  • Qt报错QOCI driver not loaded且QOCI available的解决方法
  • python mac vscode 脚本文件的运行
  • Linux之du命令
  • WRF-LES与PALM微尺度气象大涡模拟
  • 桌面程序开发框架选择
  • Vue项目开发:Vuex使用,表单验证配置,ESLint关闭与常见问题解决方案
  • 源鲁杯2024赛题复现Web Misc部分WP
  • 【企业微信新版sdk】
  • web安全测试渗透案例知识点总结(下)——小白入狱
  • 【专题】数据库的安全性
  • 【含开题报告+文档+源码】基于Java的房屋租赁服务系统设计与实现
  • 数据结构模拟题[十]
  • Java基于微信小程序的美食推荐系统(附源码,文档)
  • 基于CNN-RNN的影像报告生成
  • MacOS如何读取磁盘原始的扇区内容,恢复误删除的数据
  • 创客匠人:打造IP陷入迷茫?20位大咖直播如何破局,实现财富增长
  • 视觉目标检测标注xml格式文件解析可视化 - python 实现
  • clion远程配置docker ros2
  • 微信小程序 uniapp 腾讯地图的调用
  • OLAP平台架构演化历程
  • OmniGen: Unified Image Generation(代码的复现)
  • keepalive+mysql8双主
  • C#-基础构造函数、析构函数
  • Ubuntu删除docker