Jump to content

0.90 Kerbal Weather Systems! Alpha 0.5.3 WIP! (Jan 2)


silverfox8124

Recommended Posts

@ThatOneBritishGuy... oh stahp it you~ I'm not as good as you make me out to be. Don't get your hopes up too high, I don't want to crush them hard when I can't deliver. However,

Dev Note: We're making progress slowly still, working on some calcs regarding rain droplet size, then it'll be putting together the on-paper model and then seeing what it outputs. From there I will let you know what comes out of it. Should be hopefully soon. Wish us luck!

~SilverFox8124

Link to comment
Share on other sites

How does it work doing crosswind landings with KSP's wheels?

With this mod it looks like it becomes possible to fly a plane at a crab angle, and therefore have to land on the runway "diagonally". Has anyone tried dealing with this and how well it works with KSP's strange wheel physics? I'm a bit concerned that it might not model "skidding" at the point of touchdown properly and therefore instead of the wheel friction forcing the plane to turn a few degrees until it's aligned with the runway, it will instead make the wheels "jam up" a bit and impart flip-over rotation to the vessel.

I have a landing script in kOS that I'd like to try how it behaves when a crosswind causes surface prograde direction to differ a few degrees from the planes' facing, but installing this mod, as it's not updated to 1.0 and also depends on FAR, may come with a bit of baggage that makes it take effort to get it working. I was sort of hoping others might already have tried this (about the wheels on landing) and could report on whether it works well or not before I decide to embark upon getting this installed and working.

Link to comment
Share on other sites

@Steven Mading, crosswind can be fun, it should be fine, idk.

Dev Update! So... good news and bad news. Good news is that the model is making further progress. Bad news is that Squad doesn't like doing planets right. The temperature scales for all the planets are/can be off by a good chunk and temps at different latitudes don't correspond with what our model is showing, and with such, we'd have to butcher a perfectly good model just to accommodate for stock's crap. It's seriously starting to annoy me. I know you guys want stock really badly, but I'm afraid to say that it's not looking too peachy. RSS support will be had in the next update as it gives "realler" values for us to work with.

Stock support has butchered not only our model, but the chances for players to make their own planets to add to KWS. It has butchered it to the point where we could've had a model going by now. It has butchered it to the point where we have to un-butcher it to get RSS support, and that is ass-backwards.

If full on stock support is to be a thing, it may not be until it's in the stock game itself, as there is too much squad has gotten wrong for me to work with reliably.

It has killed too much of my dreams. I am holding off full-stock support. The only stock support I may put in, is for stock aero, in prep for a potential future stock support if a KWS Lite comes out.

Until next time,

~SilverFox8124

Link to comment
Share on other sites

The thing is, with RSS, things are MUCH, MUCH larger, meaning the cells have lesser accuracy, and that means I need to up the cells for more accuracy, and then that means a lot more resource usage... about 280MB - 1GB per planet... so yeah... As much as I'd love to go stock, the stock model is just absolute crap for use with weather.

Link to comment
Share on other sites

  • 2 weeks later...
Is high accuracy really needed? What if use the huge cells for weather calculations and then make some approximation inside a cell?

That's a question worth asking. Indeed is so important, it is considered also in the development of the weather model.

Actually, there isn't any answer yet. It would require to test the model in KWS, and conduct some good amount of testing, to see how accurate it is. How much values drifts from what is expected, if stability ensues and how long it takes. Accuracy isn't only about the size of cells actually, is about the time between updates. We need to find the nice spots where accuracy and performance are both achieved.

One value that shows this problem of accuracy is horizontal windspeed. Windspeed is the value that allows an equilibrium among the forces acting on air (pressure gradient, coriolis, friction). Pressure gradient requires to compute the average pressure (at each specific reference altitude) in a range of cells, and divide by the distance among cells (the actual mechanic considers all surrounding cells). With larger cells, pressure would have to be the average of a larger area, and that smoothes highs and lows; and dividing for a greater distance, the resulting gradient pressure force would often be too low.

Of course wind has major effects on other weather aspects, like the relative movement of air masses, driving to weather fronts and all associated phenomena, but also about the amount of evaporation and convection.

With some values, the lack of accuracy could be "adjusted" tuning the model. Windspeed however isn't that simple: if a "tuning" factor was used to bring windspeed to its expected value, with a large cell that would mean hugely more air moving than would naturally occur, and for larger distances. I'd expect than to see humid air over deserts, warm air over the poles (with imaginable consequences).

