Back

TriangularFEMForceField

sofa::component::solidmechanics::fem::elastic::TriangularFEMForceField
BaseLinearElasticityFEMForceField
Doc (from source)

Corotational Triangular finite elements for dynamic topology. corotational triangle from @InProceedings{NPF05, author = "Nesme, Matthieu and Payan, Yohan and Faure, Fran\c{c}ois", title = "Efficient, Physically Plausible Finite Elements", booktitle = "Eurographics (short papers)", month = "august", year = "2005", editor = "J. Dingliana and F. Ganovelli", keywords = "animation, physical model, elasticity, finite elements", url = "http://www-evasion.imag.fr/Publications/2005/NPF05" }

Abstract (AI generated)

The `TriangularFEMForceField` simulates corotational triangular finite elements for dynamic topology scenarios, handling both small and large deformations, internal forces, stiffness matrices, and stress visualization.

Metadata
module
Sofa.Component.SolidMechanics.FEM.Elastic
namespace
sofa::component::solidmechanics::fem::elastic
include
sofa/component/solidmechanics/fem/elastic/TriangularFEMForceField.h
inherits
  • BaseLinearElasticityFEMForceField
templates
  • sofa::defaulttype::Vec3Types
description

The TriangularFEMForceField component in the SOFA framework is designed to handle corotational triangular finite elements for simulating soft tissue mechanics. This component implements both small and large displacement formulations, allowing it to be used in a variety of dynamic topology scenarios. Below is a detailed mathematical and physical description of its key aspects.

Governing Equations and Operators

The TriangularFEMForceField contributes to the following governing equations or operators:
- Internal Force: Computes internal elastic forces acting on each triangular element using Hooke's law.
- Stiffness Matrix: Constructs the stiffness matrix for triangular elements, representing material properties and geometric relationships.
- Residual Calculation: Evaluates the nonlinear residual within the Newton-Raphson iteration framework to solve the system of equations.

Constitutive or Kinematic Laws Involved

  1. Material Stiffness:
  2. The constitutive law for elastic materials is represented by a material stiffness matrix $ D $, which relates stress to strain.

  3. Strain-Displacement Matrix:

  4. A strain-displacement matrix $ J $ maps nodal displacements to strains within the triangular elements.

  5. Corotational Framework:

  6. The corotational framework involves rotation matrices ($ R $) that transform between local and global frames, ensuring that rotations do not contribute to stretching or compression of the element.

Role in FEM Pipeline

  • Assembly Phase: Assembles the stiffness matrix and internal forces for triangular elements.
  • The stiffness matrix is assembled by computing individual element contributions from $ K = J D J^T $.
  • Internal forces are computed using the strain-displacement relationship and material properties.
  • Time Integration: Implements implicit time integration schemes (e.g., Backward Euler) to update nodal positions and velocities over discrete timesteps.
  • Nonlinear Resolution: Uses Newton-Raphson iterations to solve nonlinear equations resulting from large deformations.

Numerical Methods or Discretization Choices

  1. Small Deformation Formulation:
  2. For small deformations, the strain-displacement matrix $ J $ is computed using linearized approximations and nodal displacements directly without rotation correction.

  3. Large Deformation (Corotational) Formulation:

  4. Rotates the initial configuration of each triangle into a local frame where rotations are accounted for separately from deformations.
  5. The displacement $ D $ is computed in this rotated frame, and strains are derived accordingly.

  6. Rotation Matrices:

  7. Rotation matrices $ R_{02} $ and $ R_{20} $ ensure that rotations are handled correctly during strain calculation and force application.

Integration with Lagrangian Mechanics Framework

The TriangularFEMForceField component fits into the broader variational/Lagrangian mechanics framework by:
- Formulating the elastic potential energy of each triangular element.
- Using the principle of virtual work to derive internal forces and stiffness contributions.
- Implementing implicit time integration schemes that respect physical consistency, numerical stability, and extensibility.

Mathematical Formulation

Small Deformations (Linearized Framework)

  1. Strain Displacement:
  2. Compute strain-displacement matrix $ J_{small} $ using the initial undeformed configuration and current displacements.

  3. Stress Calculation:

  4. Strain $ \epsilon = J D $.
  5. Stress $ \sigma = D \epsilon $.

