Physics Simulation
Merlin: simulating fast enough to steer
Merlin β a GPU powered simulation engine for real-time digital twins
π― The real-time threshold
A model that is accurate but slow describes a process. It does not steer it.
That is the whole difference between a study simulation and a digital twin: the latter has to keep pace with reality, otherwise it can neither predict, nor correct, nor train anything.
Classical approaches reach their limit here. Mesh-based methods assume a domain that deforms little. As soon as you have a free surface, a phase change, flowing powder or melting material, the mesh has to be rebuilt β and the cost of that rebuild rules out real time.
βοΈ Three choices that reinforce each other
Meshless. Merlin builds on SPH methods: matter is represented by particles carrying their own quantities. There is no grid to recompute. A droplet detaching, a powder bed collapsing, a melt pool solidifying β none of these needs special handling, where a mesh-based approach demands dedicated machinery.
Physical acceleration. Rather than integrating forces at very short time steps, position based dynamics corrects positions directly under constraints. You concede a little formal accuracy; you gain a stability that does not collapse at the first extreme case. To steer a process, a stable model at video rate beats an exact model that diverges.
Hardware acceleration. Everything runs on the GPU. And 3D rendering is part of the library, not a separate tool: you see what you simulate, with no export chain or intermediate format between computation and image.

π What Merlin simulates
Four physics, in one engine and one loop:
- π§ fluids β free-surface flows;
- π§± solids β deformable and rigid bodies;
- β³ granular media β powders, packings, grain flows;
- π₯ heat transfer β and with it, changes of state.

Their coupling is what matters. A real process does not split into independent physics: powder that heats becomes a pool that flows, then a solid that contracts. Simulating those regimes separately, in three tools, amounts to not simulating them at all.
π¨οΈ The case that started it
Merlin was written for a precise goal: the first real-time digital twin of an additive manufacturing process, in order to train an artificial intelligence to steer it through reinforcement learning.
Reinforcement learning has a particular appetite: it learns by trial and error, and it needs hundreds of thousands of them. On a real machine that is out of reach β in time, in material, in wear. Training therefore has to happen in a simulator, and that simulator must satisfy two contradictory demands: run far faster than reality, and stay faithful enough for the learned policy to transfer.
That is exactly the trade-off Merlin was designed to hold.
π€ Beyond additive manufacturing
The architecture owes nothing to the process that motivated it. Wherever matter changes state, flows or deforms on contact, the same engine applies:
- additive manufacturing β deposition, melting, solidification, residual stresses;
- robotics β manipulation of granular and soft matter, rich contacts, learning in simulation before transfer to hardware;
- complex materials β behaviours that measurement alone describes poorly, and that an executable model lets you explore.
π¬ A process to mirror?
If you are trying to model a process that the usual tools handle badly β free surfaces, powders, melting, contacts β or to train a controller in simulation before putting it on a machine, let's talk. Get in touch.