Skip to main content

Eikonal-diffusion solver for periodic propagation

Project description

Illustration of streamlines

Objective

Phase fields may exhibit phase singularities. Our objective is to generate a phase field on a triangulated surface (a two-dimensional manifold embedded in three dimensions, possibly including boundaries and holes) that has phase singularities at predetermined locations with desired chirality (direction of rotation) [1]. The manifold is assumed to be a globally parameterizable surface, which is notably the case when it is homeomorphic to a sphere with holes.

The approach is based on an initial phase field analytically calculated on the 2D parameter domain, then mapped onto the surface and regularized using the eikonal-diffusion equation, which creates wave fronts spiralling around phase singularities. We developped that approach to automatically create complex initial conditions for reaction-diffusion systems [2].

Simple example

Here is a 2D example of phase map generation on a triangular mesh of a rectangle. The result is the image on the top of the page.

import numpy as np
import matplotlib.pyplot as plt
import eikonalspiral as eik
# create a 500 x 150 rectangular geometry
ver, tri = eik.rectangular_mesh(500, 150, 0.1)
# principal direction of anisotropy
orient = np.full((tri.shape[0], 2), 1/np.sqrt(2))
# distribute 10 phase singularities randomly
location, chirality = eik.random_phase_singularities(ver, tri, n=10)
# generate the phase map
theta = eik.generate_phase_map(ver, tri, None, location, chirality,
                               fiber=orient, wavelength=10, aniso_ratio=4)
# visualize the phase map
theta_interp = np.angle(np.exp(1j*theta[tri]).mean(1))
plt.tripcolor(ver[:, 0], ver[:, 1], triangles=tri, edgecolors='none',
              facecolors=theta_interp, cmap='hsv')
plt.show()

The output phase field (theta in radians) is defined on the vertices of the triangular mesh.

Syntax

theta: np.ndarray = generate_phase_map(
    vertices: np.ndarray,
    triangles: np.ndarray,
    parametrization: np.ndarray|None, 
    location: np.ndarray,
    chirality: np.ndarray, *, 
    fiber: np.ndarray=None,
    aniso_ratio: float=4,
    wavelength: float=16, 
    c: np.ndarray|float=0.1,
    D: np.ndarray|float=0.01, 
    verbose=True
)

Positional arguments

The arguments vertices and triangles define the triangulated surface (with nv vertices and nt triangles), and orientation the vector field on each triangle of that surface; parametrization continuously maps the surface onto the plane (two coordinates must be given for each vertex):

  • vertices (nv-by-3 float array): vertex positions (in cm)
  • triangles (nt-by-3 int array): vertex indices for each triangle
  • parametrization (nv-by-2 float array): 2D parameterization of the surface (continuous mapping from the vertices in 3D space to the 2D plane); can be None if the geometry is already in 2D
  • location (int array): list of vertex indices where spirals should be located
  • chirality (int array): direction of rotation for each spiral (+1 or -1)

Optional keyword arguments

  • fiber (nt-by-3 array): fiber orientation in each triangle (default: isotropic conduction).
  • aniso_ratio (float): conductivity anisotropy ratio (default: 4)
  • wavelength (float): target median wavelength in cm = conduction velocity * cycle length (default: 16 cm). A shorter wavelength makes the spiral more "curved".
  • c (float): conduction velocity in cm/rad. For a small circuit around a phase singularity (length L ~ 0.6 cm), c should be set to L/2pi ~ 0.1 cm/rad (which is the default value).
  • D (float): diffusion coefficient that is used to stabilize the system. The value should of the order of dx**2 and is set to 0.01 cm2 by default. If the output phase field seems noisy, increase this value.
  • verbose (bool): if True (default), print iterations.

Outputs

The function outputs an array of size nv providing the phase in the range (-pi, pi) for each vertex of the mesh.

Implementation

The eikonal-diffusion solver for periodic propagation [3] uses finite element methods for which implementation details are provided in [4]. It requires a solver for sparse complex linear equation (scipy.sparse.linalg.spsolve is used by default, but it could be replaced by another one if needed).

Installation

The package can be installed using the command pip install eikonalspiral. The code was tested using Anaconda 2025.12 (python 3.13) on Linux.

Acknowledgements

This work was supported by the Natural Sciences and Engineering ResearchCouncil of Canada (NSERC grant RGPIN-2020-05252).

References

  1. Reconstruction of phase maps from the configuration of phase singularities in two-dimensional manifolds, A. Herlin, V. Jacquemet, Phys. Rev. E, vol. 85, no. 5, pp. 051916, May 2012.

  2. Eikonal-based initiation of fibrillatory activity in thin-walled cardiac propagation models, A. Herlin, V. Jacquemet, Chaos, vol. 21, pp. 043136, Dec. 2011.

  3. An eikonal approach for the initiation of reentrant cardiac propagation in reaction-diffusion models, V. Jacquemet, IEEE Trans. Biomed. Eng., vol. 57, no. 9, pp. 2090-2098, Sep. 2010.

  4. An eikonal-diffusion solver and its application to the interpolation and the simulation of reentrant cardiac activations, V. Jacquemet, Comput. Methods Programs Biomed., vol. 108, no. 2, pp. 548-558, Nov. 2012.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eikonalspiral-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eikonalspiral-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file eikonalspiral-0.1.0.tar.gz.

File metadata

  • Download URL: eikonalspiral-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for eikonalspiral-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9fed99f8708d06c3dd5c097628cf36a357cbf5a008d5f15c04d66e8074a962ef
MD5 8adff19bdeffba7711616e5ebc509aed
BLAKE2b-256 178d417fe3f04f760a0e4329b33bb09f93219ea3d75f96be6779fac226313344

See more details on using hashes here.

File details

Details for the file eikonalspiral-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: eikonalspiral-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for eikonalspiral-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26738e25b18abeb75b814d303c7ff811048dc253dd9102f6210404e89aecddc3
MD5 cc7d2959e583f5b82a1127a3b205b24a
BLAKE2b-256 7b015a7bbf41f742a1f75cbe99c961da1339dff4f50a4a45e6a7583bb90d0007

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page