Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cellular Automata. CA Components Transition Rule: State of Neighbors/Self Last Time Step New State Wolfram, S. 2002. A new kind of science. Wolfram Media,

Similar presentations


Presentation on theme: "Cellular Automata. CA Components Transition Rule: State of Neighbors/Self Last Time Step New State Wolfram, S. 2002. A new kind of science. Wolfram Media,"— Presentation transcript:

1 Cellular Automata

2 CA Components Transition Rule: State of Neighbors/Self Last Time Step New State Wolfram, S. 2002. A new kind of science. Wolfram Media, Inc. Champaign, IL. 1197+ pp.

3 Base 2 Binary Numbers Digit position 87654321 Base 22727 2626 2525 2424 23232 2121 2020 Value1286432168421 Example00001001 Value81

4 Wolfram’s Binary Rule Numbers 3 neighbor, 2 state CAs General: Specific: Rule 2 + 4 + 8 + 16 = 30 Block diagram from http://mathworld.wolfram.com/ElementaryCellularAutomaton.htmlhttp://mathworld.wolfram.com/ElementaryCellularAutomaton.html 7 6 5 4 3 2 1 0 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 4+2+1 4+2 4 + 1 4 2+1 2 1 0 http://atlas.wolfram.com/

5 Rule 18 Spreadsheet 18 = 0 0 0 1 0 0 1 0 111 110 101 100 011 010 001 000 =IF(OR(AND((A1=1),(B1=0),(C1=0)), AND((A1=0),(B1=0),(C1=1))),1,0) If 1 0 0 or 0 0 1 Then 1 Else 0

6 Rule 30 Spreadsheet 30 = 0 0 0 1 1 1 1 0 111 110 101 100 011 010 001 000 =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 1 0 0 or 0 1 1 or 0 1 0 or 0 0 1 Then 1 Else 0

7 Lattice Gas Cellular Automata

8 FHP Lattice Gas Cellular Automaton Bit Value 1286432168421 A00000001 B00000010 C00000100 D00001000 E00010000 F00100000 S01000000 R10000000 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

9 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)

10 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

11 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 000000000 100000001 200000010 300000011 … 25511111111

12 Collision ‘Look up’ Table First 64 configurations (00000000 through 00111111) seventh bit (S) is 0 Same is true for configurations 128 through 191 (10000000 through 10111111) Leave unchanged for the moment Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 000000000 100000001 200000010 300000011 … 19110111111

13 Collision ‘Look up’ Table Configurations 64 through 127 and 192 through 255 (01000000 through 01111111 and 11000000 through 11111111) are on solids Bounce back In-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 6401000000 6501000001 6601000010 … 12701111111 Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 6401000000 7201001000 8001010000 … 12701111111

14 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) 00001001 137 (AD) 10001001 Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 18 (BE) 00010010 164 (CF) 10100100

15 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) 00010101 42 (BDF) 00101010 149 (ACE) 10010101 170 (BDF) 10101010 Out-State Bit Value 128 R 64 S 32 F 16 E 8D8D 4C4C 2B2B 1A1A 42 (BDF) 00101010 21 (ACE) 00010101 170 (BDF) 10101010 149 (ACE) 10010101

16 Remappings

17 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. http://www-ftp.lip6.fr/ftp/jussieu/labos/lmm/Lgapack/ In Unix/Linux: Gunzip the.gz file tar -xf the.tar file In Windows: Open archive or Extract files

18 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

19 Exercise Theoretical viscosity (2 and 3-particle collisions only) Rearrange to solve for from u max or u mean Compare

20

21 Noise Need a lot of averaging Real thermodynamics?


Download ppt "Cellular Automata. CA Components Transition Rule: State of Neighbors/Self Last Time Step New State Wolfram, S. 2002. A new kind of science. Wolfram Media,"

Similar presentations


Ads by Google