Jump to content
Nels_Anderson
Nels_Anderson

Weather in FlightGear

title.jpg

Weather in FlightGear

By Thorsten Renk

Weather is a crucial part of every flight experience and affects aviation on so many levels that it's hard to do justice to all of them. Visibility in terms of clouds and fogging decide whether VFR flight is even possible, or if IFR rules need to be used. Altitude is determined by air pressure measurements and setting the altimeter properly is something every beginner in a cockpit learns quickly. Rain and snow may make a runway slippery, cold temperatures may lead to icing on the cockpit windows or worse, and winds have been the cause of severe accidents in the past. Activities such as soaring rely on thermal updrafts or the interaction of prevailing winds with ridges - and finally storms and heavy weather may even make airports temporarily inaccessible and require flights to divert.

 

No flight simulation can consider itself realistic without also providing a good simulation of weather and the environment. In the following, we'll see how the challenge is addressed on various levels within FlightGear.

 

 

aw01.jpg

 

 

 

aw02.jpg

 

 

Two Philosophies

There are two rather different perspectives from which one would want to define weather in a flight simulation. The first one is for training or the evaluation of a specific situation - a crosswind approach, dealing with turbulence, or an aircraft flight dynamics model performance test. In such situations, it is crucial that every aspect of the weather situation can be controlled by the user. To train windshear, several wind layers need to be defined precisely in altitude and strength, while to do a performance test, standard atmosphere conditions are best used.

 

On the other hand, for setting up a casual cross-country flight, such fine-grained control is neither necessary nor even useful - the amount of data one would have to enter to simulate the change of low-altitude winds across even 100 km distance is staggering. In this situation, it is much better to set up the basic weather situation and let the simulation sort out the details. Corresponding to these two perspectives, FlightGear offers two different weather systems, for historical reasons called, 'Basic Weather' and 'Advanced Weather'. The first one is a descriptive system - it sets a weather situation as driven by user data without considering atmospheric physics. The second one on the other hand is a (crude) simulation of the state of the atmosphere, driven by a few input parameters and randomization of what is unknown. In the following, we're mostly concerned with this second system.

 

The Weather System As Organized Information Flow

From the perspective of the pilot, weather is something that is 'out there' and has to be dealt with. However, from the perspective of setting up a simulation, weather is something else entirely - it is a system that connects various rather different subsystems.

 

Consider a sailplane soaring in ridge lift: the weather system knows of the wind, but it must communicate with the terrain system to know the shape and layout of the hill and determine just how much this deflects the airstream upward. This information needs to be sent to the flight dynamics computation of the sailplane. At the same time the updraft might also generate clouds which is something that needs to be communicated to the renderer. This enables it to not only draw the clouds, but also change the lighting in response to the clouds casting shadows onto the ground. The wind pattern (also at the same time) will generate characteristic ripples on water surfaces - from which the pilot can deduce how strong the wind is. It will also move trees and grass and give many other indications.

 

The point here is that weather does not happen in isolation - it needs a tight integration with many other systems to produce realistic effects. Let's look at some branches of the weather system to see how this works in detail.

 

Convective Clouds

One of the most challenging problems to solve in a weather simulation is convective clouds - one might almost boil it down to the idea that there are cumulus clouds to deal with and then all the rest.

 

The reason why convective clouds are so complex is their interaction with the terrain. Convection develops when the terrain heats in sunshine, and that works much better for bare rock or a parking lot than for a glacier or water. In fact, from high above, a typical sight when overflying a coast on a clear day is the sudden onset of cumulus development over the land.

 

 

aw03.jpg

 

 

 

aw04.jpg

 

 

But it does not end there - consider cumulus development in the mountains: the condensation level at which the cloud base forms follows the terrain elevation - but it does not follow every peak and valley. To correctly place clouds in mountainous terrain, the weather system needs to know the mean elevation in the vicinity (as well as the variation around the mean), plus the elevation at the location of the cloud. In fact, since wind is a major player in the mountains creating updrafts, the elevation profile upwind of a cloud needs to be considered - in addition to the terrain type underneath which potentially generates the cloud.

 

