## Wednesday, March 30, 2011

### Surface Cooling, Part VI

We continue our study of Surface Cooling with the help of Circulating Cells, Version 5. We consider the transport of heat from a hot, sandy surface into the interior of a three-hundred meter cube of air. This three-hundred meter cube represents a single cell in the bottom row of our Rotating Greenhouse simulation. We refer to this cube as our super-cell. We are going to divide it into an array of sub-cells and heat the bottom row of sub-cells so as to induce convection within the super-cell.

We start by modifying our CC5 program. We set p_bottom to 100 kPa and p_top to 96.7 kPa. The total mass of our cell array is now 330 kg/m2, which is the mass of our super-cell. The program will create an array of sub-cells with 30 columns and 15 rows. Each sub-cell will have mass 20 kg/m2 and be 17 m high.

We set T_initial to 290 K, which is typical of a super-cell freshly-arrived at the surface our Rotating Greenhouse. We select Surface Heating, which warms the lowest sub-cells at a constant rate but allows no heat to escape from the array. According to our previous calculations, our super-cell will start to rise when it has warmed by a few degrees. Until then it will accumulate heat by convection of its own sub-cells.

When we start CC5, it calculates a value for the sub-cell impetus threshold using the procedure we describe in Impetus for Circulation. This value turns out to be 0.00003 K, a thousand times smaller than the value CC5 calculates for super-cells in our Rotating Greenhouse. As we showed in Simulation Time, each iteration of our simulation represents one second of planetary time. The heat arriving from the sun in the middle of the day can be as high as 1.4 kW/m2. Let us suppose our sandy planet surface is receiving 800 W/m2. The sub-cells have mass 20 kg/m2 and heat capacity 1 kJ/kgK. We set Q_heating to 0.04 K so that the bottom sub-cells warm at 0.04 K/s. We set our mixing fraction to 0.10. Each time a sub-cell circulates, it will exchange one tenth of its volume with its neighbors.

We reset the sub-cell array and start running. The Figure below shows the simulation after about an hour of simulated time (four thousand iterations).

We record the average temperature of our sub-cell rows and obtain the following plots.

After half an hour, the bottom row of sub-cells has warmed by 20 K and the row above has warmed by 15 K. Meanwhile, the average temperature of all the sub-cells taken together has risen by 5 K. Once it has warmed by 5 K, the super-cell is likely to rise away from the surface, so further warming will be prevented.

The sub-cells above the surface warms by ten or twenty degrees during the day. This warming provides the impetus for the local convection we proposed in our previous post. At the end of the day, sub-cell convection stops, and super-cell convection brings cool air down from above.

And so our simulation confirms the process we described in Surface Cooling, Part III. After sunset, the air temperature in a sandy desert will cool by twenty degrees within a couple of hours. Furthermore, the temperature we experience standing on the sand at mid-day will be twenty degrees warmer than the temperature of the air three hundred meters up.

## Thursday, March 24, 2011

### Rotating Greenhouse

The Rotating Greenhouse configuration of Circulating Cells, Version 5 simulates the cycle of day and night that results from the rotation of a Planetary Greenhouse with respect to its sun. The day_length_hr parameter gives the length of the day-night cycle in hours. In Simulation Time, we concluded that one iteration of our simulation corresponded to one second of planetary time, so one hour is 3600 iterations and one twenty-four hour day is 86400 iterations. The sun will shine upon our Rotating Greenhouse for a fraction of the day given by day_fraction. You will find both parameters in CC5's configuration array.

As in the Planetary Greenhouse, the surface is something like sand. It heats up quickly and warms the bottom cells of the atmosphere. Now that the planet is rotating, the heat from the sun increases from zero at dawn to a maximum at mid-day, and decreases to zero again at sunset. We use a sinusoidal profile for the rise in solar heating during the day. For the entire night, no heat arrives at all. In the middle of the day, heat arrives from the sun at a rate π × Q_heating. When day_fraction is one half (the days and nights are of equal length), the average rate at which the bottom cells are warmed by the sun is Q_heating. But when the day is shorter, the average warming is less than Q_heating, and when the day is longer, the average warming is greater. For now, we leave the fraction at one half.

