SofaPython3
SofaPython3 copied to clipboard
Example of a ForceField implemented with JAX
Illustrates how to leverage JAX autodiff to implement the methods 'addDForce()' and 'addKToMatrix()' automatically. This example shows a set of particles attached to the origin with a simple spring.
I included a few options for the scene, that might be unnecessary:
- time integration and linear solver, to illustrate that not all combinations require all methods to be implemented
- number of particles, to show how computational cost and memory requirement scale (important here since the jacobian computed by JAX is dense)
- SOFA built-in alternative for comparison