/MPM-Py

MPM-Py: A program for learning the Material Point Method using Python

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

MPM-Py

A Material Point Method implementation using Python: MPM-Py. This program uses objected-oriented programming paradigm to represent and modeling the elements and its interaction in the material point method context.

Installation

git clone https://github.com/fabricix/MPM-Py.git

Documentation

To create the documentation, install pdoc:

pip3 install pdoc3

And then run

pdoc --html -c latex_math=True modules/

To read the documentation, open the file /html/modules/index.html using a web browser.

Note that in Windows the module flag -m must be used to correctly use pdoc:

python -m pdoc --html -c latex_math=True modules/

Requirements

  • Python 3.7.4 or superior

  • Matplotlib 3.3.4 or superior

Running tests and examples

In the folders verification_problems and tests there are examples showing and testing the functionalities of the program.

Mesh test

All elements with particles

The file tests/mesh-test.py tests the mesh generations module by plotting the mesh and showing the number of elements, nodes and material points.

Run this example as:

python mesh-test.py

Alt text

Mesh with particles in some elements

In this case the particles are distributed in some elements.

Run this example as:

python mesh_elements_without_particles_test.py

Alt text

Interpolation function test

The file tests/interpolation_functions_test.py shows the interpolation functions and its derivates over an one 1D element.

In test_interpolation_functions function of the shape module, set shape_type="linear" for linear interpolation functions or shape_type="cpGIMP" for contiguous particle GIMP (generalized interpolation material point).

Run this example as:

python interpolation-functions-test.py

Linear interpolation functions:

Alt text

cpGIMP interpolation functions:

Alt text

Single mass vibration problem

In this verification problem a single mass vibration is analyzed numerically and then the numerical solution is compared with the analytical one.

Run this example as:

python mpm-single-mass-bar-vibration.py

Alt text

Parametric analysis over material density

python mpm-single-mass-bar-vibration_parametric_density.py

Alt text

Continuum bar vibration problem

In this verification problem a continuum bar vibration is analyzed numerically and then the numerical solution is compared with the analytical one.

Run this example as:

python mpm-continuum-bar-vibration.py

Alt text

Wave traveling in a pile

In this verification problem a wave traveling in a pile is analyzed numerically and then the numerical solution is compared with the analytical one.

Run this example as:

python mpm_wave_in_pile.py

Alt text

Parametric analysis over Young modulus

python mpm_wave_in_pile_parametric_young.py

Alt text

Local damping

The local damping is a nodal force proportional to the unbalanced nodal total force, acting in opposite nodal velocity direction.

The local damping must be setting up using the model_setup class. For example:

msetup = setup.model_setup()
msetup.damping_local_alpha=0.1

Parametric analysis over damping factor

python mpm-continuum-bar-vibration_damping.py

Alt text