The top cells, meanwhile, radiates heat into space just as they did for the Planetary Greenhouse. Top cells cool by Q_heating per second when they are at temperature T_balance. Their cooling rate increases as the fourth power of their temperature.

We allow the Rotating Greenhouse simulation to run. The report line gives us the time in hours instead of the iteration counter. In the top-left of the report window we see the current rate of solar heating, in units of K/hr. After many days, the cycle of day and night reaches equilibrium, and we see the following each day.

During the day, the surface cells warm as they absorb the Sun's heat. Once they warm by a few degrees, they rise, as we describe in Impetus for Circulation. The average temperature of the surface rows rises by a few degrees during the day, but not more. Our simulation does not allow surface cells to cool. And yet the average temperature of the surface row drops by a few degrees at night. When we mark a few cells near the surface, and watch them move after night falls, we see the surface cells being replaced by cooler cells from above. It is air descending from above that cools the surface row. And so our simulation confirms the mechanism for surface cooling we described in Surface Cooling, Part III.

Our simulation does not, however, show the sudden ten-degree cooling we observe standing in the desert just after the sun sets. Understanding this sudden drop was the motivation behind our Surface Cooling series of posts. Next time, we will use CC5 in its Surface Heating configuration to simulate the transport of heat within one or our large surface cells, and so obtain an estimate of how much the first twenty meters of the atmosphere will warm up during the day.

PS. You will find the array data corresponding to the start of the day with Q = 0.001 K and no cell mixing in RGH_Q001

## Thursday, March 17, 2011

### Impetus for Circulation

Today we introduce Circulating Cells, Version 5. You can download the source code here. As usual, you will find instructions for running the program in the comments at the top. The source code is text file, so you can open it with any text editor. We have removed the Mix check box in CC5. You now turn off the cell mixing by setting the mixing fraction to zero.

Today's post is longer than usual. We present a mystery that we would like you to help us solve, but we also describe what happens to our simulation when we try to make sure that cell circulations take place quickly enough to be consistent with simulation time.

In Work by Circulation we showed that the rising cell does more work in the act of expanding than is required to compress the falling cell. This excess work will accelerate the cells so that they circulate. If the expanding cell cools by 3.032 K and the falling cell warms by only 3.000 K, the missing 0.032 K represents heat and pressure energy that has been converted into work. With heat capacity 1 kJ/kg, there will be 32 J of work available for each kilogram of gas in the rising cell. When divided between the four cells, there will be 8 J/kg. We call this the expansion work.

Convection occurs in water as well as air. Water at 20°C is 0.2% less dense than water at 4°C. A cell of water at 20°C will be buoyant within water at 4°C. We often think of water as an incompressible fluid. But it is slightly compressible. Water at 100 kPa is 0.004% less dense than water at 200 kPa. Water at 20°C rising from a depth of 10 m to the surface of a lake will do 6 mJ/kg of work by expansion. Meanwhile, water at 4°C falling from the surface to a depth 10 m will require 0.2% less work for its compression. The excess 12 μJ/kg is adequate to accelerate four equal cells to 2.5 mm/s. It is conceivable, therefore, that expansion work can power convection in water.

Nevertheless, there appears to be another source of work to power circulation. In a block of four cells, if we have a hot cell on the lower-left and a cold cell on the upper-right, the block's center of mass will descend when we rotate clockwise. The upper-left cell slides off the hot cell to rest upon the cold cell. As it slides, the top-left cell pushes the other three cells around to complete the circulation. The circulate routine of CC4 calculates how far the center of mass of a block of four cells will descend if we rotate the block by a quarter-turn. We describe this calculation in a comment here. If the block's center of mass drops by 0.8 m in gravity 10 N/kg, the weight of the block will provide 8 J/kg of work. We call this the buoyancy work.

In CC3 we rotated a block of cells only if the buoyancy work was positive. We ignored the effect of expansion work and buoyancy work upon the cells. Of the heat we put into the array at the bottom, only 85% emerged from the top by radiation. In CC4 we calculated the expansion work and divided it up between the four cells to represent viscous heating. At equilibrium, 100% of the heat we put in emerged from the top. Our simulation conserved heat, but it ignored buoyancy work. How can that be?

