/fenicsx-beat:beat-simulationfrom fenicsx-beat
Sets up and runs cardiac electrophysiology simulations using fenicsx-beat (monodomain, eikonal, reaction-eikonal models) on FEniCSx/dolfinx meshes. Handles CLI configs, Python scripts, solver selection, cell models, and post-processing.
Ships in fenicsx-beat. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
beat (package fenicsx-beat) solves the monodomain model — the reaction-diffusion PDE
$\chi C_m \partial v/\partial t = \nabla\cdot(M\nabla v) - \chi I_{ion}(v, s) + \chi I_{stim}$
coupled to cell-model ODEs for the states $s$ — by operator splitting, on FEniCSx/dolfinx meshes. It also has an eikonal
solver, the reaction-eikonal model, a bidomain model and ECG recovery. Two ways to drive it:
beat init / validate-config / geometry / run / post): a TOML config, reproducible,
restartable, MPI-ready; beat post recomputes outputs from saved results.Your job: find out what the user really wants to simulate, agree on an approach with them, build it, and check it before they spend hours on a run. Work through the five steps below in order. Do not skip the interview because the request looks clear — the choices below change the result.
Reference files (read when the step needs them):
Run (and read the output):
python -c "import dolfinx, beat; print('dolfinx', dolfinx.__version__, 'beat', beat.__version__)"
beat version # only if the CLI route is likely; needs the `cli` extra
rush_larsen_2 + Strang, merged half-steps
in the CLI). An editable install can report a stale beat.__version__, so check features, not only
the number: python -c "import beat, inspect; print(inspect.signature(beat.SplittingSolver))" must
show splitting and merge_half_steps. If the installed beat is older, say so: recommend
upgrading, or follow that version's docs and help() instead of the defaults described here.gotranx for cell models,
cardiac_geometries for ellipsoids, ldrb for BiV/atlas fibres, ukb for the UK Biobank atlas,
pyvista for images/movies, io4dolfinx for reading meshes and results).Ask one question at a time, multiple choice with an "other" option, and say why it matters when that is not obvious. Skip a topic the user already answered; confirm instead of re-asking. Skip a topic that does not apply to where the conversation is heading (no cell-model question for activation times from the eikonal model alone), and say why. If the user asked for the CLI but wants something only Python can do (Durrer sequence, eikonal, reaction-eikonal, bath, custom ODE code, spiral-tip tracking), say so as soon as it comes up, not only at Step 3. Topics, in order:
.ode
file (converted with gotranx). Ask whether cells should be paced to steady state first and
whether different regions (endo/mid/epi layers) need different cell types or parameters.beat.activation_sequence.EndocardialActivation,
Python only). Stimulate in the PDE or the cell model, not both.Present 2–3 approaches with trade-offs and a recommendation, using problems.md and numerics.md. Typical axes:
rush_larsen_2, Strang splitting, merged half-steps in the CLI) vs
a more robust or cheaper setting; time step and mesh size against accuracy and cost.Then summarize the chosen setup in a few lines (geometry, cell model, stimulus, outputs, model, interface, dt, mesh size, end time, ranks) and get an explicit yes before building.
CLI route (in a fresh folder the user agrees on):
beat init --template <closest> config.toml # templates listed in problems.md
# edit config.toml for the agreed setup
beat validate-config config.toml # prints the resolved config; fix every error
Show the user the resolved values that matter (geometry, cell.scheme, solver.dt,
solver.end_time, stimulus, output.save_every). Config keys and allowed values: the comments in
the template, beat validate-config errors, and the configuration reference
(https://finsberg.github.io/fenicsx-beat/docs/cli_reference.html). Quantities are pint strings
("0.05 ms", "1400 cm**-1").
Python route: start from the closest demo or script in problems.md (docs page
for the explanation, GitHub source for the code — demos and scripts/ are not in the pip package).
Before using a beat call, read its signature in the installed version (python -c "import beat, inspect; print(inspect.signature(beat.SplittingSolver))", help(...)) — the API changes between
versions. When adapting a demo:
../odes/... cell models): download them from
https://github.com/finsberg/fenicsx-beat/tree/main/odes or point to the user's own file, and use
absolute paths;beat API —
copy them along;Save the fields needed for post-processing with io4dolfinx and put post-processing in a separate script (outputs.md).
beat run config.toml --set 'solver.end_time="20 ms"', into a separate
--output-folder) and, if meshing
is slow, a coarser mesh. One rank unless MPI itself is under test.
For a Python script, the same with its end time cut down. For an eikonal solve, a coarse mesh
is the smoke run.beat post, or $v$ at a probe point). For eikonal
activation times: finite everywhere, no unreached vertices (allow_unreached=False raises), and
the latest activation time plausible for the size and velocity. A stimulus
that fires but never spreads usually means the mesh is too coarse for the conductivities, the
stimulus is too weak or too short, or the stimulus is applied twice/never.beat run config.toml, or mpirun -n N beat run config.toml;
python script.py / mpirun -n N python script.py), roughly how long it will take (scale from
the smoke run), where results land, how to post-process (beat post config.toml) and restart
(beat run config.toml --restart).Never start a long run or an MPI run without asking — offer the command; run it only on an explicit yes.
help, inspect.signature,
beat validate-config) or the docs (https://finsberg.github.io/fenicsx-beat). If something does
not exist, say so and offer the closest thing that does.geometry.unit) against conductivities, $\chi$ and stimulus sizes.rush_larsen_2 steps $v$ explicitly, so a large solver.dt can blow up: use a smaller dt or
cell.scheme = "generalized_rush_larsen" with Godunov splitting;beat.SplittingSolver(..., merge_half_steps=True))
call solver.synchronize() before reading or saving the state (the CLI does this itself);cell.steady_state) when the result depends on it.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
cardiac-simulation, electrophysiology, fenicsx-beat, monodomain, eikonal, cellml
npx claudepluginhub finsberg/fenicsx-beat --plugin fenicsx-beatOther plugins' skills for the same job