Unfortunately, using large cells for "general weather" could then make the values totally unfit. Isn't like the found values would be known with some lesser accuracy (say, like +/- 1% of the true values) and then some "refinement" process could allow to improve them (e.g. to +/- 0.1%): the found values would bring to a completely different situation instead.

Link to comment
Share on other sites

@diomedea

I see. You are definitely more familiar with the subject than I am, so I'm just trying to understand.

with a large cell that would mean hugely more air moving than would naturally occur, and for larger distances

But doesn't having pressure difference between larger cells mean that in case of large amount of smaller cells we'd have the same amount of air moving as a sum of smaller flows? In other words, wouldn't the sum of smaller flows tend to do the same job of moving the same amount of air as a big flow between large areas if there's a difference in their potentials? On other hand, if we had many little winds that compensate each other, that would be equal to zero difference in pressure between large cells, in average, so IMHO using larger cells would just nullify local weather variety. Yes, in that case we'd have, say, desert air areas covering significant areas of ocean but that's a question of accuracy, the same picture just in larger "pixels".

Link to comment
Share on other sites

@Ser

(Note: I could be wrong, but I'm probably not)

Having larger cells means less accuracy, and of course, less weather phenomenon can happen. Smaller cells means that we can more reliably produce real world results as weather in a local area is a result of the sum of the surrounding area's data. No matter how we do this, it's a metric .... tonne of data to process, store, and retrieve, there's almost no way around it. It's going to be CPU intensive, and probably consume some good amounts of RAM, when graphical weather effects come in, graphics specs will go up as well. Make sure to note all of this and not try and run KWS on a tiny little netbook, it will not go well for you.

Another thing to note: A cell's data is for that local area. If a cell encompasses something like... half a country, then half the country will be more or less the same temperature, the same humidity, and have the same weather details, pretty much, and the sunrise time wouldn't be reliable either because there's too much surface covered by a cell.

The main problem here is the memory usage and the amount of cells that come in the grid as we move up the levels. We're going to need to do some number crunching and such, but I'd honestly tell you to expect to have about 2-6GB of RAM dedicated to KWS. That's just how it's going to be.

Building this weather simulation has not been easy at all for us, there are challenges and hurdles literally *every* step of the way, with the entire time we need to be concerned about how much your computer would melt. What makes it even harder for us is that Unity stuff isn't kind to multi-threading, so we can't easily work with it in that way of parallelizing our work. We want to bring you guys something that's as real as we can get it, and it's going to come at a hefty resource cost, that's how it is until some godly revelation is had.

TL;DR: Yes, smaller cells accumulate into the larger picture, but are necessary for weather phenomena to function properly to scale. This work is hard, and it'll take a while to develop, and will be resource heavy, sorry but that's how she goes for now.

Link to comment
Share on other sites

But doesn't having pressure difference between larger cells mean that in case of large amount of smaller cells we'd have the same amount of air moving as a sum of smaller flows? In other words, wouldn't the sum of smaller flows tend to do the same job of moving the same amount of air as a big flow between large areas if there's a difference in their potentials? On other hand, if we had many little winds that compensate each other, that would be equal to zero difference in pressure between large cells, in average, so IMHO using larger cells would just nullify local weather variety. Yes, in that case we'd have, say, desert air areas covering significant areas of ocean but that's a question of accuracy, the same picture just in larger "pixels".

Pressure gradient and therefore wind is computed separately for each cell (actually, same goes with alll other weather values). With smaller cells, factors influencing pressure are more localized, and the resulting winds too. Sure I expect large areas of cells with a relatively constant pressure gradient, and therefore wind. But often the barometric field will be uneven, and result in local winds (affecting only a small area, and changing in force/direction, therefore moving air in a very different way).

Let me consider with large cells, if the conditions exist for a cyclonic low pressure. In the optimal case, it would appear in the center of one cell, so all surrounding cells would show a strong pressure gradient and winds flowing around the central cell (however, changes in windspeed would be averaged for the larger distance). In the worst case, the low is placed at the point where 3 cells meet: each cell than has the same average pressure, and no pressure gradient, no wind: at that scale, it would appear like the cyclone completely disappeared. That would make for fine weather even when it shouldn't be, but if players want fine weather, they don't need KWS.

Another thing I hope to see, the jet streams occurring at the top of the boundary of air masses with marked thermal differences: if Earth has intense jet streams a few hundred Km wide, the different scale of Kerbin would make me expect to see them a few tens Km. The streams would be wide as the cells, but also average for the cell size, therefore appear less intense if the cells are too wide.

Link to comment
Share on other sites

Guys, if you succeed that would be wonderful. Have you looked at FSX weather addons, like Real Enviroment Extereme? They simulate weather somehow too and don't produce a significant load on system resources. Guess they use some cheaty way like a set of precalculated values to achieve this.

Link to comment
Share on other sites

Have you thought about just 'faking' a model using pseudo-random numbers? Changes in weather in an active ships vicinity would be stores in the persistence file, and there'd be a chance of a change in weather at a particular point at any time, with initial conditions depending on a value predicted by the system based on the overall map, while the weather in locations outside the active ships vicinity is generated randomly at the start of each save, and updated every 30 seconds or so with a certain deviation (and thus determining the wind direction and intensity of active craft)? This would mean you don't actually have to simulate all that stuff, reducing the amount of data usage to more feasible levels. Hurricanes, tornadoes, etc, could also all be simulated with pseudo random numbers. Have a tiny chance of one occurring and when it does, slowly change the model of weather in the area affected, and then eventually deteriorate it over a randomly generated period of time. KSP is still part game after all and most of us aren't meteorologists. We can do with a bit of faking. It is far better than nothing after all.

To summarize, my proposition is to 'fake' the weather model using procedural generation, thus avoiding the ram-void this mod would be if it simulated an actual weather model.

Link to comment
Share on other sites

@ThatOneBritishGuy... it was proposed, and I declined it before, and I'll decline it again. Having random weather isn't predictable and you can't use it in any meaningful manner, it'd just be there for aesthetics at that point, there's no science behind it. It feels dirty and fake. I want reliable, predictable weather that should happen a certain way given set parameters. *THAT* is a weather model, predictive or simulated, not some whimsical "I'll make a storm here for the lulz" kind of thing.

What you're suggesting is the equivalent of leaving the world's weather at pure chaos. There could be hurricanes in the antarctic, dust storms in the poles, and snow in the deserts. Weather is inofitself a cause-effect relationship, that's how it is, that's how it's meant to be, that's how it shall stay.

That being said, if you guys want some random weather .... going on, make it yourselves, feel free to, because I sure won't be making it anytime soon.

~SilverFox8124

Link to comment
Share on other sites

Hey guys, I came across an article from 2008 on Gamasutra earlier today, on the topic of practical fluid dynamics in video games. I haven't had the time to read through it thoroughly, so I don't know if it could be of some use to the mod or not, but I figured I'd pass it along anyway.

http://www.gamasutra.com/view/feature/1615/practical_fluid_dynamics_part_2.php

Link to comment
Share on other sites

Hey guys, I came across an article from 2008 on Gamasutra earlier today, on the topic of practical fluid dynamics in video games. I haven't had the time to read through it thoroughly, so I don't know if it could be of some use to the mod or not, but I figured I'd pass it along anyway.

http://www.gamasutra.com/view/feature/1615/practical_fluid_dynamics_part_2.php

Well, thanks. Any suggestion about practical ways to tame the complexity of the matter is welcome.

In the specific case, this covers just one aspect of a very complex field of study. But the specific solution it describes (calculating pressure differentials in a range of cells to generate a velocity field) is correct, and actually already in the weather model to produce wind. The model is actually based on a small subset of the equations and concepts valid for fluid dynamics, e.g. Pressure-gradient force, advection, divergence, Navier-stokes, viscosity, vorticity (sorry for the amount of math, I spent days on that to arrive to something usable).

Link to comment
Share on other sites

Well, thanks. Any suggestion about practical ways to tame the complexity of the matter is welcome.

In the specific case, this covers just one aspect of a very complex field of study. But the specific solution it describes (calculating pressure differentials in a range of cells to generate a velocity field) is correct, and actually already in the weather model to produce wind. The model is actually based on a small subset of the equations and concepts valid for fluid dynamics, e.g. Pressure-gradient force, advection, divergence, Navier-stokes, viscosity, vorticity (sorry for the amount of math, I spent days on that to arrive to something usable).

Naw, I certainly understand the amount of math involved; I spent five years earning a degree in the subject. I'm still trying to think of any methods that could be employed to simplify matters while keeping things realistic; blanking, unfortunately.

This is probably a grotesquely stupid thought, but could the cell data be calculated ahead of time and then accessed at runtime? How is the model handling the planet's initial conditions right now?

Link to comment
Share on other sites

Naw, I certainly understand the amount of math involved; I spent five years earning a degree in the subject. I'm still trying to think of any methods that could be employed to simplify matters while keeping things realistic; blanking, unfortunately.

This is probably a grotesquely stupid thought, but could the cell data be calculated ahead of time and then accessed at runtime? How is the model handling the planet's initial conditions right now?

Certainly someone with your qualification would be very welcome, should you have time to spend on KWS.

About precalculated data. Most of data with each cell are variables, and will have to be refreshed at each update cycle.

The initial temperature at each cell and layer's altitude would be made to resemble the current data in KSP (I'm confident they can actually be fetched from KSP, otherwise they should be computed from the same set of values KSP uses at runtime), but then will follow the dynamic from KWS.

