Jump to content

[1.8x - 1.11x] Kerbal Weather Project (KWP) v1.0.0


cmet24

Recommended Posts

On 1/30/2022 at 10:36 AM, cmet24 said:

@blackrack Excellent questions!

  • Your correct. Currently, the API is set up to request point data. I honestly have little knowledge of rendering textures in KSP. That said, I do think it would be possible to pass a 2D array  (with a timestamp) containing cloud cover data for the entire planet. The issue is that the GIF showed in the first post was produced from the full MPAS simulation. The climatological data used in the mod was averaged by hour (across 5-years of data) so that it could be loaded during gameplay.  Taking a look at the MPAS cloud cover data it appears that a full year (2557 hours) of data at 1 x 1 deg resolution (~24 km on Kerbin) is around 633 MB. That said, there are ways the data  could be compressed. The horizontal resolution could be halved and the time-series could be sliced to retrieve cloud cover data over a smaller chunk of the year.                                                                                                                                                                                                                              
  • Regarding the simulation. MPAS is a state of the art global climate model for Earth! It was developed by scientists at Los Alamos National Laboratory (COSIM) and the National Center for Atmospheric Research. I got MPAS to work for Kerbin because Kerbin is actually quite similar to earth in terms of atmospheric composition and solar irradiance. Modelling planets whose atmospheric composition differs significantly from Earth's (e.g. Mars, Venus, etc.) is quite tricky because a lot of the assumptions that are made in Earth-based climate models break down big-time! NASA does have a model for simulating the climate of exoplanets and other Solar System terrestrial planets. In my experience, their model is quite difficult to customize. To simulate custom KSP planets there would have to be an easy way to modify the surface terrain within the model.                                                                                                            
  • With respect to model performance, I ran MPAS with half precision. I also choose to output only variables which I found necessary for understanding Kerbin's climate. I used 55 vertical levels to ensure model stability. When your running a numerical weather model with a vertical top of 70-km you need to have quite a few layers to adequately resolve vertical motions and vertically propagating waves. For the MPAS models runs,  perhaps around 1/4 - 1/3 of the RAM was used. This is because numerical weather prediction at coarse resolution (1 x 1 degree) is largely constrained by computation limits (CPU clock speed). When you increase the horizontal resolution of the model that's when your RAM usage goes up! It'd be nice if one could run numerical weather models on a high-end GPUs. Nevertheless, porting millions of lines FORTRAN code to run on modern GPUs remains an ongoing and challenging process. There are a few industry leaders (Nividia/IBM) and quite a few Ph.D. students working on this very problem. Unfortunately, MPAS does not yet have the capability to utilize GPUs.

As an aside, I think the real power of KWP is the framework it provides for incorporating meteorological data into gameplay. One could produce a climatological (4D) dataset for their planet and use KWP's framework to implement that data into the game. The challenge is how to produce that climatology. Modders could design their own or modify existing data from real terrestrial planets. Either way it's not all about realism. For me its really all about having fun with meteorology and KSP! :)

7 hours ago, blackrack said:

Thank you for the complete reply.

There does appear to be a GPU-enabled MPAS branch here but I haven't read into it much to see how much is actually run on the GPU and what the requirements are: https://mpas-dev.github.io/atmosphere/OpenACC/index.html

Regarding resolution, if 1x1 degree resolution used 1/4 of your server's ram (so 32gb) , then I'm thinking a 2x2 or 3x3 resolution should fit in a modern GPU's memory, the cloud cover data for one year could also go from 633 mb to 150mb or 70mb respectively. Question is how coarse/bad would the simulation be at that resolution(the cloud cover gif already looks quite coarse but not sure if that's because of simulation resolution or how the gif was made)? At least for the purpose of being used in a game like this.

For the nasa model do you have a link? The link above doesn't seem to be working.

Oh, being able to create our own data would be quite cool. For smaller GPUs, I wonder if it be possible to, like, chop the thing into chunks that are each processed in sequence, trading memory for time? I've only got a 2 gig laptop GPU which'd mean it'd need to run at a 4x4 resolution or maybe even 5x5 if you're right and it does scale like that, but what if the map was in like 4 quadrants at 2x2 resolution and it ran 4x as long? Personally at least I don't mind leaving my computer on for a week if need be (tho the computer might). I'd also be very interested if anyone finds a more customizable version of the exoplanet model

Link to comment
Share on other sites

52 minutes ago, WarriorSabe said:

