SofaPython3 icon indicating copy to clipboard operation
SofaPython3 copied to clipboard

Example of a ForceField implemented with JAX

Open leobois67 opened this issue 2 months ago • 10 comments

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

leobois67 avatar Nov 07 '25 15:11 leobois67