weather and air pressure - pilkch/library GitHub Wiki

Wind occurs on a range of scales, from thunderstorm flows lasting tens of minutes, to local breezes generated by heating of land surfaces and lasting a few hours, to global winds resulting from the difference in absorption of solar energy between the climate zones on Earth.

Wind at a global scale

images/prevailing_winds_map.png

images/winds-global-circulation.jpg

  • The two main causes of large-scale atmospheric circulation are the differential heating between the equator and the poles, and the rotation of the planet (Coriolis effect).

... wind map for prevailing winds. Wind is based on real world patterns caused by Coriolis forces - so there will be trade winds, westerlies, and zones of low winds like doldrums or horse latitudes. When selecting current wind for the player surrounding area it won't be completely random as it is now, but will be based on those prevailing winds and previous wind like in some kind of random process.

Source

Wind at a local scale

  • Within the tropics and subtropics, thermal low circulations over terrain and high plateaus can drive monsoon circulations.
  • In coastal areas the sea breeze/land breeze cycle can define local winds.
  • in areas that have variable terrain, mountain and valley breezes can prevail.

Wind variation

Source, this awesome thesis "A Study on Efficient Algorithms for Generating Virtual Wind Field Usable for Real-time Animation" by Khorloo Oyundolgor

Changes with:

  • Season (Seasonal)
  • Passing weather system (Synoptic)
  • On a daily basis (Diurnal)
  • From second to second (Turbulence)

The strongest, steadiest, and most persistent winds occur in bands some 10 km above the earth’s surface. The region below about 1-2 km, the wind is strongly affected by the surface, through friction, and hence wind speeds are lower.

In general, the wind speed is nominally zero at ground level and increases steadily with height. The change of wind speed with height is known as the wind shear.

mean window speed at height z = 1/ k * u * ln(z/z0)

k is von Karman’s constant 0.4
u is the friction velocity z is the height above the ground
z0 is the surface friction roughness length

Essentially wind speed approaches zero on a surface, is slow near a surface, and the wind speed increases as you get above that surface. When the surface friction increases the wind velocity decreases further up into the atmosphere, when the surface friction is lower such as over a lake then it affects less of the air above it and the velocity can be higher.

Example surface friction roughness values:
High rise 0.40
Suburb 0.28
Ocean 0.16

Type of terrain Surface Roughness Length z0 Power Law Exponent Ξ±
Mud flats, ice 10^βˆ’5 to 3 Γ— 10^βˆ’5
Calm sea 2 Γ— 10^βˆ’4 to 3 Γ— 10^βˆ’4
Sand 2 Γ— 10^βˆ’4 to 10^βˆ’3 0.01
Mown grass 0.001 to 0.01
Low grass 0.01 to 0.04 0.13
Fallow field 0.02 to 0.03
High grass 0.04 to 0.1 0.19
Forest and woodland 0.1 to 1
Built up area, suburb 1 to 2 0.32
City 1 to 4

We can model the wind speed from a relatively steady rough wind speed plus a turbulence factor, as something like:
wind speed = calculate_wind_at_height(height above the ground, surface friction roughness) + calculate_wind_turbulence_at_height(height above the ground)

Sea breezes

In coastal regions, sea breezes and land breezes can be important factors in a location's prevailing winds. The sea is warmed by the sun more slowly because of water's greater specific heat compared to land. As the temperature of the surface of the land rises, the land heats the air above it by conduction. The warm air is less dense than the surrounding environment and so it rises. The cooler air above the sea, now with higher sea level pressure, flows inland into the lower pressure, creating a cooler breeze near the coast. A background along-shore wind either strengthens or weakens the sea breeze, depending on its orientation with respect to the Coriolis force.

At night, the land cools off more quickly than the ocean because of differences in their specific heat values. This temperature change causes the daytime sea breeze to dissipate. When the temperature onshore cools below the temperature offshore, the pressure over the water will be lower than that of the land, establishing a land breeze, as long as an onshore wind is not strong enough to oppose it.

images/wind-sea-breezes.svg

A: Sea breeze (occurs at daytime), B: Land breeze (occurs at nighttime)

Mountain breezes

Over elevated surfaces, heating of the ground exceeds the heating of the surrounding air at the same altitude above sea level, creating an associated thermal low over the terrain and enhancing any thermal lows that would have otherwise existed, and changing the wind circulation of the region. In areas where there is rugged topography that significantly interrupts the environmental wind flow, the wind circulation between mountains and valleys is the most important contributor to the prevailing winds. Hills and valleys substantially distort the airflow by increasing friction between the atmosphere and landmass by acting as a physical block to the flow, deflecting the wind parallel to the range just upstream of the topography, which is known as a barrier jet. This barrier jet can increase the low-level wind by 45%. Wind direction also changes because of the contour of the land.

