Skip to main content

crushdem

A soft-sphere discrete element method (DEM) with particle breakage for crushers: Hertz-Mindlin contacts with tangential history, analytic walls with prescribed motion (a jaw's swing plate, a cone's gyrating mantle), and particle replacement driven by the Tavares breakage model and the t10 progeny law. It installs with pip on Windows, Linux and macOS, runs on any CPU (numba) and on NVIDIA GPUs (Warp), and needs no C++ toolchain, WSL or MPI.

Status

Version 0.05.000, the first release on PyPI. The engine is implemented and tested: the soft-sphere core (particle state, velocity-Verlet integration, the Hertz-Mindlin contact with tangential history, Coulomb sliding and Tsuji damping, rolling resistance, the uniform hash grid), analytic walls with prescribed motion and their power, feed and discharge with a closing mass balance, the machines built from them (the laboratory jaw of Barrios et al. 2020 and a parametric cone) and particle-replacement breakage (the Tavares breakage model with damage, t10 and incomplete-beta progeny, a mass-conserving replacement with bounded injected energy), on a numba CPU reference and a Warp CUDA path held equal by tests. The requirements and the validation plan are in docs/design/SDD.md.

Validation: the laboratory jaw is not reproduced. Against the jaw crusher of Barrios et al. 2020 (https://doi.org/10.3390/min10080717) the throughput band set before the run is not met. The power band is met in the steady-state window, but the energy per kilogram is a third of the measured one, so that verdict is not a sign that the energy balance is right. The record states it as it is (docs/VALIDATION.md, validation/results/jaw_barrios2020.json):

Quantity, 63/52 mm feed, 6 Hz Measured crushdem (record of 0.04.000, model unchanged since) Error Band
Mean net power, steady-state window 0.34 kW 0.301 kW -11.5 percent 30 percent: met in the window
Mean net power, whole run 0.34 kW (no window stated) 0.228 kW -32.8 percent reported
Throughput 798.7 kg/h 2167 kg/h +171 percent 10 percent: not met
Specific energy (net power over throughput) 1533 J/kg (derived) 500 J/kg (window), 526 J/kg (whole run) -67 and -66 percent no band: reported
Product, median size d50 4.5 mm 11.1 mm about 2.5 times coarser no band: reported

The machine passes the batch about 2.7 times faster than the experiment and delivers about a third of the energy per kilogram; the window power lands near the paper because the two errors offset. The ore is derived from the paper's single-particle tests (all 30 particles of each Fig. 6b class, the paper's median); it was changed once, after the first review, from the paper's data and text, never from the jaw result, and no ore property is tuned. The paper's own calibrated sphere (Fig. 6a) is about six times stiffer than the Table 3 contact the case uses. The overlap limit was relaxed from 0.3 to 0.5 of the smaller radius on the paper-ore runs, and 18 of the 29 window strokes exceed 0.3; one seed was run; the 3 and 9 Hz runs and a comparison ore stopped with the engine's overlap error (a jammed bed or a too-large time step: the record does not show which), and the 3 and 9 Hz points have no measurement. Seven candidate causes are listed in the record (the contact stiffness, the throw, the swing law and the nip angle, flat smooth plates, the progeny law, the extrapolated size effect, spheres passing the gap by diameter); none has been tested and none was tuned to reach a band. Treat the engine as a research tool whose contact, wall and breakage mechanics are tested and whose agreement with a real crusher is an open result. The cone case follows when its results are confirmed in an open text.

Install

pip install crushdem            # numpy only: the core, on plain Python (correct, slow)
pip install "crushdem[jit]"     # + numba: the CPU reference path
pip install "crushdem[gpu]"     # + warp-lang: the CUDA path (NVIDIA GPU)

Python 3.10 to 3.13; Windows, Linux and macOS; no C++ toolchain, WSL or MPI. The extras are optional: the wheel imports and runs with numpy alone.

Minimal example

Two rock spheres collide head-on with a coefficient of restitution of 0.5, and the engine returns the speed they leave with. It runs in about two seconds with numpy only, no extra needed.