It might seem a bit involved to do all of this for thousands of clouds, but in fact getting realistic cloud distribution in mountainous regions is difficult to achieve otherwise. The advantage here is that such a system naturally generates the correct thermal updrafts associated with the clouds needed for soaring. Incidentally, the same information about the terrain layout can also be re-used in a different subsystem to model the slowdown of winds due to terrain roughness in the boundary layer.

 

In fact, the convective cloud system in FlightGear was primarily developed with the aim of making real-life glider pilot decision meaningful. The visuals of a cloud give a decent estimate of the updraft generating it - rules of thumb like looking at elevated terrain spots for 'blue' updrafts without a cloud cap increase the probability of finding thermals, plus avoiding a lee in the mountains with a glider is a must. In addition to being closely linked to the terrain, the convective system also has close ties to latitude and time of day, as these govern how much the ground can be heated by sunlight and hence how much energy is available for convection - and if that energy gets large, the system might even overdevelop and produce a thunderstorm!

 

Other Cloud Types

Unlike convective clouds which are really a local phenomenon tied closely to the terrain, other cloud types are generated by large-scale movements of air - stratiform clouds arise from the general upward motion of air in a low-pressure region, and higher well-defined clouds like altocumulus clouds, from instabilities in the upper air layers - neither of which requires more than a general knowledge of the terrain.

 

 

aw08.jpg

 

 

 

aw09.jpg

 

 

Since the Advanced Weather system is aware of the current weather situation, it generally picks the appropriate cloud types. For instance, it makes a distinction between an overcast sky resulting from an afternoon's over-developed convection (which produces stratocumulus clouds) and a low pressure situation (which more often than not, produces nimbostratus clouds). The weather system also knows of developments such as an approaching cold front which de-stabilizes the upper air layer and which consequently, will likely produce altocumulus clouds in this situation.

 

Likewise, having a physics model of the weather situation also allows for a realistic distribution of haze, at any given altitude. For instance, a warm sector wedged between warm and cold fronts is often characterized by moist and hazy air and because of this, the weather system knows that haze needs to be rendered higher up than usual.

 

As an amusing side note; even some pretty rare cloud types like noctilucent high-altitude (100 km) clouds can be generated by the system.

 

Large Scale Weather Patterns

How then is the larger-scale weather situation managed? There are two main possibilities - either use current real-life weather by automatically fetching METAR online or use the offline weather engine.

 

If a METAR string is fetched, the weather engine assigns the weather to the station location, uses heuristics to deduce the underlying meteorology from parameters such as pressure, cloud coverage or spread, factoring in daytime and latitude, and then uses other weather information already stored to deduce the position of airmass boundaries and fronts.

 

On the other hand, the offline weather engine can be started in a given weather situation, and is dependent on a scale parameter set by the user. It then changes the weather from there, taking into account the typical geometry of low and high pressure areas.

 

For the Advanced Weather system, weather is never the same in the visible scene, it is always tied to a particular location (yet drifting with the prevailing wind). For example: cirrus clouds becoming more pronounced are usually a sign of an approaching warm front, just as in real life.

 

 

aw06.jpg

 

 

 

aw07.jpg

 

 

Precipitation

Precipitation affects aviation mostly by impairing the view. Simulating this properly poses its own difficulties, as it's not so much the falling drops themselves which is most prominent, but rather the impact splashes on glass surfaces.

 

Impacts however are complicated, since strength and direction depends not only on droplet size and quantity but also on the airflow across the window, and this also determines how quickly residual water droplets are removed. In addition, the action of wipers may clear parts of a window even faster.

 

Thus, the weather system provides the outside visuals: falling drops with different sizes, rainbows where a shower is lit by the sun, raindrops hitting the ground, puddles, visuals of localized rain showers from afar, and then forwards the information on droplet size and speed to the renderer. It is then picked up by (aircraft-side) models which determine the airflow across windows and windshield wipers. If done properly, this combines into a rather stunning display of impact splashes which change dynamically as the aircraft picks up speed.

 

 

aw10.jpg

 

 

 

aw12.jpg

 

 

Severe Weather

Clearly the most impressive weather displays in nature are thunderstorms. At night, lightning can be seen illuminating whole cloud towers from afar. Turbulence, updraft and heavy precipitation make flying very dangerous to impossible.

 

