Back

MechanicalAccFromFVisitor

sofa::simulation::mechanicalvisitor::MechanicalAccFromFVisitor
MechanicalVisitor
Doc (from source)

Compute accelerations generated by given forces

Abstract (AI generated)

The `MechanicalAccFromFVisitor` computes accelerations generated by given forces using the inverse of the mass matrix in the SOFA framework.

Metadata
module
Sofa.framework.Simulation.Core
namespace
sofa::simulation::mechanicalvisitor
include
sofa/simulation/mechanicalvisitor/MechanicalAccFromFVisitor.h
inherits
  • MechanicalVisitor
description

The MechanicalAccFromFVisitor component in the SOFA framework is designed to compute accelerations generated by given forces. This visitor interacts with other mechanical components, specifically the BaseMass, to perform the necessary calculations within the simulation pipeline.

Governing Equations and Operators

In the context of FEM simulations, the relationship between force and acceleration is given by Newton's second law in the form:

egin{equation}
M rac{ extbf{a}}{ extbf{t}} = extbf{F} - f_{int}(x)
onumber
\end{equation}

where $ M $ is the mass matrix, $ extbf{a} $ is the acceleration vector, and $ extbf{F} $ represents external forces. For the MechanicalAccFromFVisitor, the focus is on calculating accelerations based on given forces:

egin{equation}
\mathbf{a} = M^{-1}(\mathbf{F})\nonumber
\end{equation}

Here, $ extbf{F} $ represents the external or applied force vector, and $ M^{-1} $ is the inverse of the mass matrix. The method fwdMass in the component invokes the accFromF function on a BaseMass object to compute accelerations from forces.

Constitutive and Kinematic Laws Involved

The MechanicalAccFromFVisitor does not directly involve constitutive or kinematic laws, as its primary role is to calculate accelerations based on given force vectors. The mass matrix $ M $ is assumed to be provided by the simulation context.

Role in the Global FEM Pipeline

In the broader context of the FEM pipeline:
- Assembly Phase: This component does not directly contribute to the assembly phase as it operates post-discretization and deals with the solution phase.
- Time Integration: The visitor is involved in computing accelerations, which are essential for implicit time integration schemes such as Backward Euler or Newmark-type methods. Acceleration calculations are a key part of advancing the system state through each time step.
- Nonlinear Solve: While not directly performing nonlinear solves, this component's output (acceleration) is a critical input to solving nonlinear equations, particularly in dynamic simulations where inertial effects play a significant role.

Numerical Methods and Discretization Choices

The MechanicalAccFromFVisitor does not specify the numerical methods or discretization choices. It relies on the provided mass matrix $ M $ for calculating accelerations from forces, which is typically derived during the spatial discretization phase using FEM.

Fit into Variational / Lagrangian Mechanics Framework

Within the variational and Lagrangian mechanics framework, the MechanicalAccFromFVisitor plays a role in enforcing Newton's second law at the discrete level. This visitor ensures that accelerations computed from forces are consistent with the overall dynamics of the system, aligning with the action principle used to derive Euler–Lagrange equations.

egin{equation}
\frac{d}{dt}\left(\frac{\partial \mathcal{L}}{\partial \dot q}\right) - \frac{\partial \mathcal{L}}{\partial q} = Q\nonumber
\end{equation}

In the discrete context, these accelerations contribute to solving the semi-discrete dynamical system:

egin{equation}
M\ddot{x}(t) + f_{int}(x(t)) = f_{ext}(t)\nonumber
\end{equation}

Summary

The MechanicalAccFromFVisitor is a crucial component for computing accelerations based on given forces, essential for advancing the state of the system in time integration schemes. It fits seamlessly into the variational and Lagrangian mechanics framework by ensuring consistency with Newton's second law.

