Gas Chromatography

Gas Chromatography preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)


chemistry and physics 

Tagged by Reuven M. Lerner about 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 748 times • Downloaded 82 times • Run 2 times
Download the 'Gas Chromatography' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This is a model of gas chromatography. Much of modern chemistry depends on chromatography for the separation of chemicals. (Gas chromatography is one form of chromatography, involving gases.) Chromatography can even be so sensitive as to separate enantiomers (i.e., molecules that differ only by being mirror images of each other!).

Chromatography separates chemicals using surface interactions. The idea is simple. Different chemicals have different tendencies to move through small spaces (for example, if they are of different sizes) and different tendencies to stick to surfaces. This can be observed in everyday life. For example, if you put a drop of water and a drop of glue on an inclined plane, the water will roll off, but the glue will stick where it was. Single molecules, too, can stick very differently to surfaces. For instance, water vapor will condense on a cold glass, but the oxygen in the air will not. This is because the bonds that oxygen can make with glass are not strong enough to hold the oxygen there. It takes only a small step to imagine using the different stickiness of molecules to separate them.

Practically, in gas chromatography molecules are forced to pass through a porous medium, which acts as the sticky surface. A porous medium is a material that has holes in it -- like swiss cheese, but these holes are microscopic in size. The holes allow molecules to pass from one side of the medium to the other. One example would be packed silica. Under a microscope, packed silica looks not unlike a lump of wood shavings, so molecules can go through it like water would through the wood shavings.


The blue area of the world represents the porous medium. The molecules start at the top; they are collected at the bottom. The red and green particles represent two different kind of molecules. (In real gas chromatography, these would typically be carried by an inert gas. The inert gas is forced through the medium by applying pressure. But gas chromatography can also be used to simply separate gases without a carrier.) Molecules in this model wander randomly downward through the medium. Red molecules don't stick to the medium, but green molecules do. Chemically, this is caused by a number of factors: surface interactions, geometry and size of the molecule, etc.

The amount of stickiness is controlled by a slider. For example, if the stickiness is set to five, then green molecules sticks to each part of the blue medium for five cycles, essentially slowing its downward motion when compared to the red molecules. This leads to separation.

This model also attempts to demonstrate the concept of "wall effect". If there is some space near the walls then the molecules can get through these channels. This will drastically reduce the quality of separation. The empty space near the walls may result from bad quality of absorber or from inadequate stuffing.


First set the porosity of the blue absorber with the NUMBER-OF-PORES slider. You can change the thickness of the absorbent layer with a slider named THICKNESS-OF-MEDIUM. The WALL-EFFECT? switch turns the wall effect on and off.

To run the model, press SETUP, then press GO.

The STICKINESS slider changes the stickiness parameter. The higher the value of stickiness the slower the green turtles move through absorbing layer.

The program works fastest when STICKINESS is between 3 and 7 and when NUMBER-OF-PORES is over 30. If STICKINESS is too high, or NUMBER-OF-PORES is too small, it might take a long time for the green turtles to pass through the absorbing layer.


Separation depends on porosity. If porosity is too small the absorbent gets contaminated and clogged up and the process stops. If porosity is too high then there is not enough separation. Also wall effect reduces the quality of separation in a drastic way.


One could try to improve the plotting routine. In a real chromatograph there is only one output curve showing the rate at which molecules come out and a device called an integrator that tells the amount of matter that has come out.

Try separating more than two gases.


Notice the routine that digs tunnels. It is very easy to implement parallel random walk algorithms with NetLogo.


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:


Copyright 1998 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

Click to Run Model

breed [ reds a-red ]
breed [ greens a-green ]

turtles-own [ stuck ]

;;; Setup procedures

to setup
  set-default-shape turtles "circle"
  create-molecules 400 reds red
  create-molecules 400 greens green

to setup-patches

to draw-absorber
  ask patches
    [ if abs pycor < thickness-of-medium
        [ set pcolor blue ]
      ;; if wall-effect? is on, create two channels near the edges
      if wall-effect? and ( pxcor > (max-pxcor - 15) or pxcor < (min-pxcor + 15) )
        [ set pcolor black ] ]

to draw-walls
  ask patches
    [ if patch-at 3 0 = nobody or patch-at -3 0 = nobody
        [ set pcolor (violet - 1) ] ]

to erode
  crt number-of-pores
    [ setxy random-xcor thickness-of-medium
      dig-tunnel 180 90 ]

; tunnels are dug using random walks

to dig-tunnel [direction wiggle]  ;; turtle procedure
    [ if ycor < (- thickness-of-medium)
        [ die ]
      set heading direction + wiggle - 2 * random-float wiggle
      set pcolor black
      fd 1
      set pcolor black
      fd 1 ]

to create-molecules [number new-breed new-color]
  crt number
    [ set xcor (max-pxcor - 3) - random-float (2 * (max-pxcor - 3))
      set ycor thickness-of-medium + random-float (max-pycor - thickness-of-medium)
      set breed new-breed
      set color new-color
      set stuck 0 ]

;;; Running the model

to go
  if not any? turtles
    [ stop ]
  ask turtles
    [ if patch-at 0 -1 = nobody
        [ die ]
      wander ]

; The red turtles are inert and don't stick to the blue patches
; Green turtles stick to blue.  When a green turtle encounters
; a blue patch its stuck variable is set to stickiness and then
; decreases with time.  When stuck hits zero the particle is
; no longer stuck.

to wander
  set heading (270 - random-float 180)
  ifelse stuck = 0
    [ if ([pcolor] of patch-ahead 1) = black
        [ fd 1 ]
      let p patch-ahead 1
      if p = nobody [ die ]
      if (breed = greens) and (([pcolor] of p) = blue)
        [ set stuck stickiness ] ]
    [ set stuck stuck - 1 ]

; We need to compute concentrations of reds and greens that made
; it thru the absorbing layer.

to-report reds-out
  report count reds with [ycor < (- thickness-of-medium)]

to-report greens-out
  report count greens with [ycor < (- thickness-of-medium)]

; Copyright 1998 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky about 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky almost 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky over 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky about 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky about 14 years ago Gas Chromatography Download this version

Attached files

File Type Description Last updated
Gas Chromatography.png preview Preview for 'Gas Chromatography' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.