// HACKER NEWS — CYBERSECURITY
Simulated red blood cells and microscopy
A few months after I started my PhD, I was part of a team trying to model how red blood cells (RBCs) flow through a microfluidic device.
These devices are prime candidates for detecting circulating tumor cells, extremely rare cells that signal cancer metastasis, terribly difficult to catch among the trillions of red blood cells around them.
To optimize these devices, we first needed a numerical model that could reproduce the correct physics.
One day, we were comparing two videos, one from a real experiment, and one from our simulations.
The trajectories were different, meaning the simulations were wrong.
In the simulations, the fluid was modeled with a particle method called dissipative particle dynamics (DPD), and we had a coarse-grained model for the membrane dynamics.
At this point, we were not sure whether the mismatch came from the fluid or from the membrane surface model.
To rule out the fluid part, I was tasked with writing a boundary-integral method (BIM) code, a trusted method for solving Stokes flows, to compare with the DPD method.
I never got to finish it properly since we discovered that increasing the DPD resolution fixed that part.
Recently I made simulations of sedimenting particles in a viscous flow, where a cloud of small particles transformed into a torus before breaking up.
This relies on the same principles for solving the Stokes equations, and it made me want to finally implement the boundary-integral method for a red blood cell.
I decided to extend my solver to handle the complex membrane dynamics of RBCs, based on my previous research, and combine them with the fluid solver I implemented.
In particular, I have seen several experimental videos of these cells, none of them looking like the visualizations of my "perfect" cells produced numerically.
Can we produce similar pictures, with the microscopic artifacts?
Let's first make a few simulations to obtain RBC shapes observed in experiments.
Red blood cells are roughly two things: a membrane, enclosing the cytosol, which carries the hemoglobin necessary to transport oxygen efficiently.
The cytosol can be modeled as a viscous fluid about 5 times more viscous than the plasma.
The membrane is more complicated: it is composed of a cytoskeleton and a lipid bilayer.
The former is mainly responsible for shear elasticity, while the latter contributes to bending resistance, area conservation, membrane viscosity, and area-difference elasticity, depending on the surrounding chemical conditions.
All these terms can be modeled mathematically on a single surface, and discretized onto a triangle mesh.
I'll spare you all the math and energy functionals, but it's described in detail in my previous research 1 2, and has been discretized initially in some of my colleague's work 3 and implemented in Mirheo 4.
I show a few of the force terms below.
The energies are relatively simple to implement, and have analytical solutions on spheres.
Forces are derivatives of these energies with respect to positions,
much more involved, but validated against finite differences of the energy.
I also created functions to compute the Hessian of the energies, which allows computing equilibrium shapes (minimal energy) faster with Newton's method.
This was of course all facilitated by LLMs (I mainly used Opus 4.8 from Claude Code), although I gave tight directives so that the design remained under control, performance stayed reasonable, and I adopted a test-driven development approach.
After a bit of back and forth with my agent, tweaking, and parameter tuning, I could reproduce the famous SDE sequence (stomatocyte-discocyte-echinocyte), a sequence of shapes that RBCs take due to a change in the chemical environment, causing an imbalance between the two layers of the lipid bilayer:
Fischer 5 reproduced this sequence experimentally (EDS, reversed!) by changing the albumin concentration. I remember being fascinated by how much the cells deform under this chemical change:
This is a micros