Wednesday, January 26, 2011

Circulating Cells

Today we present our new simulation program, Circulating Cells, Version 1, or CC1. The following picture shows the program's display shortly after we start it up. The array of cells represents a cross-section of the atmosphere. Each cell represents an equal mass of gas. The color of the cells indicates their absolute temperature, according to the legend at the top, with the exception of the black one. The black cell is black so we can watch it circulating around.

This version of the program heats one location on the bottom row. Any cell that enters this location we heat to 300 K. If the cell enters at a higher temperature, we let it keep its higher temperature. Thus we never remove heat from our array. The hot cells are rising, and as they rise they cool down. They turn from red to green. Meanwhile, cold cells must descend to make way for the hot cells. The cells that descend warm up. They turn from blue to green. At the beginning of our simulation, all the cells are blue. They are at 250 K. If we press Reset, all the cells will return to 250 K and the simulation will start again.

In our simulation, convection occurs by rotating blocks of four cells. The program picks a block of four cells at random. It calculates how much a quarter-turn will raise or lower the block's center of gravity. If a rotation will lower the center of gravity, the program performs the rotation. Otherwise, it does not. When the program rotates a block, one cell rises, one falls, and two stay at the same height. The one that falls contracts and warms up. The one that rises expands and cools down. The two cells that move sideways do not change temperature. But they may rise when they move from the top of a cold cell to the top of a hot cell. Hot cells are taller than cold cells. In the following picture we see the distribution of heat in the atmosphere after a few minutes of running. The black cell has moved. We can turn any cell into a black cell by clicking on it with the mouse. We can turn any black cell back into a normal cell by clicking it again.

The simulation is made possible by a fundamental approximation. We arrange the cells as if the cells in each row are all at the same height, even though some may be sitting on top of columns of air that are significantly warmer or cooler than the others. Without this approximation, we cannot arrange the cells in an array, and simulation becomes several orders of magnitude more complex and time-consuming.

In CC1, there is no way for heat to pass from one cell to another. There is no conduction, no mixing, and no radiation. There is no way for heat to leave the array. After an hour of running, we end up with the following distribution of heat, all arising from the single heated location at the center of the bottom row. There is one blue cell on the bottom remaining. It moves around a bit, but so far it has resisted being drawn into the warm location.

Our program is written in TclTk. We encourage you to download the program and run it for yourself. Click here to download the program. Instructions for how to run the simulation on Linux, MacOS, and Windows are in the comments at the top of the program. Open CC_1.tcl with a text editor to read those instructions. Once the program is running, the movement of the cells is fascinating. Further comments in the program show how each routine works.

Without self-regulation by clouds we estimate that high clouds will warm the Earth by 38°C, doubling CO2 will warm the Earth by 1.5°C, and thick clouds will cool the Earth by 96°C. It is our hope that Circulating Cells will evolve into a simulation of radiation, convection, precipitation, and, ultimately, self-regulation by clouds. We will then be able to estimate the effect of doubling CO2 concentration within a self-regulating climate. That evolution may take another year or two, and maybe the task will prove too monumental for us. But I think it will be an enjoyable journey, no matter how it ends. So I hope you will accompany me.

