calculating atmospheric surface density

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
11,318
Reaction score
2,786
Points
203
Location
between the planets
It's been a while since I posted here for the last time.

I was slowly chiping away on some stuff in the meantime, and currently I seem stuck because I can't work out a certain problem. My math sucks!

anyways, given a hypothetical planet of which I have the pressure on the surface and the main compounds of the atmosphere, how do I calculate the density? My logical thinking tells me it should be more when there's more pressure, since gases are compressable, so how to calculate it?
 
Well, it's for a stargen extension to output systems for orbiter, so atmospheres range from very thin and very cold to very dense and very hot... alas stargen provides no density, just pressure. Then again, the whole thing doesn't have to be overly exact, so I think I could work with this equation:
65a65c9e7db61d4e9d5be7f26846a1fc.png

just that I will need to update my gas table with moles... Never thought of gases when I heard "moles" so far :)

Thanks a lot for the help.

Next thing would be how to calculate the altitude of the atmosphere... :oh:
 
Oh hell, I'm at war with differentials and integrals... I'll see if I can make any sense of the document, thanks a lot in any case.
 
Oh hell, I'm at war with differentials and integrals... I'll see if I can make any sense of the document, thanks a lot in any case.

Okay. A bit better digested, in that case, in Section 2.3 of the API_Guide in the orbitersdk\doc folder. You can make reasonably simplified atmospheric models which are quite convincing.
 
Hmmm... after browsing through it shortly I can't see yet how this would help me to calculate the altlimit out of pressure and density, but I'll look at it a bit more exactly later on. Thanks anyways. :)
 
Maybe it would be best to start with a rough model, and then work up to understanding the knitty-gritty. It will come to you suddenly, in a flash. You could use some rule of thumb type relations and extrapolate them until the value is negligible, and that would be your cutoff point. Set a surface level value, and subtract your lapse rate upwards. Use earth ISA values or relations, if you like. Then you can work in (with a correction variable) how gravity might affect the compression. Then temperature, the same way.

(Here on earth, we can use the following rule of thumb to calculate density altitude based on deviation of temperature ISA. Each 1º of temperature in excess of the ISA value for a given altitude adds 120 feet to that altitude in equivalent density - in the troposphere, of course. Calculate that density altitude, and look at the table presented in the doc later on here. You will have your density for those conditions. Interpolate, if needed.)

The problem is it is not that simple in reality. The proportion and even the content of the compositions change also, with increasing altitude, leading to varying behaviour temperature wise, which directly affects density (with expansion). For example, the thermosphere has a proportion of hydrogen, which is largely absent in lower sphere's, hence marked rise in this level's temperature (it is in a greater extent than the ozone layer, responsible for the larger part of UV and other harmful wave's "absorption" or deflection).

I might be way off track, as I am not sure what you are doing. Is it for known planets? Are you making a program to calculate this game-time in the sim, or calculating them manually and then typing them in as constants?

Anyway, look at table 2 here, it will allow you to work out some rates and relationships to start off with...

http://home.anadolu.edu.tr/~mcavcar/common/ISAweb.pdf

Then you can work up to this...

http://www.atmos.washington.edu/2005Q4/212/Lecture6Notes.pdf

PS:
And just in case you didn't, please follow the links on the first Wikipedia page I posted for you (especially the equations one). There are some simplified example problems of what you are looking for in action....
 
Last edited by a moderator:
Hmmm... after browsing through it shortly I can't see yet how this would help me to calculate the altlimit out of pressure and density, but I'll look at it a bit more exactly later on. Thanks anyways. :)
The altlimit is the upper edge of your atmosphere? Strictly speaking there is no hard edge - Earth's atmosphere extends out to thousands of kilometers but the effects beyond 200km are pretty limited. So if you can calculate pressure and density as a function of altitude you just need to decide at what point the denisty is close enough to zero or you to just call it zero.
 
So if you can calculate pressure and density as a function of altitude you just need to decide at what point the denisty is close enough to zero or you to just call it zero.

Ah! Now I get it. The Altlimit Orbiter wants me to define is only to know when it can stop calculating, it is not needed to calculate the fallof of the atmosphere. Guess I was too tired yesterday evening, looking at that formula in the manual just meant pretty much -BLANK- to me :P
I understand it better now.

thanks, especially to Keith, for the effort. Yes, I sought out the links you gave me, I wouldn't be asking for help if I wouldn't be interested in it. My problem is more that I hardly even recognise a differential when I see one. All I see is strange symbols. My school math stoped at trigonometry. Maybe I should do some courses to brush up... :embarrassed:
 
thanks, especially to Keith, for the effort.