Methods
Result fwdMechanicalState (simulation::Node * , sofa::core::behavior::BaseMechanicalState * mm) virtual
Result fwdMass (simulation::Node * , sofa::core::behavior::BaseMass * mass) virtual
int getInfos ()
bool isThreadSafe () virtual
{
  "name": "MechanicalAccFromFVisitor",
  "namespace": "sofa::simulation::mechanicalvisitor",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/mechanicalvisitor/MechanicalAccFromFVisitor.h",
  "doc": "Compute accelerations generated by given forces",
  "inherits": [
    "MechanicalVisitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "fwdMechanicalState",
      "return_type": "Result",
      "params": [
        {
          "name": "",
          "type": "simulation::Node *"
        },
        {
          "name": "mm",
          "type": "sofa::core::behavior::BaseMechanicalState *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "fwdMass",
      "return_type": "Result",
      "params": [
        {
          "name": "",
          "type": "simulation::Node *"
        },
        {
          "name": "mass",
          "type": "sofa::core::behavior::BaseMass *"
        }
      ],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getInfos",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "isThreadSafe",
      "return_type": "bool",
      "params": [],
      "is_virtual": true,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    }
  ],
  "description": "The `MechanicalAccFromFVisitor` is a component in the SOFA framework under the namespace `sofa::simulation::mechanicalvisitor`. It inherits from `MechanicalVisitor` and its primary role is to compute accelerations generated by given forces. This visitor operates within the mechanical simulation pipeline, interacting with other components such as `BaseMass` to perform calculations necessary for simulating physical interactions.\n\nThe component does not have any explicit data fields but relies on methods like `fwdMechanicalState`, `fwdMass`, and `getInfos`. It also provides an implementation of the `isThreadSafe` method, indicating that it can be executed in a parallel context. The `fwdMechanicalState` method checks for the presence of mass and continues processing, while `fwdMass` computes accelerations from forces using the provided mechanical parameters (`mparams`) and accumulates results into an acceleration vector (`a`).\n\nThe visitor is designed to be thread-safe, allowing it to operate efficiently in parallel simulations. The `getInfos` method returns information about the current state of the visitor, including names of the vectors involved in the computation.",
  "maths": "<maths_md_description>\n\nThe `MechanicalAccFromFVisitor` component in the SOFA framework is designed to compute accelerations generated by given forces. This visitor interacts with other mechanical components, specifically the `BaseMass`, to perform the necessary calculations within the simulation pipeline.\n\n### Governing Equations and Operators\n\nIn the context of FEM simulations, the relationship between force and acceleration is given by Newton's second law in the form:\n\n\begin{equation}\nM \frac{\textbf{a}}{\textbf{t}} = \textbf{F} - f_{int}(x)\nonumber\n\\end{equation}\n\nwhere \\( M \\) is the mass matrix, \\( \textbf{a} \\) is the acceleration vector, and \\( \textbf{F} \\) represents external forces. For the `MechanicalAccFromFVisitor`, the focus is on calculating accelerations based on given forces:\n\n\begin{equation}\n\\mathbf{a} = M^{-1}(\\mathbf{F})\\nonumber\n\\end{equation}\n\nHere, \\( \textbf{F} \\) represents the external or applied force vector, and \\( M^{-1} \\) is the inverse of the mass matrix. The method `fwdMass` in the component invokes the `accFromF` function on a `BaseMass` object to compute accelerations from forces.\n\n### Constitutive and Kinematic Laws Involved\n\nThe `MechanicalAccFromFVisitor` does not directly involve constitutive or kinematic laws, as its primary role is to calculate accelerations based on given force vectors. The mass matrix \\( M \\) is assumed to be provided by the simulation context.\n\n### Role in the Global FEM Pipeline\n\nIn the broader context of the FEM pipeline:\n- **Assembly Phase**: This component does not directly contribute to the assembly phase as it operates post-discretization and deals with the solution phase.\n- **Time Integration**: The visitor is involved in computing accelerations, which are essential for implicit time integration schemes such as Backward Euler or Newmark-type methods. Acceleration calculations are a key part of advancing the system state through each time step.\n- **Nonlinear Solve**: While not directly performing nonlinear solves, this component's output (acceleration) is a critical input to solving nonlinear equations, particularly in dynamic simulations where inertial effects play a significant role.\n\n### Numerical Methods and Discretization Choices\n\nThe `MechanicalAccFromFVisitor` does not specify the numerical methods or discretization choices. It relies on the provided mass matrix \\( M \\) for calculating accelerations from forces, which is typically derived during the spatial discretization phase using FEM.\n\n### Fit into Variational / Lagrangian Mechanics Framework\n\nWithin the variational and Lagrangian mechanics framework, the `MechanicalAccFromFVisitor` plays a role in enforcing Newton's second law at the discrete level. This visitor ensures that accelerations computed from forces are consistent with the overall dynamics of the system, aligning with the action principle used to derive Euler–Lagrange equations.\n\n\begin{equation}\n\\frac{d}{dt}\\left(\\frac{\\partial \\mathcal{L}}{\\partial \\dot q}\\right) - \\frac{\\partial \\mathcal{L}}{\\partial q} = Q\\nonumber\n\\end{equation}\n\nIn the discrete context, these accelerations contribute to solving the semi-discrete dynamical system:\n\n\begin{equation}\nM\\ddot{x}(t) + f_{int}(x(t)) = f_{ext}(t)\\nonumber\n\\end{equation}\n\n### Summary\nThe `MechanicalAccFromFVisitor` is a crucial component for computing accelerations based on given forces, essential for advancing the state of the system in time integration schemes. It fits seamlessly into the variational and Lagrangian mechanics framework by ensuring consistency with Newton's second law.\n\n</maths_md_description>",
  "abstract": "The `MechanicalAccFromFVisitor` computes accelerations generated by given forces using the inverse of the mass matrix in the SOFA framework.",
  "sheet": "# MechanicalAccFromFVisitor\n\n## Overview\nThe `MechanicalAccFromFVisitor` is a visitor component that calculates accelerations based on external forces within the mechanical simulation pipeline. It inherits from `MechanicalVisitor` and interacts with other components such as `BaseMass` to perform necessary calculations.\n\n## Mathematical Model\nIn the context of FEM simulations, the relationship between force and acceleration is given by Newton's second law:\n\n\\[ M \\frac{d^2 x}{dt^2} = F - f_{int}(x) \\]\n\nwhere $M$ is the mass matrix, $a$ is the acceleration vector, and $F$ represents external forces. For the `MechanicalAccFromFVisitor`, the focus is on calculating accelerations based on given forces:\n\n\\[ a = M^{-1} F \\]\n\nHere, $F$ represents the external or applied force vector, and $M^{-1}$ is the inverse of the mass matrix."
}