Have AI simulate a Rotating Drum with Aspherix DEM
We set out to build a classic granular-flow benchmark — a rotating drum tumbler — entirely from a one-page spec (PROJECT.md) and Aspherix's native scripting language. All results are 100% physics based, and reproducible. Here's what the case looks like and the interesting decisions that came up along the way.
Getting the tooling
Video: Walk through AI-assisted simulation of a rotating drum
This case was built with the Aspherix Assistant skill for Claude Code, which steers Claude toward Aspherix's native declarative syntax and bundles command- and strategy-specific guidance.
To install it globally for all projects:
git clone https://github.com/CFDEMproject/aspherix-assistant ~/.claude/skills/aspherix-assistant
Claude Code auto-discovers the SKILL.md — no further configuration
The specification
- A cylindrical drum, 200 mm inner diameter, 150 mm long, closed flat end caps, axis horizontal
- Built from analytic/primitive geometry — no mesh file
- 400 spheres, 8 mm diameter
- Let the particles settle under gravity first
- Then spin the drum at 60 RPM for exactly 3 full rotations
- Track kinetic energy and center of mass, output at 20 timesteps/second
Building the drum without a mesh
Aspherix's primitive_wall command supports analytic cylinder and disk primitives, so the drum body is a finite cylinder capped by two disks at each end. No STL files, no meshing — just math. Rotation is driven by the shear keyword on the primitive walls, which imposes a surface velocity that Aspherix resolves into the local tangential direction at each contact point — applied consistently across the cylinder and its two end disks, it reads to the particles as an actually rotating drum surface.
Surface speed is v = ω·r, so 60 RPM at a 0.1 m radius gives v ≈ 0.628 m/s.
Two-phase script structure
We couldn't just add a shear value to the wall definitions from the start, because the drum needs to be stationary while particles settle.
So the case runs in two phases:
- Settle phase — static (no-shear) walls, particles packed in via insertion, then simulate mode until_settled velocity_threshold 0.001 lets Aspherix decide when kinetic energy has dropped low enough on its own — no need to guess a settling time up front.
- Rotate phase — a fresh set of primitive_wall commands recreates the identical geometry with shear now set, followed by simulate time 3.0 (3 rotations at 1 rev/s).
Tracking results
- Kinetic energy comes for free as a built-in status_style column (ke)
- Center of mass comes from calculate center_of_mass, exposed to status_style
- write_to_terminal_timestep and write_output_timestep were both set to 0.05 s (20 Hz), so both the CSV log and the ParaView output land on the requested cadence
Results
Particles settled in 0.75 s of simulated time (auto-detected by until_settled)
The rotation phase ran the full 3.0 s (three complete revolutions at 60 RPM)
simulation_data_aspherix.csv holds the kinetic energy and center-of-mass time series data
post/ holds the VTK particle/geometry frames, viewable in ParaView via the Aspherix macro
Takeaways
The whole case went from a one-page natural-language spec to a working, verified Aspherix simulation without hand-writing any .asx from scratch — the Aspherix Assistant skill grounded every command in the real public documentation and example cases instead of guessing at syntax, which is what made it possible to find the non-obvious shear-based rotation technique for analytic walls in the first place.
Just as important, "generated" didn't mean "trusted blindly": the script was smoke-tested with a short run before committing to the full 3-rotation simulation production run.
The case that ran end-to-end — settling, rotating, and writing out KE/center-of-mass data at the requested cadence — was the same one produced from the spec, with no manual patching needed beyond what testing surfaced.
Want to try yourself?
Get an Aspherix license here.
Learn how to do it here.
Do you want to know more?
The Author:
Dr Daniel Louw
Researcher and Consultant at DCS Computing GmbH.