Not at all, you are most welcome.

I was watching this space because what I believed what you were doing was very interesting. I had the idea that you wanted to create a module that made a "dynamic" sort of atmosphere, so that then the atmospheres' of highly elliptical orbit bodies would respond according to the proximity to the star (a little bit like what is believed to happen to the thin atmosphere of Pluto, that freezes out and ceases to exist at aphelion, but comes back at perihelion).

I am toying with the idea of trying it to make believable comets, as I think it might just be possible to create a body specific dll that simulates this behaviour.

Bearing all this in mind; sorry I lead you around the block with all of those references that did not answer your question! Maybe they will be useful to you in the near future.

All the best.:cheers:
 
I had the idea that you wanted to create a module that made a "dynamic" sort of atmosphere, so that then the atmospheres' of highly elliptical orbit bodies would respond according to the proximity to the star

:blink:
I didn't even know they're doing that.

best of luck!
 
I am toying with the idea of trying it to make believable comets, as I think it might just be possible to create a body specific dll that simulates this behaviour.
There is nothing in the docs that says how often CELBODY::clbkAtmParam is called but I can't see any reason why it wouldn't be at each time step. You could make your atmosphere behave in pretty much any weird fashion you desire.
 
:blink:
I didn't even know they're doing that.

best of luck!

I believe the coma of a comet can get as big as Earth from a nucleus only a few kilometers accross, as it nears the Sun. I think a highly "opaque", dynamic, expanding atmosphere would simulate that...

There is nothing in the docs that says how often CELBODY::clbkAtmParam is called but I can't see any reason why it wouldn't be at each time step. You could make your atmosphere behave in pretty much any weird fashion you desire.

Thank you; you hit the nail on the head. It would appear that CELBODY is a different class, and my nagging doubt was exactly whether members were initialized only once (at sim start up) or if it could be modified during runtime, but in any case you have put my very own thoughts into a clearer perspective. There is also the question of whether a "dummy" exhaust texture can be used with a body (to simulate the tail). Have not got around to trying any of it yet; still at concept stage!

However, I won't use jedidia's thread to expand on this subject. I will post a new thread, if required, for developement issues when I start experimenting with this...

Thanks all, again!
 
I'm all set up now, but getting impossible results. I think it's because I got some units wrong.
I'm using this formula:
65a65c9e7db61d4e9d5be7f26846a1fc.png


just turned around so I get density in the end, looks like this:

rho = RT/Mp

I think this should be correct, but I'm not quite sure. long time not seen any algebra, so maybe there's an error in here allready.

for units I'm having Kelvin for temperature, Pascals for pressure and atomic weight * 0.001kg/mole (molar mass constant if I'm not mistaken) for molar mass. I'm expecting density in kg/m3 as output.

Right now, I'm getting something like 74 TONS per m3 for a thin, martian like atmosphere, which clearly can't be correct...

---------- Post added at 04:36 PM ---------- Previous post was at 04:21 PM ----------

Ack, I just noticed that my algebra was very wrong indeed. rho = Mp/RT seems a better way to go...

I'm getting results now that could be about right, but I have nothing to compare them to to see if I can leave it like that. currently I get something like 1.35e-5 kg/m3 for a rather thin, but not extremely thin atmosphere at a pressure of 188 mBars, majorly composed of nitrogen and oxygen. could that be about right?
 
jedidia,

Allow me to check this formula with data I already have an answer for; Quito.

Rho = Prs / (Gasconst * Temp)

Rho = 71117 / (287 * 290)

Rho = 0.8544 (in kg / m3)

I know the value in slugs/ft3, so I'll just convert.

0.00238 * 0.6974 = 0.001659

EDITED:
Yes! it is spot on, now that I corrected the conversion!

The important thing, therefore, would be the gas constant for your atmosphere's specific composition, I would imagine. Try this for starters...?

http://en.wikipedia.org/wiki/Gas_constant
 
jedidia,

Allow me to check this formula with data I already have an answer for; Quito.

Rho = Prs / (Gasconst * Temp)

Rho = 71117 / (287 * 290)

Rho = 0.8544 (in kg / m3)

I know the value in slugs/ft3, so I'll just convert.

0.00238 * 0.6974 = 0.001659

EDITED:
Yes! it is spot on, now that I corrected the conversion!

The important thing, therefore, would be the gas constant for your atmosphere's specific composition, I would imagine. Try this for starters...?

http://en.wikipedia.org/wiki/Gas_constant


Thanks for the backchecking. So the overall formula is allright now, that's good. I didn't know that there are different gas-constants for each gas... ah well. ANOTHER update on the chem-table...
 
Back
Top