Title: Spatial Modeling
1Spatial Modeling
- Modeling and Simulation of Computer Systems
by Kai Bormann Supervisor Illya Stepanov
22. February 2005
2Contents
- Introduction
- Space-based Approach
- Cellular Automata
- Game of Life
- Margolus Neighborhood
- Lattice Gas Dynamics
- Ising Models
- Entity-based Approach
- L-Systems
- Particle Systems
- Summary
3Introduction
Spatial Models
Entity-based Models
Space-based Models
Space is the object
Entity in the space is the object
4Space-based Approach
- Introduction
- Space-based Approach
- Cellular Automata
- Game of Life
- Margolus Neighborhood
- Lattice Gas Dynamics
- Ising Models
- Entity-based Approach
- L-Systems
- Particle Systems
- Summary
5Cellular Automata (CA)
- Model discrete dynamic systems
- Consists of
- N-dimensional infinite grid
- Regularly ordered cells having m-states
- Rules applied for each cell
6Grid of Cellular Automata
Theory N-dimensional infinite grid Praxis 1 or
2 dimensional grid Problem The grid is not
infintite! Solution Form grid to a ring (1D)
or torus (2D)
7Cells of Automata
- Regularly ordered cells
- Cell structure normally rectangular, but
triangular or n-angular - cells are also possible
- Each cell has neighbors
- von Neumann Moore Self-defined
- neighborhood neighborhood neighborhood
- Â Â
8Rules of Cellular Automata
- All rules are applied at each cell at time t
- The next state t1 depends on
- The state of the cell at time t
- The states of the neighboring cells at time t
- The result is in t1
9Example of a CA
- Game of Life developed by the mathematics John
Horton Conway - Consists of
- n n square board
- Moore neighborhood
- 2 states
- 2 rules
- birth rule
- death rule
10Game of Life
Generation 0
Generation 1
Generation 25
Generation 50
11Margolus Neighborhood
- A CA with Margolus neighborhood
- Each block has a fix cell number
- The rules are applied for each block
- Blocks are subdivided into phases
- The different phases are overlapping
- Example
Phase 1
Phase 2
12Lattice Gas Dynamics
Using Margolus neighborhood 6 Rules
With collision detecting
13Lattice Gas Dynamics
With this 6 rules it is possible to simulate
diagonal movement
Phase 1, t0
14Lattice Gas Dynamics
With this 6 rules it is possible to simulate
diagonal movement
Phase 2, t1
15Lattice Gas Dynamics
With this 6 rules it is possible to simulate
diagonal movement
Phase 1, t3
16Lattice Gas Dynamics
With this 6 rules it is possible to simulate
diagonal movement
Phase 2, t4
17Ising Model
- Developed by the german physics Ernst Ising
- Describes the behavior of magnet materials
- An increasing temperature leads to a growth of
the interference factor - CA can simulate this model
- Consists of
- n n grid
- 2 states
- von Neumann neighborhood
Low High interference factor
18Example of Ising Model
- From http//bartok.ucsc.edu/peter/java/ising/keep/
ising.html - States are White and Blue
19Entity-based Approach
- Introduction
- Space-based Approach
- Cellular Automata
- Game of Life
- Margolus Neighborhood
- Lattice Gas Dynamics
- Ising Models
- Entity-based Approach
- L-Systems
- Particle Systems
- Summary
20L-Systems
Developed by the botanist Astrid Lindenmeyer G
(V, ?, P) V Alphabet ? Initial condition P
Production rules Alphabet F Draw a
vertical line with the length d f Does not draw
a line with the lenght d A clockwise rotation
of ? - A counter clockwise rotation of ?
21L-Systems Example 1
- G (F,,-, ?, P) ? 90
- F-F
- p1 F?F-FFF-F
Initial condition
First iteration
Second iteration
22L-Systems Example 2
- Save the current state on the stack.
- Get the saved state from the stack.
- G (F, , -, , , ?, P) ? 26
- F
- p1 F?F F F -F F
23Particle Systems
- Gas Dynamics with Time Slicing
- Gas Dynamics with Event Scheduling
- N-body Methods
- Particle Particle Method
- Particle Mesh Method
- Tree Code Method
24Gas Dynamics with Time Slicing
- Each molecule has
- Initial position
- Velocity
- Straight trajectory
- Collisions and gravity are ignored
- Formula to calculate the new position xnew
xold vx ?t - Positions are updates at every ?t
25Gas Dynamics with Event Scheduling
- Event a molecule hits a wall
- Intersection time is calculated
- Molecules are entered into the Event List
- Positions are updated upon each event
- Advantage Simulation is faster
- Problem pay attention at events with the same
timestamp
26Particle Systems
- Gas Dynamics with Time Slicing
- Gas Dynamics with Event Scheduling
- N-body Methods
- Particle Particle Method
- Particle Mesh Method
- Tree Code Method
27Particle Particle Method
- Calculate the force of each particle
- Calculate for each particle the new position and
speed - Update the timestamp
- Advantage accurate and simple
- Disadvantage N(N-1) calculations are needed
- gt complexity O(N2)
- gt bad for a high number of particles
28Optimization with Particle Mesh Method
- Lay a mesh (regular grid) over the particle space
- Calculate the forces of the meshpoints
- Calculate the force of each particle
- Calculate for each particle the new position and
speed - Update the timestamp
- Disadvantages
- Improves only if the number of meshpoints (M) is
smaller than the number of particles (N) - No collision detecting
29Tree-Code Method
- Demount the rectangles until all particles have
their own rectangle - Starting in the leafs
- Calculate the center of
- mass (COM) of each quad-cell
- Calculate the force of each particle
- Calculate for each particle the new position
and speed - Update the timestamp
- Complexity O(N log N)
3
1
31
311
31
(COM)
1
2
3
4
32
311 312 313 314
3
34
33
30Summary
Spatial Models
Entity-based Models
Space-based Models
Cellular Automata
L-Systems Particle Systems
31Questions