Monday, March 15, 2010

Simple animation of UWyo CCN counter chamber

After modifying my Random particles in a cube example with Mayavi's @animate decorator I can get this simple animation which I use to demonstrate particle growth inside the device chamber. 

The Chemistry department of our school hosting a two-days Air Pollution Workshop for the neighbourhood high-school students. As a part of "Aerosol Particles" lab I am giving a demonstration about "Cloud Condensation Nuclei (CCN)" and University of Wyoming designed CCN counter.

The example is really the simplest it gets since it is designed for high-school students to little better appreciate the particle growth in a sealed chamber. There are many improvements could be made on this animation to make things much closer to what they are in reality. Such as:
  • Particle locations should be depicted in a cylindrical space inside of a cube as given in this example. 
  • Animation could be run in parallel with the counter by simply reading the status of the device through its serial port. (i.e., reading TWAIT, FLUSH, CCN_DETC status)
  • A GUI could be added to control parameters of the instrument. (e.g., setting its supersaturation)
  • Hot top-plate and cold bottom-plate could be drawn on newly created cylindrical chamber and supersaturation could be modelled and shown.
  • Different continuous distributions could be added. (For now the particles are gamma distributed -using NumPy's gamma distribution function.)
  • Instead of growing all the particles activation could be modeled more realistically (i.e. simply via κ-Köhler theory.) and applying condensational growth equation.
  • Particle interractions could be included (e.g. gravitational settlings, collisions in between particles etc...)
  • Particle detection could be modelled employing the Mie scattering theory.
This list could be expanded with many other considerations. Some are easy to implement, some really takes a while to achieve. Before I move further it is a good idea to read Dr. Snider's Supersaturation in the Wyoming CCN Instrument article while I have chance to spend time with the counter. In case you are curious about the code just follow the link. Yes, all this buzz have been 33 lines of code. That's what you get when start coding with Python.

The bottom left photo is courtesy of Dr. David Delene (The photo should have been taken in one of Mali precipitation enhancement campaigns.) The bottom right one is courtesy of Dr. Manfred Wendisch in his Airborne Physical Measurements: Methods and Instruments lecture notes.


  1. Hey Gokhan,

    Nothing to do with the actual content of your post, but did you know that when compiling documentation with Sphinx, Sphinx builds a lot of tags that you can link too, for instance in the titles. You can find links to these tags by hovering your mouse next to the title, on the right, and clicking on the line-feed symbol that appears. That enables you to link directly to, eg the animate function itself. Very handy when answering to questions on mailing lists, for instance.

  2. Would it be difficult to produce an animated sequence, to show the result to people who don't have mayavi installed on their machine ?

  3. Gaël, good to know that functionality. @animate is the first one one that mlab_other_functions page. That's why I didn't directly link to it :)

  4. @Bruno, what I did was just to take some snapshots of the animation and later use "convert" (should be part of ImageMagick) tool in my Fedora 12 and make a simple gif animation. This could probably automated by putting a savefig() inside the decorated function and later use this sequence to create a gif file.

  5. Peh, Google docs definitely isn't in its day. Giving 404 error for the gif I use at the top this posting :) I shouldn't have talked about gif animation creation. Next time I will host them somewhere more stable for sure.

  6. OK, fixed recreating and uploading the gif image somewhere else. Apparently one must know about html tags to get the blogger posts looking neat. Without using center tags tables tend to align to the left and without using table tags there is no way to put two horizontal picture in one row :) Hah you can't also use actual tags while commenting on!