IPC Integrator¶
- class warp_ipc.ipc_integrator.IPCIntegrator(device: str = 'cuda:0', raise_error: bool = False)¶
Bases:
Integrator
The ABD-IPC integrator.
- device¶
The Warp CUDA device used for kernel launches in the IPC integrator. Defaults to “cuda:0”.
- Type:
str
- use_cpu¶
If True, use a direct CPU-based linear solver (Cholesky via scikit-sparse). Falls back to Conjugate Gradient if the solver fails or multiple environments are used. Defaults to False.
- Type:
bool
- tol¶
Convergence tolerance for the Newton solver, measured in m/s. Defaults to 1e-2.
- Type:
float
- max_newton_iter¶
Maximum number of iterations allowed for the Newton solver. The solver will terminate immediately if this limit is reached, even if convergence has not been achieved. Defaults to 500.
- Type:
int
- max_cg_iter¶
Maximum number of iterations for the Conjugate Gradient (CG) solver. Defaults to 1000.
- Type:
int
- cg_rel_tol¶
Relative tolerance for convergence in the CG solver. The solver terminates when the residual norm falls below this threshold relative to the initial residual. Defaults to 1e-5.
- Type:
float
- soft_shell_membrane_type¶
Membrane model used for shell elements. Options: BARAFF_WITKIN, ARAP. Defaults to BARAFF_WITKIN.
- Type:
warp_ipc.utils.constants.MembraneType
- soft_vol_material_type¶
Constitutive model for soft volumetric materials. Options: NEO_HOOKEAN, STVK. Defaults to NEO_HOOKEAN.
- Type:
warp_ipc.utils.constants.VolMaterialType
- affine_material_type¶
Material model for affine bodies (e.g., rigid links). Options: RIGIDITY, NEO_HOOKEAN. Defaults to RIGIDITY.
- Type:
warp_ipc.utils.constants.AffineMaterialType
- use_inversion_free_step_size_filter¶
If enabled, an additional filter is applied during the line search of the Newton iteration to clamp the global search step size and prevent volume inversion of soft bodies. Defaults to False.
- Type:
bool
- use_hard_kinematic_constraint¶
Whether to enforce hard kinematic constraints during the Newton iteration. When enabled, the kinematic satisfaction condition is incorporated into the Newton convergence criterion. If the constraint is not satisfied, the system adaptively updates the kinematic stiffness to enforce constraint compliance. Defaults to False.
- Type:
bool
- tiny_alpha_as_invalid¶
Mark environments as invalid if the Newton step size (alpha) becomes too small. Defaults to False.
- Type:
bool
- maximum_newton_as_invalid¶
Mark environments as invalid if Newton iterations exceed max_newton_iter. Defaults to False.
- Type:
bool
- inversion_free_im_tol¶
Imaginary tolerance threshold when filtering complex roots. Roots with imaginary parts smaller than this are considered real. Defaults to 1e-5.
- Type:
float
- inversion_free_cubic_coef_tol¶
Coefficient tolerance for detecting degenerate cubic equations. Used to switch from cubic to quadratic root solving when a is near zero. Defaults to 1e-10.
- Type:
float
- total_iter¶
Total number of Newton iterations accumulated across all steps.
- Type:
int
- max_iter¶
Maximum number of Newton iterations observed in a single step.
- Type:
int
- profile_helper¶
Records detailed profiling statistics per timestep and Newton iteration. Includes timing for DCD, CCD, gradient, Hessian, linear solver, and energy. Provides access to full profiling logs via
full_json
.
- class ProfileStatistics¶
Bases:
object
- property current_newton_iter_data¶
- property current_timestep_data¶
- property full_json¶
- new_newton_iter()¶
- new_timestep()¶
- record_iter_timer(timer: Profiler)¶
- record_timestep_timer(timer: Profiler)¶
- advance_func(model: ASRModel, dt: float = 0.01, control: Control | None = None, enable_debug_check: bool = False) Tuple[int, array, array] ¶
- diff_test(model: ASRModel, dt: float, x, y, cdw, cdw_n, direction_x: array, sys_dir: array, sm_damping: BsrMatrix | None, energy_name: str, eps: float = 1e-07)¶
- property last_step_time: float¶
Wall-clock time (in seconds) spent in the previous simulation step.
- simulate(model: ASRModel, dt: float, control: Control | None = None)¶
Run a single IPC simulation step on the given ASR model.
- Parameters:
model (ASRModel) – The simulation model to be updated.
model.finalize()
must be called beforehand.dt (float) – The timestep for the simulation in seconds.
control (Control) – The control input. Defaults to None which means the control values from the
Model
are used.
- Returns:
The number of solver Newton iterations in this step.