Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VascuPINN

A physics-informed neural network framework for simulating non-Newtonian blood flow in patient-specific vasculature.

License: MIT Python 3.10+ PyTorch USPTO Provisional

Overview

VascuPINN is a physics-informed neural network (PINN) system that solves the incompressible Navier–Stokes equations directly inside arterial geometries to produce velocity, pressure, and wall shear stress fields without a traditional mesh-based CFD pipeline. It is designed for clinical and research applications where speed, geometric flexibility, and the ability to fuse sparse experimental measurements with governing physics matter more than brute-force grid resolution.

The framework was developed as part of research recognized by a USPTO provisional patent (Feb 2025) and was used in a vascular surgery in India.

Why PINNs for hemodynamics

Conventional CFD requires careful meshing, long solve times, and patient-specific boundary condition tuning. PINNs replace the discretization with a neural ansatz: the network is trained to minimize the residual of the governing PDEs at sampled collocation points while simultaneously fitting boundary and (optionally) measurement data. The result is a continuous, differentiable representation of the flow field that can be queried at arbitrary points and updated quickly when geometry or boundary data change.

VascuPINN extends the standard PINN formulation in three ways relevant to clinical hemodynamics:

  1. Non-Newtonian rheology. The constitutive law uses a Carreau–Yasuda model so that shear-thinning behavior of whole blood is captured at low strain rates near vessel walls, where Newtonian assumptions break down.
  2. Pulsatile inlet conditions. Inlet velocity is parameterized as a Womersley-style waveform, allowing the same trained network to evaluate flow at any phase of the cardiac cycle.
  3. Hybrid data assimilation. When sparse measurements (e.g., 4D-flow MRI, Doppler) are available, they enter the loss as a soft constraint, biasing the solution toward measured reality without overriding the physics.

Status — read before citing this repository

This is a working reference implementation, not the code that produced the published results. Concretely:

Component State
PINN architecture (src/models/pinn.py) Implemented
Navier–Stokes + Carreau–Yasuda residuals (src/physics/navier_stokes.py) Implemented
Geometry loading and sampling (src/data/geometry.py) Implemented
Boundary conditions — Womersley inlet, no-slip, traction-free (src/physics/boundary_conditions.py) Implemented
Training loop with gradient-norm loss balancing (scripts/train.py) Implemented
Residual test suite (tests/) 8 tests, passing
Evaluation / VTK export (scripts/evaluate.py) Not implemented
Field visualisation (src/visualization/fields.py) Not implemented
Trained checkpoints, paper figures, patient geometries Not released here

The test suite verifies the physics operators against exact analytical solutions — the momentum and continuity residuals vanish on Hagen–Poiseuille flow, the Carreau–Yasuda law is monotonically shear-thinning and reaches its correct plateaus, and deliberately wrong fields produce the expected non-zero residuals. Run them with python -m pytest tests/ -v.

Two known simplifications, both deliberate and documented in the source:

  1. The momentum residual uses the Newtonian Laplacian form mu * lap(u). For a shear-thinning fluid the exact divergence form also carries a grad(mu) . grad(u) term. It is omitted here; see the comment in navier_stokes.py.
  2. The Womersley inlet solution assumes a Newtonian fluid and uses the infinite-shear viscosity. This is the standard approximation for setting an inlet condition on a shear-thinning fluid.

Repository structure

vascupinn/
├── src/
│   ├── models/           # PINN architectures (MLP, Fourier-feature, modified MLP)
│   ├── physics/          # Navier-Stokes, Carreau-Yasuda, boundary conditions
│   ├── data/             # Geometry loaders, collocation point sampling
│   ├── utils/            # Logging, checkpointing, config parsing
│   └── visualization/    # Field plots, streamlines, WSS maps  (not implemented)
├── configs/              # YAML configs per experiment
├── experiments/
│   ├── aneurysm/         # Saccular & fusiform aneurysm cases
│   ├── bifurcation/      # Carotid and abdominal aortic bifurcations
│   └── straight_vessel/  # Validation against analytical Poiseuille / Womersley
├── notebooks/            # Exploratory & figure-generation notebooks
├── tests/                # Unit tests for physics residuals
├── scripts/              # Training and evaluation entry points
├── data/                 # Geometries, boundary data (gitignored)
├── results/              # Trained checkpoints, logs (gitignored)
└── docs/                 # Method writeup, figures

Quick start

git clone https://github.com/avcodes438/vascupinn.git
cd vascupinn
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# Run the physics test suite (no geometry needed)
python -m pytest tests/ -v

# Train the canonical aneurysm case.
# Requires a watertight STL at the path named in the config, plus inlet/outlet
# cap geometry (center, normal, radius) under `boundary:`. See configs/ for the
# expected schema.
python scripts/train.py --config configs/aneurysm_saccular.yaml

scripts/evaluate.py is not implemented yet; checkpoints written by train.py load with a plain torch.load.

Method summary

The network u_θ : (x, y, z, t) → (u, v, w, p) is trained to minimize:

L = λ_pde · L_NS  +  λ_bc · L_BC  +  λ_ic · L_IC  +  λ_data · L_data

where L_NS is the residual of the incompressible Navier–Stokes equations evaluated at interior collocation points, L_BC enforces no-slip at vessel walls and the prescribed inlet/outlet conditions, L_IC enforces an initial condition for transient runs, and L_data is an optional measurement-fitting term. Loss weights are balanced via a self-adaptive scheme (gradient norm equalization) to prevent any single term from dominating training.

Wall shear stress is recovered analytically from the trained velocity field using τ_w = μ_eff(γ̇) · (∂u_t/∂n)|_wall, where μ_eff is the local effective viscosity from the Carreau–Yasuda law.

Validation

The repository includes validation cases against:

  • Analytical Poiseuille flow (steady, Newtonian, straight tube)
  • Analytical Womersley flow (pulsatile, Newtonian, straight tube)
  • Published CFD results for saccular intracranial aneurysms
  • Published CFD results for carotid bifurcation flow

Expected agreement: <5% L2 error on velocity fields, <10% on wall shear stress, against reference solutions.

Patent

A USPTO provisional patent application covering the VascuPINN system was filed in February 2025. Public disclosure has been cleared. This repository contains the research implementation; commercial use should reference the patent filing.

Citation

If you use VascuPINN in academic work, please cite the associated publications:

@article{vaghela2025vascupinn,
  title   = {Functional and Ethical Modeling of Non-Newtonian Hemodynamics in Aneurysmal and Bifurcated Vessels Using Physics-Informed Neural Networks},
  author  = {Vaghela, Aaryasinh},
  journal = {Scientific Culture},
  year    = {2025}
}

See CITATION.cff for machine-readable citation metadata.

License

MIT. See LICENSE for details. Note that the underlying method is covered by a USPTO provisional patent; the MIT license applies to this code implementation.

Contact

Aaryasinh Vaghela — aaryasinh.vaghela@gmail.com

About

Physics-informed neural network solving Navier-Stokes with Carreau-Yasuda non-Newtonian rheology for blood flow in patient-specific vasculature. PyTorch, 8 passing physics tests. Reference implementation; USPTO provisional patent, Feb 2025.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages