Jump to content

Make your own Atmospheres for KSP (automatically)


OhioBob
 Share

Recommended Posts

Make your own Atmospheres for KSP

Excel spreadsheet for mod developers who want to create their own realistic atmospheres

 

Primary Download Site - KSPatmoCalculator, v2.0.5

Alternate Download Site - KSPatmoCalculator, v2.0.5


An Excel spreadsheet used to create atmospheric models for celestial bodies in Kerbal Space Program.  It takes input from the user and automatically generates an entire Atmosphere node that can be copied and pasted into your Kopernicus configuration files.  It implements the full array of atmosphere curves available to KSP modders.  The user still has creative control over many aspects of the atmosphere, such as composition and surface pressure, but the complex number crunching is all done behind the scenes.  There is no math required on the part of the user.  Real life gas laws are used to create realistic pressure curves.  Temperature curves are approximations based on atmosphere type, solar irradiance, and other factors.  An entire atmosphere can be completed in minutes.

For those familiar with the old calculator, this is completely new.  Everything is now combined into a single spreadsheet that should be much easier to use and understand.  The input sheets are arranged in simple step by step question and answer formats.  The new spreadsheet is also much more stable than the pervious version and less prone to errors and failures.


BWapegu.png?1

Edited by OhioBob
Link to comment
Share on other sites

55 minutes ago, JetJaguar said:

Excellent!  I take it this can be used for both gas giants and terrestrial planets?

Yes it can.  The sample provided is for a terrestrial planet, but if you input properties that are consistent with a gas giant, then you'll get a gas giant atmosphere.  It can even do stars.

Edited by OhioBob
Link to comment
Share on other sites

I happen to be working on a gas giant, and given that temperature is presented as a function of pressure instead of altitude for gas planets, I came up with this method to fill out the temperature profile and just wondering if it was reasonable, or maybe there is a better/easier way, or perhaps it was unnecessary overkill.

I had a graph plotting temperature vs. pressure, so I read off about a half dozen points from the graph and initially just kind of guessed what the altitudes may be to get a starting profile.  Then, starting from the "ground" up, I went to sheet 3 and looked at the pressure (column H) to see at which altitude it was actually calculated (column A) and adjusted the altitude for that point on the temperature profile accordingly.  I repeated this until I ended up with the calculated altitude on sheet 3 more or less matching the altitude on the temperature profile.  It didn't take long, usually 2 or 3 iterations per point got it close enough.

 

Edited by JetJaguar
Link to comment
Share on other sites

16 minutes ago, JetJaguar said:

I happen to be working on a gas giant, and given that temperature is presented as a function of pressure instead of altitude for gas planets, I came up with this method to fill out the temperature profile and just wondering if it was reasonable, or maybe there is a better/easier way, or perhaps it was unnecessary overkill.

I had a graph plotting temperature vs. pressure, so I read off about a half dozen points from the graph and initially just kind of guessed what the altitudes may be to get a starting profile.  Then, starting from the "ground" up, I went to sheet 3 and looked at the pressure (column H) to see at which altitude it was actually calculated (column A) and adjusted the altitude for that point on the temperature profile accordingly.  I repeated this until I ended up with the calculated altitude on sheet 3 more or less matching the altitude on the temperature profile.  It didn't take long, usually 2 or 3 iterations per point got it close enough.

Yeah, the fact that gas giants reference everything to pressure levels certainly introduces some difficulty.  I think you came up with a perfect solution.

Although I was able to automate almost everything else, the height-temperature profile is still something the user must provide.  I'm actually in the process of trying to write something that automates that part.  It will only provide a suggested temperature curve, the user will still have the final say.  I started with gas giants.  I have some ideas on how I can make it automatically convert a pressure-temperature curve into a height-temperature curve, but until I have it working, there's no guarantee.

Link to comment
Share on other sites

Thanks.  It's not an exact solution, but I figured that would get the temperature profile points to within 1,000 m of where they should be, which is probably well within the margin of error from reading points off of a graph in a PDF document.

Just to clarify in case anyone else wants to try this method, I repeated iterations on one point until the altitudes matched before going on to the next point, and I also saved this step for last so changes elsewhere don't move things around again.

Link to comment
Share on other sites

what data values would I have to edit in order to make a planet with kerbin's gravity but with eve's atmosphere?

