Skip to content

novaphy.solvers.SolverIPC

Newton-aligned SolverBase adapter over libuipc for mathematically guaranteed penetration-free Incremental Potential Contact. Requires CUDA ≥ 12.4 and a build with NOVAPHY_WITH_IPC=ON.

When IPC is not built, both SolverIPC and IPCConfig resolve to None; always feature-check before constructing:

if novaphy.has_ipc() and novaphy.solvers.SolverIPC is not None:
    solver = novaphy.solvers.SolverIPC(model, novaphy.solvers.IPCConfig())

How It Works

  1. Shape conversion — NovaPhy shapes are converted to tetrahedral meshes consumed by libuipc.
  2. GPU Newton solver — libuipc solves the barrier-based contact problem on GPU.
  3. Barrier contact — a log-barrier potential guarantees no interpenetration at the cost of a fixed dt matching IPCConfig.dt.

The solver advances state through the standard solver.step contract; dt and gravity are validated against the libuipc scene built at construction time, and mismatches raise.

Constructor

novaphy.solvers.SolverIPC(model: Model, config: IPCConfig)
Parameter Description
model Required. Model from ModelBuilder.finalize().
config IPCConfig (dt, gravity, barrier distance, friction).

Build with IPC

git submodule update --init --recursive
CMAKE_ARGS="--preset=ipc" pip install -e .

See Build from Source for the compiler matrix (GCC 11–13, Clang 19+, MSVC 2019+, CUDA 12.4).

Example

import novaphy

if novaphy.has_ipc():
    config = novaphy.solvers.IPCConfig()
    config.dt = 1.0 / 60.0

    solver   = novaphy.solvers.SolverIPC(model, config)
    state    = model.state()
    control  = model.control()

    for _ in range(steps):
        solver.step(state, state, control, None, config.dt)

When To Use

Scenario Recommendation
Guaranteed no-penetration (precise machinery, jamming, tight clearances) Use IPC.
Real-time large scenes on commodity GPUs Often SolverSemiImplicit is faster; profile first.
Deformable bodies (planned) IPC is the future home; today only rigid.

Limitations

  • Fixed dt requirement: changing dt between steps requires reconstructing the solver.
  • CUDA-only: no CPU fallback.
  • The deprecated top-level novaphy.IPCWorld backend container remains importable behind a DeprecationWarning; new code should use SolverIPC.

Demos

Demo What it shows
python/demos/demo_ipc_stack.py Box stacking with guaranteed no-penetration.

See Also