Model Blood Cell Flow and Deformation in Matter.js

This article explains how to simulate the flow and mechanical deformation of red blood cells (erythrocytes) traveling through narrow capillary channels using the 2D physics engine Matter.js. Because Matter.js is fundamentally a rigid-body engine, capturing microvascular dynamics requires approximating soft-body mechanics through constrained particle rings, building static geometric constrictions, applying external hydrodynamics to emulate plasma flow, and tuning material parameters to prevent cell collapse while enabling realistic stretching.

1. Constructing Deformable Red Blood Cells

Matter.js does not provide native continuous soft-body or fluid-membrane physics, so each red blood cell must be modeled as a discretized spring-mass composite:

2. Setting Up the Capillary Channel Geometry

Capillaries are narrow biological passages often smaller in diameter than the resting diameter of a red blood cell (typically ~8 µm cell versus 4–7 µm channel):

3. Simulating Plasma Flow and Hydrodynamic Forces

Because Matter.js does not calculate Navier-Stokes fluid mechanics, fluid pressure gradients must be represented via direct programmatic force injection:

4. Tuning Physics Engine Constraints

Accurate microvascular deformation requires careful calibration of the Matter.js solver settings:

By combining an elastic ring structure with a parabolic force field and low-friction static boundaries, Matter.js can reliably demonstrate the parachute-like and bullet-like deformation patterns characteristic of erythrocyte transit through narrow microchannels.