Oh, being able to create our own data would be quite cool. For smaller GPUs, I wonder if it be possible to, like, chop the thing into chunks that are each processed in sequence, trading memory for time? I've only got a 2 gig laptop GPU which'd mean it'd need to run at a 4x4 resolution or maybe even 5x5 if you're right and it does scale like that, but what if the map was in like 4 quadrants at 2x2 resolution and it ran 4x as long? Personally at least I don't mind leaving my computer on for a week if need be (tho the computer might). I'd also be very interested if anyone finds a more customizable version of the exoplanet model

If you are fine with waiting you are probably fine running the CPU version anyway.

Link to comment
Share on other sites

2 hours ago, blackrack said:

If you are fine with waiting you are probably fine running the CPU version anyway.

Yeah but like might as well go faster, right? I'm not sure how much the GPU accelerates things so even going slower maybe it'll be faster overall

Link to comment
Share on other sites

  • 4 weeks later...

Here's a question:

KWP on a JNSQ Kerbin with Kerbal Konstructs launch sites,  and KWP set to point weather data. Will KWP have an issue with the KSC location on JNSQ-Kerbin, and then would the point weather launch conditions get applied to other detected launch sites, like ones added by KK?

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
On 2/8/2022 at 5:27 AM, blackrack said:

Thank you for the complete reply.

There does appear to be a GPU-enabled MPAS branch here but I haven't read into it much to see how much is actually run on the GPU and what the requirements are: https://mpas-dev.github.io/atmosphere/OpenACC/index.html

Regarding resolution, if 1x1 degree resolution used 1/4 of your server's ram (so 32gb) , then I'm thinking a 2x2 or 3x3 resolution should fit in a modern GPU's memory, the cloud cover data for one year could also go from 633 mb to 150mb or 70mb respectively. Question is how coarse/bad would the simulation be at that resolution(the cloud cover gif already looks quite coarse but not sure if that's because of simulation resolution or how the gif was made)? At least for the purpose of being used in a game like this.

For the nasa model do you have a link? The link above doesn't seem to be working.

@blackrack Sorry, for the delayed response.  I finally had some time to spin up KSP this weekend and check back on the forum. :)

Good find! I didn't realize there was a GPU-enabled branch of MPAS . Unfortunately, it's scope is quite narrow. The version of the model is not up to date (the GPU branch uses MPAS v6) and is only supported on IBM's AC922 architecture. Not to say that one couldn't get it to compile on a home GPU but I don't think the effort would reap much benefit. The radiation code is still run through the CPU and the physics options are highly limited in the GPU branch. 

FYI: Here is the link to the NASA model: ROCKE-3D. I've run it successfully but it requires quite a bit of manual adaption to modify the terrain and land surface of the planet being modeled. 

Regarding the quality of a lower resolution simulation, reducing the resolution to 2x2 or 2.5x2.5 degrees wouldn't be unreasonable. In fact, many global climate models used to project the impacts of anthropogenic climate change are run at coarse resolutions on the order of a (1-2.5 deg). It should be noted that, on Kerbin, 1 x 1 deg (at the equator) is on the order of ~25 x 25 km. So, when projected onto Kerbin's coordinate grid, a little goes a long way. This is why KWP is able to resolve difference in climate conditions between the mountains west of the KSC and the ocean to the east. In the model, the mountains are ~200 km away from the KSC. In the game, they're maybe ~20 km from the KSC, since the planet has a radius of 600 km. In MPAS the terrain is scaled up and the model is run with the planetary radius set to Earth's radii. The reasoning behind this approach is outlined in the background section of the KWP webpage.
 

On 3/3/2022 at 12:27 PM, RocketRyleigh said:

Here's a question:

KWP on a JNSQ Kerbin with Kerbal Konstructs launch sites,  and KWP set to point weather data. Will KWP have an issue with the KSC location on JNSQ-Kerbin, and then would the point weather launch conditions get applied to other detected launch sites, like ones added by KK?

@RocketRyleigh So, KWP should still work in JNSQ its just that the point-weather data was run for the stock planet and not the JNSQ version of Kerbin. So, the data may not line up perfectly with what you might expect for the local micro climate. If I recall correectly, the JNSQ KSC site is at a similar latitude as the KSC site in the stock game. In JNSQ the KSC is also relatively close to the water so I wouldn't expect the point weather data at the KSC (for JNSQ) to be terribly off base. That said, one potential complication of using KWP on a modified version of Kerbin is the difference in the length of the day. In JNSQ, Kerbin is ~2.5X larger and the day length is 12 hours (instead of 6). This means that the diurnal cycle of weather (from KWP) would be invalid in a JNSQ playthrough. Basically, when playing JNSQ, you'd have two days of weather in one. While this is wholly inaccurate it's probably not game breaking.