from crushdem import ContactTable, Material, PairParams, ParticleState, Simulation, stable_time_step

rock = Material("rock", youngs_modulus=1.0e8, poisson=0.25, density=2700.0)
table = ContactTable.build([rock], default=PairParams(restitution=0.5, friction=0.0))
state = ParticleState.from_arrays([[0.0, 0.0, 0.0], [0.010001, 0.0, 0.0]], [0.005, 0.005], table,
                                  vel=[[0.5, 0.0, 0.0], [-0.5, 0.0, 0.0]])
sim = Simulation(state, table, dt=stable_time_step(state, table, 0.05), gravity=(0.0, 0.0, 0.0))
sim.run(2000)
after = sim.state()
print(f"rebound ratio {(after.vel[1, 0] - after.vel[0, 0]) / 1.0:.4f} for a restitution of 0.5")

It prints rebound ratio 0.4999 for a restitution of 0.5. The notebooks in notebooks/ take this contact apart and build up to the jaw.

A bed that settles

A column of 2000 spheres falls onto a floor of frozen spheres and settles (with the jit extra: on plain Python this takes hours); the same call runs on the GPU with backend="warp" (check crushdem.available_backends()).

import crushdem
from crushdem import Simulation, stable_time_step
from crushdem.core.scenarios import settling_column

state, table = settling_column(2000, seed=1, initial_speed=1.0)   # spheres, and their material/contact table
dt = stable_time_step(state, table, fraction=0.1)                 # 0.1 of the Rayleigh time of the smallest sphere
sim = Simulation(state, table, dt=dt, backend="numba", seed=1)
sim.run(1000)
result = sim.result()
print(result["state"]["n_contacts"], "contacts,", f"{result['performance']['particle_steps_per_second']:.2e}", "particle-steps/s")
Simulation.write_result(result, "run.json")                       # validates against schemas/run.schema.json

A jaw crusher

The laboratory jaw of Barrios et al. 2020, fed a batch of one narrow size class (without breakage coarse rock is trapped by the gap, fine rock passes). Every machine dimension and where it comes from is in machine.provenance (docs/machines.md).

import numpy as np
from crushdem import ParticleState, Simulation, stable_time_step
from crushdem.machines import BARRIOS_FEED_CLASSES, barrios_contact_table, jaw_barrios2020

machine, table = jaw_barrios2020(), barrios_contact_table()
feed = machine.feed([BARRIOS_FEED_CLASSES["16/13.2"]], batch_mass=0.05, seed=1)
probe = ParticleState.from_arrays([[0, 0, 0]], [feed.min_radius], table)
empty = ParticleState.from_arrays(np.zeros((0, 3)), np.zeros(0), table)
jaw = Simulation(empty, table, dt=stable_time_step(probe, table, 0.1), feed=feed, capacity=30, seed=1,
                 **machine.simulation_kwargs())
jaw.run_cycles(2, machine.period_s)
swing = next(w for w in jaw.wall_report() if w["name"] == "swing_plate")
print(f"swing plate {swing['mean_power_w']:.1f} W,", jaw.flow()["n_out"], "spheres out")

The same jaw with breakage

Give the run an ore and its spheres break by the Tavares model and are replaced by progeny drawn from the pool of capacity slots, which is the particle cap. The ore parameters of the jaw case, each with its source, are jaw_ore_barrios2020(); the model, its bounds and what the result reports are in docs/breakage.md.

from crushdem.machines import jaw_ore_barrios2020

ore = jaw_ore_barrios2020()
feed = machine.feed([BARRIOS_FEED_CLASSES["31.5/26.5"]], batch_mass=0.15, seed=1)
probe = ParticleState.from_arrays([[0, 0, 0]], [0.5 * ore.min_diameter], table)   # the smallest sphere sets the time step
crusher = Simulation(empty, table, dt=stable_time_step(probe, table, 0.1), feed=feed, capacity=400, ore=ore, seed=1,
                     **machine.simulation_kwargs())
