Welcome to pycbg’s documentation!

This module helps configuring MPM simulations for CB-Geo MPM, using a simple python script to generate the required input files (see Preprocessing). The results of the simulation can also be imported in python using pycbg (see Postprocessing). This documentation should be used alongside CB-Geo MPM documentation.


Preprocessing a simulation for CB-Geo MPM consists in creating several input files:

  • a mesh file, where the positions of all nodes and their interconnections are described. Pycbg saves it under the name mesh.msh. Can be created using the Mesh class.

  • a particles file, where the initial positions of all material points are specified. Pycbg saves it under the name particles.txt. Can be created using the Particles class.

  • an entity sets file (if entity sets are defined), where all entity sets are defined using entities’ ids. An entity can be a node, a particle or a cell. Pycbg saves it under the name entity_sets.txt. Can be created using the EntitySets class.

Instantiating the Simulation class involves creating Mesh, Particles, Materials and EntitySets objects and should be enough to prepare a simulation.

Classes overview


Create and write to a file a mesh using gmsh.


Create and write to a file particles from a Mesh object.


Create and write to a file entity sets for nodes and particles.


Create materials for particle sets.


Includes all simulation ingredients in order to create an appropriate CB-Geo MPM .json input file with the write_input_file method, after attributes definition.


While CB-Geo MPM outputs results in a number of files being often generated at each save iteration, the ResultsReader is provided for a seamless processing of those data.


Load the result of a simulation.

Indices and tables