Wheel optimization through differentiable MPM
The simulation is built with taichi MPMsolver from taichi_elements.
The project starts with a simple scenario by dropping a wheel with an initial angular velocity
To run the mpm simulation you can simply run python run_mpm.py
with an argument -o "path/to/output/folder"
. It will output .png
files for each dt
. It will run 500 frames for simulation, and store a .png
file for each frame in output directory.
To make a .gif of these files, you can run python make_gif.py -i "path/to/png/folder" -o "path/to/output.gif"
. You can use --fps
to control the frame rate.
Here are some examples of simulation running with two different initial angular velocity. We can observe that the higher inital angular velocity makes the wheel roll further. One of our tasks is to optimize
Figure 1.
Before using differential programming feature in Taichi, we implement another optimization approach, Gaussian Process (GP), to update gpu-a100
node in Lonestar6). The optimization can be summarized by the following steps:
- Run the first mpm simulation with an initial guess of
$\omega_0$ (In this case,$\omega_0$ is 20), and get the final position$x_{pos}$ of the wheel. - Use simulated data (
$\omega_0$ ,$x_{pos}$ ) as test data to update the predicted function in GP. - Use predicted function to find the new
$\omega_0$ that has highest probability at$x_{pos}=0.6$ . - Use new
$\omega_0$ to run mpm simulation and get results - Repeat step 2-4 until
$x_{pos}$ close to 0.6
To run GP, simply python run_mpm_opt -o "path/to/output/folder" --iter num_iter --guess initial_guess --target target_x_pos
The following figure is an example of Gaussian Process updating omega. The black curve is the predicted function from GP. The blue filled area shows the interval of 95% confidence. The red dots represent the simulation data (
Figure 2. Updating predicted function in Gaussian process
Figure 3.