Furthermore, how large is the buoyancy work compared to the expansion work? If one is positive, is the other always positive? The circulate routine of CC5 includes code that calculates both the buoyancy work and expansion work, and reports them both. We ran our simulation with this code activated. In a wide variety of conditions, both evolving and convergent, the buoyancy work was always between 95.7% and 97.6% of the expansion work. To within the margin of error introduced by our simulation, buoyancy and expansion work are equal.

Why are they equal? Michele has proved to me several times that for adiabatic circulation, temperature will drop linearly with altitude. Could it be that this linear relationship causes buoyancy and expansion work to be equal? Or are buoyancy work and expansion work just two faces of the same process, so that we can count one or the other, but not both? If they are one and the same, then buoyancy work cannot exist without expansion work, which implies that convection would not occur in a perfect, incompressible fluid. But surely convection can occur in a perfect, incompressible fluid?

We would like to provide you with answers to these questions, but we don't have them yet. Perhaps, after a few more debates with Michele and anyone else who wants to take part, we will have answers. For now, however, we are going to assume that we cannot add buoyancy and expansion work together to obtain the total work available to accelerate our cells. We have a simulation that conserves heat at equilibrium, and we want to keep it that way. We will calculate and use the expansion work only, and add it back to the cells as viscous friction.

In the circulate routine of CC5, we calculate the drop in the combined temperature of the four cells in a block. We call this net loss our impetus for circulation. If the impetus is 0.032 K, our expansion work will be 8 J/kg when spread among the four cells. The cells could, in theory, reach a speed of 4.0 m/s. The cells in our atmospheric array are roughly 400 m high, so a circulation at 4 m/s will take place in 100 s. There are 450 cells in our 15×30 array, and our simulation picks a new block on every iteration. We expect one of the four cells in our block to be picked again within a hundred iterations. But one hundred iterations corresponds to 100 s, so we see 0.032 K is the minimum impetus required to make sure that our rotation takes place before we expect one of its cells to take part in another rotation.

Our CC5 program rotates a block of four cells only if its impetus for circulation is greater than an impetus threshold. With the impetus threshold set to 0.032 K, we ran CC5 to produce new versions of the graphs we presented in Simulation Time.

The impetus threshold has no effect upon the profiles we obtain with no mixing (M = 0.0). Nor do we see any effect with heavy mixing (M = 0.20). We do, however, see a slight change in the presence of mild mixing (M = 0.05). Mild mixing now raises the surface temperature by a few degrees.

The impetus threshold makes sure that rising cells are significantly warmer than falling cells. When a cell rises from row 7 to row 8, its temperature drops by a factor of 0.9879 (see here). If our impetus threshold is 0.03 K, warm cells about to rise from row 7 must be 0.03 K ÷ (1-0.9879) = 2.5 K warmer than cool cells about to arrive in the same row. Between the bottom rows, the required difference is 3.0 K, and between the top rows it is 1.7 K. With Q = 0.001 K, a cell freshly-arrived in the bottom row will warm by 3.0 K in three thousand iterations, which is almost an hour. Soon after, it will start to rise.

In our next post, we will see how well our program performs when we simulate night and day using CC5's new Rotating Greenhouse configuration.

PS. You will find the equilibrium array for Q = 0.001 K and M = 0.00 in PGH_Q001_M00. The array for Q = 0.001 K and M = 0.20 is PGH_Q001_M02. Saved arrays now have comments in them that tell us the conditions under which they were obtained.

## Sunday, March 13, 2011

### Summary to Date

On the side-bar, you will see a new link, Summary to Date. The new page gives a history of the posts on this site. It attempts to explain what we have achieved so far, what we are working on now, and what we hope to achieve in the future. I'll maintain the page, adding paragraphs every few months. With any luck, the page will allow newcomers to make sense of what's going on.

## Wednesday, March 9, 2011

### Simulation Time

So far, we have measured simulation time in units of iterations. Today we relate iterations to time in seconds, and use this relationship to choose a heating rate better suited to a simulation of the Earth and the Sun.

Our simulation selects one block of four cells at random on each iteration. With thirty columns and fifteen rows in our array, a rising cell will find itself selected once in every hundred iterations. For circulation to occur, the rising cell must be one of the two lower cells in the block. Furthermore, the cell diagonally above it must be a falling cell. No more than half the cells are falling, so we see that a rising cell will move up by one row every four hundred iterations on average. A cell will take roughly six thousand iterations to rise from bottom to top.

