This technical benchmark demonstrates how to automate Discrete Element Method (DEM) workflows using Aspherix® and Anthropic's Claude Code. By deploying the open-source Aspherix Assistant skill, engineers can generate 100% physics-based, verified DEM simulation scripts—such as a meshless rotating drum tumbler using analytic primitives—directly from natural language specifications without writing manual code.
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.
Video: Walk through AI-assisted simulation of a rotating drum
Getting the tooling
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 is required.
Defining the DEM Simulation Specification for Claude Code
- 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 Meshless DEM Geometries with Aspherix Primitive Geometries
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.
Generating Settle and Rotate Phase Scripts via AI
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 Simulation Kinetic Energy and Center of Mass
- 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
Benchmark Results and Simulation Cadence
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
Frequently Asked Questions: AI & DEM Simulations
Q: Can AI write reliable Discrete Element Method (DEM) scripts?
Yes. By using the Aspherix Assistant skill, Claude Code is grounded in actual Aspherix documentation. This prevents syntax hallucinations and ensures simulation commands are technically accurate and 100% physics-based.
Q: Do I need a mesh (STL file) to simulate a rotating drum in Aspherix?
No. Aspherix's native scripting language allows you to build meshless geometries using analytic primitives like cylinders and disks, defined entirely via mathematical parameters.
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.
Testimony
“ The aspherix-assistant skill has significantly streamlined our process of setting up and running DEM simulations. The ability to generate solver-ready input scripts from simple descriptions also reduces the level of expertise required to create models with more complicated physics. By spending less time searching documentation and troubleshooting, we can direct our focus towards analyzing results. Overall, we are able to complete simulations faster, explore new capabilities within the software, and be more productive. "
— Mike Mayer & Sia Zamani, Dow
Want to try yourself?
Get an Aspherix license here.
Learn how to do it here.
Takeaways
Do you want to know more?
The Author:
Dr Daniel Louw
Researcher and Consultant at DCS Computing GmbH.