Climate Change: Simple, Serious, Solvable › Models
Leaky and Stirred: Two Layers of Air over Warm Ground
The real air isn't a perfect pane of glass. Some Earthlight leaks straight through it, and rising air carries heat up past it. Make two layers of air leak, stir them, and see what that does to the ground.
Two layers of air over black ground
- Sunlight
- Earthlight
- Heat carried by rising air
- The numbers beside the arrows are in W/m².
| Level | Temperature | Takes in (W/m²) | Gives off (W/m²) |
|---|
- Your settings
- The same air with no heat carried by rising air
Heat in equals heat out. Each layer and the ground settle at the temperature where they give off as much as they take in. A layer emits Earthlight from both of its sides, and it emits as strongly as it absorbs.
You choose how much heat the rising air carries. The model moves that much, whatever the temperatures are. The real air decides for itself. The simpler model, Panes of Glass, has perfect panes and still air. The About tab has every equation.
About this model
This model starts where the layer model of Chapter 3 stops. In the layer model, panes of glass absorb every bit of the Earthlight that reaches them, and nothing but light moves heat. One pane warms the ground to 303 K, and the real Earth's surface averages about 288 K. Chapter 3 gives the reason: the real atmosphere is more like one pane that's leaky and stirred.
Here the panes are two layers of air over black ground, and you can make them leak and stir them.
- Leaky: a layer absorbs only a share of the Earthlight (thermal infrared radiation) that reaches it. The rest passes straight through.
- Stirred: rising air carries heat upward, from the ground into the lower layer and from the lower layer into the upper layer. Chapter 3 calls this vertical mixing. In the model it stands for everything but light that moves heat upward: warm air rising, and water that evaporates at the ground and condenses higher up.
The rule for every level is still the book's: heat in equals heat out. Each layer and the ground settle at the temperature where they give off as much as they take in. With layers that absorb all of the Earthlight and with no rising air, this is the layer model with two panes, and the ground is at 335 K (62 °C, 143 °F), as in Figure 3.3 of the book. The page opens with layers that absorb 75% of the Earthlight and with rising air that carries 103 W/m² up from the ground. With those the ground is at 288 K (15 °C, 59 °F).
The simpler model, Panes of Glass, has the perfect panes and the still air. It's the place to start.
How to use this page
The page has two views of the same model. "The flows" draws the two layers and the ground from the side, with space at the top. The straight arrow is Sunlight, on its way down through the air to the ground. The wavy arrows are Earthlight, and they stand in three columns: the ground's Earthlight, then the lower layer's, then the upper layer's. Follow a column through a layer and you can see how much of that Earthlight is left on the other side. The broad dashed arrows are the heat that rising air carries. The number beside an arrow is the flow of energy in W/m². Each layer's temperature is at its right-hand end, and the ground's is written on the ground.
"The temperatures" is a graph of the three temperatures, with the ground at the bottom. The solid line is for your settings. The dashed line is the same air with nothing carried by rising air, so the space between the two lines is what the stirring does. A thin upright line marks 288 K. The model has no heights in it, so the graph spaces the three levels evenly.
You can change six things:
- How much each layer absorbs, from 1% to 100% of the Earthlight that reaches it. The page opens with 75% for both layers.
- The heat that rising air carries from the ground into the lower layer, from 0 up to all the Sunlight the ground takes in. The page opens at 103 W/m².
- The heat that rising air carries on from the lower layer into the upper layer, from 0 up to what it carries from the ground. The page opens at 86 W/m².
- The Sunlight on a square meter that faces the Sun, from 800 to 1,500 W/m². The page opens at 1,361 W/m², the Earth's.
- The albedo, which is the share of the Sunlight that the planet reflects, from 0% to 90%. The page opens at 30%, the Earth's.
The two sliders for rising air stop where the model does, and the lines under them say where that is. If you change something else so that a slider is past its new stop, the page moves it back to the stop.
Three buttons set the air for you. "Two perfect panes, still air" makes both layers absorb 100% and stops the rising air. "Leaky layers, still air" sets both layers to 75% and stops the rising air. "Back to the start: leaky and stirred" puts every control back where it started.
Under each view, a few lines give the temperatures in words. Under the drawing of the flows, a table gives each level's heat budget: its temperature, what it takes in and what it gives off.
The address in your browser changes as you move the controls, so you can bookmark a view or send it to someone. Nothing is sent anywhere as you work.
This page is part of the website for Climate Change: Simple, Serious, Solvable, an open textbook by Scott Denning. It goes with Chapter 3, "How Climate Works".
The equations
You don't need any of this to use the page. But the whole model is seven short steps, and you can follow every one of them with a calculator.
The model asks one question of every level: how warm does it have to be to give off as much heat as it takes in? A level that takes in more than it gives off warms up, and a warmer level emits more. So each level ends up at the one temperature where the two are equal. The model goes straight to those temperatures.
You choose six things:
- the Sunlight, S, on a square meter that faces the Sun. For the Earth it's the solar constant of Chapter 2.
- the albedo, α (the Greek letter alpha), which is the share of the Sunlight that the planet reflects.
- the share of the Earthlight that each layer absorbs: ε1 for the upper layer and ε2 for the lower (ε is the Greek letter epsilon). A share of 75% is an ε of 0.75. Physicists call ε a layer's emissivity, for a reason that step 2 gives.
- the heat that rising air carries, in W/m²: Cg from the ground into the lower layer, and C2 from the lower layer into the upper layer. The C is for carried, and for convection, which is Chapter 3's word for heat carried by moving air.
One number never changes:
| Letter | What it is | Its value |
|---|---|---|
| σ | the Stefan–Boltzmann constant of Chapter 2 (the Greek letter sigma), in W/m² per K⁴ | 5.67 × 10⁻⁸ |
The layers are numbered from the top, as the panes are in the simpler model. Layer 1 is the upper layer and layer 2 is the lower. A letter with a number under it belongs to that layer, so T1 is the temperature of the upper layer. A letter with a small g under it belongs to the ground, as in Tg. A C is named for the level the heat leaves. Temperatures are in kelvins, and every flow of energy is in W/m².
1. How much Sunlight does the ground take in?
Averaged over the whole planet, day and night, the ground takes in
in W/m². This is Section 3.1 of the book. A planet catches Sunlight on a disk, the area of its shadow, and its whole surface has four times that area. So each square meter gets a quarter of S on average, and that's the 4. The (1 − α) is the share that isn't reflected. For the Earth, a quarter of 1,361 is about 340 W/m², and 70% of that is 238 W/m². In this model the air is clear to Sunlight, so all of Q reaches the ground.
2. How much Earthlight does a level emit?
A level at temperature T emits
in W/m². For the black ground ε is 1, and this is the Stefan–Boltzmann law of Chapter 2, which writes it with the letter F. Here it's E, for emitted.
A layer of air isn't black. It absorbs a share ε of the Earthlight that reaches it and lets the rest, a share of 1 − ε, pass straight through. And it emits ε times as much as a black surface at its temperature would. That's a law of physics, Kirchhoff's law: whatever absorbs a kind of light weakly emits it just as weakly. A layer emits E from each of its two sides, so it gives off 2E of Earthlight in all.
3. How much does the upper layer emit?
Start at the top, as the simpler model does. The Earthlight that leaves for space has two parts. One is what the upper layer emits upward, E1. The other is what leaks through it from below. Call the Earthlight that comes up to the upper layer U. The layer absorbs ε1U of it and lets the rest through. The stack as a whole takes in Q, and it has to send the same amount out:
Now do the upper layer's own budget. It takes in the Earthlight it absorbs and the heat that rising air brings up from the lower layer. It emits E1 up and E1 down. Heat in equals heat out:
That's two equations with two unknowns, E1 and U. Put the second into the first to get rid of U, and you have
Look at what isn't in it: the lower layer and the ground. The upper layer has to make up what the whole stack owes to space, so what it emits depends only on Q, on its own ε1 and on the heat that rising air brings it. If the layer absorbs everything, ε1 is 1 and E1 is just Q. That's the top pane of the simpler model.
4. How much Earthlight comes up to the upper layer?
Step 3's two equations each account for a part of U. The first says how much of it gets through the upper layer: (1 − ε1)U is Q − E1. The second says how much of it the layer absorbs: ε1U is 2E1 − C2. The two parts make up all of U, so add them:
You can read this one straight off the drawing. Look at the gap between the two layers. Going up through it are U and the rising air's C2. Coming down through it are the Sunlight, Q, and the upper layer's E1. What goes up has to equal what comes down, or everything under the gap would be warming or cooling.
5. How much does the ground emit?
U has two parts as well: the share of the ground's Earthlight that the lower layer lets through, and what the lower layer emits upward:
Then do the ground's budget. The ground takes in the Sunlight, what the lower layer emits downward, and the part of the upper layer's Earthlight that leaks down through the lower layer. It gives off its own Earthlight, Eg, and the heat that rising air carries away, Cg:
Two more equations and two more unknowns, Eg and E2. Put in the U of step 4, get rid of E2, and you have
The rising air comes in with minus signs. Every W/m² that rising air carries up is one the ground doesn't have to emit, so stirring cools the ground. With perfect panes and still air, ε2 is 1, the two Cs are 0 and E1 is Q, so the ground emits 3Q. That's the simpler model with two panes.
6. How much does the lower layer emit?
Turn the first equation of step 5 around:
The lower layer's own budget hasn't been used yet, so it makes a good check. The layer absorbs a share ε2 of the ground's Earthlight and of the upper layer's, and rising air brings it Cg. It emits E2 from each side and gives C2 to the rising air:
The numbers from the steps above always fit it.
7. How warm is each level?
Turn step 2 around to get the temperature of a level that emits E:
in kelvins. For the ground, ε is 1. The power 1/4 is a fourth root. On a calculator, press the square-root key twice.
A leaky layer is warmer than its Earthlight suggests. A layer with an ε of 0.75 that emits 160 W/m² is at 248 K. A black surface that emitted as much would be 17 K colder.
Where the equations stop
This is still a toy, and it leaves a lot out.
- You choose the rising air. In the real atmosphere, the heat that rising air carries depends on the temperatures: warm air rises only while the air above it is cooler. Here Cg and C2 are yours to set, and the model carries what you ask for. Ask for enough and a layer comes out warmer than the level under it, which rising air couldn't do. The page tells you when that happens.
- One share for all of the Earthlight. A real gas absorbs some wavelengths strongly and lets others through, and that's the window of Section 3.4. This model has one number for the whole spectrum. Earthlight Seen from Space shows the real spectrum.
- Two layers. The real air has no layers. Its temperature changes smoothly with height.
- Air that's clear to Sunlight. The real air absorbs some of the Sunlight on its way down (Figure 3.10 of the book). Here all of Q reaches the ground.
- One square meter for the whole planet. There's no day and night, no summer and winter, and no tropics and poles.
So the model can match the real surface's 288 K, but it doesn't match every flow. As the page opens, 24 W/m² of the ground's Earthlight goes straight out to space, and Figure 3.10 has 22. But the model's sky sends 255 W/m² down to the ground, and Figure 3.10 has 342.
A worked example
Open the page and leave the controls alone. Both layers absorb 75%, so ε1 and ε2 are 0.75. Rising air carries 103 W/m² from the ground and 86 W/m² from the lower layer. The Sunlight is 1,361 W/m² and the albedo is 30%, so α is 0.3.
- Sunlight taken in (step 1). Q = 1,361 × (1 − 0.3) ÷ 4 = 238 W/m². That's the number beside the Sunlight in the drawing.
- The upper layer (step 3). E1 = (0.75 × 238 + 0.25 × 86) ÷ (2 − 0.75) = 200 ÷ 1.25 = 160 W/m². That's the number on the upper layer's arrow to space, and on its arrow down.
- What comes up to the upper layer (step 4). U = 238 + 160 − 86 = 312 W/m².
- The ground (step 5). Eg = 160 + (2 × 238 − 103 − 86) ÷ (2 − 0.75) = 160 + 287 ÷ 1.25 = 390 W/m², to the nearest whole number. That's the number on the arrow going up from the ground.
- The lower layer (step 6). The lower layer lets through 0.25 × 390 = 97.5 W/m² of the ground's Earthlight. So E2 = 312 − 97.5 = 214.5 W/m². The page prints 215 on each of the lower layer's two arrows, because it carries every number from step to step without rounding it. Use 215.
- The temperatures (step 7). For the ground, divide 390 by 5.67 × 10⁻⁸ and you get about 6.9 billion. Take the square root of that twice and you have 288 K. For each layer, εσ is 0.75 × 5.67 × 10⁻⁸. Divide 215 by that and take the square root twice, and the lower layer is at 267 K. Do the same with 160, and the upper layer is at 248 K.
- The other scales. 288 − 273.15 = 14.85, which the page prints as 15 °C. And 14.85 × 1.8 + 32 = 58.73, which it prints as 59 °F.
Those are the numbers in the drawing and in the table under it: 160, 215 and 390 W/m², and 248 K, 267 K and 288 K.
A few details
- Rounding. The page prints each flow to a whole W/m² and each temperature to a whole kelvin. It works out the Celsius and the Fahrenheit from the whole kelvins, as the last line of the worked example does. Each number is rounded by itself, so a sum in the table can be 1 off.
- Why a layer can't absorb 0%. A layer that absorbs none of the Earthlight emits none, and then nothing fixes its temperature. Step 7 would divide by zero. So the sliders stop at 1%.
- Why the rising air has limits. Rising air can carry from the ground no more than the Sunlight the ground takes in, and it can carry from the lower layer no more than it brings up from the ground. Inside those limits every level emits more than nothing, so every level has a temperature. Past them, the equations can ask a level to emit less than nothing.
- The settings the page opens with. The 103 W/m² from the ground is the book's: Figure 3.10 has 82 W/m² leaving the surface by evaporation and 21 in rising warm air. The two shares of 75% and the 86 W/m² aren't measurements. They were chosen so that the ground comes out at 288 K, and other choices do that just as well.
See the equations at work
Keep the Earth's Sunlight and albedo for all of these.
- Two perfect panes. Press "Two perfect panes, still air". The upper layer is at 255 K, the lower at 303 K and the ground at 335 K (62 °C, 143 °F). Those are the numbers of the simpler model with two panes, and of Figure 3.3.
- Let them leak. Press "Leaky layers, still air". Each layer now lets a quarter of the Earthlight through, and 33 W/m² of the ground's Earthlight goes straight out to space. The ground cools to 310 K (37 °C, 98 °F). That's still much warmer than the real Earth.
- Stir the lower air. Set the heat carried from the ground to 103 W/m², and leave the heat carried from the lower layer at 0. The ground cools to 297 K and the lower layer warms from 277 K to 282 K. The upper layer stays at 241 K: nothing about the ground or the lower layer is in step 3.
- Stir the upper air too. Now set the heat carried from the lower layer to 86 W/m². The ground cools to 288 K, the lower layer cools to 267 K and the upper layer warms to 248 K. As Chapter 3 says, vertical mixing cools the surface and warms the upper air. The view "The temperatures" shows it as the space between the two lines.
- More than one way to 288 K. Set the upper layer to 60%, the lower layer to 85% and the heat carried from the lower layer to 63 W/m². The ground is at 288 K again, with different air over it. The model has four dials for the air, and one temperature can't tell you where to set them.
- Thicken the greenhouse. Press "Back to the start: leaky and stirred", then raise both layers from 75% to 85%. Less of the ground's Earthlight leaks out to space, 10 W/m² where it was 24, and the ground warms from 288 K to 296 K.
- Ask too much of the rising air. Set both layers to 50% and both flows of rising air to 100 W/m². The upper layer comes out at 251 K, over a lower layer at 245 K. Real air wouldn't rise into warmer air above it, and the page says so under the drawing.
Where the numbers come from
The solar constant, 1,361 W/m², is Chapter 2's, from Kopp and Lean (2011). The Earth's albedo, about 30%, and the Stefan–Boltzmann constant are in Chapter 2 as well. The 288 K for the Earth's surface is Chapter 3's. The 103 W/m² that rising air carries from the ground is the sum of two numbers in Figure 3.10 of the book, as the details above explain. The other three settings the page opens with were chosen to give 288 K.
The model is Scott Denning's, written for teaching. It grows out of the layer model, and the book's source for that is David Archer's textbook.
Kopp, G., and Lean, J. L. (2011). A new, lower value of total solar irradiance: Evidence and climate significance. Geophysical Research Letters 38(1). doi:10.1029/2010GL045777
Archer, D. (2012). Global Warming: Understanding the Forecast (2nd ed.). John Wiley & Sons.
How it was checked
A set of tests comes with the model, and they run every time the page changes. Here's what they hold it to.
- The code, against a second copy. The tests have the seven steps written out a second time, in another programming language. At 339 settings of the six controls, the two copies give the same temperatures to a millionth of a kelvin.
- The short way, against the long way. The steps above solve the budgets one level at a time. The tests also take the budgets of the ground and the two layers and solve all three at once, as a set of simultaneous equations. The two ways agree to a millionth of a kelvin.
- The page, against the first versions. Scott Denning's first version of this model was a web app written in R, and it solved the budgets the long way. A later version is in Python. Run as they were left, at the same 339 settings, both agree with this page's code to a millionth of a kelvin.
- The model, against the simpler one. With layers that absorb everything and with still air, the temperatures are 255 K, 303 K and 335 K, the same as two panes in Panes of Glass.
- Heat in, against heat out. At every setting, the Earthlight that leaves the top equals the Sunlight the ground takes in, and each level gives off what it takes in.
- The limits. The tests try the corners of the controls and thousands of settings in between. Inside the limits, every level emits more than nothing.
- This tab, against the model. Every equation above is tried with the model's own numbers. The worked example is done again from the rounded numbers a calculator would use. And each number in the text is worked out again from the model.
The code
The code is small enough to read. Two files do all the work, and they use no outside software. The comments in model.js use the same step numbers and letters as the equations above.
model.js is the science: the seven steps, and a list of every flow between the levels.
app.js is the page: the controls, the drawing, the graph and the table.
To keep a copy, save model.js or app.js.
All of the model's code is on GitHub, at github.com/airscottdenning/climate-models. You're free to use it, change it and teach with it.
Credits
By Scott Denning, for Climate Change: Simple, Serious, Solvable.
The page began as Scott Denning's web app, written in R, and a second version in Python that he made with Codex, from OpenAI. Claude, from Anthropic, rebuilt it to run in your browser, worked the three budgets into the seven steps above, drew every flow and checked it against both earlier versions.