With respect to other launch sites. KWP supports a selection of launch sites from the Kerbinside Remastered mod in addition to the other stock launch sites (i.e. DLS and WLS). In JNSQ, moving to a different site added by KK would simply result in KWP grabing point weather data from the nearest site in its database. For example, say KK adds a site at 35 N, 120 E.  If you spawned at this site, KWP would use the point weather data from the Woomerang Launch Site location (45 N, 136 E) as that would be the closest site (coordinate) for which point weather was available. Essentially KWP grabs data from the nearest site it can find, if the current location is not in its database. For the climate data this is irrelevant, only for point weather data does the latitude/longitude location matter.

Edited by cmet24
Link to comment
Share on other sites

  • 4 weeks later...

Hello guys!

I just discovered this mod from the Kottabos channel video and I really liked what I saw. I would like to know if this mod will be compatible with RSS and Realism Overhaul in the future? I'm curious to know because I really wanted to use this mod so I could have one more challenge to launch rockets and planes on planet Earth and especially have a closer realism to real life.

Thank you very much! And congratulations on the great work!

Link to comment
Share on other sites

  • 3 months later...

@cmet24 What is the time resolution for the climate weather data? I suppose half resolution means double the overall time for the same amount of data? Or maybe there's a possibility for compression, when data doesn't change very much? I.e. instead of 5 entries with wind speeds between 10.5 and 11.5 m/s, just make 1 entry for 11 m/s and specify a start and end time?

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hello @cmet24! This mod is just perfect considering that I am really passionate about designing all kinds of aircraft.

