Thursday, June 30, 2011

Cells with Momentum

We invite you to download Circulating Cells 7 by clicking here. Each cell now has vertical and horizontal kinetic energy in the manner we described in Cell Kinetic Energy.

The preservation of momentum after a circulation is controlled by the ke_fraction parameter. By default, this parameter is 0.0, and the simulation will run exactly as before, with the entire impetus for convection being transformed into viscous friction. But with ke_fraction set to 0.9, 90% of the impetus for convection will turn into kinetic energy.

In version 7.0, we have have no graphical illustration of the cell kinetic energy. Perhaps we can use short lines within the cells to indicate momentum in the future. But we can always can stop the simulation and save the array to a text file. The text file tells us the state of each cell. Text files written by 7.0 have a new format, as shown below. But please note that 7.0 can read in text files written by previous versions of the simulation.
row column marking temperature vertical_ke horizontal_ke
In the future, we will add moisture content and cloud concentration to this list of properties. For now, the cells remain dry. The kinetic energy is in units of J/kg, so if we want to know how fast the cell is moving, we take the absolute value of the kinetic energy, double it, and take the square root. If the energy is 32 J/kg, the speed is 8 m/s. The direction is given by the sign of the kinetic energy: positive is up or right.

We have been playing around with CC7, using the Left-Only and Planetary Greenhouse. We set ke_fraction to 0.9 and looked to see if a breeze developed along the lowest row of cells, from right to left. After several hundred thousand iterations, we saved the array to disk and find that all the cells along the bottom row are moving to the left, while all the cells along the top row are moving to the right. By marking cells, we can observe these movements as the simulation runs. We don't see a simple clockwise rotation: there is a lot of random movement on top of the rotation. In the middle rows, the cell movements are as random as they were in our original Left-Side Only simulation with no accounting for momentum. But along the surface and along the tropopause, we appear to have the prevailing breeze we were looking for.

What we have yet to determine is what value of ke_fraction is required to establish a steady breeze, and what fraction is realistic. We invite you to download the code and play with it yourself. We hope the implementation of kinetic energy is correct, but if not we hope you will point out any problems.

UPDATE: There is a flaw in the way we combine cell kinetic energy with impetus for circulation. When we subtract the kinetic energy of a cell from the impetus, this kinetic energy ends up disappearing from the array. We observed a similar program-induced loss of energy in Work by Circulation. Given that the effect of preserving cell momentum was not dramatic, we resolve to remove the kinetic energy calculation from our code, so that ke_fraction will remain zero.

Tuesday, June 21, 2011

Cell Kinetic Energy

When a block of four cells rotates within our Circulating Cells simulation, the rotation does work, and we call this work the impetus for circulation. We express the impetus for circulation in units of energy per kilogram of gas in the four cells (J/kg). In our CC6 program, we take the impetus for circulation and add it back into the gas as heat. Our assumption is that the impetus is first used to accelerate the gas, and so turns into kinetic energy, but later is dissipated as viscous friction. At the end of our circulation, the gas is once again at rest.

But clearly the gas will not be at rest at the end of a circulation. Once it starts moving, it will tend to continue moving. In our previous post we showed that the cells coming to stop means that our simulation will never allow convection to produce a steady breeze. We would like our simulation to allow a cell to retain some of its kinetic energy after the circulation is complete, and thus allow this kinetic energy to influence subsequent movements of the same cell.

We propose that our upcoming CC7 program should handle kinetic energy in the following way. First, we give each cell two additional numbers that specify its kinetic energy per kilogram in the vertical and horizontal directions. When a cell is moving down, indicate its downward motion by giving its vertical kinetic energy a negative sign. When moving to the left, we give its horizontal kinetic energy a negative sign. The kinetic energy is in units of J/kg, just like the impetus for circulation. The use of a sign to indicate direction does not imply that the kinetic energy is really negative, because kinetic energy cannot be negative.

