Skip to main content

Binding for LMGC90.

Project description

compas_lmgc90

Python bindings for LMGC90 discrete element solver.

Installation

Conda

With conda alreay installed, create a conda environment from the yaml file

conda env create -f environment.yml

Then activate it and install the module inside it:

conda activate compas_lmgc90-dev
python -m pip install .

Linux

# Install dependencies
sudo apt update
sudo apt install -y gfortran libopenblas-dev liblapack-dev cmake

# Clone and install
git clone https://github.com/BlockResearchGroup/compas_lmgc90.git
cd compas_lmgc90
conda create -n lmgc90 python=3.12 -y
conda activate lmgc90
conda install -c conda-forge libstdcxx-ng=14
pip install -r requirements-dev.txt
pip install --no-build-isolation -ve .

Note: The libstdcxx-ng=14 is required because the module is compiled with GCC 13.3+ and needs GLIBCXX_3.4.32.

macOS

# Install dependencies
brew install gcc openblas cmake

# Clone and install
git clone https://github.com/BlockResearchGroup/compas_lmgc90.git
cd compas_lmgc90
conda create -n lmgc90 python=3.12 -y
conda activate lmgc90
pip install -r requirements-dev.txt
pip install --no-build-isolation -ve .

Note: CMake will auto-detect Homebrew GCC/gfortran. If detection fails, set compilers manually:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14  
export CXX=$(brew --prefix gcc)/bin/g++-14

Windows

Windows is not currently supported. The package requires Fortran compilers and POSIX-style build tools.

Usage

from compas_dem.models import BlockModel
from compas_dem.templates import ArchTemplate
from compas_lmgc90.solver import Solver

# Create model
template = ArchTemplate(rise=3, span=10, thickness=0.5, depth=0.5, n=20)
model = BlockModel.from_boxes(template.blocks())

# Run simulation
solver = Solver(model)
solver.set_supports(z_threshold=0.4)
solver.preprocess()
solver.run(nb_steps=100)
solver.finalize()

Examples

python temp/dem_of_an_arch.py
python temp/dem_of_a_wall.py
python temp/dem_of_a_dome.py
python temp/contacts.py

Troubleshooting

ImportError: libmatlib.so not found

Make sure you installed the package with pip install -e . in the correct conda environment. The LMGC90 libraries are bundled during installation.

GLIBCXX version error (Linux)

Install the required libstdc++:

conda install -c conda-forge libstdcxx-ng=14

macOS: Compiler not found

If CMake can't find gfortran, manually set the compilers before building:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14
export CXX=$(brew --prefix gcc)/bin/g++-14
pip install --no-build-isolation -ve .

macOS: Compiler not found

If CMake can't find gfortran, manually set the compilers before building:

export FC=$(brew --prefix gcc)/bin/gfortran-14
export CC=$(brew --prefix gcc)/bin/gcc-14
export CXX=$(brew --prefix gcc)/bin/g++-14
pip install --no-build-isolation -ve .

Contributing

Testing a Pull Request

# Fetch the PR branch (replace PR_NUMBER with the actual number)
git fetch upstream pull/PR_NUMBER/head:pr-branch-name
git checkout pr-branch-name

# Build and test
pip install --no-build-isolation -ve .
python temp/contacts.py

Pushing changes to a PR

# Add the PR author's fork as a remote
git remote add author https://github.com/AUTHOR/compas_lmgc90.git

# Push your changes to their branch
git push author branch-name

Note: This requires the PR author to have enabled "Allow edits from maintainers" on their PR.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

compas_lmgc90-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl (19.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

compas_lmgc90-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl (19.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

File details

Details for the file compas_lmgc90-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_lmgc90-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9067889e5dceda0b3ce2c9856994656a0c8ab8d57b8619bc89f42b9538ca480
MD5 9a78ef7f16440bb32fdd5c8bf083fd33
BLAKE2b-256 147adc1c6181bad54d22628d1157da5ce39a098f8e17b3e384c8c056cc92c02d

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_lmgc90-0.1.5-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on BlockResearchGroup/compas_lmgc90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_lmgc90-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_lmgc90-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bcfeeb0fa42ff8e7191fe6d1d7fce353cfaed21d9626473c284a631d941491db
MD5 072ce1183032c7282f6152213536fd50
BLAKE2b-256 1d43ccda6c68937a8795c3bd82b4d62e657476e24e53ade53e7d29a349483ed7

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_lmgc90-0.1.5-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on BlockResearchGroup/compas_lmgc90

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page