  This new approach allows the user to experiment with model choices easily and
quickly without requiring in-depth expertise, as constitutive models can be
modified by one line of code only. This ease in building new models makes
SOniCS ideal to develop surrogate, reduced order models and to train machine
learning algorithms for uncertainty quantification or to enable
patient-specific simulations. SOniCS is thus not only a tool that facilitates
the development of surgical training simulations but also, and perhaps more
importantly, paves the way to increase the intuition of users or otherwise
non-intuitive behaviors of (bio)mechanical systems. The plugin uses new
developments of the FEniCSx project enabling automatic generation with FFCx of
finite element tensors such as the local residual vector and Jacobian matrix.
We validate our approach with numerical simulations such as manufactured
solutions, cantilever beams, and benchmarks provided by FEBio. We reach machine
precision accuracy and demonstrate the use of the plugin for a real-time haptic
simulation involving a surgical tool controlled by the user in contact with a
hyperelastic liver. We include complete examples showing the use of our plugin
for simulations involving Saint Venant-Kirchhoff, Neo-Hookean, Mooney-Rivlin,
and Holzapfel Ogden anisotropic models as supplementary material.
