Climate Change: Simple, Serious, Solvable › Models
A Day on the Moon: Sunlight, Crushed Rock and No Air
The Moon has no air and no water, and its day lasts a month. Its surface is crushed rock that bakes at noon and is bitterly cold before sunrise. Change the length of the day and see what a world with no greenhouse effect does between noon and midnight.
One day in the ground at the Moon's equator
- The surface (the top 5 mm of the ground)
- 3 cm down
- 10 cm down
- 30 cm down
- The day you kept
Move over the graph, or select it and use the arrow keys, to read values.
| Sunlight taken in, Q | |
|---|---|
| Infrared radiation emitted, E | |
| Heat flowing down to the next layer, F1 | |
| Left over, Q − E − F1 | |
| The top layer's warming in this step, ΔT1 |
The clock is the Sun's. The graph runs from one midnight to the next. The Sun rises at 6 a.m., it's straight overhead at noon and it sets at 6 p.m., however long the day is. On the Moon that takes 29.53 Earth days, so every hour on this clock lasts more than one of our days.
This is a very simple model. It's just one-dimensional heat transfer through crushed rock. Sunlight heats the surface, and the infrared radiation the surface emits cools it. The Moon has no atmosphere, so there's no greenhouse effect, no wind and no weather. The About tab has every equation.
About this model
This is a very simple model of ground temperatures on the Moon's equator. It's just one-dimensional heat transfer through crushed rock. Sunlight heats the surface, the infrared radiation the surface emits cools it, and heat soaks down into the ground by day and comes back up at night.
The Moon has no atmosphere, so there's no greenhouse effect, no wind and no water to move heat around. And its day is long: 29.53 Earth days from one noon to the next, which is about two weeks of Sunlight and then about two weeks of night. At noon the model's surface reaches 381.5 K (108.4 °C, 227.1 °F), hotter than boiling water. Just before sunrise it's down to 94.1 K (−179.1 °C, −290.3 °F).
There's no soil on the Moon. Soil is a mixture of chemically altered rock fragments, organic matter, air and water. It hosts complex ecosystems of living things, and they maintain it. The Moon's surface is bedrock that's been blasted to smithereens by billions of years of impacts. What's left is a much simpler mixture of rock fragments and hard vacuum. Scientists call it regolith, a word coined in 1897 from the Greek for blanket and stone. It's a blanket of loose rock on top of the bedrock. This page just calls it crushed rock.
With nothing but vacuum between the fragments, heat flows through crushed rock much more slowly than through soil on Earth. The daily heating and cooling reaches only a little way down. In the model, the ground 30 cm (a foot) down stays near 217 K (−56 °C, −69 °F) all day and all night.
Box 2.2 in Chapter 2, "Energy and Radiation", asks how cold the ground would get in one night on Earth if its own glow were its only energy transfer. Worked out one hour at a time, the ground ends up around −50 °C (−58 °F) by sunrise. A real morning on Earth is far warmer than that, and Chapter 3 has the reason. On the Moon nothing rescues the night. This model does the box's sum a few minutes at a time, through a whole day, with layers of crushed rock under the surface.
How to use this page
The page has one view, "The Moon's day". Its graph follows one day at the Moon's equator, from one midnight to the next. The clock is the Sun's: the Sun rises at 6 a.m., it's straight overhead at noon and it sets at 6 p.m., however long the day is. The upper part shows the temperature of the surface and of the ground 3, 10 and 30 cm down. The lower part shows the heat going into the ground, which is the Sunlight the surface takes in less the infrared radiation it emits. It's above zero while the ground takes heat in, from sunrise until the middle of the afternoon. It's below zero while the ground gives heat back, for the rest of the afternoon and all night.
You can change three things:
- The length of the day, from 1 Earth day to 365. The page opens on the Moon's own day. The two buttons under the slider go to its two ends.
- The albedo, which is the share of the Sunlight that the surface reflects, from 5% to 30%. The page opens at 11%.
- The time step, which is how far the model moves the clock between one sum and the next, from 1 minute to 20. The page opens at 5 minutes. Too long a step breaks the model, and step 6 below says why.
Move over the graph to read the temperatures at that time of day. Or select the graph and press the left or right arrow key. The first press starts at noon, and each press after it moves a quarter of an hour, or an hour with Shift. Under the graph, a table shows the top layer's sum for that one step: the Sunlight it takes in, the infrared radiation it emits, the heat flowing down, and how much it warms. Below the table, a few lines give the day's hottest, coldest and average surface temperatures.
"Keep this day to compare" leaves the day you're looking at on the graph as a dashed line while you change the controls. "Let the kept day go" takes it away, and "Back to the Moon as it is" puts every control back where it started.
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 2, "Energy and Radiation".
The equations
You don't need any of this to use the page. But the whole model is six short equations, and you can follow every one of them with a calculator.
The model cuts the top meter of the ground into 13 layers, thin at the top and thicker farther down, and gives each layer one temperature. Then it asks one question, over and over: how much does each layer warm or cool in the next few minutes? It adds the answer to the layer's temperature, moves the clock on and asks again. It goes around the day like that until one day comes out the same as the day before. That day is the one on the graph.
You choose three things:
- the length of the day, P, from one noon to the next
- the albedo, α (the Greek letter alpha), which is the share of the Sunlight that the surface reflects
- the time step, Δt, which is how far the clock moves each time. Δ is the Greek capital letter delta. Here it means a small piece of something, or a small change in it, so Δt is a small piece of time.
Five numbers never change:
| Letter | What it is | Its value |
|---|---|---|
| S | the solar constant of Chapter 2: the Sunlight on a square meter that faces the Sun, in W/m² | 1,361 |
| σ | the Stefan–Boltzmann constant of Chapter 2 (the Greek letter sigma), in W/m² per K⁴ | 5.67 × 10⁻⁸ |
| k | the crushed rock's conductivity, which is how well it carries heat, in W/m per K | 0.003 |
| c | the crushed rock's heat capacity: the joules it takes to warm a cubic meter of it by 1 K | 1,000,000 |
| Δz1 | the thickness of the top layer, in meters. Each layer is 1.4 times as thick as the one above it, so Δz2 is 0.007. | 0.005 |
The layers are numbered from the top. T1 is the temperature of the top layer, which the page calls the surface. T2 is the temperature of the layer under it, and so on down to T13. They're all in kelvins.
1. Where is the Sun?
The model counts the time since midnight, t, in the same units as the length of the day. It turns that into the Sun's angle from straight overhead, θ (the Greek letter theta):
At midnight θ is −180°. At sunrise it's −90°, at noon it's 0° and at sunset it's 90°. The model's Sun passes straight overhead every day, so there are no seasons.
2. How much Sunlight does the surface take in?
While the Sun is up, the surface takes in
in W/m². The (1 − α) is the share that isn't reflected. The cos θ is the slant: Sunlight that comes in at an angle is spread over more ground, as Chapter 2 says, so each square meter gets less of it. With the Sun straight overhead cos θ is 1, and at sunrise and sunset it's 0. At night Q is zero.
3. How much infrared radiation does the surface emit?
This is the Stefan–Boltzmann law, the equation Chapter 2 says is worth memorizing:
in W/m². Chapter 2 writes it with the letter F. Here it's E, for emitted, because step 4 needs the F. The fourth power makes a hot surface emit far more than a cold one. At noon the model's surface emits about 1,200 W/m², and just before sunrise it emits about 4.
4. How much heat flows down through the ground?
Heat flows from a warmer layer to a cooler one. From the top layer into the second layer, it flows at
in W/m². A bigger difference in temperature makes a faster flow, and a longer way to go makes a slower one. The middles of the two layers are half of Δz1 + Δz2 apart, and that half is where the 2 on top comes from. When the second layer is the warmer one, as it is at night, F1 is negative and the heat flows up. The same equation with the next two layers' numbers in it gives F2, the flow from the second layer into the third, and so on down.
5. How much does a layer warm in one step?
The top layer keeps what's left over: the Sunlight it takes in, less what it emits, less what flows on down. In one time step that warms it by
kelvins. The top of the fraction is the energy left over in the step, in joules for each square meter. The bottom is the energy it takes to warm a square meter of the layer by 1 K. When more goes out than comes in, ΔT1 is negative and the layer cools.
A layer farther down gets no Sunlight and emits nothing to space. It keeps what flows in from above, less what flows out below:
Nothing flows out of the bottom of the lowest layer. The model works out every flow from the temperatures at the start of the step, and only then changes the temperatures.
6. How long can a time step be?
Each step takes the rate at which the surface emits at the start of the step and holds it for the whole step. That's fine when the step is short. When it's long, there's trouble. Say the surface is a little too warm. It emits a little extra, so it cools toward where it should be. Over a long step it goes on cooling at that same rate, and it goes past where it should be and ends up too cold. If it overshoots by more than it was off to begin with, the next step throws it back farther still, and the temperature zig-zags wider and wider. That happens when the step is longer than about
seconds. Here's where L comes from. A surface at 381.5 K that's 1 K too warm emits an extra 4σT1³, which is 12.6 W/m². Over one step that extra cools the top layer by Δt × 4σT1³ ÷ (cΔz1) kelvins. If that's more than 2 K, the layer ends up more than 1 K too cold, which is farther off than it started. A step of L makes it 2 K exactly.
The hotter the surface, the shorter L is, so the trouble starts near noon. On the page as it opens, the surface reaches 381.5 K, which makes L 794 seconds, or 13.2 minutes. A time step of 13 minutes works, and one of 14 zig-zags. With a longer step still you get crazy values, such as temperatures below zero kelvins. The page works L out for the day you've chosen and prints it under the time step.
Where the equations stop
This is a toy, and it leaves a lot out.
- The same crushed rock all the way down. The real regolith is fluffy at the top and packed tighter below, and it carries heat better the deeper you go. The model uses one conductivity and one heat capacity for every layer, at every temperature.
- One flat place. The model is level ground on the equator, with no rocks, no slopes and no shadows. Its Sun passes straight overhead and is always the same distance away.
- One plain surface. It reflects the same share of the Sunlight whatever the Sun's angle, and it emits infrared radiation as a black surface does.
- Nothing from below. No heat flows in or out through the bottom of the lowest layer, almost a meter down.
- Time in steps. Real time doesn't move in steps. With a time step longer than L the arithmetic fails, and the page says so when it does. The real Moon doesn't zig-zag.
A worked example
Open the page and leave the controls alone. Select the graph and press the right arrow key once, which puts you at noon. Then hold Shift and press the left arrow key four times. You're at 8:00 a.m., and the page says the surface is at 318.98 K and the layer under it is at 285.30 K. Here's the top layer's next step.
- The Sun (step 1). At 8:00 a.m., 8 of the day's 24 hours have gone by, so t ÷ P is 8 ÷ 24. Then θ = 360° × 8 ÷ 24 − 180° = −60°. The Sun is 60° from straight overhead.
- Sunlight taken in (step 2). The albedo is 11%, so α is 0.11, and cos(−60°) is 0.5. Q = 1,361 × (1 − 0.11) × 0.5 = 605.6 W/m².
- Infrared radiation emitted (step 3). E = 5.67 × 10⁻⁸ × 318.98⁴ = 587.0 W/m².
- Heat flowing down (step 4). F1 = 2 × 0.003 × (318.98 − 285.30) ÷ (0.005 + 0.007) = 16.8 W/m².
- What's left over (step 5). 605.6 − 587.0 − 16.8 = 1.8 W/m². The surface is taking in over 600 W/m² and keeping less than 2.
- The warming (step 5). The time step is 5 minutes, which is 300 seconds. ΔT1 = 300 × 1.8 ÷ (1,000,000 × 0.005) = 0.11 K.
Those are the five numbers in the table under the graph. The last one, 0.11 K, is how much the surface warms in the next 5 minutes.
A few details
- The layers. There are 13. The top one is 5 mm thick and the lowest one ends 0.98 m down. The graph's lines for 3, 10 and 30 cm are the layers whose middles are 2.9, 10.0 and 29.7 cm down.
- Reaching a day that repeats. The model starts every layer at 250 K and runs day after day. It stops when the surface's average for the day is within 0.002 K of the day before, and every layer's average is within 0.002 K of the surface's. That takes about 8 days. If 40 days aren't enough, it stops anyway and the page says so.
- A shortcut for the deep layers. Left to itself, the ground a meter down would take decades to settle. But over a day that repeats, no layer gains or loses heat on balance, and that means every layer has the same average temperature. So after each day the model moves each layer by the difference between the surface's average and its own.
- A whole number of steps. The steps have to fit the day exactly, so the model trims the time step a little when they don't. A step of 14 minutes becomes 839.9 seconds on the Moon's day. The page prints the number of steps under the time step.
- The Moon's day. The model's is 29 days, 12 hours and 45 minutes, which is 29.53 Earth days.
See the equations at work
- A night fed from below. On the page as it opens, move to midnight and read the table. There's no Sunlight. The surface emits 6.4 W/m², and F1 is −6.3 W/m²: heat that soaked into the ground by day is coming back up, and it supplies nearly all of what the surface emits. That's why the surface cools so slowly through the long night.
- A day as long as the Earth's. Press "A day as long as the Earth's". Noon hardly changes: 378.8 K, against 381.5 K on the Moon's own day. The night changes a lot. The surface is never colder than 139.7 K, against 94.1 K, because a night of 12 hours is too short for it to cool much further. And the heating and cooling don't reach as far down: the lines for 10 and 30 cm are flat.
- The same Sunlight, a warmer average. With a day as long as the Earth's, the surface's average temperature is 240.2 K. On the Moon's own day it's 217.2 K. The Sunlight taken in over a day is the same in both, and so is the infrared radiation emitted, which has to match it. The reason is the fourth power in step 3. A surface that swings between very hot and very cold emits more than a steady surface with the same average temperature. So the bigger the swing, the lower the average temperature at which the surface emits as much as it takes in.
- A day as long as an Earth year. Press "A day as long as an Earth year". The surface is as cold as 69.7 K before sunrise, and its average is down to 204.0 K. Even after six months of night it's still cooling, more and more slowly. It emits only 1.3 W/m² by then.
- A brighter Moon. Go back to the Moon as it is and raise the albedo to 30%. Noon falls from 381.5 K to 359.2 K. The coldest moment of the night hardly notices: 92.4 K, against 94.1 K.
- Break the model. Go back to the Moon as it is and set the time step to 13 minutes. Nothing much changes. Now set it to 14. The surface's line turns into a solid band, which is the zig-zag of step 6 drawn hundreds of times, and the page tells you not to trust the numbers. At 20 minutes the model blows up before noon on its first day.
- Two days on one graph. Press "Keep this day to compare" before you change a control, and the day you kept stays on the graph as a dashed line.
Where the numbers come from
The Sunlight, the Moon's albedo and the length of its day are NASA's numbers for the Moon: 1,361 W/m², 0.11 and 29.53 days.
The two numbers for the crushed rock lean on Diviner, an instrument on NASA's Lunar Reconnaissance Orbiter that has measured the infrared radiation coming from the Moon's surface since July 2009. Vasavada and colleagues compared the night temperatures it found at the equator with models of the regolith. For a regolith that's the same at every depth they used a conductivity of 0.003 W/m per K, and that's the model's k. They got a closer fit from one that's fluffy at the top and gets denser and more conductive within a few centimeters, which this model leaves out.
The heat capacity goes with it. How fast a surface warms and cools depends on the two numbers together, as the square root of k × c. That's called the thermal inertia. Hayne and colleagues found a thermal inertia of 55 ± 2 for the top few centimeters of the Moon's regolith. The model's is the square root of 0.003 × 1,000,000, which is 54.8.
Williams, D. R. (2024). Moon Fact Sheet. NASA Goddard Space Flight Center. nssdc.gsfc.nasa.gov/planetary/factsheet/moonfact.html
Vasavada, A. R., Bandfield, J. L., Greenhagen, B. T., Hayne, P. O., Siegler, M. A., Williams, J.-P., and Paige, D. A. (2012). Lunar equatorial surface temperatures and regolith properties from the Diviner Lunar Radiometer Experiment. Journal of Geophysical Research: Planets 117(E12), E00H18. doi:10.1029/2011JE003987
Hayne, P. O., Bandfield, J. L., Siegler, M. A., Vasavada, A. R., Ghent, R. R., Williams, J.-P., Greenhagen, B. T., Aharonson, O., Elder, C. M., Lucey, P. G., and Paige, D. A. (2017). Global regolith thermophysical properties of the Moon from the Diviner Lunar Radiometer Experiment. Journal of Geophysical Research: Planets 122(12), 2371–2400. doi:10.1002/2017JE005387
Williams, J.-P., Paige, D. A., Greenhagen, B. T., and Sefton-Nash, E. (2017). The global surface temperatures of the Moon as measured by the Diviner Lunar Radiometer Experiment. Icarus 283, 300–325. doi:10.1016/j.icarus.2016.08.012
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 six equations written out a second time, in another programming language. On the page as it opens and seven other settings, the two copies give the same temperatures to a millionth of a kelvin. With a time step that's too long, they agree that the model zig-zags or blows up.
- The shortcut, against the slow way. The second copy also runs with no shortcut for the deep layers. Every layer starts at 250 K and the model just runs, for 495 of the Moon's days, which is 40 years. After 10 years the lowest layer is still more than 3 K too warm. After 40 years every layer is within 0.01 K of what the shortcut gives in 8 days.
- Energy in, against energy out. Over a day that repeats, the surface has to emit as much as it takes in. On the page as it opens it takes in 385.6 W/m², averaged over the day and the night, and it emits 385.6 W/m².
- The model, against the Moon. At the Moon's equator, Diviner found noon temperatures of about 387 to 397 K, depending on the albedo of the surface, and about 95 K just before sunrise (Williams and colleagues, 2017). NASA's fact sheet gives 95 K to 390 K. The model's noon is 381.5 K, which is 5 K below the lowest of Diviner's. Its coldest moment is 94.1 K, which is within 1 K.
- 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 six equations, and the loop that runs them until a day repeats.
app.js is the page: the controls, the graph and the lines under it.
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 model is Scott Denning's, and it began as a web app written in R. Claude, from Anthropic, rebuilt it to run in your browser and checked it against the measurements above. The rebuild changed the crushed rock's conductivity and heat capacity, with Scott's agreement, so that the model's nights match what Diviner measured.