Overview
libgran is a C++ template library for Discrete Element Method (DEM) simulations. It targets static modularity - an approach where different modules involved in a simulation, like the integrator and the inter-particle force models, are assembled at compile time. These semantics are achieved through the extensive use of templates. The main advantage of static modularity is that the compiler has more information about the simulation that is going to be run, thus allowing it to optimize generated code more radically.
Libgran has several built-in force models, such as Van der Waals attraction and contact friction force and is designed to be easily extensible with custom models.
libgran architecture
Each libgran simulation is initialized and driven by a program that specializes and creates instances of libgran's templates. In particular, the driver program has to initialize three components:
Step handler
A typical simulation workflow involving these components is illustrated in the diagram below: