/LPM-CPP

A C++ implementation of lattice particle method

Primary LanguageFortranMIT LicenseMIT

LPM-CPP

A multi-threaded implementation of a nonlocal lattice particle method (LPM) using an iterative solution procedure. The default force unit is N, displacement unit is mm, pressure unit is MPa. Below shows the image of slip system activation in a SENT sample [1].

Slip

Prerequisites

  • Linux operating system (also work in Windows or other systems, but require other Integrated Development Environment like Visual Studio)
  • Editor (such as VS Code)
  • CMake version 3.25+

Building instructions

Intel MKL environment

  1. go to the Intel oneAPI website (https://www.intel.com/content/www/us/en/developer/tools/oneapi/overview.html) download and install the base and hpc toolkits (install 2021.4+ version of oneAPI to have a proper support for CMake)
  2. source /opt/intel/oneapi/setvars.sh linux64 --force (directory may change if customize the oneAPI installation)
  3. install Ninja: sudo apt-get install ninja-build
  4. install openmp: sudo apt-get install libomp-dev
  5. install boost: sudo apt install libboost-all-dev
  6. note: please add the MKL include path into your editor preference (like VS Code)

Compile and run LPM-CPP

  1. git pull https://github.com/longfish/LPM-CPP.git under LPM-CPP folder if need an updated version of the code
  2. source /opt/intel/oneapi/setvars.sh linux64
  3. git clone https://github.com/longfish/LPM-CPP.git # clone the project source files into your own machine
  4. mkdir build
  5. cd build
  6. cmake .. -G "Ninja" -DMKL_INTERFACE=ilp64 -DCMAKE_BUILD_TYPE=Release # change from Release to Debug for debugging (e.g., valgrind)
  7. cmake --build . -j 8

Run the code

./lpmcpp

The results will be in the build folder.

Examples

There are some example files in the ./examples folder that contains additional numerical cases such as those in [1, 2]. They define the run() functions of the project. Please change/add the example file and also include them into src/lmpcpp.cpp to run the code. Please note that other code pieces, such as assembly.h, lpm.h, etc. may also need to be changed.

Loading/Geometry

To ease some common geometries that often see in numerical simulations, customized loading and geometry codes are provided. The loading folder contains Jupyter code, while geometry folder contains cpp code.

References

  1. Meng C, Wei H, Chen H, et al. Modeling plasticity of cubic crystals using a nonlocal lattice particle method[J]. Computer Methods in Applied Mechanics and Engineering, 2021, 385: 114069.
  2. Meng C, Liu Y. Damage-augmented nonlocal lattice particle method for fracture simulation of solids[J]. International Journal of Solids and Structures, 2022, 243: 111561.

Appendix

  1. Valgrind command: valgrind --leak-check=yes --show-leak-kinds=all --log-file=valgrind.rpt ./lpmcpp