There is the philosophical question of how much effort one should spend on simulating a situation no pilot would voluntarily get into in real life - but one of the advantages of a simulation is that one can experience such situations without getting harmed. Thus, it's all there in the simulation - you can see lightning bolts, fly through severe turbulence, be carried near the stratosphere by vicious updrafts, and watch rain and hail hammer on the canopy!

 

 

aw11.jpg

 

 

 

aw13.jpg

 

 

Weather interacts with the visible terrain in multiple ways and requires a tight integration of the weather system and 3D rendering. One example is wave motion on water: the direction and strength of the wind drives the direction and strength of wave motion, and water surfaces can show tiny ripples in fair weather as well as foam-covered wave crests in a storm. In FlightGear, this is simulated by passing averaged wind-information to the water shader which then generates the appropriate pattern of waves procedurally.

 

Another important example is the effect of precipitation on the ground. For instance, wet terrain is darker and has a different reflectivity when compared with dry terrain. On hard surfaces, puddles may form, and if there is any open water, rain splashes can be seen impacting. Snow gradually covers the terrain according to density, but whether snow stays on the ground or melts is a function of temperature, which in the mountains is determined by altitude.

 

In fact, snow is rather complicated, because snow cover depends on the past weather pattern rather than the current weather - there can be snow on the ground on a beautiful sunny winter's day (and likewise the ground can be wet after a T-storm has already passed). For that reason, such effects are only half-driven by the weather system, and the user can opt to have snow on the ground even if the weather system has no current knowledge of snow.

 

 

aw14.jpg

 

 

 

aw15.jpg

 

 

Weather And Aircraft

Weather may affect aircraft in multiple ways - however once this gets more complicated than the wind simply changing the aerodynamics, it requires that the aircraft creator takes weather explicitly into account - and not all aircraft are simulated at this detail level.

 

For instance, one important effect is icing. This can affect the pitot tube and the wings and requires the ability to operate heaters, but there is also the possibility to render visible freezing of windows (which need to be thawed by cabin heaters). Another example is the detailed simulation of rain splashes and wipers as mentioned above. However, in a sense aircraft can also make their own weather. For instance the downwash of a helicopter moves grass pretty much the same way as wind moves trees, and recently a detailed downwash simulation effect has been added to FlightGear, adding much to the experience of hovering helicopters over grass or water.

 

 

aw16.jpg

 

 

 

aw17.jpg

 

 

The Truly Global Perspective

For simulating spacecraft in Earth orbit, FlightGear offers the Earthview orbital rendering engine. With its rich procedural post-processing of textures, a sophisticated lighting code for the dawn zone and a detailed aurora display, this is one of the best free visualizations of Earth from orbit, especially when full hi-res textures are installed - and it even offers some (limited) weather options.

 

From orbit, weather of course affects the visuals only, and the cloud patterns are fairly restricted to the cloud maps NASA provides, but the renderer can change wet and dry aerosol density dynamically and thus produces a variable amount of haze and cloud cover - with the atmosphere effect correspondingly reduced over mountain ranges. And there's even visuals of thunderstorms illuminating their storm cells during the night portion of the orbit to be discovered!

 

 

aw05.jpg

 

 

 

aw18.jpg

 

 

Final Thoughts

Coding realistic weather is and continues to be one of the truly hard challenges. It is always tempting to make the system more realistic, yet with the need to manage thousands of clouds and thermals in the visible range while doing detailed terrain interaction for a sizeable fraction of them, introducing better atmosphere physics leads to performance hits rather quickly. This is even more true for subtle effects which are not readily visible. As a fellow developer once put it: 'Do we want a weather simulator or a flight simulator?'

 

The weather system in FlightGear is therefore gradually evolved along with the increasing performance of computers and graphics cards, taking care to interface it with the renderer and the adaptions that need to be done aircraft-side. There is clearly no shortage of ideas and directions for further development - one of the next things to appear might for instance be a connection to the recently added active volcano simulation in terms of ash clouds and their effect on flight dynamics.

 

More Information

 

 

Thorsten Renk
http://home.flightgear.org/

weather.jpg

User Feedback

Recommended Comments

There are no comments to display.



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...