This Python library provides tools for creating and examining clumps using techniques: the Euclidean Distance Transform, Favier, and Ferellec-McDowell. It allows for the efficient generation of clumps and the extraction of their surfaces.
Project description
CLUMP
Description
CLUMP is a collection of scripts to generate multi-sphere particles of overlapping or non-overlapping spheres, which approximate target geometries. Multi-spheres (a.k.a. clumps) are popular in numerical simulations using the Discrete Element Method (DEM), but these geometric object can find applications in a wider perspective, past numerical modelling. The motivation behind developing CLUMP stemmed from the need to compare different clump-generation techniques, both in terms of particle morphology and mechanical performance using the DEM. To this end, CLUMP offers two existing and well established clump-generation techniques and proposes a new one. The generated clumps can be exported in various formats, compatible with some of the most prominent DEM codes. Last, the surface of each generated clump can be extracted as a triangulated mesh and saved as an stl file, allowing for a full characterisation of particle morphology, using tools like SHAPE or 3D-printing of physical particle replicas. CLUMP was initially developed in MATLAB and has now been fully translated in Python. Both implementations will continue to be developed in parallel as the software evolves.
Architectural Features
CLUMP performs the following functions:
-
GenerateClump
- Favier et al (1999)
- Ferellec and McDowell (2010)
- Euclidean 3D (2021) and Extended Euclidean 3D (proposed in this code)
-
ExportClump
- YADE
- MercuryDPM
- LAMMPS
- EDEM
- PFC3D
-
CharacteriseClump
- Surface extraction
Installation
Running the following code in the terminal (for Linux and macOS) or in the Command Prompt (for Windows) will automatically set up the module along with its corresponding dependencies.
pip install clump-python
Quick Start
After the installation using pip install clump-python
, CLUMP can easily be imported as
import CLUMP
This following examples demonstrate different approaches to generate clumps for the different target geometry. The variables below are documented within each function.
from CLUMP.examples import Example_Euclidean_3D
from CLUMP.examples import Example_Euclidean_3D_Extended
from CLUMP.examples import Example_Ferellec_McDowell
from CLUMP.examples import Example_Favier
The following example demonstrates the surface extraction method.
from CLUMP.examples import Example_ExtractSurface
Simple Examples
Here is an example of generating a clump from an STL file using Euclidean Distance Transform method.
from CLUMP import GenerateClump_Euclidean_3D
inputGeom = "path_of_STL.stl"
N = 21
rMin = 0
div = 102
overlap = 0.6
output = 'path_of_clump_output.txt'
outputVTK = 'path_of_clump_vtk.vtk'
visualise = True
GenerateClump_Euclidean_3D(inputGeom, N, rMin, div, overlap, output=output, outputVTK=outputVTK, visualise=visualise)
To run the Extended Euclidean Transform, one needs to specify the maximum sphere radius which will trigger the extended version. The example is as follows:
from CLUMP import GenerateClump_Euclidean_3D
inputGeom = "path_of_STL.stl"
N = 21
rMin = 0
div = 102
overlap = 0.6
output = 'path_of_clump_output.txt'
outputVTK = 'path_of_clump_vtk.vtk'
visualise = True
rMax_ratio = 0.3 # Parameter to trigger the Extended Euclidean method
GenerateClump_Euclidean_3D(inputGeom, N, rMin, div, overlap, output=output, outputVTK=outputVTK, visualise=visualise, rMax_ratio=rMax_ratio)
Here is an example for the Ferellec-McDowell clump generation method:
from CLUMP import GenerateClump_Ferellec_McDowell
inputGeom = "path_of_STL.stl"
dmin = 0.1
rmin = 0.01
rstep = 0.01
pmax = 1.0
seed = 5
output = 'path_of_clump_output.txt'
outputVTK = 'path_of_clump_vtk.vtk'
visualise = True
mesh,clump=GenerateClump_Ferellec_McDowell(inputGeom=inputGeom, dmin=dmin, rmin=rmin, rstep=rstep, pmax=pmax, seed=seed, output=output, outputVTK=outputVTK, visualise=visualise)
To generate a clump using the Favier method, you can use the following example:
from CLUMP import GenerateClump_Favier
inputGeom = "path_of_STL.stl"
N = 10
chooseDistance = 'min'
output = 'path_of_clump_output.txt'
outputVTK = 'path_of_clump_vtk.vtk'
visualise = True
mesh,clump=GenerateClump_Favier(inputGeom=inputGeom, N=N, chooseDistance=chooseDistance, output=output, outputVTK=outputVTK, visualise=visualise)
Consider a clump defined as follows:
import numpy as np
clump = np.array([[1, 0, 0, 1.1],
[2, 1, 0, 1.1],
[3, 0, 0, 1.2],
[1, 0, 1, 1.2]])
To extract the surface of the clump, you can use ExtractSurface function as follows:
from CLUMP import ExtractSurface
N_sphere = 200
N_circle = 100
visualise = True
faces, vertices = ExtractSurface(clump, N_sphere, N_circle, visualise)
BYOS (Bring Your Own Scripts)!
If you enjoy using CLUMP, you are welcome to require the implementation of new clump-generation approaches and features or even better contribute and share your implementations. CLUMP was created to provide a comparison of different methods, by collecting them in one place and we share this tool hoping that members of the community will find it useful. So, feel free to expand the code, propose improvements and report issues.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file clump-python-0.3.3.tar.gz
.
File metadata
- Download URL: clump-python-0.3.3.tar.gz
- Upload date:
- Size: 1.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e17e5c9fb5da1ae18f10087b871a1ff3a801320a5a278030d88acef37fc414c4 |
|
MD5 | 95358098785af266fcb3737c980fe576 |
|
BLAKE2b-256 | 52706405e2eab81a5d391ae0d2f2b59941929cec75f12cd6aaa8f643af5eb009 |
File details
Details for the file clump_python-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: clump_python-0.3.3-py3-none-any.whl
- Upload date:
- Size: 1.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab03bcb40bd873f7ff8f38e2c492329f45e82c6d368960b53840873e59837177 |
|
MD5 | 2a78fa0c0c07967a56be2abbf933aef1 |
|
BLAKE2b-256 | b9d6c2c8724e8d8e6a3bd33f2cf23308132a54a3ab151fca537e90e976494629 |