When four stationary cells rotate, we calculate the impetus for circulation just as we did in CC6. We rotate the cells if the impetus exceeds our impetus threshold. After that, we take a fraction of the impetus, given by the new ke_fraction parameter, and add it to the kinetic energy of each cell. In a clockwise rotation, the bottom-left cell acquires upward kinetic energy, the top-left cell acquires rightward kinetic energy, and so on. What is left of the impetus, we add into the cell temperature as viscous heat. If we set ke_fraction to zero, the simulation will run exactly as it did in CC6, because the entire impetus will turn into viscous heat, and no kinetic energy will be imparted to the cells.

When four cells with kinetic energy rotate, however, we add to the impetus for circulation whatever kinetic energy the cells might have in the direction they will be expected to move.

Suppose we have four cells, three of which are stationary, but the bottom-left one is already moving upwards with kinetic energy 40 J/kg. If the impetus for circulation due to buoyancy and expansion is 2 J/kg, we now add 10 J/kg to account for the fact that the bottom-left cell has 40 J/kg of kinetic energy that favors the rotation. The total impetus is 12 J/kg. Assuming our threshold is below 12 J/kg, the rotation takes place. If our ke_fraction is 0.5, each cell ends up with 6 J/kg in the direction of the rotation. The bottom-left cell ends up with 6 J/kg of upward, vertical kinetic energy, which is far less than the 40 J/kg it started with. Its kinetic energy was used to drive a circulation that might not have taken place at all, and in doing so, the it accelerated and heated three other cells. The bottom-left cell slowed down, but it is still moving up.

If the bottom-left cell also has kinetic energy in the horizontal direction, we ignore this fact, and assume that this horizontal energy will neither hinder nor help the rotation. When the rotation takes place, the kinetic energy of the bottom-left cell in the horizontal direction will remain unchanged.

This is what we plan to do in CC7. We welcome your comments before we proceed. The program is likely to slow down, so we are trying to figure out how to make the calculations faster. Not that any of us is in a hurry, of course.

Friday, June 10, 2011

Left-Side Only

On a sunny day at the beach, the wind tends to blow towards the shore. The land warms up more than the water and warm air rises off the land. The air moving upwards sucks air sideways off the water to make the on-shore breeze. We wonder if our simulation will do something similar if we heat cells only on the left side of the array. The left-side would simulate land, and the right side would simulate water. We might see cells moving along the surface from the right, warming on the left, rising up to the top, and cooling as the move to the right again.

The figure below shows our Circulating Cells simulation program, Version 6.0, which you can download by clicking CC6. With the Left_Only box checked and Planetary Greenhouse heating, the surface cells on the left side receive twice the normal heat from the sun, while those on the right side receive none at all.



We started the simulation by loading the equilibrium state of the array with both sides receiving heat, which we have saved in PGH_Q001_M00. Following our recent discussion of enthalpy, we recognize this symmetric equilibrium state as the one in which all cells have the same enthalpy. Those at the top have more gravitational potential, but less internal heat and pressure energy, so that the sum of all three forms of energy is the same for all cells, or almost the same.

We checked the Left_Only box and increased Q_heating 0.01 K/s. You may point out that the unit of Q_heating should be Kelvin per iteration, not Kelvin per second, but we recall that one iteration corresponds to one second, so the two are equivalent. With Q_heating at 0.01 K/s, the left-side surface cells warm at 0.02 K/s and those on the right do not warm at all.

We ran the simulation for a million iterations and saved the cell array in PGH_Left_Only. The figure above shows the saved state of the cell array, after another ten thousand iterations. The temperature profile is consistent with a large-area circulation of air powered by heating on the left surface. The heated air rises to the tropopause and moves over to the right side as it radiates its heat into space. Once it has cooled, it descends to the right surface and moves along to the left.

We marked a few cells by clicking on them, and watched them go around. We invite you to do the same. The cells circulate in a clockwise direction. They rise to the tropopause on the left, but hardly ever rise to the tropopause on the right. Nevertheless, we don't see individual cells moving steadily in a clockwise direction across the width and height of the array. Often, cells rise on the extreme left and descend upon the center-left. Cells on the right rise up a little and fall again. They slowly drift to the left, but they do a lot of jumping around along the way.

