Stable Neo-Hookean is a hyperelastic energy that remain stable under large deformations. This is the FEM implementation with Stable Neo-Hookean energy in libigl.
Demo video here.
phi_linear_tetrahedron.cpp
In order to enable the physics simulation, all deformation laws have to be discretized. Tetrahedral meshes are common discrete volumetric geometry representations. All the quantity inside the volume can be represent use a shape function
The general coordinates are formed as a stack vector
T_linear_tetrahedron.cpp
mass_matrix_mesh.cpp
mass_matrix_lnear_tetrahedron.cpp
For a Tetrahedron, we need to consider the kinetic energy of every infitesmial piece of mass inside the tetrahedron
$$
T = \frac{1}{2}\dot{q}^TM\dot{q}
$$
where the
dphi_linear_tetrahedron_dX.cpp
To determine forces due to deformation, we need to know how the nearby points have moved relative to one another. This information is captured by the Deformation Gradient
psi_neo_hookean.cpp
The hyperrelastic energy density
$$
\psi_{\text{Stable}}(F) = \frac{\mu}{2}(I_C - 3) + \frac{\lambda}{2}(J - 1 - \frac{\mu}{\lambda})^2
$$
where
I also test the Neo-Hookean energy from Bower 2009 $$ \psi_{\text{Neo}}(F) = \frac{\mu}{2}(J^{-\frac{2}{3}}I_C - 3) + \frac{\lambda}{2}(J - 1)^2 $$
V_linear_tetrahedron.cpp
dV_linear_tetrahedron_dq.cpp
dV_spring_particle_dq.cpp
d2V_linear_tetrahedron_dq2.cpp
dpsi_neo_hookean_dF.cpp
d2psi_neo_hookean_dF2.cpp
Per-element generalized force $$ \text{f} = -\frac{\partial V}{\partial q} $$ Per-element stiffness $$ \text{K} = -\frac{\partial^2 V}{\partial q^2} $$ To assemble the global forces vector and global stiffness matrix:
assemble_forces.cpp
assemble_stiffness.cpp
newtons_method.h
implicit_euler.h
I test the Newton-type Implicit Integration scheme and Linea Search with both LDLT(fast) and Conjugate Gradient solvers(slow). LDLT can perform much faster and perform the real-time simulation.
build_skinning_matrix.cpp
Directly run FEM on the high resolution mesh can be slow. To get the real-time simulation, I use the Skinning to mapping the motion from low resolution armadillo tetrahedron mesh to the high resolution armadillo triangle mesh.
sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libx11-dev
sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libxi-dev
sudo apt-get install libxmu-dev
sudo apt-get install libblas-dev
sudo apt install libxinerama-dev libxcursor-dev
Mac & Ubuntu
Build:
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
Then you can start to drag the armadillo with following command:
Run with Stable Neo-Hookean
./stable_neohooken stable
Run without Stable Neo-Hookean
./stable_neohooken nonstable
Notice that different mouse/touchpad setting can effects the mouse force acting on the armadillo. For Ubuntu 20.04, it seems the touchpad can act larger force than mouse on the same machine, so I make the demo using the touchpad.
The framework of this project is based on assignment from Prof. David I.W. Levin.