Skip to main content

#Rocket Simulation v1.0.3 Simple tool for rocket motor simulation by using python,written by Quix @ZQWEI

##Basic charicteristics 1.The core algorithm were based on the original SRD software(Simple Rccket Designer)

2.Interial ballistic calculation was based on RK Method, and supports the two-phase flow model

3.Thrust calculation support the auto-design of the laval nozzle

4.It also provide the functions to calculate the propellent burnrate from the thrust(see example 3)

##Install Just use pip to install ! :D

pip install rocketsimu

##License MIT License

##Examples ###Example 1:

import rocketsimu as rs
import rocketsimu.motorsimu as ms
from rocketsimu import propellent,grain,nozzle
import matplotlib.pyplot as plt

# 定义药柱参数
R = 0.01  # 药柱外径
r = 0.002  # 药柱内径
rt = 0.002  # 喉管半径
L = 0.05  # 药柱总长
end_faces = 0  # 可燃端面数

total_time = 1.5  # 计算总时间
step_length = 0.0001  # 计算时间步
t_intial = 0  # 初始时间(一般为0)
p_intial = 101325  # 初始压强(一般为大气压)
two_phase_model_swtich = True  # 是否打开两相流模型
nozzle_type = 1  # 选择尾喷管模型
erosion_ratio = 1  # 默认平均侵蚀比

# ms.config_log(True)

propellent_test = rs.propellent.KNSB()  # 定义燃料
grain_test = rs.grain.tube_grain(R, r, rt, end_faces, L, propellent_test, nozzle_type)  # 实例化药柱类
nozzle_test=rs.nozzle.straight_nozzle(effiency=0.9)

P, t = ms.pressure_calc(t_intial, p_intial, step_length, -1, grain_test, two_phase_model_swtich,
                         erosion_ratio)  # 四阶龙格库塔法求解/自动时间步求解
F = ms.thrust_calc(P, grain_test, nozzle_test)
It = ms.impulse_calc(F,t)

# 展示结果
print("Impulse:"+str(It))
plt.plot(t,P)
plt.xlabel("time/s")
plt.ylabel("pressure/MPa")
plt.figure()
plt.plot(t,F)
plt.xlabel("time/s")
plt.ylabel("force/N")
plt.show()

###Example 2:

import rocketsimu as rs
import rocketsimu.motorsimu as ms
from rocketsimu import propellent,grain,nozzle
import matplotlib.pyplot as plt

# 定义药柱参数
R = 0.01  # 药柱外径
r = 0.002  # 药柱内径
rt = 0.002  # 喉管半径
L = 0.05  # 药柱总长
end_faces = 0  # 可燃端面数

total_time = 1.5  # 计算总时间
step_length = 0.0001  # 计算时间步
t_intial = 0  # 初始时间(一般为0)
p_intial = 101325  # 初始压强(一般为大气压)
two_phase_model_swtich = True  # 是否打开两相流模型
nozzle_type = 1  # 选择尾喷管模型
erosion_ratio = 1  # 默认平均侵蚀比

ms.config_log(True)

propellent_test = rs.propellent.KNSB()  # 定义燃料
grain_test = rs.grain.tube_grain(R, r, rt, end_faces, L, propellent_test, nozzle_type)  # 实例化药柱类
laval_nozzle_test=rs.nozzle.laval_nozzle(effiency=0.9,IsCustomized=False) # 实例化拉法尔喷管,指定为自动优化设计类型
straight_nozzle_test=rs.nozzle.straight_nozzle(effiency=0.9)

P, t = ms.pressure_calc(t_intial, p_intial, step_length, -1, grain_test, two_phase_model_swtich,
                         erosion_ratio)  # 四阶龙格库塔法求解/自动时间步求解
F_laval = ms.thrust_calc(P, grain_test, laval_nozzle_test)
F_str = ms.thrust_calc(P, grain_test, straight_nozzle_test)
It_laval = ms.impulse_calc(F_laval,t)
It_str = ms.impulse_calc(F_str,t)

# 展示结果
print("Impulse  Laval vs Straight:\r\n"+str(It_laval)+" vs "+str(It_str))
plt.plot(t,P)
plt.xlabel("time/s")
plt.ylabel("pressure/MPa")
plt.figure()
p1=plt.plot(t,F_laval)
p2=plt.plot(t,F_str)
plt.xlabel("time/s")
plt.ylabel("force/N")
plt.show()

##Example 3:

import rocketsimu as rs
import rocketsimu.motorsimu as ms
from rocketsimu import propellent, grain, nozzle
import matplotlib.pyplot as plt

# 定义药柱参数
R = 0.01  # 药柱外径
r = 0.002  # 药柱内径
rt = 0.002  # 喉管半径
L = 0.05  # 药柱总长
end_faces = 0  # 可燃端面数

total_time = 1.5  # 计算总时间
step_length = 0.0001  # 计算时间步
t_intial = 0  # 初始时间(一般为0)
p_intial = 101325  # 初始压强(一般为大气压)
two_phase_model_swtich = True  # 是否打开两相流模型
nozzle_type = 1  # 选择尾喷管模型
erosion_ratio = 1  # 默认平均侵蚀比

ms.config_log(True)

propellent_test = rs.propellent.KNSB()  # 定义燃料
grain_test = rs.grain.tube_grain(R, r, rt, end_faces, L, propellent_test, nozzle_type)  # 实例化药柱类
nozzle_test = rs.nozzle.straight_nozzle(effiency=0.9)  # 实例化喷管

P, t = ms.pressure_calc(t_intial, p_intial, step_length, -1, grain_test, two_phase_model_swtich,
                        erosion_ratio)  # 四阶龙格库塔法求解/自动时间步求解
F = ms.thrust_calc(P, grain_test, nozzle_test)

# grain_test.pro = rs.propellent.NONE()
P_t2p=ms.thrust2pressure(F,grain_test,nozzle_test.aeat,nozzle_test.effiency)
burnrate_simulated, P_simulated = ms.pro_2phase_perform_calc(P_t2p, t, grain_test, propellent_test.density_gr,
                                                             propellent_test.density_gr,
                                                             propellent_test.k_chamber, propellent_test.cp_fraction,erosion_ratio, propellent_test.c)

burnrate_real, P_real = ms.pro_burnrate_calc(propellent_test)  # 求解两相流燃料性能

# 展示结果
plt.plot(t, P)
plt.xlabel("time/s")
plt.ylabel("pressure/MPa")
plt.figure()
plt.plot(P_real, burnrate_real)
plt.plot(P_simulated, burnrate_simulated)
plt.xlabel("pressure/Pa")
plt.ylabel("burnrate/ms^-1")
plt.show()

Release files for rocketsimu 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rocketsimu 1.0.5
File Size Uploaded
rocketsimu-1.0.5.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rocketsimu 1.0.5
File Interpreter ABI Platform
rocketsimu-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 18.5 kB

Release files / rocketsimu-1.0.5.tar.gz

Download URL rocketsimu-1.0.5.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b47b59895547900e533557e78609e1e726500439bce392e577b1e58a621d5ec0
BLAKE2b-256 checksum
How to use checksums
3da7755f1f7993de072dc1b5c7c08c589158743da49b87e7013be3088e6d0687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3

Release files / rocketsimu-1.0.5-py3-none-any.whl

Download URL rocketsimu-1.0.5-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9f59e0e7cccfb56ddd63d044ab3d13ff09e16eb75574eae86d276fa85048e5f
BLAKE2b-256 checksum
How to use checksums
69c2b4bd59d507d7831ea04f7d8349a3668942ca813bb041926e75ebf7f22a44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page