We present an efficient MATLAB-based implementation of the material point method (MPM) and its most recent variants. MPM has gained popularity over the last decade, especially for problems in solid mechanics in which large deformations are involved, such as cantilever beam problems, granular collapses and even large-scale snow avalanches. Although its numerical accuracy is lower than that of the widely accepted finite element method (FEM), MPM has proven useful for overcoming some of the limitations of FEM, such as excessive mesh distortions. We demonstrate that MATLAB is an efficient high-level language for MPM implementations that solve elasto-dynamic and elasto-plastic problems. We accelerate the MATLAB-based implementation of the MPM method by using the numerical techniques recently developed for FEM optimization in MATLAB. These techniques include vectorization, the use of native MATLAB functions and the maintenance of optimal RAM-to-cache communication, among others. We validate our in-house code with classical MPM benchmarks including (i) the elastic collapse of a column under its own weight; (ii) the elastic cantilever beam problem; and (iii) existing experimental and numerical results, i.e. granular collapses and slumping mechanics respectively. We report an improvement in performance by a factor of 28 for a vectorized code compared with a classical iterative version. The computational performance of the solver is at least 2.8 times greater than those of previously reported MPM implementations in Julia under a similar computational architecture.

The material point method (MPM), developed in the 1990s

The core idea of MPM is to discretize a continuum with material points carrying state variables (e.g. mass, stress and velocity). The latter are mapped (accumulated) to the nodes of a regular or irregular background finite element (FE) mesh, on which an Eulerian solution to the momentum balance equation is explicitly advanced forward in time. Nodal solutions are then mapped back to the material points, and the mesh can be discarded. The mapping from material points to nodes is ensured using the standard FE hat function that spans over an entire element

MATLAB© allows a rapid code prototyping, although it is at the expense of significantly lower computational performance than compiled language.
An efficient MATLAB implementation of FEM called MILAMIN (Million a Minute) was proposed by

More recently,

As MPM and FEM are similar in their structure, we aim to improve the performance of MATLAB up to the level reported by

