240 likes | 370 Views
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. Excitable Media.
E N D
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
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
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
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: • If the value of U>0.3 then U=V=1 • If the value of V<0.6 then U=0 • While V>0 decrement V by 0.01
Cellular Automata Rules for Excitable Media • Rules Continued: • 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) Based on the U value of U in the neighboring cells U value of CELL is updated in small increments.
Cellular Automata Rules for Excitable Media Unexcited Cell (U diffuses) Excited Cell Unexcited Cell Value of U Value of V Excited Cell (V decreases) Unexcited Cell (Refractory State)
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)
Implementation Details • 1000 x 2000 Rectangular Grid • Cells on the edges of the grid are always unexcited (u:0v: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” …
Parallelization Issues – Domain Slicing Problem CPU A CPU B CELL1 depends on points 1,2,3,5,7,8, 9 and CELL2 but 3, 9 and CELL2 values belong to CPUB
Work Distribution Master Node (Control) OpenGL Graphical Thread 1st Chunk 2nd Chunk … 19th Chunk
Diffusion Coefficient Cellular Automaton Rules - Implementation 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; } } (*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); V decrement Refraction Threshold Ignition Threshold
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);
Excited Cells Refractory Cells Initiating Spiral Waves Intersecting squares of Excited and Refractory cells produce 2 Spiral Waves Spiral Wave is a unique configuration of Excited and Refractory cells – it will spin forever, and it cannot be destroyed by collisions with other waves
Spiral Wave Rotation • The Size of the • Rotation Core Depends on: • Ignition threshold • Refraction threshold • V decrement size • U diffusion coefficient Rotation Core Spiral Wave Tip Spiral Wave rotates around a core – this makes it move around on the grid and makes it collide with other waves – which alters the direction of the spin.
Computer Simulation Initial Setup – Randomly placed intersecting squares. This picture represents the state several generations old.
Computer Simulation Spiral Waves are Forming (4 neighbor diffusion)
Computer Simulation Runtime 5-10 minutes (4 neighbor diffusion)
Speedup Analysis Using 8 neighbors we get much smoother waves.
Computer Simulation Formation of Spiral Wave Pairs (8 neighbors)
Computer Simulation Multiple Spiral Wave Clusters forming
Computer Simulation Spiral Wave Pair becomes the dominant feature
Computer Simulation Runtime 5-6 hours: single Spiral Wave dominates the grid
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?