12 comments:

  1. Kevan,
    The result that you get seems obvious because the completely adiabatic behavior of the cells among them and of the whole array with the outside. At the end all the cells will be at the same energy CpT + gz = CpTb and the lapse rate of the column will be dT/dz = - gz/Cp.
    Your visualization of the convection is important because it puts in evidence that a source of heating located at the base of the column (without heat exganges to its inside and with surrounding) causes the convection that tends to realize an isoenergetic column with an adiabatic lapse rate.
    Michele

    ReplyDelete
  2. Dear Michele,

    That's an elegant calculation. I think it applies in this case for two reasons. First, there is no exchange of heat between the cells. Second, the 300 K temperature at the bottom is sufficient to cause a cell to rise almost to the top. But what if I heat the bottom only to 275 K? I'm running that simulation now, and it appears that the cells don't rise more than half-way up the array, so the higher cells will have more energy in your equation.

    Were you able to run the program yourself?

    I think my next step should be to introduce heat exchange between the cells, and see what happens. I predict that the entire array will arrive at the same temperature after a long time.

    ReplyDelete
  3. Elementary, my dear Kevan! Excuse me for the Holmes’ quote.
    The cell will rise until its temperature is greater than 250K and starting with 275K at the bottom this occurs at half height of column where the upward pushing force vanishes. Obviously starting at 325K the top temperature will be 275K.
    I agree with you that the heat exchange between the cells will equalize the temperatures into the entire array to that of source.
    Michele

    ReplyDelete
  4. Well, that's what happened: they stopped half-way. (Also, I read your "until temperature is greater than" to mean "until temperature is less than").

    I will add conduction and mixing as the basis of my next post.

    Were you able to run the program? If you find it difficult to get going, then I don't suppose anyone else will be able to do it. I may have to figure out how to get the program to run within a browser.

    ReplyDelete
  5. Kevan,
    The force acting on the cell is the same on the balloon in the previous post, F = gMi(Ti/Te-1), and it is directed upward if Ti > Te, i.e. if Tcell > 250K in our case. That’s if I am not mistaking.
    I am waiting for the check of your next post.
    Michele

    ReplyDelete
  6. Peter Newnam tells me he had no trouble getting the simulation to run on Windows XP.

    ReplyDelete
  7. Tried on MacBookPro, complained about something deprecated, so tried again on Linuxlite (checked tk status first in Synaptic) in VirtualBox and it ran fine, all blue squares disappeared in 10 minutes or so.

    ReplyDelete
  8. I'm going to add instructions for running the program to the blog entry, and in the comments of the code itself. I just downloaded CC_1.tcl file using the link in the blog post, and ran it on my desktop in MacOS 10.15.7 with:

    wish CC_1.tcl

    It starts up right away and I see the little bubbles of air moving about. The "wish" version is "8.5.18". Please try again with the above command on your MacBookPro. If that fails, post the error message for me.

    ReplyDelete
  9. I'm on Monterey 12.0.1. Python dot org says it should be fixed in Tk 8.6.12. If trying tclsh instead of wish, complains about 'toplevel'. I'll paste the terminal output below for what it's worth.

    wish CC_1.tcl
    DEPRECATION WARNING: The system version of Tk is deprecated and may be removed in a future release. Please don't rely on it. Set TK_SILENCE_DEPRECATION=1 to suppress this warning.
    Error in startup script: can't invoke "update" command: application has been destroyed
    while executing
    "update"
    ("while" body line 11)
    invoked from within
    "while {[winfo exists $w]} {
    set i [expr $array_width / 2]
    if {[get_temp 0 $i] < $T_min} {
    set_temp 0 $i $T_min
    plot_cell 0 $i
    update
    }
    set j..."
    (file "CC_1.tcl" line 312)
    GrahamTD@Grahams-MBP Downloads % tclsh CC_1.tcl
    invalid command name "toplevel"
    while executing
    "toplevel $w"
    (file "CC_1.tcl" line 86)

    Will try and update python now ... Regards.

    ReplyDelete
    Replies
    1. Update done (now have a github account) and after restart your code is working ...

      Delete
  10. Dear Graham,

    "Error in startup script: can't invoke "update" command: application has been destroyed"

    That's rather serious. I don't have a Moterey machine to look into this first-hand. How is it that an update to your Python installation fixes your TclTk installation? Well, you don't have to answer that. Suffice to say: update Python and it will work. Thank you.

    ReplyDelete
  11. Yes, needed to get an installer from ActiveState (ActiveTcl-8.5.18.0 ...) as the tcl/tk included in Monterey MacOS is not up to date. My mistake about the application being destroyed. When running your code, two windows open, first is blank entitled CC_1.tcl and the second one showing the coloured squares is entitled Circulating Cells, Configuration 1, Version 1. If the blank window is closed first then the 'application has been destroyed ...' text appears. Learnt a bit more today, thanks.

    ReplyDelete