In this contribution, we present an implementation of an efficiently vectorized explicit MPM solver, fMPMM-solver (v1.1 is available for download from Bitbucket at

The material point method (MPM), originally proposed by

A typical calculation cycle (see Fig.

a mapping phase, during which properties of the material point (mass, momentum or stress) are mapped to the nodes;

an updated Lagrangian FEM (UL-FEM) phase, during which the momentum equations are solved on the nodes of the background mesh, and the solution is explicitly advanced forward in time;

a convection phase, during which (i) the nodal solutions are interpolated back to the material points, and (ii) the properties of the material point are updated.

Typical calculation cycle of an MPM solver for a homogeneous velocity field, inspired by

Since the 1990s, several variants have been introduced to resolve a number of numerical issues. The generalized interpolation material point method (GIMPM) was first presented by

GIMPM is categorized as a domain-based material point method, unlike the later development of the B-spline material point method (BSMPM, e.g.

Nodal connectivities of the

We choose the explicit GIMPM variant with the modified update stress last scheme (MUSL; see

Additionally, we implemented a CPDI/CPDI2q version (in an explicit and quasi-static implicit formulation) of the solver. However, in this paper, we do not present the theoretical background of the CPDI variant nor the implicit implementation of an MPM-based solver. Therefore, interested readers are referred to the original contributions of

Domain-based material point method variants could be treated as two
distinct groups:

the material point's domain is a square for which the deformation is always aligned with the mesh axis, i.e. a non-deforming domain uGIMPM

the material point's domain is either a deforming parallelogram that has its dimensions specified by two vectors, i.e. CPDI

Not updating the domain is not suitable for simple stretching and hydrostatic compression or extension.

A domain update based on

The domain will vanish with increasing rotation when using

The domain volume will change under isochoric deformation when using

Regarding the recent CPDI/CPDI2q version,

Consequently, the domain-based method and the domain-updating method should be carefully chosen according to the deformation mode expected for a given case. The domain-updating method will be clearly mentioned for each case throughout the paper.

The large deformation framework in a linear elastic continuum requires an appropriate stress–strain formulation. One approach is based on the finite deformation framework, which relies on a linear relationship between elastic logarithmic strains and Kirchhoff stresses

Plastic deformation is modelled with a pressure-dependent Mohr–Coulomb law with non-associated plastic flow, i.e. both the dilatancy angle

The elastic state is defined when

A similar approach is used to return stresses when considering a non-associated Drucker–Prager plasticity (see

The solver procedure is shown in Fig.

Workflow of the explicit GIMPM solver and the calls to functions within a calculation cycle. The role of each function is described in the text.

After initialization, a while loop solves the elasto-dynamic (or elasto-plastic) problem until a time criterion

At the beginning of each cycle, a connectivity array

The following five functions are called successively during one calculation cycle:

The numerical simulations are conducted using MATLAB© R2018a within a Windows 7 64-bit environment on an Intel Core i7-4790 (fourth-generation CPU with four physical cores of base frequency at 3.60 GHz up to a maximum turbo frequency of 4.00 GHz) with

The GIMPM basis function

Similar to the FEM, the strain-displacement matrix

The algorithm outlined in Fig.

Coordinates of the material points

Given the piece-wise Eq. (

Code fragment 1 shows the vectorized solution to the calculation of the basis functions and their derivatives within

Another computationally expensive operation for MATLAB© is the mapping (or accumulation) of the material point contributions to their associated nodes. It is performed by the function

The standard calculations for the material point contributions to the lumped mass

Once the mapping phase is achieved, the equations of motion are explicitly solved forward in time on the mesh. Nodal accelerations

Code fragment 2 shows the vectorized solution to the nodal projection of material point quantities (e.g. mass and momentum) within the local function

The vectorized solution comes from the use of the built-in function

In the function

To calculate the temporary vector of internal forces (

To illustrate the numerical efficiency of the vectorized multiplication between a matrix and a vector, we have developed an iterative and vectorized solution of

Finally, we propose a vectorization of the function

The material point updated momentum is found by

To solve for the interpolation of updated nodal solutions to the material points, we rely on a combination of element-wise matrix multiplication between the array of basis functions

When accessing global nodal vectors by means of

This procedure is used for the velocity update (line 6 in Fig.

Code fragment 3 shows the vectorized solution for the interpolation of nodal solutions to material points with a double-mapping procedure (or MUSL) within the function

Regarding the initial setting of the background mesh of the demonstration cases presented in the following, we select a uniform mesh and a regular distribution of material points within the initially populated elements of the mesh. Each element is evenly filled with four material points, e.g.

In this contribution, Dirichlet boundary conditions are resolved directly on the background mesh, as in the standard finite element method. This implies that boundary conditions are resolved only in contiguous regions between the mesh and the material points. Deviating from this contiguity or having the mesh not aligned with the coordinate system requires specific treatments for boundary conditions

As explicit time integration is only conditionally stable, any explicit formulation requires a small time step

In this section, we first demonstrate our MATLAB-based MPM solver to be efficient at reproducing results from other studies, i.e. the compaction of an elastic column (

Regarding the performance analysis, we investigate the performance gain of the vectorized solver considering a double arithmetic precision with respect to the total number of material points for the following reasons: (i) the mesh resolution, i.e. the total number of elements

Following the convergence analysis proposed by

The initial geometry is shown in Fig.

Initial geometry of the column.

To consistently apply the external load for the explicit solver, we follow the recommendation of

The error between the analytical and numerical solutions is as follows:

The convergence toward a quasi-static solution is shown in Fig.

We finally report the wall-clock time for the cpGIMPM (iterative), cpGIMPM (vectorized) and the CPDI2q (vectorized) variants. As claimed by

The wall-clock time for cpGIMPM (vectorized and iterative solutions) and the CPDI2q solution with respect to the total number of material points

The cantilever beam problem

Initial geometry for the cantilever beam problem; the free end material point appears in red, and a red cross marks its centre.

The beam geometry is depicted in Fig.

Vertical deflection

As indicated in

The local minimal and the minimal and maximal values (in timing and magnitude) are in agreement with the FEM solution of

Figure

We also report quite a significant difference in execution time between the CPDI variant compared with the CPDI2q and cpGIMPM variants: CPDI executes in an average of 280.54 iteration per second, whereas both CPDI2q and cpGIMPM execute in an average of 301.42 iterations

Finite deformation of the material point domain and vertical Cauchy stress

We present an application of the MPM solver (vectorized and iterative version) to the case of landslide mechanics. We selected the domain-based CDPI variant as it performs better than the CPDI2q variant in modelling torsional and stretching deformation modes

Initial geometry for the slump problem from

The geometry of the problem is shown in Fig.

MPM solution to the elasto-plastic slump. The red lines indicate the numerical solution of

The numerical solution to the elasto-plastic problem is shown in Fig.

The vectorized and iterative solutions are resolved within approximately 630 s (a wall-clock time of

We evaluate the computational performance of the solver, using the MATLAB version R2018a on an Intel Core i7-4790, with a benchmark based on the elasto-plastic collapse of the aluminium-bar assemblage, for which numerical and experimental results were initially reported by

Initial geometry for the elasto-plastic collapse

We vary the number of elements of the background mesh, which results in a variety of different regular mesh spacings

We conducted preliminary investigations using either uGIMPM or cpGIMPM variants – the latter with a domain update based either on the determinant of the deformation gradient or on the diagonal components of the stretching part of the deformation gradient. We concluded that the uGIMPM was the most reliable, even though its suitability is restricted to both simple shear and pure rotation deformation modes

Final geometry of the collapse: in the intact region (horizontal displacement

We observe a good agreement between the numerical simulation and the experiments (see Fig.

The vectorized and iterative solutions (for a total of

The performance of the solver is demonstrated in Fig.

Number of floating point operations per second (flops) with respect to the total number of material points

These considerations provide a better understanding of the performance gain of the vectorized solver shown in Fig.

Number of iterations per second with respect to the total number of material points

We compare the computational efficiency of the vectorized CPDI2q MATLAB implementation and the computational efficiency reported by

Our CPDI2q implementation, in MATLAB R2018a, is at least 2.8 times faster than the Julia implementation proposed by

Efficiency comparison of the Julia implementation of

In this contribution, a fast and efficient explicit MPM solver is proposed that considers two variants (e.g. the uGIMPM/cpGIMPM and the CPDI/CPDI2q variants).

Regarding the compression of the elastic column, we report good agreement of the numerical solver with previous explicit MPM implementations, such as

For the cantilever beam, we report good agreement of the solver with the results of

The elasto-plastic slump also demonstrates the solver to be efficient at capturing complex dynamics in the field of geomechanics. The CDPI solution showed that the algorithm proposed by

Regarding the elasto-plastic collapse, the numerical results demonstrate the solver to be in agreement with both previous experimental and numerical results

The computational performance comes from the combined use of the connectivity array

An iterative implementation would require multiple nested for-loops and a larger number of operations on smaller matrices, which increase the number of BLAS calls, thereby inducing significant BLAS overheads and decreasing the overall performance of the solver. This is limited by a vectorized code structure. However, as shown by the matrix multiplication problem, the L2 cache reuse is the limiting factor, and it ultimately affects the peak performance of the solver due to these numerous RAM-to-cache communications for larger matrices. This problem is serious, and its influence is demonstrated by the delayed response in terms of performance for the function

The overall performance achieved by the solver is higher than expected, and it is even higher than what was reported by

We have demonstrated the capability of MATLAB as an efficient language with regard to a material point method (MPM) implementation in an explicit formulation when bottleneck operations (e.g. calculations of the shape function or material point contributions) are properly vectorized. The computational performance of MATLAB is even higher than the performance previously reported for a similar CPDI2q implementation in Julia, provided that built-in functions such as

The vectorization activities that we performed provide a fast and efficient MATLAB-based MPM solver. Such vectorized code could be transposed to a more efficient language, such as the C-CUDA language, which is known to efficiently take advantage of vectorized operations.

As a final word, a future implementation of a poro-elasto-plastic mechanical solver could be applied to complex geomechanical problems such as landslide dynamics while benefiting from a faster numerical implementation in C-CUDA, thereby resolving high three-dimensional resolutions in a decent and affordable amount a time.

Variables of the structure arrays for the mesh

The fMPMM-solver developed in this study
is licensed under the GPLv3 free software licence. The latest version of the code is available for download from Bitbucket at

EW wrote the original draft of the paper. EW and YP developed the first version the solver (fMPMM-solver, v1.0). YA provided technical support, assisted EW with the revision of the latest version of the solver (v1.1) and corrected specific parts of the solver. EW and YA wrote and revised the final version of the paper. MJ and YP supervised the early stages of the study and provided guidance. All authors reviewed and approved the final version of the paper.

The authors declare that they have no conflict of interest.

Yury Alkhimenkov gratefully acknowledges support from the Swiss National Science Foundation (grant no. 172691). Yury Alkhimenkov and Yury Y. Podladchikov gratefully acknowledge support from the Russian Ministry of Science and Higher Education (project no. 075-15-2019-1890). The authors gratefully thank Johan Gaume for his comments that contributed to improving the overall quality of the article.

This research has been supported by the Swiss National Science Foundation (grant no. 172691). This research has been supported by the Russian Ministry of Science and Higher Education (project no. 075-15-2019-1890).

This paper was edited by Alexander Robel and reviewed by two anonymous referees.