Genesis
Genesis copied to clipboard
[FEATURE] Add implicit fem with newton + conjugate gradient
trafficstars
Description
Added an implicit Euler integration method with Newton + Conjugate Gradient Solver. Also added a test for this solver.
Related Issue
Resolves Genesis-Embodied-AI/Genesis#1182
Motivation and Context
Implicit solver can offer a more robust and stable simulation with a larger time step.
How Has This Been / Can This Be Tested?
I tested on my MacBook. The implicit method can use real dt = 1e-2 to simulate while explicit method needs real dt=1e-4 (dt = 1e-3, substeps=10) to run.
import genesis as gs
import time
gs.init(backend=gs.cpu, precision="32", logging_level="debug")
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=0.01,
substeps=1,
),
fem_options=gs.options.FEMOptions(
use_explicit_solver=True,
n_newton_iterations=3,
n_pcg_iterations=50,
pcg_threshold=1e-4,
),
show_viewer=True,
)
scene.add_entity(
material=gs.materials.FEM.Elastic(),
morph=gs.morphs.Mesh(
file="./cube8.obj",
scale=0.1,
pos=(0, 0, 0.5),
),
)
scene.build()
for i in range(500):
scene.step()
cube8.zip @YilingQiao