IPC
Incremental Potential Contact (IPC) is for robust and accurate time stepping of nonlinear elastodynamics. IPC guarantees intersection- and inversion-free trajectories regardless of materials, time-step sizes, velocities, or deformation severity.
Install / Use
/learn @ipc-sim/IPCREADME
IPC
This is the opensource reference implementation of the SIGGRAPH 2020 paper Incremental Potential Contact: Intersection- and Inversion-free Large Deformation Dynamics.
Files
-
src/: source code -
cmake/andCMakeLists.txt: CMake files -
Format/: automatic code formatting (requiresclang-format) -
input/: input data and scripts needed to rerun all examples in our paper, together with some tutorial examples -
output/: output data (will be created) -
tests/: unit-tests -
tools/: Python and Bash scripts for generating and processing results -
wiki/: images used in Github wiki page -
build.py: a python script to automatically build IPC with default compiler -
batch.py: a python script to automatically run a batch of examples (ininput/n/by default) withnthreads for each linear solver in the program -
batch_tetgen.py: a python script to automatically tetrahedralize a batch of closed surface meshes using Tetgen
Build
You can either use python build.py or
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
gcc 7 or later is recommended.
Dependencies
- libigl, OSQP, TBB, spdlog, MshIO, Gulrak's Filesystem, and CLI11: downloaded and built through CMake
- CCD-Wrapper: downloaded and built through CMake
- Includes Etienne Vouga's CTCD and Tight-Inclusion CCD methods
Optional Dependencies
- SuiteSparse: must be
installed at a system level
- Specifically IPC requires CHOLMOD, AMD, CAMD, CCOLAMD, and COLAMD which are all part of SuiteSparse and METIS which is sometimes a separate library
- Enabled by default, and it can be disabled using the CMake argument
-DIPC_WITH_CHOLMOD=OFF - Use of the CHOLMOD linear system solver is highly recommended as it is significantly faster than the alternative solvers provided (Eigen and AMGCL).
- macOS:
brew install suite-sparse- Alternatively, you can build SuiteSparse and then copy all files under
SuiteSparse/includeandSuiteSparse/libto/usr/local/includeand/usr/local/librespectively.
- Alternatively, you can build SuiteSparse and then copy all files under
- Ubuntu:
sudo apt-get install libsuitesparse-dev libmetis-dev- For program efficiency, we strongly recommend compiling SuiteSparse using Intel MKL LAPACK and BLAS (on an Intel machine):
make library BLAS='-lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -lmkl_blas95_lp64 -liomp5' LAPACK='-lmkl_lapack95_lp64' -j 8
- For program efficiency, we strongly recommend compiling SuiteSparse using Intel MKL LAPACK and BLAS (on an Intel machine):
- IPC also supports using Eigen or AMGCL as linear solver, which can be set via
IPC_LINSYSSOLVERinCMakeLists.txt. To use custom linear solvers, you can implement a new interface (subclass) to ourLinSysSolverclass.
- AMGCL: downloaded and built through CMake
- Enabled by default, and it can be disabled using the CMake argument
-DIPC_WITH_AMGCL=OFF
- Enabled by default, and it can be disabled using the CMake argument
- Catch2: downloaded and built through CMake
- Used for unit-tests.
- Enabled by default iff IPC is being built as the top-level project.
Without OpenGL
If your system does not have the required OpenGL libraries, you can disable the viewer using the CMake argument -DIPC_WITH_OPENGL=OFF. It is important to then run IPC in offline mode (see below).
2D?
IPC is only implemented for 3D simulation.
HPC
If your system uses Slurm like our cluster does, then you can take advantage of our scripts to build IPC as a batch job.
From the IPC root directory use sbatch build.sh to compile IPC via a
batch job. You can check the status of the job using
squeue -u $USER -n IPC_build.
It is important to not build on the login node because while it supports AVX2,
the compute nodes may not. Building on the login node will enable AVX2
support which may cause an Illegal instruction error when run on a compute
node. Alternatively, this can be fixed by using Intel's compilers, icc and icpc, with the
flag -axCORE-AVX2. This enables executables to run on compute nodes with or
without AVX2 instructions. If the compute nodes support AVX2 instructions,
executables will run AVX2 instructions, otherwise it will use other available
instructions such as AVX or SSE4.2.
Sub-Projects
IPC contains two optional sub-projects for unit tests, debug, and file processing. To enable them use the CMake
flag -DIPC_BUILD_<sub-project-name>_PROJECT=On where sub-project-name is the name
of the sub-project (e.g. DIAGNOSTIC or MESH_PROCESSING). You can also set these interactively using ccmake.
Run
Please see our quick start guide for a hello world example with various settings. The output of each script will be saved into a separate folder in output/.
Offline Mode
It is possible to run IPC with and without the viewer. By default, the batch.py script runs IPC with the viewer. If you provide the argument --offline to batch.py then it will run IPC in offline mode (i.e. without the viewer).
If you are running the IPC_bin executable directly then the first argument controls the mode. Mode 10 runs IPC with the viewer and is the default in the batch.py. Mode 100 runs IPC in offline mode (without the viewer). See IPC_bin --help for more detail.
HPC
From the IPC root directory use sbatch run.sh to processes all the input
files in input/12/ using 12 CPU cores.
This will process all input scenes in series. I am currently, working on a script to process all scenes in parallel via separate batch jobs.
Sub-Projects
The executables for the sub-projects are placed in their respective directory
in src/Projects/.
Output Files
<n>.obj: surface mesh of the simulated objects and volumetric/surface kinematic collision objects in n-th time stepn.seg: mesh file of the segment kinematic collision objects if any in n-th time steppt<n>.obj: vertex coordinates of the point cloud kinematic collision objects if any in n-th time stepstatus<n>: saved information of n-th time step that can be used to restart simulation fromACO<m>_<n>.obj: mesh file of m-th analytical plane if any in n-th (and the following if unchanged) time stepsBC_<n>.txt: node index of Dirichlet nodes if any in n-th (and the following if unchanged) time steps0.png: snapshot of initial time stepfinalResult.png: snapshot of last time stepfinalResult_mesh.msh: rest shape of simulated objectanim.gif: animation preview of the simulationconfig.txt: the config file containing all simulation settings that can be used to rerun the simulationiterStats.txt: simulation/optimization statistics of each iterationinfo.txt: timing informationlog.txt: debug informationsysE.txt: total energy (kinematic, gravity, and elasticity) of each simulated objectsysL.txt: linear momentum of each simulated objectsysM.txt: angular momentum of each simulated object
Script Settings
See our quick start guide for detailed examples of minimal settings needed for a simulation.
energy {FCR | NH}NH: Neo-Hookean elasticity energy (default)FCR: Fixed Co-rotational elasticity energy
timeIntegration {BE | NM} <β> <γ>BE: Backward Euler (default)NM: Newmark (optional: add β and γ to change from default of 0.25 and 0.5)
dampingStiff <dampingStiff>- add lagged Rayleigh damping with stiffness
dampingStiffor not ifdampingStiffis zero or not specified dampingStiffmust be greater than or equal to zero
- add lagged Rayleigh damping with stiffness
dampingRatio <dampingRatio>- set
dampingStiffto be0.75 * dampingRatio * h^3or0ifdampingRatiois zero or not specified dampingRatiomust be greater than or equal to zero
- set
time <num-seconds> <time-step>- total time in seconds, 5 by default
- time-step, h, in seconds, 0.025 by default
density <density>- density of the mesh in Kg/m³, 1000 by default
stiffness <young-modulus> <poisson-ratio>- Young's modulus (E) in Pa, 1e5 by default
- Poisson's ratio (ν), 0.4 by default
turnOffGravity- no gravity if specified
shapes input <num-of-shapes>- number of input shapes followed by that number of lines specifying the shape paths and initial configuration in model coordinates:
<mesh-file-path> <x> <y> <z> <rot-deg-x> <rot-deg-y> <rot-deg-z> <scale-x> <scale-y> <scale-z> <extra-command> ...<extra-command>: assigning different materials, initial velocities, boundary conditions, or scripted motions for each shape individually if anymaterial <density> <young-modulus> <poisson-ratio>initVel <lvx> <lvy> <lvz> <avx> <avy> <avz>- `DBC <left-bottom-back-x> <left-bottom-back-y> <left-bottom-back-z> <right-top-front-x> <right-top-front-y> <right-top-front-z>
Related Skills
node-connect
337.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.3kCommit, push, and open a PR
