MicroSimulator simulates microbial populations in microfluidic devices. It follows every cell as it grows, divides, and pushes against its neighbors, and it solves the flow of medium through the device along with the nutrients and signals that the flow carries. The engine is a C++23 library with a one-to-one Python package, and it runs on a native CPU, Apple Metal, or NVIDIA CUDA backend, headlessly or in the desktop app.
With MicroSimulator, a model states what the cells do and where they live. This example is a microfluidic cell trap fed with nutrient by a flowing channel:
The Python implementation of the model shown above:
import microsimulator as ms
nutrient = ms.Signal("nutrient")
ecoli = (
ms.Strain("E. coli")
.grows(ms.monod(nutrient, rate=1.0, half=5.0))
.consumes(nutrient, ms.growth_yield(0.5))
.divides_at(ms.uniform(3.2, 3.8), ms.Jitter.XY)
)
chip = (
ms.TrapChannel(trap=(40, 20, 1.5), channel_width=20)
.flowing(20.0)
.carrying(nutrient, ms.Medium(diffusion=40, inlet=10, initial=10))
.washing_out_beyond(50.0)
)
model = (
ms.Model.builder("trap")
.seed(42)
.inside(chip)
.inoculate(ecoli, [ms.Founder(position=(35, 0, 0), length=3.5)])
.mechanics(ms.Mechanics(flow_drift=True, load=ms.linear_load(200.0)))
.resolving_flow_every(5, ms.FlowFeedback(drag=2.0, moving_biomass=True))
.build()
)
model.run(steps=1000, dt=0.02, output="trap.json")
model.positions(), model.growth_rates(), model.field(nutrient)The colony fills the trap and spills into the channel, where the flow carries cells to the outlet. See examples/microfluidic_trap.py for the same model with its constants named and explained.

