Module:Sandbox/Wnt: Difference between revisions
Appearance
Content deleted Content added
have to see this to believe it... |
grams per meter, measured in kg |
||
Line 16: | Line 16: | ||
-- newton weight is kg * gravity |
-- newton weight is kg * gravity |
||
-- so x atm of pressure weigh x * gravity * 1225 kg per kilometer per square meter |
-- so x atm of pressure weigh x * gravity * 1225 kg per kilometer per square meter |
||
return pressure * gravity * |
return pressure * gravity * 0.001225 * increment |
||
end |
end |
||
Line 27: | Line 27: | ||
local p = 1 -- arbitrary 1 pascal |
local p = 1 -- arbitrary 1 pascal |
||
local it = 0 |
local it = 0 |
||
output = "" |
output = "radius gravity pressure" |
||
repeat |
repeat |
||
it = it + 1 |
it = it + 1 |
||
p = p + deltapressure (p, localg(r)) |
p = p + deltapressure (p, localg(r)) |
||
r = r - increment |
r = r - increment |
||
output = output .. |
output = output .. r .. "," .. localg(r) .. "," .. r .. "<br />" |
||
until it > 100 |
until it > 100 |
||
return output |
return output |
Revision as of 14:43, 30 May 2016
local p = {}
increment = 1 -- in meters; should end up around 1000 or so. Basis is meters and kilograms throughout.
G = 6.674E-11 -- 6.674×10−11 N⋅m2/kg2
M = 1E26
function localg (r)
-- black hole has gravity GM / r2
return M * G / (r*r)
end
function deltapressure (pressure, gravity)
-- for a given global increment, return the increase in pressure in atm, pressure in gs
-- density of "air" per pressure in atm is (1.225 kg/m3) / atm
-- pressure of air is 101325 newton / m2 at 1 atm
-- newton weight is kg * gravity
-- so x atm of pressure weigh x * gravity * 1225 kg per kilometer per square meter
return pressure * gravity * 0.001225 * increment
end
function p.main (frame)
-- we SHOULD start at the "exobase", which on Earth is roughly 7000 km from the center
-- I am not finding decent figures for exosphere pressure
-- for now let's calculate from an arbitrary (too high) 1 pascal and see from there what the dependence is
-- exobase equivalent is where GM/r = same as on Earth, i.e. r = 7000 km * M / mass of Earth
local r = 7000000 * M / 5.97237E24 -- kg, mass of Earth
local p = 1 -- arbitrary 1 pascal
local it = 0
output = "radius gravity pressure"
repeat
it = it + 1
p = p + deltapressure (p, localg(r))
r = r - increment
output = output .. r .. "," .. localg(r) .. "," .. r .. "<br />"
until it > 100
return output
end
return p