Skip to main content

Rocky-UniaxC: Multiscale Uniaxial Compression Simulation Toolkit for Ansys Rocky

Build and Test Python Versions License: MIT

rocky-uniaxc is a Python toolkit designed to automate the configuration, mesh generation, execution, and analysis of multiscale uniaxial compression simulations in Ansys Rocky DEM. It supports running simulations locally or deploying parallel job arrays on HPC clusters (like BlueBear or SCP) using SLURM.


🌟 Key Features

  • Automated Boundary Mesh Generation: Programmatically creates custom compression wall and insert surfaces using GMSH.
  • Design of Experiments (DOE):
    • Full-Factorial Parameter Sweeps: Automatically expands all parameter combinations to perform comprehensive grid sweeps.
    • One-Factor-at-a-Time (OFAT): Evaluates parameter sensitivities by varying one variable at a time while holding others constant.
    • ...more to be added
  • Flexible Simulation Backends: Works with the modern pyrocky API wrapper or standard rocky_prepost scripts.
  • SLURM HPC Cluster Presets: Ready-made presets for submitting parallel simulation batch jobs on UoB BlueBear (CPU/GPU) and SCP (GPU).
  • Robust Post-Processing: Automated analysis of settled and compressed states (e.g., calculating bulk densities, Coordination/Contact Numbers, and contacts ratio).
  • Data Export & Quality Audits: Automatically scans logs for lost particles, flags faulty runs, and gathers results into structured databases (SQLite) and dataframes (Pandas/CSV/Parquet).

📋 Prerequisites

  • Python: >= 3.10
  • Ansys Rocky DEM: Ansys Rocky version 2025 R2 (or compatible release) with its Python API (ansys-rocky-core) installed.
  • GMSH: Required on your system for generating boundary STL meshes.

⚙️ Installation

You can install the package using uv (recommended) or pip:

Using uv

To sync development and testing dependencies in a virtual environment:

uv sync --all-extras --dev

To install the package into your current Python environment:

uv pip install .

Using pip

Install the core package:

pip install .

Install with testing dependencies:

pip install .[test]

Install with documentation dependencies:

pip install .[docs]

🚀 Quickstart

1. Run a Parameter Sweep

Define your parameter space in a JSON config file (e.g., sweep_config.json):

{
  "shape": {
    "name": "sphere"
  },
  "particle_properties": {
    "radius": [0.005, 0.006],
    "density": [2500],
    "poisson": [0.25],
    "youngmod": [1e7]
  },
  "inseractions": {
    "pp": {
      "fric_dyn": [0.3, 0.5],
      "fric_stat": [0.4],
      "fric_rolling": [0.1],
      "cor": [0.5]
    },
    "pw": {
      "fric_dyn": [0.4],
      "fric_stat": [0.5],
      "cor": [0.5]
    }
  },
  "experim_settings": {
    "box_len": [0.1],
    "p_compress": [1000]
  },
  "contact_model": {
    "normal": "linear_hysteresis",
    "tangential": "coulomb_limit",
    "rolling": "none",
    "adhesion": "none"
  }
}

Write a script to generate and schedule the simulations:

from rocky_uniaxc import launch_sweep
from rocky_uniaxc.utils import RockyScheduler

# 1. Define the cluster scheduler settings (e.g., BlueBear CPU)
scheduler = RockyScheduler.bb_cpu(ncpus=20, run_days=3)

# 2. Launch the sweep configuration
launch_sweep(
    sweep_name="my_first_sweep",
    scheduler=scheduler,
    json_path="sweep_config.json",
    autolaunch=True,
    target="CPU",
    backend="pyrocky"
)

2. Post-Process Simulation Results

Load all simulation results from SQLite databases and export them for downstream analysis:

import rocky_uniaxc.sweep_analysis as analyze

# Load data into a Pandas DataFrame
df = analyze.load_data("my_first_sweep")
print(df.head())

# Check for runs with particle loss warnings or outliers
analyze.find_faulty_runs("my_first_sweep", dump=True)

# Export the results in custom formats (parquet, csv, excel)
analyze.dump_results("my_first_sweep", filetype="parquet", minimal=True)

3. Run a Single Case via CLI

You can execute a single simulation case using a local settings.json file:

python -m rocky_uniaxc.case_runner path/to/settings.json

🧪 Running Tests

To run the unit test suite and check code correctness:

uv run pytest

📚 Documentation

The documentation is configured for hosting on ReadTheDocs.

To build the HTML documentation locally:

uv run mkdocs build

The compiled output will be available at site/index.html.

To run a local live-reload server for development:

uv run mkdocs serve

📄 License

This project is licensed under the MIT License. See LICENSE for details.

Metadata

Release files for rocky-uniaxc 0.1.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 rocky-uniaxc 0.1.0
File Size Uploaded Provenance Actions
rocky_uniaxc-0.1.0.tar.gz 45.0 kB Without provenance Details for rocky_uniaxc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rocky-uniaxc 0.1.0
File Interpreter ABI Platform Actions
rocky_uniaxc-0.1.0-py3-none-any.whl Python 3 none any Details for rocky_uniaxc-0.1.0-py3-none-any.whl

Total release size: 98.3 kB

Release files / rocky_uniaxc-0.1.0.tar.gz

Download URL rocky_uniaxc-0.1.0.tar.gz
Size 45.0 kB
Tags Source
SHA-256 checksum
How to use checksums
440f1fc211041b7862cbf785bc344e71dac09b8cb6c3f3f0ee3de0cea539b920
BLAKE2b-256 checksum
How to use checksums
5b15f26782964c15896117ba160e22529932d34fe88dd1ad667f78c641110e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / rocky_uniaxc-0.1.0-py3-none-any.whl

Download URL rocky_uniaxc-0.1.0-py3-none-any.whl
Size 53.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4b0f2c8f4997f7c02051d448839360b224a22d98d1989b904046d7b1b414fb9
BLAKE2b-256 checksum
How to use checksums
62712b15cb8372f76d04abf8da19cea937752bbd714da8a19622b8350aa7aff0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.22 {"installer":{"name":"uv","version":"0.11.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for rocky-uniaxc 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.1.0 This release

2 release files No 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