I am new to modding (haven't even downloaded korpencious yet :P) but I like the idea of making a custom universe.

Edited by nascarlaser1
fixed question so it isnt a contradicting question lol
Link to comment
Share on other sites

1 hour ago, The White Guardian said:

You're kinda contradicting yourself here. Which are you looking for? Or did you mean 'radius' for one of the two by chance?

oops. meant to write kerbin's gravity but eve's atmosphere :P. srry about that.

I pretty much just want to make a new planet that minus the KSC, is identical to Kerbin in the structure (so just a carbon copy of Kerbin since I am bad at modeling :() but has the thick atmosphere of eve.

Edited by nascarlaser1
Link to comment
Share on other sites

If you want a body with the size and gravity of Kerbin, then just enter Kerbin's radius and gravity in the radius and gravity input fields (cells E8 and E10).  If you want a surface pressure similar to Eve's, then enter that pressure in the surface pressure input field (cell E20).  If you want the air to have the same molecular weight as Eve's (43 g/mol) then enter in a composition that will yield a similar molecular weight (for instance, 93.75% CO2 and 6.25% N2).

These settings will give you something like Eve's atmosphere, but it wouldn't be Eve's atmosphere.  This spreadsheet will compute the atmospheric according to real life gas laws.  The atmosphere will end up being whatever it ends up being based on the parameters you specify.

Link to comment
Share on other sites

Just a note for everyone: in the spreadsheet '1360' is defined as the 'solar constant' by default. However, this value is for G-class stars.

For other star classes you can use these values:
O 40800000
B 6800000
A 23120
F 4080
G 1360
K 408
M 108.8

Color legend:
O = Blue
B = Blueish white
A = White
F = Yellowish white
G = Yellow
K = Orange
M = Red

Should you have trouble remembering this order, astronomers use the following sentence to help them should they forget: 'Oh Be A Fine Girl Kiss Me'. As you can see, the first letters form the order: O-B-A-F-G-K-M

@OhioBob the following function can be added to the spreadheet to make this process automatic:
=IF(X="O",40800000,IF(X="B",6800000,IF(X="A",23120,IF(X="F",4080,IF(X="G",1360,IF(X="K",408,IF(X="M",108.8,0)))))))
With X being the cell that takes the 'star class'. I've tested this method using the formula for effective temperature given in your thread 'modeling atmospheres in KSP' and it seems to work as intended.

So, this 'star class cell' will only accept the entries O, B, A, F, G, K and M. Anything else will result in a value of 0. (I created a 'star spreadsheet' for personal use that automatically computes stuff like lightColors. Instead of giving a value of 0, it shamelessly calls me a 'scrub' if I try to enter 'Taco!' as a valid star class... )

Also, can Xenon be added to the table of atmospheric composition? Here's the info:

Molar mass: 0.1313 kg/mol

Density: 5.9 kg/m3

For the heat spec. constant (adiabatic index) it uses the same value as the other noble gases (Krypton, Argon, Helium)

Also, there's a typo in the spreadsheet: Krypton's symbol is 'Kr'.

Link to comment
Share on other sites

That's absolutely terrific! Thank you so much!

EDIT: Can you allow us to edit the scale of the atmosphere compression factor (The thing that makes it 0.8 times the height) and choose whether or not it's a Kerbal Scale or Real Scale body? I can see on Sheet3, which is permission locked, that the options appear to exist.

EDIT2: Oops, the option is already there. I didn't get much sleep last night, you see...

Edited by GregroxMun
Link to comment
Share on other sites

@GregroxMun driving a train is always tiring. I hope you're not full zombie mode behind your computer though...

I personally have mixed feelings about the spreadsheet being permission locked. I respect @OhioBob's decision to protect his work and find it quite a handy solution, but on the other hand, I can't make any edits myself (such as adding gases to the table).

Oh, well. I can always still make an atmosphere by hand if necessary.

Edited by The White Guardian
Link to comment
Share on other sites

I'll take all your suggestions under advisement and will consider changes.

Regarding the solar constant.  Changing star type doesn't necessarily mean the solar constant changes.  The solar constant depends on both stellar luminosity and distance from the star.  You could change your star type from G to, say, a K or F, but if you also relocate the home world closer or farther away, the solar constant may remain 1360 W/m2.  If you want your home world to have earthlike temperature, then you are probably going to want to keep the solar constant somewhere near 1360 W/m2.  Of course by moving the home world, you are also likely defining the value of 1 AU.  In most cases you'd probably make 1 AU = semimajor axis of home world.

I was very undecided about whether or not to password protect the spreadsheet, so for the initial release I thought better safe than sorry.  I'm definitely going to leave the protection on to prevent accidental changes, but I may decide to remove the password.  I trust the vast majority of people that will use the spreadsheet, but it's the one person who will cause problems that I'm afraid of.

Link to comment
Share on other sites

9 hours ago, The White Guardian said:

@OhioBob the following function can be added to the spreadheet to make this process automatic:
=IF(X="O",40800000,IF(X="B",6800000,IF(X="A",23120,IF(X="F",4080,IF(X="G",1360,IF(X="K",408,IF(X="M",108.8,0)))))))
With X being the cell that takes the 'star class'. I've tested this method using the formula for effective temperature given in your thread 'modeling atmospheres in KSP' and it seems to work as intended.

I don't think I want to automate it in the way you describe because that doesn't account for the distance of the home world.  But I do like the idea of doing something, just not sure what it is yet.

I'm also not entirely sure that changing the solar constant at the home world even does anything in the game.  I ran some tests on this a while ago found things rather buggy.  For instance, solar panels always seem to have the same power output at the home world regardless of the luminosity setting.  I'll have to revisit this and try some new tests with all the recent updates.

Link to comment
Share on other sites

Just now, OhioBob said:

I'm also not entirely sure that changing the solar constant at the home world even does anything in the game.  I ran some tests on this a while ago found things rather buggy.  For instance, solar panels always seem to have the same power output at the home world regardless of the luminosity setting.  I'll have to revisit this and try some new tests with all the recent updates.

I thought there was something called the 'solarPowerCurve' for that but I'm not entirely certain. I thought RSS used it to account for the new system size.

Link to comment
Share on other sites

Just now, The White Guardian said:

I thought there was something called the 'solarPowerCurve' for that but I'm not entirely certain.

solarPowerCurve is a relic from the past.  It doesn't do anything anymore.

Link to comment
Share on other sites

6 hours ago, JetJaguar said:

If I could make a suggestion, maybe add a blank, user-editable line to the gas table.

I like that idea.  Maybe even a couple lines.  I'll add that and try to get out an update sometime this weekend.

Link to comment
Share on other sites

Version 1.0.2

Just updated the spreadsheet to include space for the user to add up to two additional gases to the atmosphere.  The instructions have also been updated (you made need to refresh to see the new screenshot).  As noted in the instructions, when adding a gas you'll need to enter values for M and Cp°.  While M is easy to look up, Cp° is a little harder to come by.  I recommend http://kinetics.nist.gov/janaf/, which generates tables giving Cp° at various temperatures.  It works best if you enter the chemical formula and select specific state = any.  If more than one state is generate, select g for gas.  If your temperature falls between those listed, just interpolate.

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...