Initial pressure will be the set base pressure in KSP for altitude=0, but the pressure variance with altitude changes with temperature, so it will be computed for any altitude != 0; and clearly also the base pressure will then dynamically change in KWS.

Humidity isn't covered in KSP, my intent is to start with some "credible" values following a simple equation (based on biome and temperature). Of course KWS then will update.

Those above are enough to compute any further values, e.g. air density, cloud coverage, reflectivity and absorption.

Clouds reflectivity and absorption are probably the best area where values should be precalculated. The math required to compute those values depends on a few variables (amount of water vapor, effective droplets size and cloud thickness; other conditions are averaged for the spectrum of incident light and reflected IR, or the scatter angles, and then assumed constant). However the development of that math would take a significant portion of all the exectuion time in KWS, so the best approach is to use a set of precomputed tables.

Silverfox and me both hope to find other areas where values may be precalculated, that will certainly help mightly with KWS performance. When the weather model is finished, I hope to use it to find specific relationships from one or few values and the outcomes. That could come both as a simplification in the internal math used, or as discovery of significant "patterns" (cause-effect relationships in the weather across the modelled body, like e.g. the formation of a specific pressure field in an area associated with presence of humid/warm air, will develop in 80% of cases in a thunderstorm after 6 hours). Though I have yet to consider how KWS could be programmed to deal with those "patterns".

