2D Soil Collapse Test
Note
We use a classic example: 2D & 3D granular collapse[1], to demonstrate how to establish computational models and solve them.
To successfully run the code, we will install the dependencies at the beginning of the code provided below. If you are already familiar with the Julia Pkg ENV and have installed the necessary packages, you can ignore this part.
We default to using Nvidia's GPU or x86/ARM CPUs. If you want to use other acceleration backends, please make modifications in the appropriate places in the code.
We use Unicode to enhance readability (when comparing formulas), but sometimes it may be confused with regular letters, such as
and v
. If you are using VSCode, you can enable the following in the settings:
"editor.unicodeHighlight.ambiguousCharacters": true,
- You can copy and save it in the
your_file.jl
and run the file directly using Julia inREPL
:
julia> include("path/to/your_file.jl")
Or run this file in the terminal:
bash> julia path/to/your_file.jl
Here is the complete 2D code
using Pkg
Pkg.add(["MaterialPointSolver", "MaterialPointGenerator", "CairoMakie", "CUDA"])
using MaterialPointSolver
using MaterialPointGenerator
using CairoMakie
using CUDA
2D model description

In this example, aluminum bars are used to model the non-cohesive soil collapse. We use uGIMP to simulate the failure process of soil collapse. The geometry of the numerical model is depicted in the figure, with a length
Parameter | Value | Unit | Description |
---|---|---|---|
density | |||
- | Poisson's ratio | ||
bulk modulus | |||
second | simulation time | ||
degree | friction angle | ||
- | FLIP-PIC mixing factor |
2D code explaination
Bui, H.H., Fukagawa, R., Sako, K., Ohno, S., 2008. Lagrangian meshfree particles method (SPH) for large deformation and failure flows of geomaterial using elastic–plastic soil constitutive model. Int. J. Numer. Anal. Methods Geomech. 32, 1537–1570. https://doi.org/10.1002/nag.688 ↩︎