Skip to main content

Module excitable

Module excitable 

Source
Expand description

Excitable media shared by dicty_aggregation and heart_fibrillation (SPEC-002 Batch M13).

Two kernels, one per kind of tissue:

  • Barkley (1991) on a rectangular Grid with the isotropic 9-point Laplacian: a fast FitzHugh–Nagumo-type medium with sharp fronts whose semi-implicit update keeps u, v ∈ [0, 1] exactly (DICT-A5). The excitability b may vary per node.
  • AlievPanfilov (1996) on a masked Medium (any shape, no-flux walls at the mask edge): the cardiac model whose restitution lets spirals break up (HRT).

Plus the analysis both spiral scenes need: count_singularities finds phase singularities (spiral tips) by the winding of the excitation phase.

Structs§

AlievPanfilov
Aliev & Panfilov (1996): ∂u/∂t = D∇²u − ku(u − a)(u − 1) − uv, ∂v/∂t = ε(u, v)(−v − ku(u − a − 1)), ε = ε₀ + μ₁v/(u + μ₂), explicit Euler with node spacing h and step dt (time units).
Barkley
Barkley’s model ∂u/∂t = ∇²u + ε⁻¹u(1 − u)(u − u_th), u_th = (v + b)/a, ∂v/∂t = u − v, discretised with node spacing h and sub-step tau (time units).
Front
One broken front: a straight segment a → b, excited on the n side.
FrontStroke
How a Front is painted: the excited strip’s width, the refractory tail’s width (nodes), and v along the tail from the front to its end.
Medium
A lattice region of any shape: the nodes inside a mask and each node’s four neighbours, a neighbour outside the mask (or the lattice) replaced by the node itself, so the 5-point Laplacian sees a zero gradient there (no-flux wall).

Constants§

AP_V_MAX
v never exceeds this in the model’s own dynamics (its nullcline tops out near k(1 + a)²/4 ≈ 2.6 for k = 8); the clamp only guards the display and tests.

Functions§

count_singularities
Count phase singularities (spiral tips) of the fields on m: plaquettes of four inside nodes around which the phase winds by ±2π. A tip found within merge nodes (Chebyshev) of one already counted is the same tip seen twice and is not counted again. The first tips.len() tips found are written to tips (lattice coordinates of the plaquette’s top-left node), row by row. theta and taken are scratch of the lattice’s size.
excite_disc
Excite (u = 1) every node within r nodes of (cx, cy) that has recovered to v < v_max: a pacemaker firing into a medium, which leaves refractory nodes alone.
paint_front
Paint front into the fields: a front_w-node strip of u = 1 on the n side of the segment, backed by a tail_w-node strip whose v ramps down away from it.
phase
Excitation phase atan2(v − v*, u − u*) of a node (radians, (−π, π]).
unit
Unit vector from a to b and the distance (a zero-length segment points along x).