Large Deformations (Corotational Framework)

  1. Rotation Matrices:
  2. Compute rotation matrix $ R_{02} $ from initial configuration to current orientation.

  3. Displacement in Local Frame:

  4. Displacements $ D = R_{02} (x_{deformed} - x_{initial}) $.

  5. Strain-Displacement Matrix:

  6. Compute local strain-displacement matrix $ J_{large} $ from rotated configurations.

  7. Stress Calculation:

  8. Strain $ \epsilon = J_{large} D $.
  9. Stress $ \sigma = D \epsilon $.

  10. Force Application:

  11. Internal forces are derived from the stress-strain relationship and applied in the global frame.

Example Formulas

  • Strain calculation (general):
    $$ \epsilon = J D $$

  • Stress calculation:
    $$ \sigma = D \epsilon $$

  • Rotation correction:
    $$ R_{02} x = x_{rotated} $$

  • Corotational stiffness matrix construction:
    $$ K = J D J^T $$

This mathematical and physical description provides a rigorous understanding of how TriangularFEMForceField operates within the SOFA framework, enabling accurate simulation of soft tissue mechanics.

Data Fields
NameTypeDefaultHelp
d_hosfordExponant Real Exponent in the Hosford yield criteria
d_criteriaValue Real Fracturable threshold used to draw fracturable triangles
d_showStressValue bool Flag activating rendering of stress values as a color in each triangle
d_showStressVector bool Flag activating rendering of stress directions within each triangle
d_showFracturableTriangles bool Flag activating rendering of triangles to fracture
d_computePrincipalStress bool Compute principal stress for each triangle
Methods
void init ()
void reinit ()
void addForce (const core::MechanicalParams * mparams, DataVecDeriv & f, const DataVecCoord & x, const DataVecDeriv & v)
void addDForce (const core::MechanicalParams * mparams, DataVecDeriv & df, const DataVecDeriv & dx)
void buildDampingMatrix (core::behavior::DampingMatrix * )
SReal getPotentialEnergy (const core::MechanicalParams * mparams, const DataVecCoord & x)
void computeElementStiffnessMatrix (type::Mat<9, 9, Real> & S, type::Mat<9, 9, Real> & SR, const MaterialStiffness & K, const StrainDisplacement & J, const Transformation & Rot)
void addKToMatrix (sofa::linearalgebra::BaseMatrix * mat, SReal k, unsigned int & offset)
void buildStiffnessMatrix (core::behavior::StiffnessMatrix * matrix)
void draw (const core::visual::VisualParams * vparams)
void createTriangleInformation (Index triangleIndex, TriangleInformation & , const core::topology::BaseMeshTopology::Triangle & t, const int & , const int & )
int getMethod ()
void setMethod (int val)
void setMethod (const int & methodName)
void getFractureCriteria (int element, Deriv & direction, Real & value)
void computeStressAlongDirection (Real & stress_along_dir, Index elementIndex, const Coord & direction, const type::Vec<3, Real> & stress)
void computeStressAlongDirection (Real & stress_along_dir, Index elementIndex, const Coord & direction)
void computeStressAcrossDirection (Real & stress_across_dir, Index elementIndex, const Coord & direction, const type::Vec<3, Real> & stress)
void computeStressAcrossDirection (Real & stress_across_dir, Index elementIndex, const Coord & direction)
void computeStress (type::Vec<3, Real> & stress, Index elementIndex)
void getRotation (Transformation & R, Index nodeIdx)
void getRotations ()
void computeStiffness (Stiffness & K, const StrainDisplacement & J, const MaterialStiffness & D)
void computePrincipalStrain (Index elementIndex, TriangleInformation & triangleInfo)
void computePrincipalStress (Index elementIndex, TriangleInformation & triangleInfo)
void computeStressPerVertex ()
void applyStiffness (VecCoord & f, Real h, const VecCoord & x, const Real & kFactor) virtual
void computeMaterialStiffness (int i, Index & a, Index & b, Index & c) virtual
void initSmall (int i, Index & a, Index & b, Index & c)
void accumulateForceSmall (VecCoord & f, const VecCoord & p)
void applyStiffnessSmall (VecCoord & f, Real h, const VecCoord & x, const Real & kFactor)
void initLarge (int i, Index & a, Index & b, Index & c)
void accumulateForceLarge (VecCoord & f, const VecCoord & p)
void applyStiffnessLarge (VecCoord & f, Real h, const VecCoord & x, const Real & kFactor)
{
  "name": "TriangularFEMForceField",
  "namespace": "sofa::component::solidmechanics::fem::elastic",
  "module": "Sofa.Component.SolidMechanics.FEM.Elastic",
  "include": "sofa/component/solidmechanics/fem/elastic/TriangularFEMForceField.h",
  "doc": "Corotational Triangular finite elements for dynamic topology.\n\ncorotational triangle from\n@InProceedings{NPF05,\n  author       = \"Nesme, Matthieu and Payan, Yohan and Faure, Fran\\c{c}ois\",\n  title        = \"Efficient, Physically Plausible Finite Elements\",\n  booktitle    = \"Eurographics (short papers)\",\n  month        = \"august\",\n  year         = \"2005\",\n  editor       = \"J. Dingliana and F. Ganovelli\",\n  keywords     = \"animation, physical model, elasticity, finite elements\",\n  url          = \"http://www-evasion.imag.fr/Publications/2005/NPF05\"\n}",
  "inherits": [
    "BaseLinearElasticityFEMForceField"
  ],
  "templates": [
    "sofa::defaulttype::Vec3Types"
  ],
  "data_fields": [
    {
      "name": "d_hosfordExponant",
      "type": "Real",
      "xmlname": "hosfordExponant",
      "help": "Exponent in the Hosford yield criteria"
    },
    {
      "name": "d_criteriaValue",
      "type": "Real",
      "xmlname": "criteriaValue",
      "help": "Fracturable threshold used to draw fracturable triangles"
    },
    {
      "name": "d_showStressValue",
      "type": "bool",
      "xmlname": "showStressValue",
      "help": "Flag activating rendering of stress values as a color in each triangle"
    },
    {
      "name": "d_showStressVector",
      "type": "bool",
      "xmlname": "showStressVector",
      "help": "Flag activating rendering of stress directions within each triangle"
    },
    {
      "name": "d_showFracturableTriangles",
      "type": "bool",
      "xmlname": "showFracturableTriangles",
      "help": "Flag activating rendering of triangles to fracture"
    },
    {
      "name": "d_computePrincipalStress",
      "type": "bool",
      "xmlname": "computePrincipalStress",
      "help": "Compute principal stress for each triangle"
    }
  ],
  "links": [],
  "methods": [
    {
      "name": "init",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "reinit",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addForce",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const core::MechanicalParams *"
        },
        {
          "name": "f",
          "type": "DataVecDeriv &"
        },
        {
          "name": "x",
          "type": "const DataVecCoord &"
        },
        {
          "name": "v",
          "type": "const DataVecDeriv &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addDForce",
      "return_type": "void",
      "params": [
        {
          "name": "mparams",
          "type": "const core::MechanicalParams *"
        },
        {
          "name": "df",
          "type": "DataVecDeriv &"
        },
        {
          "name": "dx",
          "type": "const DataVecDeriv &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "buildDampingMatrix",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "core::behavior::DampingMatrix *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getPotentialEnergy",
      "return_type": "SReal",
      "params": [
        {
          "name": "mparams",
          "type": "const core::MechanicalParams *"
        },
        {
          "name": "x",
          "type": "const DataVecCoord &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeElementStiffnessMatrix",
      "return_type": "void",
      "params": [
        {
          "name": "S",
          "type": "type::Mat<9, 9, Real> &"
        },
        {
          "name": "SR",
          "type": "type::Mat<9, 9, Real> &"
        },
        {
          "name": "K",
          "type": "const MaterialStiffness &"
        },
        {
          "name": "J",
          "type": "const StrainDisplacement &"
        },
        {
          "name": "Rot",
          "type": "const Transformation &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addKToMatrix",
      "return_type": "void",
      "params": [
        {
          "name": "mat",
          "type": "sofa::linearalgebra::BaseMatrix *"
        },
        {
          "name": "k",
          "type": "SReal"
        },
        {
          "name": "offset",
          "type": "unsigned int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "buildStiffnessMatrix",
      "return_type": "void",
      "params": [
        {
          "name": "matrix",
          "type": "core::behavior::StiffnessMatrix *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "draw",
      "return_type": "void",
      "params": [
        {
          "name": "vparams",
          "type": "const core::visual::VisualParams *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "createTriangleInformation",
      "return_type": "void",
      "params": [
        {
          "name": "triangleIndex",
          "type": "Index"
        },
        {
          "name": "",
          "type": "TriangleInformation &"
        },
        {
          "name": "t",
          "type": "const core::topology::BaseMeshTopology::Triangle &"
        },
        {
          "name": "",
          "type": "const int &"
        },
        {
          "name": "",
          "type": "const int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getMethod",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setMethod",
      "return_type": "void",
      "params": [
        {
          "name": "val",
          "type": "int"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setMethod",
      "return_type": "void",
      "params": [
        {
          "name": "methodName",
          "type": "const int &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getFractureCriteria",
      "return_type": "void",
      "params": [
        {
          "name": "element",
          "type": "int"
        },
        {
          "name": "direction",
          "type": "Deriv &"
        },
        {
          "name": "value",
          "type": "Real &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStressAlongDirection",
      "return_type": "void",
      "params": [
        {
          "name": "stress_along_dir",
          "type": "Real &"
        },
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "direction",
          "type": "const Coord &"
        },
        {
          "name": "stress",
          "type": "const type::Vec<3, Real> &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStressAlongDirection",
      "return_type": "void",
      "params": [
        {
          "name": "stress_along_dir",
          "type": "Real &"
        },
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "direction",
          "type": "const Coord &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStressAcrossDirection",
      "return_type": "void",
      "params": [
        {
          "name": "stress_across_dir",
          "type": "Real &"
        },
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "direction",
          "type": "const Coord &"
        },
        {
          "name": "stress",
          "type": "const type::Vec<3, Real> &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStressAcrossDirection",
      "return_type": "void",
      "params": [
        {
          "name": "stress_across_dir",
          "type": "Real &"
        },
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "direction",
          "type": "const Coord &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStress",
      "return_type": "void",
      "params": [
        {
          "name": "stress",
          "type": "type::Vec<3, Real> &"
        },
        {
          "name": "elementIndex",
          "type": "Index"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getRotation",
      "return_type": "void",
      "params": [
        {
          "name": "R",
          "type": "Transformation &"
        },
        {
          "name": "nodeIdx",
          "type": "Index"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getRotations",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "computeStiffness",
      "return_type": "void",
      "params": [
        {
          "name": "K",
          "type": "Stiffness &"
        },
        {
          "name": "J",
          "type": "const StrainDisplacement &"
        },
        {
          "name": "D",
          "type": "const MaterialStiffness &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "computePrincipalStrain",
      "return_type": "void",
      "params": [
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "triangleInfo",
          "type": "TriangleInformation &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "computePrincipalStress",
      "return_type": "void",
      "params": [
        {
          "name": "elementIndex",
          "type": "Index"
        },
        {
          "name": "triangleInfo",
          "type": "TriangleInformation &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "computeStressPerVertex",
      "return_type": "void",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "applyStiffness",
      "return_type": "void",
      "params": [
        {
          "name": "f",
          "type": "VecCoord &"
        },
        {
          "name": "h",
          "type": "Real"
        },
        {
          "name": "x",
          "type": "const VecCoord &"
        },
        {
          "name": "kFactor",
          "type": "const Real &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "computeMaterialStiffness",
      "return_type": "void",
      "params": [
        {
          "name": "i",
          "type": "int"
        },
        {
          "name": "a",
          "type": "Index &"
        },
        {
          "name": "b",
          "type": "Index &"
        },
        {
          "name": "c",
          "type": "Index &"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "initSmall",
      "return_type": "void",
      "params": [
        {
          "name": "i",
          "type": "int"
        },
        {
          "name": "a",
          "type": "Index &"
        },
        {
          "name": "b",
          "type": "Index &"
        },
        {
          "name": "c",
          "type": "Index &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "accumulateForceSmall",
      "return_type": "void",
      "params": [
        {
          "name": "f",
          "type": "VecCoord &"
        },
        {
          "name": "p",
          "type": "const VecCoord &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "applyStiffnessSmall",
      "return_type": "void",
      "params": [
        {
          "name": "f",
          "type": "VecCoord &"
        },
        {
          "name": "h",
          "type": "Real"
        },
        {
          "name": "x",
          "type": "const VecCoord &"
        },
        {
          "name": "kFactor",
          "type": "const Real &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "initLarge",
      "return_type": "void",
      "params": [
        {
          "name": "i",
          "type": "int"
        },
        {
          "name": "a",
          "type": "Index &"
        },
        {
          "name": "b",
          "type": "Index &"
        },
        {
          "name": "c",
          "type": "Index &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "accumulateForceLarge",
      "return_type": "void",
      "params": [
        {
          "name": "f",
          "type": "VecCoord &"
        },
        {
          "name": "p",
          "type": "const VecCoord &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    },
    {
      "name": "applyStiffnessLarge",
      "return_type": "void",
      "params": [
        {
          "name": "f",
          "type": "VecCoord &"
        },
        {
          "name": "h",
          "type": "Real"
        },
        {
          "name": "x",
          "type": "const VecCoord &"
        },
        {
          "name": "kFactor",
          "type": "const Real &"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "protected"
    }
  ],
  "description": "The `TriangularFEMForceField` is a SOFA component designed for corotational triangular finite elements in dynamic topology scenarios, as described in the reference by Nesme et al. (2005). It specializes in modeling mechanical behavior using elastic forces and supports both small and large displacement formulations. This component inherits from `BaseLinearElasticityFEMForceField` and is part of the SolidMechanics.FEM.Elastic module.\n\n**Role and Purpose:**\nThe primary role of `TriangularFEMForceField` is to handle triangular finite elements with corotational methods for simulating soft tissue mechanics. It supports various operations such as stiffness computation, stress calculation, and visualization of stress values and directions within each triangle. This component can also compute principal stresses and strains, which are important in fracture criteria calculations.\n\n**Interactions with Other Components:**\nThe `TriangularFEMForceField` interacts with the mechanical parameters provided by the simulation through its methods such as `addForce`, `addDForce`, `buildStiffnessMatrix`, and `getPotentialEnergy`. It also interfaces with the topology to handle triangle creation, destruction, and update functions. Additionally, it integrates into SOFA’s visualization pipeline via the `draw` method.\n\n**Usage Guidance:**\nThe component provides several data fields for configuring its behavior, including:\n- `hosfordExponant`: Exponent in the Hosford yield criteria.\n- `criteriaValue`: Fracturable threshold used to draw fracturable triangles.\n- `showStressValue`: Flag to render stress values as color within each triangle.\n- `showStressVector`: Flag to render stress directions within each triangle.\n- `showFracturableTriangles`: Flag to render triangles that are expected to fracture.\n\nUsers can also set the method for displacement (small or large) and compute principal stresses if needed. The component is useful in applications involving dynamic topology changes and requires careful handling of material properties and mesh configurations.",
  "maths": "The `TriangularFEMForceField` component in the SOFA framework is designed to handle corotational triangular finite elements for simulating soft tissue mechanics. This component implements both small and large displacement formulations, allowing it to be used in a variety of dynamic topology scenarios. Below is a detailed mathematical and physical description of its key aspects.\n\n### Governing Equations and Operators\n\nThe `TriangularFEMForceField` contributes to the following governing equations or operators:\n- **Internal Force**: Computes internal elastic forces acting on each triangular element using Hooke's law.\n- **Stiffness Matrix**: Constructs the stiffness matrix for triangular elements, representing material properties and geometric relationships.\n- **Residual Calculation**: Evaluates the nonlinear residual within the Newton-Raphson iteration framework to solve the system of equations.\n\n### Constitutive or Kinematic Laws Involved\n\n1. **Material Stiffness**:\n   - The constitutive law for elastic materials is represented by a material stiffness matrix \\( D \\), which relates stress to strain.\n     \n2. **Strain-Displacement Matrix**: \n   - A strain-displacement matrix \\( J \\) maps nodal displacements to strains within the triangular elements.\n\n3. **Corotational Framework**:\n   - The corotational framework involves rotation matrices (\\( R \\)) that transform between local and global frames, ensuring that rotations do not contribute to stretching or compression of the element.\n     \n### Role in FEM Pipeline\n\n- **Assembly Phase**: Assembles the stiffness matrix and internal forces for triangular elements.\n  - The stiffness matrix is assembled by computing individual element contributions from \\( K = J D J^T \\).\n  - Internal forces are computed using the strain-displacement relationship and material properties.\n- **Time Integration**: Implements implicit time integration schemes (e.g., Backward Euler) to update nodal positions and velocities over discrete timesteps.\n- **Nonlinear Resolution**: Uses Newton-Raphson iterations to solve nonlinear equations resulting from large deformations.\n\n### Numerical Methods or Discretization Choices\n\n1. **Small Deformation Formulation**:\n   - For small deformations, the strain-displacement matrix \\( J \\) is computed using linearized approximations and nodal displacements directly without rotation correction.\n     \n2. **Large Deformation (Corotational) Formulation**:\n   - Rotates the initial configuration of each triangle into a local frame where rotations are accounted for separately from deformations.\n   - The displacement \\( D \\) is computed in this rotated frame, and strains are derived accordingly.\n     \n3. **Rotation Matrices**: \n   - Rotation matrices \\( R_{02} \\) and \\( R_{20} \\) ensure that rotations are handled correctly during strain calculation and force application.\n\n### Integration with Lagrangian Mechanics Framework\n\nThe `TriangularFEMForceField` component fits into the broader variational/Lagrangian mechanics framework by:\n- Formulating the elastic potential energy of each triangular element.\n- Using the principle of virtual work to derive internal forces and stiffness contributions.\n- Implementing implicit time integration schemes that respect physical consistency, numerical stability, and extensibility.\n\n### Mathematical Formulation\n\n#### Small Deformations (Linearized Framework)\n1. **Strain Displacement**:\n   - Compute strain-displacement matrix \\( J_{small} \\) using the initial undeformed configuration and current displacements.\n     \n2. **Stress Calculation**:\n   - Strain \\( \\epsilon = J D \\).\n   - Stress \\( \\sigma = D \\epsilon \\).\n\n#### Large Deformations (Corotational Framework)\n1. **Rotation Matrices**: \n   - Compute rotation matrix \\( R_{02} \\) from initial configuration to current orientation.\n     \n2. **Displacement in Local Frame**:\n   - Displacements \\( D = R_{02} (x_{deformed} - x_{initial}) \\).\n\n3. **Strain-Displacement Matrix**: \n   - Compute local strain-displacement matrix \\( J_{large} \\) from rotated configurations.\n     \n4. **Stress Calculation**:\n   - Strain \\( \\epsilon = J_{large} D \\).\n   - Stress \\( \\sigma = D \\epsilon \\).\n\n5. **Force Application**: \n   - Internal forces are derived from the stress-strain relationship and applied in the global frame.\n     \n### Example Formulas\n- Strain calculation (general): \n  \\[ \\epsilon = J D \\]\n- Stress calculation: \n  \\[ \\sigma = D \\epsilon \\]\n- Rotation correction: \n  \\[ R_{02} x = x_{rotated} \\]\n- Corotational stiffness matrix construction:\n  \\[ K = J D J^T \\]\n\nThis mathematical and physical description provides a rigorous understanding of how `TriangularFEMForceField` operates within the SOFA framework, enabling accurate simulation of soft tissue mechanics.",
  "abstract": "The `TriangularFEMForceField` simulates corotational triangular finite elements for dynamic topology scenarios, handling both small and large deformations, internal forces, stiffness matrices, and stress visualization.",
  "sheet": "# TriangularFEMForceField\n\n## Overview\nThe `TriangularFEMForceField` is a component in the SOFA framework designed to simulate corotational triangular finite elements for dynamic topology scenarios. It supports both small and large deformations, computes internal forces and stiffness matrices, and provides visualization of stress values and directions within each triangle.\n\n## Mathematical Model\nThe `TriangularFEMForceField` contributes to the following governing equations or operators:\n- **Internal Force**: Computes internal elastic forces acting on each triangular element using Hooke's law.\n- **Stiffness Matrix**: Constructs the stiffness matrix for triangular elements, representing material properties and geometric relationships.\n- **Residual Calculation**: Evaluates the nonlinear residual within the Newton-Raphson iteration framework to solve the system of equations.\n\n### Constitutive or Kinematic Laws Involved\n1. **Material Stiffness**:\n   - The constitutive law for elastic materials is represented by a material stiffness matrix \\( D \\), which relates stress to strain.\n2. **Strain-Displacement Matrix**: \n   - A strain-displacement matrix \\( J \\) maps nodal displacements to strains within the triangular elements.\n3. **Corotational Framework**:\n   - The corotational framework involves rotation matrices (\\( R \\)) that transform between local and global frames, ensuring that rotations do not contribute to stretching or compression of the element.\n\n### Role in FEM Pipeline\n- **Assembly Phase**: Assembles the stiffness matrix and internal forces for triangular elements.\n  - The stiffness matrix is assembled by computing individual element contributions from \\( K = J D J^T \\).\n  - Internal forces are computed using the strain-displacement relationship and material properties.\n- **Time Integration**: Implements implicit time integration schemes (e.g., Backward Euler) to update nodal positions and velocities over discrete timesteps.\n- **Nonlinear Resolution**: Uses Newton-Raphson iterations to solve nonlinear equations resulting from large deformations.\n\n### Numerical Methods or Discretization Choices\n1. **Small Deformations**:\n   - For small deformations, the strain-displacement matrix \\( J_{small} \\) is computed using linearized approximations and nodal displacements directly without rotation correction.\n2. **Large Deformations (Corotational Framework)**:\n   - Rotates the initial configuration of each triangle into a local frame where rotations are accounted for separately from deformations.\n   - The displacement \\( D \\) is computed in this rotated frame, and strains are derived accordingly.\n3. **Rotation Matrices**: \n   - Rotation matrices \\( R_{02} \\) and \\( R_{20} \\) ensure that rotations are handled correctly during strain calculation and force application.\n\n### Integration with Lagrangian Mechanics Framework\nThe `TriangularFEMForceField` component fits into the broader variational/Lagrangian mechanics framework by:\n- Formulating the elastic potential energy of each triangular element.\n- Using the principle of virtual work to derive internal forces and stiffness contributions.\n- Implementing implicit time integration schemes that respect physical consistency, numerical stability, and extensibility.\n\n### Mathematical Formulation\n#### Small Deformations (Linearized Framework)\n1. **Strain Displacement**:\n   - Compute strain-displacement matrix \\( J_{small} \\) using the initial undeformed configuration and current displacements.\n2. **Stress Calculation**:\n   - Strain \\( \\epsilon = J D \\).\n   - Stress \\( \\sigma = D \\epsilon \\).\n\n#### Large Deformations (Corotational Framework)\n1. **Rotation Matrices**: \n   - Compute rotation matrix \\( R_{02} \\) from initial configuration to current orientation.\n2. **Displacement in Local Frame**:\n   - Displacements \\( D = R_{02} (x_{deformed} - x_{initial}) \\).\n3. **Strain-Displacement Matrix**: \n   - Compute local strain-displacement matrix \\( J_{large} \\) from rotated configurations.\n4. **Stress Calculation**:\n   - Strain \\( \\epsilon = J_{large} D \\).\n   - Stress \\( \\sigma = D \\epsilon \\).\n5. **Force Application**: \n   - Internal forces are derived from the stress-strain relationship and applied in the global frame.\n\n### Example Formulas\n- Strain calculation (general): \n  \\[ \\epsilon = J D \\]\n- Stress calculation: \n  \\[ \\sigma = D \\epsilon \\]\n- Rotation correction: \n  \\[ R_{02} x = x_{rotated} \\]\n- Corotational stiffness matrix construction:\n  \\[ K = J D J^T \\]\n\n## Parameters and Data\nThe significant data fields exposed by the component are as follows:\n- `hosfordExponant`: Exponent in the Hosford yield criteria.\n- `criteriaValue`: Fracturable threshold used to draw fracturable triangles.\n- `showStressValue`: Flag activating rendering of stress values as a color within each triangle.\n- `showStressVector`: Flag activating rendering of stress directions within each triangle.\n- `showFracturableTriangles`: Flag activating rendering of triangles to fracture.\n- `computePrincipalStress`: Compute principal stress for each triangle."
}