1.2 Atmospheric Composition

The atmosphere is a mixture of gases, aerosols, and water vapor. While nitrogen and oxygen dominate by volume, trace gases like CO₂, CH₄, and O₃ play crucial roles in climate and chemistry.

Major Atmospheric Gases

Nitrogen (N₂)

78.08%

Chemically inert in lower atmosphere. Essential for life via nitrogen cycle.

Oxygen (O₂)

20.95%

Essential for respiration. Product of photosynthesis. Absorbs UV in stratosphere.

Argon (Ar)

0.93%

Noble gas, completely inert. Third most abundant atmospheric constituent.

Water Vapor (H₂O)

0-4%

Highly variable. Most important greenhouse gas. Source of clouds and precipitation.

Trace Gases & Climate

Carbon Dioxide (CO₂)

~420 ppm

Primary anthropogenic greenhouse gas. Risen from 280 ppm pre-industrial to 420 ppm today.

Methane (CH₄)

~1.9 ppm

25× more potent GHG than CO₂ over 100 years. Sources: wetlands, agriculture, fossil fuels.

Ozone (O₃)

~0.3 ppm

Stratospheric: protects from UV. Tropospheric: pollutant and greenhouse gas.

Nitrous Oxide (N₂O)

~0.33 ppm

Potent GHG (298× CO₂). Sources: agriculture, combustion, industrial processes.

Mean Molecular Weight

$$\bar{M} = \sum_i x_i M_i = 28.97 \text{ g/mol}$$

For dry air (dominated by N₂ at 28 and O₂ at 32)

The ideal gas law for air: $p = \rho R_d T$ where Rd = R*/M̄ = 287 J/(kg·K) is the gas constant for dry air.

Python: Composition Analysis

#!/usr/bin/env python3
"""
atmosphere_composition.py - Analyze atmospheric composition

Run: python3 atmosphere_composition.py
Requires: pip install numpy matplotlib
"""
import numpy as np
import matplotlib.pyplot as plt

# Atmospheric composition (dry air, by volume)
gases = {
    'N2': {'fraction': 0.7808, 'M': 28.013, 'name': 'Nitrogen'},
    'O2': {'fraction': 0.2095, 'M': 31.999, 'name': 'Oxygen'},
    'Ar': {'fraction': 0.0093, 'M': 39.948, 'name': 'Argon'},
    'CO2': {'fraction': 420e-6, 'M': 44.01, 'name': 'Carbon Dioxide'},
    'Ne': {'fraction': 18.18e-6, 'M': 20.18, 'name': 'Neon'},
    'He': {'fraction': 5.24e-6, 'M': 4.003, 'name': 'Helium'},
    'CH4': {'fraction': 1.9e-6, 'M': 16.04, 'name': 'Methane'},
    'N2O': {'fraction': 0.33e-6, 'M': 44.01, 'name': 'Nitrous Oxide'},
}

# Calculate mean molecular weight
M_bar = sum(g['fraction'] * g['M'] for g in gases.values())
print(f"Mean molecular weight of dry air: {M_bar:.3f} g/mol")

# Gas constant for dry air
R_star = 8.314  # J/(mol·K)
R_d = R_star * 1000 / M_bar  # J/(kg·K)
print(f"Gas constant for dry air: R_d = {R_d:.1f} J/(kg·K)")

# Greenhouse gas radiative forcings (W/m²)
ghg_forcing = {
    'CO2': 2.16,
    'CH4': 0.54,
    'N2O': 0.21,
    'Halocarbons': 0.41,
}

# Plot pie chart of major constituents
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 6))

# Main composition (N2, O2, Ar, other)
main_fractions = [0.7808, 0.2095, 0.0093, 0.0004]
main_labels = ['N₂ (78.08%)', 'O₂ (20.95%)', 'Ar (0.93%)', 'Other (0.04%)']
colors = ['#3498db', '#e74c3c', '#9b59b6', '#2ecc71']
ax1.pie(main_fractions, labels=main_labels, colors=colors, autopct='', startangle=90)
ax1.set_title('Atmospheric Composition (Dry Air)', fontsize=14)

# Greenhouse gas forcing
ghg_names = list(ghg_forcing.keys())
ghg_values = list(ghg_forcing.values())
bars = ax2.barh(ghg_names, ghg_values, color=['#e74c3c', '#f39c12', '#3498db', '#9b59b6'])
ax2.set_xlabel('Radiative Forcing (W/m²)', fontsize=12)
ax2.set_title('Greenhouse Gas Radiative Forcing (since 1750)', fontsize=14)
ax2.bar_label(bars, fmt='%.2f')

plt.tight_layout()
plt.savefig('atmosphere_composition.png', dpi=150, bbox_inches='tight')
plt.show()
print("Saved as atmosphere_composition.png")

# CO2 concentration over time (Keeling curve approximation)
years = np.arange(1960, 2025)
co2_base = 315  # ppm in 1960
co2_growth = 1.5  # ppm/year average
co2 = co2_base + co2_growth * (years - 1960) + 3 * np.sin(2 * np.pi * years)  # with seasonal cycle

print(f"\nCO2 concentration (2024): ~{co2[-1]:.0f} ppm")