The tropopause pressure in CC4 is 50 kPa, and the surface pressure is 100 kPa. Using the equation we presented in Atmospheric Pressure, we see our tropopause altitude is around 5 km. If one iteration corresponds to one second, cells will take six thousand seconds to rise five kilometers. Their average speed will be around 1 m/s. They will rise from the surface to the tropopause in one and a half hours. But if one iteration corresponds to ten seconds, rising cells will move at 0.1 m/s and take seventeen hours to reach the tropopause.

In Work by Circulation we presented an example circulation driven by a rising cell at 320 K and a falling cell at 300 K. This particular circulation generated 160 J of work for each kilogram of air in the rising cell. In our Planetary Greenhouse simulation, the average work produced by a single circulation is 60 J per kilogram of the rising cell. If this work turns into kinetic energy of the four rotating cells, each kilogram will receive 15 J. The cells will accelerate to 5 m/s. Our CC4 simulation assumes this kinetic energy is dissipated as viscous friction within the block. In that case, the average speed of the circulating cells will be less then their maximum possible speed, perhaps as low as 1 m/s. But the speed will certainly not be as low as 0.1 m/s.

We conclude that one iteration of our simulation is closer to one second of planetary time than it is to ten seconds. With one second per iteration, rising air will take roughly one and a half hours to travel from the surface to the tropopause. Falling air will take one and a half hours to descend.

As we showed in Solar Heat, the average power arriving from the sun per square meter of the Earth's surface is close to 350 W. Let's suppose the bottom cells of our simulation are warmed at an average rate of 350 W/m2. With top pressure 50 KPa, bottom pressure 100 kPa, and 15 rows of cells, each row represents a drop of 3.3 kPa. With gravity 10 N/kg, the mass of each row must be 330 kg/m2. The heat capacity of air at constant pressure is 1 kJ/kgK, so 350 W/m2 will cause a cell to warm at 0.001 K/s, or 3.6 K/hr.

Thus we see that Q_heating of 0.001 K represents the Sun's effect upon the surface of the Earth far better than the 0.01 K that we have been using in our experiments until now.

With Q_heating set to 0.001 K instead of 0.01 K, the heat flow through our cell array will be ten times lower. The heat flow will be ten times smaller when compared to the heat capacity of the cell array. It will take ten times as many iterations for the simulation to converge. We find that it still takes six thousand iterations for a cell to rise up through the array, but now it takes six million iterations to approach a new equilibrium. Six million iterations represents six million seconds, or roughly two months. This corresponds well to the pace of the Earth's seasons. The shortest day in Boston, for example, is in December. But the coldest weather occurs two months later.

We ran our CC4 simulation in Planetary Greenhouse mode and allowed the temperature profile to reach equilibrium for various values of mixing fraction. We present our results below. In the legend, M is mixing_fraction and Q is Q_heating. Our CC4 program allows us to save and load previously-converged cell arrays. With the help of saved arrays, we were able to obtain convergence within two million iterations in most cases.

As we discussed in Circulation and Mixing, allowing cells to mix as they circulate can increase the temperature drop from the bottom to the top of the array. This is indeed the case when Q = 0.01 K, which corresponds to Solar heating of 3.5 kW/m2, or ten times what we expect on Earth. But when we reduce Q to 0.001 K, mixing has the opposite effect. Michele's experiments show us that when Q = 0.001 K and M = 0.10, mixing alone is sufficient to transport all the heat through the array with a temperature drop of only 60 K. The temperature drop is less than that we would obtain without mixing. The temperature profile is, in Michele's words, hypo-adiabatic.

With M = 0.05, our simulation predicts a temperature of 297 K at the surface and 250 K at 6 km, which is very close to that of the Earth in middle latitudes. We observe steady circulation of cells from bottom to top.

When we increase M to 0.10, however, circulation slows down dramatically. If circulation slows down, mixing must slow down too, which means that our result for M = 0.10 presents us with an apparent contradiction. We see that mixing can occur only up to the point where it starts to slow down circulation. With Q = 0.001 K, we must have M ≤ 0.05. For M ≤ 0.05, the surface temperature is within one degree of its value for M = 0.00. Now that we have reduced Q to 0.001 K, it appears that we are better off running with the mixing turned off. We speed up execution, we avoid any self-contradictory mixing behavior, and we suffer no significant change to our atmospheric temperature profile.

