Board index FlightGear Development Scenery

A smart cloud altitude algorithm

Questions and discussion about enhancing and populating the FlightGear world.

A smart cloud altitude algorithm

Postby Thorsten » Tue May 18, 2010 4:08 pm

I've been experimenting with a smart algorithm to determine in which altitude to place a Cumulus cloud. I believe the standard 3d clouds are placed a fixed altitude above the lowest point in the current terrain tile. That sometimes leads to strange effects when there are gorges, for example flying from KGCN (Grand Canyon), clouds are placed down in the Canyon.

My attempt to overcome this is based on a probabilistic sampling of terrain elevation in 1000 points before generating a Cumulus layer. That allows to determine a few quantities. What seems to work well is alt_20 (the altitude below which 20% of the terrain are) and alt_median (the altitude below which 50% of the terrain are). The idea behind the algorithm is that air layers would flow around isolated obstacles, but would follow a general slope in terrain - at least up to a point.

The algorithm attempts to place clouds at alt_20, but if the actual elevation is larger, then there is a correction and clouds are shifted upward, but never more than up to alt_med. The actual shift depends on how close the elevation already is to alt_med. The Nasal code is rather short:

Code: Select all
var get_convective_altitude = func (balt, elevation) {


var alt_offset = getprop(lw~"tmp/tile-alt-offset-ft");
var alt_median = getprop(lw~"tmp/tile-alt-median-ft");

# get the maximal shift
var alt_variation = alt_median - alt_offset;

# get the difference between offset and foot point
var alt_diff = elevation - alt_offset;

# now get the actual shift

var fraction = alt_diff / alt_variation;

if (fraction > 1.0) {fraction = 1.0;} # no placement above maximum shift
if (fraction < 0.0) {fraction = 0.0;} # no downward shift

return balt + alt_diff * fraction;

}


The test cases I've been looking so far work rather well. This is a mesa - note that the clouds group in two layers, one with a given altitude below the mesa plateau, others with a higher altitude above the mesa plateau.

Image

This is Grand Canyon - clouds are placed at rim altitude and not in the Canyon. From my personal experience, that is how clouds actually are placed there.

Image

Finally, a case study in the Alps near Innsbruck. Clouds from convection started at the summits are shifted upward about 1500 ft. I'm not entirely sure if that is how it would look like - I'd appreciate if anyone with mountain flying experience could comment.

Image

Also, if anyone knows more tricky test cases, let me know...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: A smart cloud altitude algorithm

Postby Fahim Dalvi » Wed May 19, 2010 8:21 am

Hey Thorsten,

Thats great as it looks! Are these changes available in the GIT repo? I will be happy to test them.

I didn;t really understand what your test cases are supposed to be, but Airports like LFLJ provide a great opportunity to fly inn the mountains :D

Regards,
Fahim
User avatar
Fahim Dalvi
 
Posts: 1353
Joined: Sun Oct 14, 2007 2:08 pm
Location: Qatar
Callsign: Fahim
Version: 2020.3.11
OS: macOS

Re: A smart cloud altitude algorithm

Postby Thorsten » Wed May 19, 2010 9:54 am

Until a week ago, I had never heard of GIT, now I have, although I don't really know what it is or how to use it (I'm sure there is a manual somewhere, I just haven't looked...) - so it's not available there.

If you (or anyone else) would like to test the algorithm, you can get the v0.61 package and I make the updated Nasal files available - the code in its present state, although it seems to work, is not packageable with a good conscience...

I didn;t really understand what your test cases are supposed to be


In some sense difficult terrain. When placing clouds, you'd have the notion that a layer never follows a gorge, that it does follow a sudden large-scale change in elevation like a mesa, that it does follow a slowly rising terrain, that it flows around a suddenly rising obstacle like a single mountain peak in flat terrain. The algorithm is supposed to deal with all of these adequately without manual input, so the question is if it actually does that for all cases. I've flown from KLSV to KGCN yesterday and the cloud placement worked nicely across the substantial variation in altitude, I haven't really tried the Alps yet, that's probably more complicated.

Also, does anyone know if there is Cumulus development on really high plateaus (like Tibet) the same way as at lower altitudes?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: A smart cloud altitude algorithm

Postby snowmanf » Wed May 19, 2010 10:09 am

In arid and mountainous areas the cloudbase can be very high levels maybe even over 6,000 m
you probably already know humidity dictates a lower base.
snowmanf
 
Posts: 72
Joined: Tue Apr 13, 2010 3:25 pm

Re: A smart cloud altitude algorithm

Postby WooT » Thu May 20, 2010 1:15 pm

I've just been testing the terrain presampling feature in the Innsbruck area, I had a very nice flight !
http://fgfs.i-net.hu/modules/fgtracker/ ... ID=1869846

Image

As you can see on the screenshot, I could actually fly way above the clouds that are in the valley. It has been a difficult flight, because the clouds are relatively near the ground over the mountains. As the thermal algorythm says that lift increseases gradually from 0 m AGL to 250 m AGL, it is hard to find good lift so close to the ground.

I have no real life experience of mountain flying , so I don't know if this is realistic or not.

Another point I'm unsure of, is if real cumulus clouds really follow terrain even at the higher point ( they do it really good with your current implementation in the alps ) , or if at some altitude the condensation level actually hits a maximum.
This may sound obscure so I made a drawing :
Image

I presume this depends on various meteorogical factors, of which I have cureently no knowledge.
We would really need the feedback of people with mountain fliying experience !

I'll try to read about that.
WooT
 
Posts: 92
Joined: Tue Mar 17, 2009 5:09 pm

Re: A smart cloud altitude algorithm

Postby Thorsten » Thu May 20, 2010 2:25 pm

The algorithm would hit a maximum, but the Innsbruck area is a very bad place to see it. Basically, clouds follow the terrain up to the difference between alt_20 and alt_med, so the amount of shift gets less and less with increasing elevation (that's why the clouds are so close to the ground when over summits). In the Innsbruck region, the airfield is actually a bit below alt_20 (i.e. more than 80% of the terrain are higher up) and alt_med is rather large - which makes for a very large allowed shift - so you never really see peaks above the clouds. I suppose it would happen when you try a more pronounced valley with pronounced peaks- maybe the Texel-group in the Bozen/Meran area.

But I'd likewise appreciate input from someone who either lives in the Innsbruck region and can tell me how the clouds are actually distributed on a fair day, or someone with mountain flying experience.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am


Return to Scenery

Who is online

Users browsing this forum: No registered users and 3 guests