When averaged over thousands of iterations, the combined movement of the cells is a large clockwise circulation, with a net movement of cells from right to left along the surface. But a simulated person standing on the center surface would not feel a steady breeze blowing from the right side. He would instead feel the wind changing every minute or two, and only by looking at the average wind speed would he be able to conclude that the net movement of air was on-shore.

Our simulation assumes that all momentum generated by circulation is dissipated as viscous heat at the end of each circulation. Thus each circulation affects only the temperature of the cells. No cell can build up momentum that encourages further circulation in the same direction.

We conclude that momentum is one of the driving forces behind the on-shore breezes. Buoyancy alone is not sufficient. If we want our simulation to produce steady winds, we must allow circulating cells to retain some of the momentum they gain during circulation, and we must allow this momentum to influence future circulations of the same cell.

Thursday, June 2, 2011

Pressure Energy and Gravity

In our Circulating Cells program, we assume each cell has a uniform pressure. We know perfectly well, however, that the weight of the gas in the cell causes the pressure at the bottom to be greater than the pressure at the top. If p is the average pressure of the cell, m is the mass of the cell per square meter of its base area, and g is gravity, the pressure at the top will be pmg/2 and at the bottom will be p+mg/2. Today we consider how our assumption of uniform pressure affects our calculation of cell enthalpy.



Our diagram shows a cell in three consecutive states. In state 1, the cell has height h and average pressure p. Its center of mass is at altitude h/2. In state 2, the cell has warmed up and expanded, but its center of mass remains at the same altitude. As the cell expanded, it pushed upwards with pressure pmg/2 and downwards with pressure p+mg/2. The top and bottom surfaces each moved outwards a distance δh/2. The top surface does work work (pmg/2)δh/2 and the bottom surface does work (p+mg/2)δh/2. The total work done by the gas as it expands is the sum of these two quantities, which comes out to be pδh. The mg terms cancel. Thus we get the same value for the total work done that we would obtain if we assumed a uniform pressure p pushing outwards for a total distance δh.

In state 3 we allow the cell to rise up, so that its bottom surface is once again sitting on the ground at altitude zero. The altitude of its center of mass is now (hh)/2. As the cell moved up, its height remained constant. Its top surface pushed upwards with force pmg/2 over a distance δh/2. Meanwhile, something pushed upwards upon its bottom surface with force p+mg/2, and did so over the same distance. The top surface does work (pmg/2)δh, but the bottom surface absorbs work (p+mg/2)δh. The net work done is upon the cell is mgδh. This time, the terms in p cancel and we are left with a term in mg. If we were to assume the pressure in the cell was uniform, we would not arrive at this same result. We would instead conclude that no net work was done upon the surfaces of the cell to raise them up.

We recall that the enthalpy of a cell is the work required to replace it with an identical cell from a reservoir. Because of the pressure difference across a cell, we see that the work we must do to raise a cell to altitude z is mgz, so we our calculation of enthalpy must include not only the pressure energy of the cell and its internal heat energy, but also a term mgz. This term has a name: it is the gravitational potential energy, which we add to the internal and pressure energy of a stationary cell to obtain its enthalpy per kilogram, H.

H = CvT + RT + gz = CpT + gz

The gas above our cell rises a total distance of δh, which requires work pδh per square meter of base area. We could say that the gravitational potential of the gas above our cell has increased by pδh, and we would be correct, but this increase is already accounted for in our enthalpy equation. The increase in our cell's pressure energy is RδT, where δT is the amount by which we warmed the cell to make it taller. For an ideal gas, RδT = pδh. Thus the increase in the pressure energy of our cell is one and the same as the increase in the gravitational potential energy of the gas pressing down upon it from above.

The gravitational potential term in our enthalpy equation represents the effect of the pressure drop across a cell as we change its altitude. By including the gravitational potential term, we can continue our enthalpy calculations with the assumption that the cell pressure is uniform. But an increase in gravitational potential is not accompanied by any change in the appearance or state of our cell. Gravitational potential is a useful and elegant concept, but it has no physical existence of its own.