Atmospheric Thermodynamics
As you climb a mountain, lower pressure lets air expand and cool on its own; that is adiabatic cooling. The dry adiabatic lapse rate is about 10°C/km, and when vapor condenses latent heat is released so cooling slows to the moist rate of about 5°C/km. The altitude where a parcel reaches the dew point becomes the cloud base, and air descending over a mountain compresses and warms as the Foehn effect. Here you can change surface temperature and environmental lapse rate to explore cloud-base height and atmospheric stability.