crusher.run_cycles(1, machine.period_s)
b = crusher.breakage_report()
print(b["n_events"], "breakages,", b["n_progeny"], "progeny,", f"{crusher.flow()['fines_kg'] * 1000:.1f} g of fines")

Your own spheres: ContactTable.build([Material(...)], default=PairParams(restitution, friction)) and ParticleState.from_arrays(positions, radii, table, vel=...). The contact law and its sources are in docs/contact.md; measured speeds in docs/performance.md; the benchmark is python bench/settle.py; the jaw batch is python bench/jaw_batch.py.

Areas

Area Where State
Core (state, materials, contact law, scenarios) crushdem/core/ active, tested
Neighbour search (hash grid) crushdem/neighbours/ active, tested
Walls, their motion laws and power crushdem/walls/ active, tested
Feed, discharge, mass balance crushdem/flow.py active, tested
Machines (Barrios jaw, parametric cone) crushdem/machines/ active; the jaw is not reproduced, see Status
Breakage (Tavares model, t10 progeny, replacement) crushdem/breakage/ active, tested
Backends (numba reference, Warp CUDA) crushdem/backends/ active; the CPU path carries the release
Run loop and result crushdem/simulation.py, schemas/run.schema.json active
Comparison protocol (band, steady-state window, window statistics and the resolved-verdict rule, product passing sizes) crushdem/comparison.py (crushdem.comparison, used by the validation case and the comparison notebook; functions and units in docs/design/SDD.md, Validation) active, tested
Notebooks (five, English and Spanish, level 2; the comparison notebook imports crushdem.comparison) notebooks/ active
Validation validation/, docs/VALIDATION.md the jaw case, a negative result
Documentation docs/ (contact, machines, breakage, performance, design) active
Tests and benchmarks tests/, bench/, scripts/run_notebooks.py python -m pytest -q
Deploy .github/workflows/publish.yml PyPI Trusted Publishing from a GitHub release

Consumed by CAOS_ChancaDEM, which bakes its runs offline.

How to cite

Cite the software by its release and the methods by their sources. Software: Santibanez-Leal, F., crushdem, version 0.5.0, https://github.com/fsantibanezleal/CAOS_CrushDEM (see CITATION.cff). Methods: the breakage model is Tavares, L. M. (2022), KONA Powder and Particle Journal 39, 62-83, https://doi.org/10.14356/kona.2022012; the laboratory jaw and its measurements are Barrios et al. (2020), Minerals 10(8), 717, https://doi.org/10.3390/min10080717; the contact damping is Tsuji, Tanaka and Ishida (1992), Powder Technology 71, 239-250, https://doi.org/10.1016/0032-5910(92)88030-L.

Licence

MIT, see LICENSE.

Metadata

Release files for crushdem 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crushdem 0.5.0
File Size Uploaded Provenance Actions
crushdem-0.5.0.tar.gz 108.6 kB With provenance Details for crushdem-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for crushdem 0.5.0
File Interpreter ABI Platform Actions
crushdem-0.5.0-py3-none-any.whl Python 3 none any Details for crushdem-0.5.0-py3-none-any.whl

Total release size: 186.1 kB

Release files / crushdem-0.5.0.tar.gz

Download URL crushdem-0.5.0.tar.gz
Size 108.6 kB
Tags Source
SHA-256 checksum
How to use checksums
963c7f0f470ec59fb10b166b1c27cb5f7fdb47ba23ff06b2d35079c366e41e9e
BLAKE2b-256 checksum
How to use checksums
bdd6f5de7940314ec7c18e703780cfb40ac5b7f14b572d3d700e631e7d6ea55e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / crushdem-0.5.0-py3-none-any.whl

Download URL crushdem-0.5.0-py3-none-any.whl
Size 77.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d80f3119a8b29afae9e6c5245b285744510830bafb632ad1d16c1d0d89e87516
BLAKE2b-256 checksum
How to use checksums
785a2c08e4a884bc09c627217bc03f201948251ac9bf64d509ce3967e5da5fc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for crushdem 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for crushdem-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page