PS. You can download the equilibrium state of the Planetary Greenhouse with M = 0.05 and Q = 0.001 K in PGH_M005_Q001.

## Wednesday, March 2, 2011

### Work By Circulation

The CC3 program we presented in Planetary Greenhouse Simulation ignores the work done by cell circulation. Today we show how this omission caused the top cells to converge to a temperature 10 K lower than we expected. (Thanks to Michele for all his help in the comments.)

With Q_heating at 0.01 K, our simulation heats each cell in the bottom row by 0.01 K per iteration. With T_balance at 250 K each cell in the top row cools by 0.01 K per iteration. Our simulation assumes an ideal gas, so the heat required to warm or cool a cell by 0.01 K is always the same. At equilibrium, the heat entering must be equal to the heat leaving. We expect the top row converge to 250 K.

But the top row of CC3 converged to only 240 K. At 240 K, each top cell cools by only 0.0085 K per iteration. With circulation turned off, however, and only mixing to transport heat, the top row of CC3 did converge to exactly 250 K. We concluded that something was amiss with our circulation routine: it was making heat disappear.

In Work by Convection we showed how the expansion of warm, rising air does more work than is required to compress cool, falling air. The excess work manifests itself immediately as an upward force on the rising air. We could harness this force with a wind turbine. Otherwise the rising air will accelerate into a turbulent flow. Over time, viscous friction will transform this kinetic energy into heat. We discussed this phenomenon in Dissipation by Convection, and concluded that work by convection is what powers storms and winds.

Suppose we have a block of four cells in our simulation, at the bottom of the cell array. The lower-left cell is at 320 K while the upper-right is at 300 K. We rotate the block clockwise. The lower-left cell rises. Its pressure drops by 3.3 kPa, this being the weight per square meter of a single cell in CC3. If the cell expands adiabatically, its final temperature will be 320 K × 0.9903 = 316.90 K. Meanwhile, the upper-right cell falls. Its pressure rises by 3.3 kPa. Its final temperature will be 300 K ÷ 0.9903 = 302.94 K. One cell cooled by 3.10 K while the other warmed by 2.94 K. The two remaining cells, which do not change pressure, neither warm nor cool.

Both cells have the same mass, and the ideal gas inside has constant specific heat capacity Cp = 1.003 kJ/kg. One cell lost 3.10 kJ/kg while the other gained 2.94 kJ/kg. The difference is 160 J/kg. This 160 J/kg is the work done by the circulation. We did not account for this work in CC3. Each time a block rotated, the work by circulation disappeared.

Our CC4 program provides several new features. You can save the array temperatures to a text file, and load them also. You can track the movements and temperature of marked cells with the Tracking option. Within the code, we have greatly expanded the explanatory comments and we have simplified some of the routines and global variables to make future enhancements easier. But most important, CC4 accounts for the work done by circulation, as you can see for yourself in the circulate routine. The Viscosity option indicates whether or not we account for the dissipation of work by viscosity.

When CC4 rotates four cells, it calculate the work available just as we did above. We assume this work goes into accelerating the air within the cells and ends up dissipating as viscous friction within the four cells. The simulation adds the viscous heat to the four cells equally. The following graph shows the temperature profiles we obtained from CC4 after a million iterations for various values of mixing fraction (M) and heating rate (Q). Click on the graph for better resolution.

The top row converges to 250 K in each case. With no mixing, the bottom row is 50-K warmer than the top. With mixing fraction 0.1, the bottom is 58 K warmer than the top. With mixing fraction 0.4, it is 70 K warmer. The effect of mixing is almost exactly the same as it was for CC3. Also in the graph, you can see the profile that results when we turn off the circulation (NC) but set mixing fraction to 1.0. Heat is transported by mixing alone and the bottom is 62 K warmer than the top.

We conclude that the incorrect convergence of CC3 was indeed the result of our ignoring work by circulation. Indeed, we can obtain the CC3 results with CC4 simply by turning off CC4's viscous friction adjustment.