Cellular Automata
CA Components Transition Rule: State of Neighbors/Self Last Time Step New State Wolfram, S A new kind of science. Wolfram Media, Inc. Champaign, IL pp.
Base 2 Binary Numbers Digit position Base Value Example Value81
Wolfram’s Binary Rule Numbers 3 neighbor, 2 state CAs General: Specific: Rule = 30 Block diagram from
Rule 18 Spreadsheet 18 = =IF(OR(AND((A1=1),(B1=0),(C1=0)), AND((A1=0),(B1=0),(C1=1))),1,0) If or Then 1 Else 0
Rule 30 Spreadsheet 30 = =IF(OR( AND((A1=1),(B1=0),(C1=0)), AND((A1=0),(B1=1),(C1=1)), AND((A1=0),(B1=1),(C1=0)), AND((A1=0),(B1=0),(C1=1))),1,0) If or or or Then 1 Else 0
Lattice Gas Cellular Automata
FHP Lattice Gas Cellular Automaton Bit Value A B C D E F S R Fundamental basis is mass and momentum conservation All particles have the same mass and speed so that momentum conservation reduces to conservation of the vector sum of the velocities Maximum of 1 particle per direction S = Solid, R = Random Boolean variables n = (n1, n2, …, n8) 8 bits 256 possibilities
Zero net momentum, head-on, 2- and 3-particle collisions Pre-collision Possible post-collision configurations Pre-collision Post-collision (Choose based on random bit R)
Unchangeable configurations Pre-collisionPost-collision All 5 and 6 particle collisions are similar; no configurations other than the original conserve momentum No configurations other than the original conserve mass and momentum
Collision ‘Look up’ Table 256 Entries Start with all unchanged –‘new configuration’ = ‘old configuration’ Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A …
Collision ‘Look up’ Table First 64 configurations ( through ) seventh bit (S) is 0 Same is true for configurations 128 through 191 ( through ) Leave unchanged for the moment Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A …
Collision ‘Look up’ Table Configurations 64 through 127 and 192 through 255 ( through and through ) are on solids Bounce back In-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A … Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A …
Collision ‘Look up’ Table Two-particle head-on collisions In-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 9 (AD) (AD) Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 18 (BE) (CF)
Collision ‘Look up’ Table Three-particle head-on collisions In-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 21 (ACE) (BDF) (ACE) (BDF) Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 42 (BDF) (ACE) (BDF) (ACE)
Remappings
Code /* Put collisions */ table[A + D] = B + E; table[A + D + EPS] = C + F; table[B + E) = C + F; table[B + E + EPS] = A + D; table[C + F] = A + D; table[C + F + EPS] = B + E; table[A + C + E] = B + F + D; table[B + D + F] = A + C + E; table[A + C + E + EPS] = B + F + D; table[B + D + F + EPS] = A + C + E; Lgapack Version for the simulation of flow with lattice-gas automata. Copyright (C) 1997 D.H. Rothman and S. Zaleski. In Unix/Linux: Gunzip the.gz file tar -xf the.tar file In Windows: Open archive or Extract files
Matlab Script for Lgapack clear('all') load x_mom load y_mom load mass x_vel=x_mom./(2*mass) y_vel=sqrt(3)*y_mom./(2*mass) quiver(x_vel',y_vel') axis equal
Exercise Theoretical viscosity (2 and 3-particle collisions only) Rearrange to solve for from u max or u mean Compare
Noise Need a lot of averaging Real thermodynamics?