Accurate Lung Visualization and Simulation
Given a CT-Scan for the lungs of a patient, we extract the personalized extended bronchial tree using AVATREE and the FAST framework in order to develop a computational model using OpenFOAM for airflow and gas transport in the subject-specific human lungs. The project as a whole is meant to be open-source allowing for any possible future contributions by the community.
OpenFOAM_Automation.py configures the pressure, velocity, and meshing dictionaries for a binary airway tree. It requires PyFoam and an existing OpenFOAM case containing 0/p, 0/U, system/snappyHexMeshDict, and system/surfaceFeaturesDict.
python3 OpenFOAM_Automation.py --generations 7 --case /path/to/openfoam-caseThis produces 2^n outlet patches for n generations. The helper stops at 12 generations by default (4,096 outlets); pass --allow-large-case only when that scale is intended.
Native build dependencies (Homebrew):
brew install eigen boost cgal itk qtcmake -S src -B build-mac -G Ninja && ninja -C build-mac -j2Viewer with airflow demo (see docs/demo-airflow.md for the full story):
./src/ApplicationV2 demo/tree.obj # healthy bifurcation + flow
./src/ApplicationV2 demo_constricted/tree.obj # 50% stenosis variant
./src/ApplicationV2 data/lung.obj # large mesh, no flow dataKeys: a particles, v color mode (branch/pressure/plain), +/- speed,
l load, w wireframe, p screenshot, --help for all.
Re-run the CFD at a new inlet velocity:
demo/rerun.sh --case demo/case --demo demo --velocity 0.025 --iters 200Docker OpenFOAM usage:
docker compose run --rm modeller bash
python3 OpenFOAM_Automation.py --generations 7 --case /path/to/openfoam-caseRun tests:
pytest


