Tutorial 4: Rolling sphere¶
Introduction¶
This is the first dynamic tutorial in MPM3S. A rigid sphere rolls down a slope under gravity, and the distance it travels is compared against the analytical slip/stick solution for a range of friction coefficients.
The problem validates frictional contact and dynamic time integration together. As the sphere moves, the elements beneath it are refined to a fine mesh that travels with it, and a boundary track keeps only the part of the slope around the sphere active.
This tutorial has four sections:
Problem description¶
You will define the slope, the sphere, the dynamic stage, the solver and the output in the input file. All the inputs to the simulation are defined using the input_data.json file format.
To keep the slope aligned with the background grid, the slope is kept horizontal and gravity is tilted by \(45^\circ\) instead (see Figure 1). The sphere then rolls along \(+x\) under the in-plane component of gravity.

Figure adapted from 1.
Slope: A material domain \(12.8\) m long, \(1.6\) m wide and \(0.8\) m thick, made of \(0.8\) m base elements with \(2 \times 2 \times 2\) material points in each. The elements the sphere touches are refined to \(0.025\) m.
Boundary conditions: The two ends of the material domain (\(x = 0\) and \(x = 12.8\) m) and its base are fixed, and its two sides are rollers. The top surface is free.
Material: A very stiff Hencky elastic material domain: Young's modulus \(E = 10^9\) Pa, Poisson's ratio \(\nu = 0\) and density \(\rho = 1000\) kg/m\(^3\). It deforms negligibly, but modelling it with material points is what exercises the contact between a rigid body and a refined mesh - the point of the test.
Sphere: sphere.stl, a sphere of radius \(r = 1\) m made of 3120 triangles on a latitude-longitude grid, drawn centred on the origin. Its point is at the centre, with mass \(m = 5000\) kg and rotational inertia \(I = \tfrac{2}{5} m r^2 = 2000\) kg\(\cdot\)m\(^2\), a solid sphere. The sphere can move in \(x\) and \(z\) and rotate about \(y\); its other three degrees of freedom are fixed.
Friction: The friction coefficient \(\mu\) is the parameter you sweep. Try \(\mu \in \{0,\, 0.1,\, 0.2,\, 0.4,\, 1.0\}\) to cover both the slipping (\(\tan\theta_s > 3.5\mu\)) and sticking regimes.
Loading: A single dynamic stage lasting \(1\) s, with a time step of \(0.005\) s. Gravity is applied as a tilted vector
equivalent to a \(45^\circ\) slope under vertical gravity.
Solver: Newton-Raphson, implicit dynamic. The sphere's velocity, angular velocity and rotation evolve through time under gravity and contact.
The analytical solution to compare against is the distance the sphere has travelled along \(+x\) as a function of time:
with \(g = 9.81\) m/s\(^2\) and \(\theta_s = 45^\circ\).
Input setup¶
The input file is a single JSON object - a human-readable, editable text file. The complete file for this problem can be found here, and every key is described on the input_data.json file format page.
input_data_sphere.jsonDomain¶
- The background grid is a cube, sized automatically to hold the material domain: its \(12.8\) m length makes it a \(12.8\) m cube (domain).
"gravity"is the tilted vector from the Problem description: its two non-zero components are \(9.81/\sqrt{2} \approx 6.93672\) m/s\(^2\).
Material points¶
- A single \(0.8\) m layer over a \(12.8 \times 1.6\) m footprint, with the stiff elastic properties from the Problem description (material points).
- The refinement size used later, \(0.025\) m, is \(0.8/2^5\), so the base element size needs no rounding.
Rigid body¶
- The sphere is one system with one point, at its centre.
- The point's six boundary conditions, in the order \([u_x, u_y, u_z, \theta_x, \theta_y, \theta_z]\), leave it free to move in \(x\) and \(z\) and to rotate about \(y\).
sphere.stlis drawn centred on the origin, the same place as the point (STL files)."offset"then places the whole sphere with its centre above \(x = 1.5\) m, halfway across the material domain's width and \(1.8\) m up - resting on the material domain surface at \(0.8\) m.
"rigid bodies": [
{
"offset": [1.5, 0.8, 1.8],
"points": [
{ "position": [0.0, 0.0, 0.0], "mass": 5000.0, "rotational inertia": [2000.0, 2000.0, 2000.0],
"boundary conditions": ["free", "fixed", "free", "fixed", "free", "fixed"] }
],
"stl files": [
{ "name": "sphere", "stl": "sphere.stl", "mesh cache": "sphere_mesh.txt", "point": 1 }
]
}
],
Contact¶
- The friction coefficient between the sphere and the material domain, here \(\mu = 0.2\) (contact properties).
- This is below \(\tan(45^\circ)/3.5 \approx 0.286\), so the sphere slips as it rolls.
- Change it between runs to reproduce the friction sweep, and change the output directory names to match, so the runs do not overwrite each other.
Analysis¶
- A single dynamic stage: \(1\) s of motion in steps of \(0.005\) s (analysis stages).
- The Newmark parameters \(\beta = 0.5\) and \(\gamma = 1.0\) add numerical damping, which keeps the stiff contact stable.
"rigid body surface placement": "on"makes sure the sphere starts exactly on the material domain surface."rigid body surface"adaptivity refines the elements the sphere's surface passes through to \(0.025\) m at every step (adaptivity).- The material domain's ends and base are fixed and its sides are rollers (boundary conditions).
"boundary track"makes the \(x\) boundaries follow the sphere (boundary track):- a fixed plane at the back of the sphere deletes the material domain it leaves behind (
"remove": "yes"); - a fixed plane \(1\) m ahead of it keeps the material domain further ahead inactive until the sphere approaches;
- tracking is
"off"in \(y\) and \(z\).
- a fixed plane at the back of the sphere deletes the material domain it leaves behind (
"analysis": [
{
"type": "dynamic",
"dt": 0.005,
"final time": 1.0,
"beta": 0.5,
"gamma": 1.0,
"rigid bodies": "on",
"rigid body surface placement": "on",
"adaptivity": {
"type": "rigid body surface",
"element size": 0.025
},
"boundary conditions": { "min": ["fixed", "roller", "fixed"], "max": ["fixed", "roller", "free"] },
"boundary track": {
"min": { "type": ["fixed", "off", "off"], "distance": [0.0, 0.0, 0.0],
"advance": ["positive", "positive", "positive"], "remove": ["yes", "no", "no"] },
"max": { "type": ["fixed", "off", "off"], "distance": [1.0, 0.0, 0.0],
"advance": ["positive", "positive", "positive"], "remove": ["no", "no", "no"] }
}
}
],
Solver¶
- Newton-Raphson iterations to a tolerance of \(10^{-6}\) in each time step (solver).
- A step that has not converged after 20 iterations is retried with half the time step.
- The ghost stabilisation uses
"ghost factor": 10.0for the stiffness and"ghost factor mass": 0.25for the mass.
Deploying and running the problem¶
MPM3S is written in the Julia programming language. See the installation guide for installing Julia and MPM3S, and Tutorial 1 for a first, small run.
Working in the MPM3S folder
Julia runs in the MPM3S folder - the folder you downloaded - throughout this tutorial, and every path in the commands and scripts is relative to it. The input file is read from validation_data_and_jsons/input_data_sphere.json, and the output folders vtk_sphere_mu0.2 and csv_sphere_mu0.2 are written to, and read back from, the MPM3S folder.
terminalSetting up the problem¶
The input file for this tutorial comes with MPM3S, as validation_data_and_jsons/input_data_sphere.json, together with the sphere geometry, sphere.stl, and its mesh cache, sphere_mesh.txt; the input file is the same as the complete input file. The STL and mesh-cache paths in the input file are relative to the input file, so the files must stay in the same folder.
As in Tutorial 1, open a terminal, start Julia with every CPU thread available (-t auto), then move into the folder where you downloaded MPM3S, activate it, install its dependencies with Pkg.instantiate() and load MPM3S. The output folders are created in the MPM3S folder.
Running the problem¶
Julia is now running in the MPM3S folder and MPM3S loaded. The JSON file for this problem is loaded with MPM3S and is stored in the folder validation_data_and_jsons, the simulations are started with:
The analysis runs on a workstation CPU but takes a while; set "GPU": "on" if a GPU is available.
Reading the output¶
Before the first time step, MPM3S reports the rigid body surface placement: the lowest point of the sphere (body base) and the top of the material domain (material top) are both at \(0.8\) m, so the sphere is moved by only Δz = 1.87755e-7 m.
The progress line works as in Tutorial 1, except that in a dynamic stage t is the simulated time, out of the \(1\) s final time. The \(200\) time steps of Δt 0.005 s end at step 201, each converging in about 4 Newton-Raphson iterations (NR) with no steps cut or material points deleted. N is large, over \(100\,000\) nodes, because the mesh is refined to \(0.025\) m around the sphere.
$ julia -t auto
julia> cd("path/to/MPM3S")
julia> using Pkg; Pkg.activate(".")
Activating project at `path/to/MPM3S`
julia> Pkg.instantiate()
julia> using MPM3S
julia> MPM3S.non_linear_solve("validation_data_and_jsons/input_data_sphere.json");
[ Info: rigid body surface placement: body base 0.8 → material top 0.8 Δz = 1.87755e-7
stage 1/1 ████████████ 100.0% t 1.0/1.0 step 201 Δt 0.005 NR 4 cuts 0 del 0 N 109572
Viewing the results¶
Watching the sphere roll
The VTK files in path/to/MPM3S/vtk_sphere_mu0.2 can be opened in ParaView to watch the sphere roll, following the same steps as for the compression cube in Tutorial 2. Everything needed to check the result is in rigid_body.csv, used below.
Distance travelled¶
csv_sphere_mu0.2/rigid_body.csv has one row per time step. The distance travelled is $d_x = $ body1_position_x \(- 1.5\) m, to be plotted against the time column and compared with \(d_x(t)\) from the Problem description. When the sphere sticks, it rolls without slipping, so body1_angular velocity_y equals body1_velocity_x (the radius is \(1\) m); when it slips, the angular velocity lags behind.
The short Julia script below compares the distance travelled with the analytical solution. Run it from the MPM3S folder, either by copying it into the REPL or by saving it as distance.jl and running include("distance.jl"). It needs Plots, installed as described in Tutorial 1.
using DelimitedFiles, Plots
# one row per time step for the sphere's point, body1
data, header = readdlm("csv_sphere_mu0.2/rigid_body.csv", ',', Float64; header=true)
column(name) = data[:, findfirst(==(name), vec(header))]
t = column("time")
dx = column("body1_position_x") .- 1.5 # distance travelled (m)
# analytical solution: the sphere slips if tan θ > 3.5 μ, otherwise it rolls without slipping
g, θ, μ = 9.81, π/4, 0.2
slipping = tan(θ) > 3.5μ
a = slipping ? g * (sin(θ) - μ * cos(θ)) : 5/7 * g * sin(θ) # acceleration along x (m/s²)
dx_exact = a .* t.^2 ./ 2
println(slipping ? "slipping" : "sticking")
println("distance after 1 s: MPM3S ", round(dx[end], digits=3), " m, analytical ", round(dx_exact[end], digits=3), " m")
plot(t, dx_exact, label="analytical", xlabel="time (s)", ylabel="distance travelled (m)")
scatter!(t[1:5:end], dx[1:5:end], label="MPM3S", markersize=3)
For this run it prints:

The second script, run after the first, compares the speed of the sphere's centre, \(v_x\), with the speed of its surface, \(r\omega\). With \(\mu = 0.2\) the sphere slips, so \(r\omega\) grows more slowly than \(v_x\); with \(\mu \geq 0.286\) it rolls without slipping and the two lines lie on top of each other.
# run after distance.jl, which reads the data and sets t, g, θ, μ, a and slipping
vx = column("body1_velocity_x") # speed of the centre (m/s)
ω = column("body1_angular velocity_y") # spin (rad/s)
r = 1.0 # sphere radius (m)
# analytical: the centre speeds up at a; while slipping, friction spins the sphere up at 5μg cos θ / 2r
v_exact = a .* t
rω_exact = slipping ? 2.5 * μ * g * cos(θ) .* t : v_exact
plot(t, v_exact, label="v_x analytical", xlabel="time (s)", ylabel="speed (m/s)")
plot!(t, rω_exact, label="r ω analytical")
scatter!(t[1:5:end], vx[1:5:end], label="v_x MPM3S", markersize=3)
scatter!(t[1:5:end], r .* ω[1:5:end], label="r ω MPM3S", markersize=3)

-
Robert E. Bird, William M. Coombs, Charles E. Augarde, Giuliano Pretti, and Ted J. O'Hare. An implicit octree-based adaptive material point method. 2026. URL: https://arxiv.org/abs/2606.09275, arXiv:2606.09275. ↩