cardiacFoam is an OpenFOAM toolbox for cardiac electrophysiology and electro-mechanics.
It keeps the solids4foam runtime-selection style, and can run in two modes:
- Full mode: with a full
solids4foaminstallation (electro + solid + FSI workflows). - Electro-only mode: with the lightweight fallback
modules/physicsModelshipped in this repository.
cardiacFoam/
├── applications/
│ ├── solvers/cardiacFoam/ # Main executable
│ ├── utilities/ # sweepCurrents, setFibreField, ...
│ └── scripts/
│ ├── driverFoam/openfoam_driver/ # Python tutorial automation engine
│ └── cellML2foam/ # CellML -> ionic model generation pipeline
├── src/
│ ├── electroModels/ # Runtime-selectable electro solvers
│ ├── ionicModels/ # Runtime-selectable ionic ODE models
│ ├── genericWriter/ # Shared I/O and stimulus parsing helpers
│ └── couplingModels/ # Electro-mechanics coupling signal interfaces
├── modules/
│ └── physicsModel/ # Lightweight fallback physicsModel
├── tutorials/ # Reference cases and regression cases
└── etc/resolveSolids4Foam.sh # Backend selection helper
At runtime, solver/model selection is fully dictionary-driven:
applications/solvers/cardiacFoam/cardiacFoam.CcreatesphysicsModel::New(runTime).physicsModeltype is selected fromconstant/physicsProperties(type).- For electro runs,
src/electroModels/electroModel::New(...)selectselectroModelfromconstant/electroProperties(electroModel). - Electro models (
MonoDomainSolver,SingleCellSolver,EikonalSolver) select ionic models throughionicModel::New(...)(ionicModelin electro coefficients).
This gives one stable executable (cardiacFoam) with pluggable electro and ionic sub-models.
MonoDomainSolver: tissue PDE-ODE model, explicit/implicit stepping, activation-time tracking.SingleCellSolver: single integration-point ODE workflow (no spatial PDE solve).EikonalSolver: reduced-order activation-time model.
Compiled in libionicModels:
AlievPanfilovBuenoOrovioCourtemancheFabbriGaurGrandiORdStewartTNNPToRORd_dynClTrovatomonodomainFDAManufactured(manufactured monodomain verification model)bidomainFDAManufactured(manufactured bidomain verification model)
Manual tutorial entry points are in tutorials/*/Allrun. For parameter sweeps and post-processing automation, use:
applications/scripts/driverFoam/openfoam_driver
Current tutorial specs in the Python driver:
singleCellniederer2012manufacturedFDAmanufacturedFDABidomainrestitutionCurves
The driver writes run manifests and artifact manifests (run_manifest.json, plots.json) for reproducibility.
./AllwmakeRun examples:
cd tutorials/singleCell
./Allrun
cd ../NiedererEtAl2012
./Allrun parallelRun automation from repository root:
foamctl all --tutorial singleCell
foamctl all --tutorial niederer2012- Tutorial regression entrypoint:
tutorials/Alltest-regression - Driver architecture contract tests:
applications/scripts/driverFoam/openfoam_driver/tests/test_tutorial_architecture_contract.py
This is active research software. APIs and dictionaries evolve as models and workflows are expanded.