Back

MechanicalAddSeparateGravityVisitor

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

Add dt*mass*Gravity to the velocity This is called if the mass wants to be added separately to the mm from the other forces

Abstract (AI generated)

The `MechanicalAddSeparateGravityVisitor` adds gravity to velocity based on mass using the formula v_{new} = v_{old} + dt \times m \times g, specifically when mass needs separate treatment from other forces.

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

The MechanicalAddSeparateGravityVisitor is a component within the SOFA simulation framework designed to handle gravitational forces in mechanical simulations. Its primary role is to add gravity to the velocity based on mass, following the formula:

egin{equation}
v_{new} = v_{old} + dt imes m imes g
ag{1}
ext{where:}
\begin{itemize}
\item $v_{new}$ is the new velocity after applying gravity,
\item $v_{old}$ is the previous velocity,
\item $dt$ is the time step size,
\item $m$ is the mass of the element or node,
\item $g$ is the gravitational acceleration vector.
\end{itemize}

This visitor is specifically used when the mass needs to be treated separately from other forces. It inherits from the MechanicalVisitor class and implements a method fwdMass that processes the gravitational effect on the BaseMass. The component also provides a getInfos method for debugging purposes, returning information related to the vectors it operates on.

The MechanicalAddSeparateGravityVisitor fits into the broader variational / Lagrangian mechanics framework by contributing to the update of velocity in the time integration phase. Specifically, this contribution ensures that gravitational forces are correctly applied and integrated over time steps, thereby preserving physical consistency in simulations involving gravity. The component operates during the assembly phase when it is necessary to separately account for mass contributions due to gravity.

In summary, MechanicalAddSeparateGravityVisitor plays a role in ensuring accurate and consistent treatment of gravitational forces within the SOFA simulation pipeline.

Methods
Result fwdMass (simulation::Node * , sofa::core::behavior::BaseMass * mass) virtual
int getInfos ()
{
  "name": "MechanicalAddSeparateGravityVisitor",
  "namespace": "sofa::simulation::mechanicalvisitor",
  "module": "Sofa.framework.Simulation.Core",
  "include": "sofa/simulation/mechanicalvisitor/MechanicalAddSeparateGravityVisitor.h",
  "doc": "Add dt*mass*Gravity to the velocity\nThis is called if the mass wants to be added separately to the mm from the other forces",
  "inherits": [
    "MechanicalVisitor"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "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"
    }
  ],
  "description": "The `MechanicalAddSeparateGravityVisitor` is a component within the SOFA simulation framework designed to handle gravitational forces in mechanical simulations. Its primary role is to add gravity to the velocity based on mass, following the formula `dt * mass * Gravity`. This visitor is specifically used when the mass needs to be treated separately from other forces.\n\nIt inherits from the `MechanicalVisitor` class and implements a method `fwdMass` that processes the gravitational effect on the BaseMass. The component also provides a `getInfos` method for debugging purposes, returning information related to the vectors it operates on.\n\nThe component interacts with SOFA's mechanical simulation components, particularly those involving mass (`BaseMass`). It is part of the broader set of visitors in SOFA that manage different aspects of mechanical computations.",
  "maths": "The `MechanicalAddSeparateGravityVisitor` is a component within the SOFA simulation framework designed to handle gravitational forces in mechanical simulations. Its primary role is to add gravity to the velocity based on mass, following the formula:\n\n\begin{equation}\n    v_{new} = v_{old} + dt \times m \times g\n\tag{1}\n\text{where:}\n\\begin{itemize}\n    \\item $v_{new}$ is the new velocity after applying gravity,\n    \\item $v_{old}$ is the previous velocity,\n    \\item $dt$ is the time step size,\n    \\item $m$ is the mass of the element or node,\n    \\item $g$ is the gravitational acceleration vector.\n\\end{itemize}\n\nThis visitor is specifically used when the mass needs to be treated separately from other forces. It inherits from the `MechanicalVisitor` class and implements a method `fwdMass` that processes the gravitational effect on the `BaseMass`. The component also provides a `getInfos` method for debugging purposes, returning information related to the vectors it operates on.\n\nThe `MechanicalAddSeparateGravityVisitor` fits into the broader variational / Lagrangian mechanics framework by contributing to the update of velocity in the time integration phase. Specifically, this contribution ensures that gravitational forces are correctly applied and integrated over time steps, thereby preserving physical consistency in simulations involving gravity. The component operates during the assembly phase when it is necessary to separately account for mass contributions due to gravity.\n\nIn summary, `MechanicalAddSeparateGravityVisitor` plays a role in ensuring accurate and consistent treatment of gravitational forces within the SOFA simulation pipeline.",
  "abstract": "The `MechanicalAddSeparateGravityVisitor` adds gravity to velocity based on mass using the formula v_{new} = v_{old} + dt \\times m \\times g, specifically when mass needs separate treatment from other forces.",
  "sheet": "\n# MechanicalAddSeparateGravityVisitor\n\n## Overview\nThe `MechanicalAddSeparateGravityVisitor` is a component within SOFA's mechanical simulation framework. It handles the addition of gravitational forces to velocity based on mass, ensuring that mass contributions due to gravity are treated separately from other forces.\n\n## Mathematical Model\nThe visitor updates the velocity by adding the effect of gravity according to the formula:\n\\[ v_{new} = v_{old} + dt \\times m \\times g \\]\nwhere:\n- $v_{new}$ is the new velocity after applying gravity,\n- $v_{old}$ is the previous velocity,\n- $dt$ is the time step size,\n- $m$ is the mass of the element or node,\n- $g$ is the gravitational acceleration vector.\n\nThis visitor fits into the broader variational / Lagrangian mechanics framework by contributing to the update of velocity in the time integration phase, ensuring that gravitational forces are correctly applied and integrated over time steps."
}