However, I noticed that it has a very weak upwards wind component, which makes building gliders kind of useless, since you can't take advantage of the vertical winds. I am familiar with C# and I've seen that the mod source code is available on GitHub. My wish would be to multiply the vertical wind component by a considerable amount at all times (since it depends on lots of factors, randomization wouldn't be a problem). Since I'm not too familiar with KSP modding in particular, I would like to ask you what variables or lists should I modify.

I would like to rebuild the mod for personal use with the desired changes, if that's okay.

Link to comment
Share on other sites

On 12/20/2022 at 2:08 PM, doxid310 said:

Hello @cmet24! This mod is just perfect considering that I am really passionate about designing all kinds of aircraft.

However, I noticed that it has a very weak upwards wind component, which makes building gliders kind of useless, since you can't take advantage of the vertical winds. I am familiar with C# and I've seen that the mod source code is available on GitHub. My wish would be to multiply the vertical wind component by a considerable amount at all times (since it depends on lots of factors, randomization wouldn't be a problem). Since I'm not too familiar with KSP modding in particular, I would like to ask you what variables or lists should I modify.

I would like to rebuild the mod for personal use with the desired changes, if that's okay.

Nevermind, I found out myself.

For anyone interested, in climate_data.cs and weather_data.cs multiply the "ww" variables with something around 30-100 and don't forget to change in the GUI the units for vertical velocity from mm/s to m/s (remove the *1000 and edit the string). Rebuild the project and replace the dll in gamedata/kerbalweatherproject. Cheers.

Link to comment
Share on other sites

  • 1 month later...
On 12/20/2022 at 4:08 AM, doxid310 said:

Hello @cmet24! This mod is just perfect considering that I am really passionate about designing all kinds of aircraft.

However, I noticed that it has a very weak upwards wind component, which makes building gliders kind of useless, since you can't take advantage of the vertical winds. I am familiar with C# and I've seen that the mod source code is available on GitHub. My wish would be to multiply the vertical wind component by a considerable amount at all times (since it depends on lots of factors, randomization wouldn't be a problem). Since I'm not too familiar with KSP modding in particular, I would like to ask you what variables or lists should I modify.

I would like to rebuild the mod for personal use with the desired changes, if that's okay.

@doxid310Correct! So, in general, the atmosphere is pretty close to hydrostatic balance most of the time (i.e. vertical motions are small). There are some exceptions when the atmosphere becomes statically unstable. In that event, convection will happen to restore stability. That said, convection takes place on a very short time scale (~ few hours). Since we perform some temporal averaging (to get the climatology) the atmosphere is generally statically stable - meaning little vertical motion. In some places, like the tropics, the mean state can be marginally unstable; however, to capture that we would've required a much more high resolution simulation capable of resolving convection.

 

On 12/21/2022 at 2:32 PM, doxid310 said:

Nevermind, I found out myself.

For anyone interested, in climate_data.cs and weather_data.cs multiply the "ww" variables with something around 30-100 and don't forget to change in the GUI the units for vertical velocity from mm/s to m/s (remove the *1000 and edit the string). Rebuild the project and replace the dll in gamedata/kerbalweatherproject. Cheers.

I'm glad you figured it out! Feel free to make a fork of the mod on Github (if you haven't already).

Edited by cmet24
Link to comment
Share on other sites

On 9/27/2022 at 3:55 AM, infinite_monkey said:

@cmet24 What is the time resolution for the climate weather data? I suppose half resolution means double the overall time for the same amount of data? Or maybe there's a possibility for compression, when data doesn't change very much? I.e. instead of 5 entries with wind speeds between 10.5 and 11.5 m/s, just make 1 entry for 11 m/s and specify a start and end time?

@infinite_monkey So, in this mod, atmospheric fields (e.g. temperature, humidity, pressure, etc.) were interpolated to a 1 x 1-degree rectangular grid. A five-year, hourly, climatology of Kerbin was subsequently produced by averaging this gridded weather data over time. Since the data is averaged by the hour the climatology captures the diurnal cycle of weather on Kerbin. The climate data has four dimensions: (t, z, lat, lon) where t is the hour of the day, z is height, and lat/lon are geospatial coordinates. In the main version of KWP this 4D "climatology" dataset is ~52MB. In the lite version its reduced in size to ~13MB. This reduction is achieved by reducing the geospatial resolution of the climatology by half (so from 1x1 deg to 2x2 deg).

In-game the weather/climate data is inteprolated to the position of the craft. In my experience, the data itself isn't the biggest constraint in this mod. The most computationally taxing part is computing the effects of wind, temp, etc. on flight dynamics rather than interpolating or reading in the weather/climate data itself. 

Edited by cmet24
Link to comment
Share on other sites

  • 4 weeks later...

Hello @cmet24,

 

As I understand it, you once had a full resolution dataset for Kerbin, but downsampled/averaged it to be the data for a single day outside of "point" launchsite locations.  If I may ask, how large was the full initial dataset?  I understand it was probably prohibitively large for a internet transfer, but do you still have access to it?  Would it be the sort of thing that say, if I sent you a thumbdrive and a paypal donation, you'd be willing to copy the full dataset to a thumbdrive and mail back to me?  Space is not a concern on my rig, but I do understand bandwidth being an internet problem.  Let me know if this is possible or even worthy of consideration.  Most interesting project!

Regards,

-RTB

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 3 months later...

wouldn't it be incredible if there was a collab between Blackrack and cmet to integrate this weather system into the volumetric clouds!
I mean it would be quite the undertaking but with such talented modders I'm sure they could make it happen, this is a really incredible project and I wish the best of luck!
also, with volumetric clouds, weather, parallax, life support and colonization, planet packs, and everything else the ksp1 modding community has made, it's gonna be very hard for the KSP2 team to top this (whenever they can get their current game playable that is)

Edited by Arzielle
Link to comment
Share on other sites

7 hours ago, Arzielle said:

wouldn't it be incredible if there was a collab between Blackrack and cmet to integrate this weather system into the volumetric clouds!
I mean it would be quite the undertaking but with such talented modders I'm sure they could make it happen, this is a really incredible project and I wish the best of luck!
also, with volumetric clouds, weather, parallax, life support and colonization, planet packs, and everything else the ksp1 modding community has made, it's gonna be very hard for the KSP2 team to top this (whenever they can get their current game playable that is)

I've actually thought about this a fair bit and it's probably possible.
Take the cloud cover from a time step, lerp that between the current timestep and next time step, turn that into a coverage map, you could probably derive a type map from wind speed, altitude and various other factors.

The main issue would be resolution, it's only 180x90 pixels afaik (it's a bit different) which is far lower than what most people use for cloud maps. Would be an interesting experiment nonetheless.

Link to comment
Share on other sites

  • 2 weeks later...
On 8/19/2023 at 7:45 PM, ballisticfox0 said:

I've actually thought about this a fair bit and it's probably possible.
Take the cloud cover from a time step, lerp that between the current timestep and next time step, turn that into a coverage map, you could probably derive a type map from wind speed, altitude and various other factors.

The main issue would be resolution, it's only 180x90 pixels afaik (it's a bit different) which is far lower than what most people use for cloud maps. Would be an interesting experiment nonetheless.

Would it be feasible to increase the resolution by up-scaling the map and adding procedural noise to give the clouds more definition? I suppose the rendered clouds don't need to be a perfect one to one representation of the data provided by KWP, so it seems to me something like this could look great. And I assume maps defining where there's rain and where there's snow wouldn't need to be very high res in the first place since you'll only really see those relatively close up.

I'm just wondering what the performance penalty would be of changing the cloud map in real time.

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...