Skip to content

weebforever00-oss/rayleigh-scattering-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

🔵 Rayleigh Scattering Simulator

Why is the sky blue? Why are sunsets red?

This simulation models Rayleigh scattering — the physical phenomenon where light interacts with molecules in Earth's atmosphere. The key insight is that scattering intensity is proportional to λ⁻⁴, meaning shorter wavelengths (blue/violet) scatter ~10× more than longer wavelengths (red).

The Physics

When sunlight enters the atmosphere, gas molecules scatter shorter wavelengths much more efficiently than longer ones:

  • Overhead sky (short path): Blue light scatters in all directions → sky appears blue
  • Sunset (long path): Blue is scattered away entirely, only red survives → sky appears red/orange

Features

  • Calculate Rayleigh cross-sections for any wavelength
  • Simulate sky color at any zenith angle (0° = overhead, 90° = horizon)
  • Chapman-like atmospheric path length model
  • Color intensity bar charts for visualization

Quick Start

python rayleigh.py

Output

The simulator shows:

  1. Relative scattering intensities across the visible spectrum
  2. Sky color evolution from zenith to horizon
  3. Quantitative explanation of why blue drops ~5000× while red drops only ~15×

References

  • Rayleigh, Lord (1871). "On the light from the sky, its polarization and colour"
  • Hansen & Travis (1974). "Light scattering in planetary atmospheres"

About

Simulation of Rayleigh scattering — why the sky is blue and sunsets are red

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages