Granular Intrusion Continuum Modeling (Matlab 2018a)

Implementation of continuum modeling of granular intrusion scenarios using Material Point Method (MPM)
Updated 26 Jan 2021

View License

The code models various granular intrusion and granular flow scenarios using continuum modeling implemented using a Material Point Method (2D). The simulation categories and a few example details are provided below. The sequence of simulation is:
1) Enter the image name saved in the current directory (All elastic bodies in the red and granular domain in the blue; more details later)
2) Press the 'Import image' button
3) Define x-y limits of the system
4) Enter spatial discretization
5) Select simulation type
6) Enter material properties
7) Press the 'Discretize' button to discretize the system
8) Enter velocity and gravity values, if applicable
9) Enter friction coefficient between the bodies, total simulation time, time discretization, and plotting frequency for visualization/data.
10) Press the save data button and enter input save directory name (if desired)
11) Press the 'Start' button in the simulation section
12) Terminate the app to stop a simulation by using a combination of ctrl+c In the command window (Unfortunately, adding a stop button in this version of the app was not possible).

The app models 3 kinds of problems:
A) Granular Drag: Dragging an elastic body submerged in the granular medium at a fixed velocity eg.
a) Run sample_1 with Vx= 0.0, Vy=-1.0, dx=0.004, dt=2e-5
b) Run sample_2 with Vx= 0.1, Vy=0.0, dx=0.004, dt=2e-5

B) Granular Impact: Impacting an elastic body into a bed of granular media eg:
a) Run sample_3 with Vx = 1, Vy =-1, dx=0.002, dt=1e-5

C) Granular flow: Flow of granular media under gravity
a) Run sample_4, dx=0.004, dt=2e-5
b) Run sample_5, dx=0.004, dt=2e-5

** Please make sure to change the simulation category before running a simulation.

IMPORTING AN IMAGE: We use images (in .png format) for defining the system. Save the system image in the current working directory. We include five sample images with the app: sample_1, sample_2, sample_3, sample_4, and sample_5. Type their names in the 'select system image' field to access them. The numerical system sizes are entered manually by defining x-min value, y-min value, and x-max values. The app calculates the upper y-limit using the input image's aspect ratio. The discretization uses square elements (thus dx=dy). We use hat-shape functions in numerical implementation.

IMAGE COLOR CODE: We use two kinds of materials in these simulations:
Elastic bodies: Defined in red with RGB value [1,0,0]
Granular bodies: Defined in blue with RGB value [0,0,1].
The system edges are non-penetrative.

UNSTABLE SIMULATIONS: In the case of simulation blowing off, use smaller time steps. Make sure CFL condition (dt<(dx/wave-speed)) is met.

VISUALIZATION: The default plot frequency is set to 10. It can be updated from GUI
Note that default discretization is set to a low resolution (large Delta x) for speedy simulations/visualizations. Thus, bodies might seem to interact with each other at large distances. Decrease the size of Delta x for improving the results.

SAVING FRAMES: The simulation data frames can be saved as the .mat files. The app saves the data at the same frequency as the plot-frequency. Press the 'Save data' button, create a save-directory, and enter the save-directory name before starting the simulations for saving the data frames. The app expects the save-directory as a subdirectory of the current working directory. Each frame file contains a variable 'data' with dimensions of [Nx17], where N represents the 'Number of material points' in the system. The 17 variables are as follows:
[1, 2, 3, 4] : [position-x, position-y, velocity-x, velocity-y]
[6, 7, 8, 9] : stress[sigma_xx, sigma_xy, sigma_yy, sigma_zz]
[10, 11, 12] : [ gravity-x, gravity-y, density]
[13] : [body_identifier (elastic body=1, granular body =2)]
[14,15,16,17] : Strains [e_xx, e_yy, eq plastic strain rate, eq plastic strain]

MPM IMPLEMENTATION DETAILS: The technical details of the MPM implementation are provided in the pdf in the comment section.

FUTURE VERSIONS: We plan to upload a more user-friendly code in the future (faster code, more control over plotting, more data on contact material points, etc). Please post your comments in case of any trouble in using this code.

INSTALLATION: Use the 'Install App' button on the Matlab GUI to install this app.

Version 1.2/1.3 corresponds to the app version compatible with Matlab 2018a.
Earlier versions, 1.0/1.1 were compatible with Matlab 2020a

Please cite our work: 'Efficacy of simple continuum models for diverse granular intrusions, S Agarwal, A Karsai, DI Goldman, K Kamrin (2021)' in case you use this app in your research work.

Cite As

Efficacy of simple continuum models for diverse granular intrusions, S Agarwal, A Karsai, D I Goldman, K Kamrin (2021)

Modeling of the interaction of rigid wheels with dry granular media, Agarwal et al, Journal of Terramechanics (2019)

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Minor updates


Version Compatible with Matlab 2018a


Renaming the app