def test_01(self): # Truth values from NASA RP 1046 Value = SA.alt2density(8000) Truth = 0.06011 self.assertLessEqual(RE(Value, Truth), 1e-5)
def __init__(self, h): # Cantera Solution object self.gas = ct.Solution('air.xml') # Discretised altitude steps self.h = h # Average molecular diameter of gas self.d = 4E-10 self.steps = len(h) self.rho = np.zeros(self.steps) self.p = np.zeros(self.steps) self.T = np.zeros(self.steps) self.a = np.zeros(self.steps) self.k = np.zeros(self.steps) self.mu = np.zeros(self.steps) for index, alt in enumerate(self.h): self.rho[index] = atm.alt2density(alt, alt_units='m', density_units='kg/m**3') self.p[index] = atm.alt2press(alt, press_units='pa', alt_units='m') self.T[index] = atm.alt2temp(alt, alt_units='m', temp_units='K') self.a[index] = atm.temp2speed_of_sound(self.T[index], temp_units='K', speed_units='m/s') for index, alt in enumerate(self.h): self.gas.TP = self.T[index], self.p[index] self.k[index] = self.gas.cp / self.gas.cv self.mu[index] = self.gas.viscosity print 'ATMOSPHERIC MODEL COMPUTED (US76)' return None
def test_02(self): # test psf # Truth values from NASA RP 1046 Value = SA.alt2density(49000) Truth = 0.012215 self.assertLessEqual(RE(Value, Truth), 2e-5)
def test_06(self): # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.alt2density(65322, density_units='kg/m**3', alt_units='m') Truth = 1.4296e-4 self.assertLessEqual(RE(Value, Truth), 5e-5)
def test_03(self): # test pa and m # Truth values from NASA RP 1046 Value = SA.alt2density(25000, alt_units='m', density_units='kg/m**3') Truth = 0.039466 self.assertLessEqual(RE(Value, Truth), 1e-5)
def test_07(self): # test units in other order # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.alt2density(80956, density_units='kg/m**3', alt_units='m') Truth = 1.3418e-5 self.assertLessEqual(RE(Value, Truth), 3e-5)
def __init__(self, h, T_thermosphere): # Cantera Solution object self.gas = ct.Solution('air.xml') # Discretised altitude steps self.h = h # Average molecular diameter of gas self.d = 4E-10 # Ratio of specific heats self.steps = len(h) self.rho = np.zeros(self.steps) self.p = np.zeros(self.steps) self.T = np.zeros(self.steps) self.a = np.zeros(self.steps) self.k = np.zeros(self.steps) self.mu = np.zeros(self.steps) # Call Jacchia77 model data = j77.j77sri(np.max(h), T_thermosphere) data_np = np.array(data) h_int = spint.griddata T_int = spint.griddata mw_int = spint.griddata n = spint.griddata for index, alt in enumerate(self.h): self.rho[index] = atm.alt2density(alt, alt_units='m', density_units='kg/m**3') self.p[index] = atm.alt2press(alt, press_units='pa', alt_units='m') self.T[index] = atm.alt2temp(alt, alt_units='m', temp_units='K') self.a[index] = atm.temp2speed_of_sound(self.T[index], temp_units='K', speed_units='m/s') for index, alt in enumerate(self.h): self.gas.TP = self.T[index], self.p[index] self.k[index] = self.gas.cp / self.gas.cv self.mu[index] = self.gas.viscosity return None
def Aerodynamic_Acceleration(self, body): '''Computes the spacecraft's acceleration due to aerodynamic drag whilst encountering the body's atmosphere.''' # Altitude of spacecraft above the body [m] H = self.Altitude(body) # Atmospheric density at this altitude [kg/m^3] try: rho = alt2density(H, alt_units='m', density_units='kg/m**3') except: return 0.0 # Coefficient of drag CD = 2.2 # Planaform area of satellite perpendicular to velocity A = self.area # Velocity vector with respect to body v_vec = self.Position_and_Velocity_WRT(body)[1] # Velocity magnitude with respect to body v = np.linalg.norm(v_vec) # Velocity vector direction from body to spacecraft v_hat = np.divide(v_vec, v) # Most recent mass of spacecraft m = self.masses[-1] # Aerodynamic acceleration of spacecraft due to body's atmosphere aa = (rho * CD * A * v**2 * v_hat) / (2 * m) return aa
# In[193]: Resolution = 2000 Start_Pa = 0.1 # ## Preliminary Calculations # ### The operating environment # The environment in which the aircraft is expected to operate plays a very important role in many of the conceptual design calculations to follow. The conditions corresponding to the current design brief are computed as follows: # In[194]: SeaLevelDens_kgm3 = ISA.alt2density(0, alt_units='ft', density_units='kg/m**3') print('ISA density at Sea level elevation: {:0.3f} kg/m^3'.format( SeaLevelDens_kgm3)) # In[195]: TakeOffDens_kgm3 = ISA.alt2density(TakeOffElevation_m, alt_units='m', density_units='kg/m**3') print('ISA density at take-off elevation: {:0.3f} kg/m^3'.format( TakeOffDens_kgm3)) # In[196]: ClimbAltDens_kgm3 = ISA.alt2density(ROCAlt_m, alt_units='m',