Python bindings for LMGC90 discrete element solver.
With conda alreay installed, create a conda environment from the yaml file
conda env create -f environment.ymlThen activate it and install the module inside it:
conda activate compas_lmgc90-dev
python -m pip install .# 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.
# 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++-14Windows is not currently supported. The package requires Fortran compilers and POSIX-style build tools.
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()python temp/dem_of_an_arch.py
python temp/dem_of_a_wall.py
python temp/dem_of_a_dome.py
python temp/contacts.pyMake sure you installed the package with pip install -e . in the correct conda environment. The LMGC90 libraries are bundled during installation.
Install the required libstdc++:
conda install -c conda-forge libstdcxx-ng=14If 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 .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 .# 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# 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-nameNote: This requires the PR author to have enabled "Allow edits from maintainers" on their PR.