- #1

- 2

- 0

What im doing is building a free/open source rifle 'game' for Blender3d's game engine (python scripting) with moderately accurate ballistics (several approximations, but i should be within 5..10cm at 1km (i.e. functionally, no error)), but iv got out of my league trying to work out the atmospheric density (and there was me thinking that calculating the trajectory would be the hard bit ;)).

(in truth its an art project but iv decided to try to get the bullet physics as close as is practical, some approximation is fine, ditto lookup tables)

**Im trying to determine a single equation for approximating Atmospheric density based on the Altitude, Temperature, Barometric pressure and Humidity**

im starting with something (apparently) simple

DensityOfAir=(AbsolutePressure(air)/(SpecificGasConstant(air)*(Temp(air)+273.15)))+(AbsolutePressure(water)/(SpecificGasConstant(water)*(Temp(water)+273.15)))

i.e. the density will be the total of the two component pressures/sgc*t

instead of calculating the values of specific gas constants (SpecificGasConstant=IdealGasConstant/MolarMassOfGas) i think i can get away with just using:

SGC,dry air = 287.05 J/(kg·K)

SGC,water vapor = 461.495 J/(kg·K)

(these are sea level, standard atmosphere values, but i doubt it will make much difference, please correct me if im wrong)

so, all i need now is to use the humidity to work out the pressures of air/water vapor.... right?

which is where my head starts to hurt.

I think it has something to do with the saturation vapor pressure

SatVapPres = 6.11*10.0**(7.5*Temp/(237.7+Temp))?

and

WaterVapPres = (RelHumid(%)*SatVapPres)/100.0)

but, i simply dont understand what im doing anymore, thus have no clue if im doing it right or not :/

I keep running into lapse rates and other confusing things, and its not helped by wiki pages which dont tell you what the variables are, or the way that many of the equations im finding online simply dont agree with each other and/or dont tell me what units they use (no point plugging Celsius into something expecting Fahrenheit) ;)

im getting very close to just plugging in "AverageDensity(sealevel) = 1.2(kg/m**3)" and walking away :/

I fully understand if nobody wants to help, i do a lot of support myself and hate this sort of question, but... with a bit of luck, someone who knows the subject already will be able to point me in the right direction, tell me what i can ignore, what i can use a constant value for etc. and get me moving again. i hope that 10minutes of your time can save me another 2 days of confused wiki trawling ;)

thanks in advance

OOPz

(btw, if you really want, i can provide an extensive collection of equations iv been trying to use, but tbh, i dont think that will really help anybody)