Link to comment
Share on other sites

Silverfox has approached me before on helping with the mod; I've got a few too many commitments at the moment to get involved with another project but I'd definitely be willing to consult with y'all.

I'll give the simulation of initial dewpoint values some thought...that one should only be an issue on Kerbin and Laythe, right? Maybe Eve?

Link to comment
Share on other sites

I'll give the simulation of initial dewpoint values some thought...that one should only be an issue on Kerbin and Laythe, right? Maybe Eve?

Thanks about the initial dewpoint. Of course Kerbin and Laythe, having the same atmospheric mix of Earth, are easier to consider, and with them I'm actually only concerned about water dew. And given their resemblance with Earth's atmosphere, I'm actually using values valid for Earth (such as those for the Magnus formula in dew point calculations, but also Antoine's and Wagner's equations).

The other bodies are still a big unknown (must say I've started to consider some plausible mix of gases for them, but the matter requires more research).

Eve certainly has liquid on its surface, therefore a mass going through evaporation and dew. Unfortunately I could not yet find what that would be, to stay liquid at 5bar and 360-420°K. However the temperature changes enormously with altitude, I could imagine even water being present (only, water rain would never fall to the surface before evaporating again). Any thought about Eve will be of immense help.

Don't think initial dewpoint requires a thought for other stock bodies. Duna only seems affected by sublimation/deposition of CO2, so my effort goes only towards computing the amount changing state and the heat exchanged. Jool seems to only have very light substances, unable to condense in its atmosphere.

Link to comment
Share on other sites

<snip /> Unfortunately I could not yet find what that would be, to stay liquid at 5bar and 360-420°K. <snip />

Elemental mercury comes to mind given the temperature and pressure conditions, though the conditions under which mercury would be present in quantities great enough to fill a planet's oceans would be......unique, I'll say. Plus the color is all wrong...

Link to comment
Share on other sites

Unfortunately I could not yet find what that would be, to stay liquid at 5bar and 360-420°K

funny enough i found that iodine almost perfectly matches these criteria and is purple at large concentrations. at roughly 5 bars it's liquid at 400k ,solid at just below at 350k and evaporates at 450k which might be just right for eve, also because temps decrease slower then temps it will be vapor at higher altitudes and just above the surface and create "snow" at even higher altitudes constantly within clouds and give it a purple look with some water/ammonia vapor in the atmosphere

http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/07/255/7255152.pdf page 31

http://www.nist.gov/data/PDFfiles/jpcrd55.pdf apde 26

Edited by EladDv
Link to comment
Share on other sites

funny enough i found that iodine almost perfectly matches these criteria and is purple at large concentrations. at roughly 5 bars it's liquid at 400k and solid at just below at 350k and evaporates at 450k which might be fine for

http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/07/255/7255152.pdf page 31

http://www.nist.gov/data/PDFfiles/jpcrd55.pdf apde 26

Elemental mercury comes to mind given the temperature and pressure conditions, though the conditions under which mercury would be present in quantities great enough to fill a planet's oceans would be......unique, I'll say. Plus the color is all wrong...

Thanks guys. I actually considered both iodine and mercury, but because of molar mass they can't be major atmosphere constituents (mercury (Hg) 200.59, iodine (I2) 253.8 g/mol).

Eve's atmosphere mix averages 43 g/mol, any gas 500% heavier than the average should only fill the deepest layers, can't see why it would lift and stay mixed with lighter components. Of all the gas components in Earth's atmosphere (apart minor traces of He), all are within 55-152% of the average molar mass. Clearly those heavyweights have to be a small percentage, or other even lighter components would make their part to bring the average molar mass; therefore the difference between heavy and light components would be even more marked.

I can consider Eve to have a layered atmosphere, but then would certainly enjoy some help to devise its characteristics, there would be neat boundaries from one to another layer (not to talk about densities, all of the aerodynamic properties in KSP would seem wrong).

E.g., I did venture to consider an atmospheric mix for Eve with I2 at small concentrations: but then the I2 layer would only reach a few tens of meters above sea level (using the correct ScaleHeight for pressure on Eve, 35 mt of I2 would account for 1% of the total pressure). Above that level aerodynamic properties may not be really affected, but I2 would not really affect the atmosphere dynamics too, can only guess at heat exchanges through the layer boundary I2/lighter gas.

Link to comment
Share on other sites

Thanks guys. I actually considered both iodine and mercury, but because of molar mass they can't be major atmosphere constituents (mercury (Hg) 200.59, iodine (I2) 253.8 g/mol).

Eve's atmosphere mix averages 43 g/mol, any gas 500% heavier than the average should only fill the deepest layers, can't see why it would lift and stay mixed with lighter components. Of all the gas components in Earth's atmosphere (apart minor traces of He), all are within 55-152% of the average molar mass. Clearly those heavyweights have to be a small percentage, or other even lighter components would make their part to bring the average molar mass; therefore the difference between heavy and light components would be even more marked.

I can consider Eve to have a layered atmosphere, but then would certainly enjoy some help to devise its characteristics, there would be neat boundaries from one to another layer (not to talk about densities, all of the aerodynamic properties in KSP would seem wrong).

E.g., I did venture to consider an atmospheric mix for Eve with I2 at small concentrations: but then the I2 layer would only reach a few tens of meters above sea level (using the correct ScaleHeight for pressure on Eve, 35 mt of I2 would account for 1% of the total pressure). Above that level aerodynamic properties may not be really affected, but I2 would not really affect the atmosphere dynamics too, can only guess at heat exchanges through the layer boundary I2/lighter gas.

hmm the ground is purple in itself so it might not be the atmosphere itself that has the purple shade BUUUUUT if you can calculate the atmospheric composition of an atmosphere of one that diffuses mostly purple light at 380-420nm using Rayleigh scattering formula is a close enough approximation OR you could go for spectral lines (molecular emission lines at high energy like getting hit by photons) hydrogen is a strong contender in that category but might be a bit too light but other ones will be better for sure (also take into account that higher energy photons will be emitted more often then lower ones due to the nature of photon emission in atoms so they will be more vibrant) gallium is also a strong contender in this category and is just at the upper bound of your hypothetical eve molar mass at 69.7 and also iron, titanium and phosphorus but again those are only acting as emissive atoms and molecules are much more complicated to find data for. in all honesty a multi layered atmosphere might get the most realistic results but would be much harder to code and implement with all the math involved (please take into account that i am hardly familiar with these matters and just throwing ideas that SEEM plausible but might not actually be realistic in any way)

Edited by EladDv
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...