Lattice Gas Automaton

Lattice Gas Automaton preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Eytan Bakshy (Author)

Tags

chemistry and physics 

Tagged by Reuven M. Lerner almost 11 years ago

waves 

Tagged by Reuven M. Lerner almost 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 357 times • Downloaded 60 times • Run 0 times
Download the 'Lattice Gas Automaton' modelDownload this modelEmbed this model

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


WHAT IS IT?

This model demonstrates circular wave propagation using a cellular automaton on a square grid. The behavior of the waves approximates the Navier-Stokes equation, a well established fluid dynamics equation discovered in 1823.

HOW IT WORKS

In the model, space is divided into cells which are occupied by the gas particles. Each particle has the same mass and absolute velocity (each particle will move only a single cell at each time step). Space is broken up into neighborhoods of 2x2 cell squares. Collisions occur when multiple particles are in the same square and occur instantaneously, conserving both mass and momentum.

The model is implemented using a Margolus neighborhood of 2x2 cell squares in which the particles belong to two separate spacetime sublattices, propagation and collision, (sometimes referred to as "even" and "odd" lattices), which evolve independently of each other.

The CA can be summarized with the following core rules:

  W W  ->  W W                B W  ->  W W            B W  ->  W B
  W W      W W                W W      W B            W B      B W

  B W  ->  W B                W B  ->  B B            B B  ->  B B
  B W      W B                B B      B W            B B      B B

It applies these rules to the even lattice of 2x2 squares followed by the odd lattice of 2x2 squares. Specifically, this means that the top left patch of four applies one of the above rules, then the bottom right patch of four does the same. To run the model in reverse, we simply switch the order of those two operations. No patch gets changed more then twice per tick. That means that each patch sees only one possible even rule and one possible odd rule each iteration.

HOW TO USE IT

The basic controls for the model are:
SETUP - Sets up patches with a given percentage of particles
DENSITY - Percentage of particles in gas
GO - Run the model
REVERSE - Run the model in reverse

These controls let you "paint" an initial setup in the view using the mouse:
DRAW-CIRCLE - Clicking any location in the view creates a solid circle of particles
RADIUS - Controls the radius of the circles

THINGS TO NOTICE

Drawing a circle in the center of the world and clicking GO creates a circular wave that travels through the lattice. Once the wave reaches the edges of the world, it wraps around the sides and causes the wave to collide with itself. You may stop the model by clicking GO again, and reverse the system by clicking REVERSE. The wave will now implode and eventually return to its original starting state.

How does the density of the center of the wave vary over time? Why?

Why does the model appear to act the same when run forwards and backwards?

THINGS TO TRY

How does the density of the gas effect the propagation of the wave? Try running the model with various DENSITY settings. Why do certain densities impede the propagation of waves?

What happens when you create multiple compressions in the gas and run the model?

EXTENDING THE MODEL

Can you create obstacles that deflect the movement of particles?

This particular model is known as the HPP model. The HPP model is very limited. The FHP (Frisch, Hasslacher and Pomeau) model was invented in the mid-eighties in order to improve the accuracy of the HPP model. The underlying rules of the FHP model are similar to that of the HPP model except that the FHP model has a symmetry-group order of six. The hexagonal lattice allows for more advanced modeling, such as hydrodynamical simulations. Can you write a model that emulates a hexagonal lattice in NetLogo?

NETLOGO FEATURES

In order for the algorithm to operate correctly, the size of the lattice must be even in both dimensions. That means there is no unique center patch. Since there is no center patch, we chose to place the origin (0, 0) patch in the lower left corner. (The model rules are not coordinate-based, though, so it doesn't really matter where the origin is.)

CREDITS AND REFERENCES

Thanks to Ethan Bakshy for his work on this model.

For more information about lattice gas automata, see:

J. Hardy, Y. Pomeau & O. de Pazzis, Time evolution of two-dimensional model system. I. Invariant states and time correlation functions, J. Math. Phys. 14 (1973), pp. 1746-1759.

U. Frisch, B. Hasslacher & Y. Pomeau, Lattice-gas automata for the Navier-Stokes equation, Phys. Rev. Lett. 56 (1986), pp. 1505-1508.

T. Toffoli and N. Margolus. 1987. "Cellular Automata Machines: A New Environment for Modeling".

Wolfram, S. 2002. A New Kind of Science. Wolfram Media Inc. Champaign, IL.

HOW TO CITE

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 AND LICENSE

Copyright 2002 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ 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 uri@northwestern.edu.

This model was created 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.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  lattice   ;; only those patches where both pxcor and pycor are even
]

to setup
  clear-all
  set lattice patches with [pxcor mod 2 = 0 and pycor mod 2 = 0]
  if count lattice != count patches / 4
    [ user-message "The world size must be even in both dimensions."
      stop ]
  ask patches
    [ set pcolor white ]
  ask patches
    [ if random-float 100 < density
        [ set pcolor black ] ]
  reset-ticks
end 

to go
  ask lattice [ do-rule  1 ]  ;; propagation
  ask lattice [ do-rule -1 ]  ;; collision
  tick
end 

to go-reverse  ;; applying rules to the lattice in reverse order reverses the system
  ask lattice [ do-rule -1 ]  ;; collision
  ask lattice [ do-rule  1 ]  ;; propagation
  tick
end 

;; grid = 1 if even lattice, grid = -1 if odd lattice

to do-rule [grid]
  let a self
  let b patch-at (- grid) 0
  let c patch-at 0 grid
  let d patch-at (- grid) grid

  ifelse ([pcolor] of a) != ([pcolor] of b) and
         ([pcolor] of c) != ([pcolor] of d)
    [ swap-pcolor a b
      swap-pcolor c d ]
    [ swap-pcolor a d
      swap-pcolor b c ]
end 

to swap-pcolor [p1 p2]
  ask p1 [
    let temp pcolor
    set pcolor [pcolor] of p2
    ask p2 [ set pcolor temp ]
  ]
end 

to draw-circle
  while [mouse-down?]
    [ ask patch mouse-xcor mouse-ycor
        [ ask patches in-radius radius
            [ set pcolor black ] ]
      display ]
end 


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

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky almost 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 over 11 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 almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Lattice Gas Automaton Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.