If there is a pass in the mountain range, winds will rush through the pass with considerable speed because of the Bernoulli principle that describes an inverse relationship between speed and pressure. The airflow can remain turbulent and erratic for some distance downwind into the flatter countryside. These conditions are dangerous to ascending and descending airplanes. Cool winds accelerating through mountain gaps have been given regional names. In Central America, examples include the Papagayo wind, the Panama wind, and the Tehuano wind. In Europe, similar winds are known as the Bora, Tramontane, and Mistral. When these winds blow over open waters, they increase mixing of the upper layers of the ocean that elevates cool, nutrient rich waters to the surface, which leads to increased marine life.

In mountainous areas, local distortion of the airflow becomes severe. Jagged terrain combines to produce unpredictable flow patterns and turbulence, such as rotors, which can be topped by lenticular clouds. Strong updrafts, downdrafts, and eddies develop as the air flows over hills and down valleys.

Wind shear

Difference in wind direction/speed/pressure between two bodies of air close to each other. A plane could be in stable flight in one body of air, and hit a second body of air with a different wind direction/speed/pressure and drop sudden. Wind shear can be broken down into vertical and horizontal components, with horizontal wind shear seen across weather fronts and near the coast, and vertical shear typically near the surface, though also at higher levels in the atmosphere near upper level jets and frontal zones aloft.

Wind Speeds

Beaufort Force Description Wind Speed KPH
Force 0 Calm < 2
Force 1 Light 2 βˆ’ 6
Force 2 Light 7 βˆ’ 12
Force 3 Moderate 13 βˆ’ 19
Force 4 Moderate 20 βˆ’ 30
Force 5 Fresh 31 βˆ’ 40
Force 6 Strong 41 βˆ’ 51
Force 7 Strong 52 βˆ’ 62
Force 8 Gale 63 βˆ’ 75
Force 9 Gale 76 βˆ’ 87
Force 10 Storm 88 βˆ’ 103
Force 11 Storm 104 βˆ’ 117
Force 12 Hurricane β‰₯ 118

Clouds

Simulate with 4 layers of these types of clouds? TODO: Should they be sphere/cylinder volumes instead so we can have clear sky above one location and thunderstorm over another? You would be able to see the clouds rolling in on the horizon for example.

Types:

  • Whispy
  • Scattered
  • Patchy white clouds
  • Thick white clouds
  • Thunderstorm
  • Fog (TODO: If we are using layers fog could just be overcast at ground height?)
  • Sand storm
  • Volcanic (Blacken the sky, add ash particles)
  • Firestorm (Redden the sky, add ash particles)

images/cloud-types.png

Technically you get different types of clouds (Cirrus, cumulonimbus, cirrostratus, altostratus, etc.) at different heights, but we can probably simplify it to cloud layers/volumes with different properties, so you could any cloud type at any height. The ambient temperature can dictate how low the clouds/fog will get however. Might be able to simulate cloud types with variables for precipitation, density, shape (Individual balls of cloud or extended lines of clouds (Affected by the wind?)). Precipitation would be more likely with higher density.

Rain

Orographic precipitation and rain shadows

Orographic precipitation occurs on the windward side of mountains and is caused by the rising air motion of a large-scale flow of moist air across the mountain ridge, also known as upslope flow, resulting in adiabatic cooling and condensation. In mountainous parts of the world subjected to relatively consistent winds (for example, the trade winds), a more moist climate usually prevails on the windward side of a mountain than on the leeward or downwind side. Moisture is removed by orographic lift, leaving drier air on the descending and generally warming, leeward side where a rain shadow is observed.

Winds that flow over mountains down into lower elevations are known as downslope winds. These winds are warm and dry. Wind speeds during downslope wind effect can exceed 160 KPH.

Simulation

struct CloudVolume {
  cCylinder volume;
  float fTemperature;
  float fPressurePa;
};

Humidity can be calculated from the air temperature and pressure.

Below 0Β°C change rain to snow or hail?
Rain, hail and snow have a "size"

precipitation = 0.0f;
precipitation_type = RAIN;

for (each weather volume) {
  if (player.xy is near/within volume.xy) {
    if (volume.precipitation) {
      precipitation += precipitation but add some ramping in and out of the volume;
    }
  }
}

// TODO: Support hail? It is caused when rain is blow upwards via an updraft where it freezes higher up in the atmosphere, then drops back down
if (ambient temperature < 0.0f) precipitation_type = SNOW;

Markov Chains to Calculate Weather Transitions

We can use a Markov Chain to choose the next weather transition. It only relies on the the current weather. There is the Simple Weather Model, or the Stock Market example here:
https://en.wikipedia.org/wiki/Examples_of_Markov_chains#A_simple_weather_model

Wikipedia uses matrices, but the diagrams are basically state machines where each state which might be easier to visualise and reason about. The weather model mentions switching weather every day, but it would be more interesting choosing a new weather every minute (Bearing in mind, it would mostly stay in the current weather).