initial commit
This commit is contained in:
commit
f7bca393a1
4 changed files with 788 additions and 0 deletions
52
1d_sim.py
Normal file
52
1d_sim.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
l_barrel = 2 #m
|
||||
d_barrel = 0.2 #m
|
||||
|
||||
l_sabot = 0.03 #m
|
||||
mu_sabot = 0.04
|
||||
|
||||
m_payload = 6 #kg
|
||||
|
||||
vol_chamber = 0.015 #m^3
|
||||
p_chamber = 20e5 #Pa
|
||||
t_chamber = 300 #K
|
||||
gamma = 1.4
|
||||
|
||||
dt = 0.00003
|
||||
|
||||
a_b = d_barrel**2 * np.pi / 4
|
||||
|
||||
def step(t, f, a, v, l, vol, p, temp):
|
||||
global dt
|
||||
ft = a_b * p - mu_sabot*d_barrel*np.pi*l_sabot*p
|
||||
at = ft / m_payload
|
||||
vt = v + at*dt
|
||||
lt = l + vt*dt
|
||||
volt = vol + vt*dt*a_b
|
||||
pt = p * (vol/volt)**gamma
|
||||
tt = t+dt
|
||||
tempt = t_chamber * (vol_chamber/vol)**(gamma-1)
|
||||
return tt, ft, at, vt, lt, volt, pt, tempt
|
||||
|
||||
data = [(
|
||||
0, 0, 0, 0, 0, vol_chamber, p_chamber, t_chamber,
|
||||
),]
|
||||
|
||||
i = 0
|
||||
print(data[0])
|
||||
while data[-1][4] < l_barrel:
|
||||
i+=1
|
||||
print(i)
|
||||
erg = step(*data[-1])
|
||||
data.append(erg)
|
||||
|
||||
print("done")
|
||||
|
||||
tt, ft, at, vt, lt, volt, pt, tempt = np.transpose(data)
|
||||
|
||||
plt.plot(lt, pt/1000)
|
||||
plt.xlabel("Weg ([m]")
|
||||
plt.ylabel("Pressure [bar]")
|
||||
plt.show()
|
||||
477
calc.ipynb
Normal file
477
calc.ipynb
Normal file
File diff suppressed because one or more lines are too long
101
calc.py
Normal file
101
calc.py
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import numpy as np
|
||||
from scipy import constants
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
# Konstanten und Physik
|
||||
|
||||
gasses = {
|
||||
"air": {
|
||||
"c_p": 1.005e3, # J/kgK
|
||||
"c_v": 0.718e3, # J/kgK
|
||||
"m_mol": 28.949e-3 , # kg/mol
|
||||
},
|
||||
}
|
||||
|
||||
gas = gasses['air']
|
||||
temp_r = 273.15+25
|
||||
r_s = constants.R / gas['m_mol']
|
||||
|
||||
|
||||
# Modellparameter
|
||||
|
||||
sample_d = 0.2 #m
|
||||
sample_l = 0.3 #m
|
||||
sample_vel = 100 #m/s
|
||||
sample_m = 6 #kg
|
||||
|
||||
chamber_p = 20e5 # Pa
|
||||
|
||||
sample_a = (sample_d/2)**2 * np.pi
|
||||
sample_v = sample_a * sample_l
|
||||
density = sample_m / sample_v #kg/m³
|
||||
e_kin = sample_m * sample_vel**2 / 2
|
||||
print(f"Probenenergie: {e_kin/1000:.0f} kJ")
|
||||
|
||||
chamber_v = e_kin/ chamber_p
|
||||
# chamber_v = 0.05
|
||||
print(f"Chamber Volume = {chamber_v*1000:.1f} l")
|
||||
|
||||
m_g = chamber_v*chamber_p / (r_s * temp_r)
|
||||
print(f"Gas-Masse = {m_g:.3f} kg = {m_g / (sample_m+m_g) *100:.2f} % der Systemmasse")
|
||||
|
||||
# e_kin = (sample_m * sample_vel**2 / 2) + (m_g * sample_vel**2 /6)
|
||||
# print(f"kinetische System-energie = {e_kin:.0f} J")
|
||||
|
||||
|
||||
## isothermer Ansatz
|
||||
|
||||
e_pot = chamber_p * chamber_v
|
||||
print(f"p V = {e_pot} J")
|
||||
l_f = chamber_v / sample_a
|
||||
print(f"l_f = V_c / A = {l_f:.3f} m")
|
||||
barrel_l = l_f * np.exp(e_kin / e_pot)-l_f
|
||||
print(f"Lauflänge = {barrel_l:.3f} m")
|
||||
|
||||
# Adiabatischer Ansatz
|
||||
|
||||
gamma = gas['c_p']/gas['c_v']
|
||||
print(f"γ = {gamma}")
|
||||
|
||||
l_f = chamber_v / sample_a
|
||||
const = chamber_v*chamber_p *(l_f**(gamma-1)) / (1-gamma)
|
||||
L = (e_kin/const + l_f**(1-gamma))**(1/(1-gamma)) - l_f
|
||||
|
||||
print(f"Lauflänge L = {L:.3f}")
|
||||
|
||||
# Grafiken
|
||||
|
||||
def work(x):
|
||||
return const *((l_f + x)**(1-gamma) - l_f**(1-gamma))
|
||||
|
||||
def vel(x):
|
||||
return np.sqrt(2*work(x) /sample_m)
|
||||
|
||||
def vol(x):
|
||||
return chamber_v + sample_a*x
|
||||
|
||||
t_0 = 273.15+25
|
||||
|
||||
def temp(x):
|
||||
return t_0 * (chamber_v / vol(x))**(gamma-1)
|
||||
|
||||
def pres(x):
|
||||
return e_pot * (chamber_v / vol(x))**(gamma-1) / chamber_v
|
||||
|
||||
|
||||
print(f"L = {L:.3f}")
|
||||
|
||||
l_v = 3
|
||||
print(f"W(x={L:.3f}, p={chamber_p:.0e}) = {work(L):.3f}")
|
||||
print(f"p(x={L:.3f}, p={chamber_p:.0e}) = {pres(L):.2e}")
|
||||
print(f"V(x={L:.3f}, p={chamber_p:.0e}) = {vol(L):.2e}")
|
||||
print(f"ΔT(x={L:.3f}, p={chamber_p:.0e}) = { temp(L):.2f}")
|
||||
|
||||
print(e_kin + vol(L)*pres(L))
|
||||
|
||||
|
||||
l_array = np.linspace(0,L,400)
|
||||
plt.plot(l_array, vel(l_array))
|
||||
plt.ylabel('Speed [m/s]')
|
||||
plt.xlabel('Sample Travel [m]')
|
||||
plt.show()
|
||||
158
sim.ipynb
Normal file
158
sim.ipynb
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue