Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata...

24
Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20- CPU Linux Cluster Lukasz Grzegorz Maciak Micheal Alexis Faculty Supervisor: Dr. Roman Zaritski CMPT 680-01 Parallel Architectures and Algorithms

Transcript of Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata...

Page 1: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Simulation of Long-Term Interaction of Spiral Waves in Excitable Media

Modeled by Cellular Automata using a 20-CPU Linux Cluster

Lukasz Grzegorz Maciak

Micheal Alexis

Faculty Supervisor: Dr. Roman ZaritskiCMPT 680-01 Parallel Architectures and Algorithms

Page 2: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Excitable Media Definition of Excitable Media:

An excitable medium is a nonlinear dynamical system which has the following properties: The capacity to propagate a wave of some description Inability to support the passing of another wave until a certain amount

of refractory time has passed Examples of Excitable Media in Nature:

Forest Fire Cardiac Muscle Tissue

Excited Wave Propagating Outwards

Refractory Area – cannot be excited

Page 3: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Cellular Automaton

Excitable media can be modeled using the Cellular Automaton Theory: Cells on a grid are assigned discrete values Values are updated based on the state of the

neighboring cells according to some rules. Example:

Conway’s Game of Life:

Dead Cell

Live Cell

Page 4: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Cellular Automata Rules for Excitable Media

The state of each cell is described by 2 values: Excitation (U) and Refraction (V)

The cell is Excited if U≥1 The cell stops being excited (U=0) if 0<V<0.6

Rules:1. If the value of U>0.3 then U=V=1

2. If the value of V<0.6 then U=0

3. While V>0 decrement V by 0.01

Page 5: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Cellular Automata Rules for Excitable Media

Rules Continued:4. The current value of U is determined based on

the state of either 4 or 8 neighboring cells using rules for diffusion (discretization of Laplace Operator)

1 2 3

4 CELL 5

6 7 8

Based on the U value ofU in the neighboring cellsU value of CELL is updated in small increments.

Page 6: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Cellular Automata Rules for Excitable Media

Unexcited Cell Unexcited Cell(U diffuses)

Excited Cell

Excited Cell(V decreases)

Unexcited Cell(Refractory State)

Value of U

Value of V

Page 7: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Implementing Computer Simulation

Implementation in C++ 20 CPU Linux Cluster

(located in RI 109) MPI library (parallel

communication) OpenGL library (data

visualization) LPThread library (the

graphical display functions)

Page 8: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Implementation Details 1000 x 2000 Rectangular Grid Cells on the edges of the grid are always unexcited (u:0 v:0) Using Vertical Domain Slicing to divide workload among the

20 CPU’s Using MPI Send and Receive Functions to exchange cell

values on borders between each “chunk”

CPU 1

CPU 2

CPU 3

CPU 17

CPU 18

CPU 19

Page 9: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Parallelization Issues – Domain Slicing Problem

1 2 3 4

5 CELL 1 CELL 2 6

7 8 9 10

CELL1 depends on points 1,2,3,5,7,8, 9 and CELL2but 3, 9 and CELL2 values belong to CPUB

CPU A CPU B

Page 10: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Work Distribution

Master Node (Control)

2nd Chunk

OpenGL Graphical Thread

1st Chunk

19th Chunk

Page 11: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Diffusion of U:

(*uu)(i,j) = U+2.76*D*dt/dx/dx*((*u)(i+1,j)+(*u)(i-1,j)+(*u)(i,j+1)+(*u)(i,j-1)-4*U);

Change of V:

if (V>0) {

V=V-0.01; if (V<0.6) (*uu)(i,j)=0;}else {

if(((*uu)(i,j)>0.3)&&((*uu)(i,j)<1)){

(*uu)(i,j)=1.0; V=1.0; }

}

Cellular Automaton Rules - Implementation

Diffusion Coefficient

V decrement Refraction Threshold

Ignition Threshold

(*uu)(i,j) = U+2.76*D*dt/dx/dx*((*u)(i+1,j)+(*u)(i-1,j)+(*u)(i,j+1)+(*u)(i,j-1) +(*u)(i-1,j-1) +(*u)(i-1,j+1) +(*u)(i+1,j-1) +(*u)(i+1,j+1)-8*U);

Page 12: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Parallel Communication

MPI Library functions MPI_Send and MPI_Recv are used for communication

The U and V values on the “chunk” border need to be swapped among CPU’s

MPI Code Samples:

MPI_Send((void*)uu->GetColumnPtr(L_min_2), N_plus_1, MPIFPTYPE, right, 11+DiscrTime, MPI::COMM_WORLD);

MPI_Recv((void*)u->GetColumnPtr((k-1)*(L-2)), L*(N+1), MPIFPTYPE, ltor[k], k, MPI::COMM_WORLD, status);

Page 13: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Initiating Spiral Waves

Excited Cells

Refractory Cells

Intersecting squares of Excited and Refractory cells produce 2 Spiral Waves

Spiral Wave is a unique configuration ofExcited and Refractory cells – it will spinforever, and it cannot be destroyed by collisions with other waves

Page 14: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Spiral Wave Rotation

Spiral Wave Tip

Rotation Core

Spiral Wave rotates around a core – this makes it move around on the gridand makes it collide with other waves – which alters the direction of the spin.

The Size of the Rotation Core Depends on:

• Ignition threshold • Refraction threshold• V decrement size• U diffusion coefficient

Page 15: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Initial Setup – Randomly placed intersecting squares.This picture represents the state several generations old.

Page 16: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Spiral Waves are Forming (4 neighbor diffusion)

Page 17: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Runtime 5-10 minutes (4 neighbor diffusion)

Page 18: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Speedup Analysis

Using 8 neighbors we get much smoother waves.

Page 19: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Formation of Spiral Wave Pairs (8 neighbors)

Page 20: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Multiple Spiral Wave Clusters forming

Page 21: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Spiral Wave Pair becomes the dominant feature

Page 22: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Computer Simulation

Runtime 5-6 hours: single Spiral Wave dominates the grid

Page 23: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

Speedup Analysis

Speed-Up Curve

0

2

4

6

8

10

12

14

16

18

0 5 10 15 20

# CPU

Sp

ee

d-U

p

DT=100

DT=500

DT=1000

Page 24: Simulation of Long-Term Interaction of Spiral Waves in Excitable Media Modeled by Cellular Automata using a 20-CPU Linux Cluster Lukasz Grzegorz Maciak.

FUTURE DIRECTIONS

Using different boundary conditions Continuous Domain (Cylinder, Taurus) Reflective Boundaries

Discovering effective ways to eliminate spiral ways Long term statistical analysis of Spiral Wave

behavior: What are the optimal conditions for forming pairs and

triplets? What is the least time needed for a triplet to form? Is there a time period after which we can safely say, that if

no pairs have formed, it is unlikely that they will form at all?