Skip to content

NewmarkImplicitSolver

This component belongs to the category of integration schemes or ODE Solver.

This scheme is an implicit time integrator for dynamic system using the Newmark scheme. To compute the new position or new velocity, the NewmarkImplicitSolver is based on the following equations:

Applied to a mechanical system where , we need to solve the following system:

Sequence diagram

Data

The solver is ruled by several breaking (converging or diverging) conditions:

  • gamma is the Newmark scheme gamma coefficient
  • beta is the Newmark scheme beta coefficient

Usage

At each simulation step and each Newton Raphson iteration, the NewmarkImplicitSolver requires:

  • a LinearSolver to solve the linear system
  • and a MechanicalObject to store the state vectors.

Example

This component is used as follows in XML format:

<NewmarkImplicitSolver rayleighMass="0.01" rayleighStiffness="0.01" />

or using SofaPython3:

node.addObject('NewmarkImplicitSolver', rayleighMass='0.01', rayleighStiffness='0.01')  

An example scene involving a NewmarkImplicitSolver is available in examples/Component/ODESolver/Backward/NewmarkImplicitSolver.scn

Target: Sofa.Component.ODESolver.Backward

namespace: sofa::component::odesolver::backward

parents:

  • OdeSolver
  • LinearSolverAccessor

Data:

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the objet belongs to
bbox this object bounding box
componentState The state of the component among (Dirty, Valid, Undefined, Loading, Invalid). Undefined
listening if true, handle the events, otherwise ignore the events 0
rayleighStiffness Rayleigh damping coefficient related to stiffness 0
rayleighMass Rayleigh damping coefficient related to mass 0
vdamping Velocity decay coefficient (no decay if null) 0
gamma Newmark scheme gamma coefficient 0.5
beta Newmark scheme beta coefficient 0.25
threadSafeVisitor If true, do not use realloc and free visitors in fwdInteractionForceField. 0

Links:

Name Description
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used)
slaves Sub-objects used internally by this object
master nullptr for regular objects, or master object for which this object is one sub-objects
linearSolver Linear solver used by this component

Examples

Component/ODESolver/Backward/NewmarkImplicitSolver.scn

<Node name="root" gravity="-1.8 0 100" dt="0.02">
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader MeshOBJLoader] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [BarycentricMapping] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [NewmarkImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
    <RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin name="Sofa.Component.Topology.Container.Constant"/> <!-- Needed to use components [MeshTopology] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <DefaultAnimationLoop/>

    <Node name="Reference">
        <MeshOBJLoader name="meshLoader_0" filename="mesh/truthcylinder1-bent.obj" scale="0.95" handleSeams="1" />
        <OglModel src="@meshLoader_0" dx="0" dy="-1" dz="0" color="green" />
    </Node>
    <Node name="Springs">
        <NewmarkImplicitSolver rayleighMass="0" rayleighStiffness="0.1" />
        <SparseLDLSolver/>
        <MeshGmshLoader name="loader" filename="mesh/truthcylinder1.msh" />
        <MeshTopology src="@loader" />
        <MechanicalObject src="@loader" dx="15" />
        <UniformMass totalMass="15" />
        <FixedProjectiveConstraint indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345" />
        <MeshSpringForceField name="Spring" tetrasStiffness="1870" tetrasDamping="0" />

        <Node>
            <MeshOBJLoader name="meshLoader_3" filename="mesh/truthcylinder1.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_3" color="yellow" dx="15" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
    </Node>

    <Node name="CoFEM">
        <NewmarkImplicitSolver rayleighMass="0" rayleighStiffness="0.1" />
        <CGLinearSolver iterations="100" tolerance="1e-5" threshold="1e-5"/>
        <MeshGmshLoader name="loader" filename="mesh/truthcylinder1.msh"/>
        <MeshTopology src="@loader" />
        <MechanicalObject src="@loader" dx="30" />
        <UniformMass totalMass="15" />
        <FixedProjectiveConstraint indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345" />
        <TetrahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.49" method="polar" />

        <Node>
            <MeshOBJLoader name="meshLoader_2" filename="mesh/truthcylinder1.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_2" color="cyan" dx="30" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
    </Node>
    <Node name="LinearFEM">
        <NewmarkImplicitSolver rayleighMass="0" rayleighStiffness="0.1" />
        <CGLinearSolver iterations="100" tolerance="1e-5" threshold="1e-5"/>
        <MeshGmshLoader name="loader" filename="mesh/truthcylinder1.msh"/>
        <MeshTopology src="@loader" />
        <MechanicalObject src="@loader" dx="45" />
        <UniformMass totalMass="15" />
        <FixedProjectiveConstraint indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345" />
        <TetrahedronFEMForceField name="FEM" youngModulus="1116" poissonRatio="0.49" method="small" />

        <Node>
            <MeshOBJLoader name="meshLoader_1" filename="mesh/truthcylinder1.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_1" color="red" dx="45" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
    </Node>
</Node>
def createScene(rootNode):

    root = rootNode.addChild('root', gravity="-1.8 0 100", dt="0.02")
    root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
    root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
    root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Direct")
    root.addObject('RequiredPlugin', name="Sofa.Component.LinearSolver.Iterative")
    root.addObject('RequiredPlugin', name="Sofa.Component.Mapping.Linear")
    root.addObject('RequiredPlugin', name="Sofa.Component.Mass")
    root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
    root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.FEM.Elastic")
    root.addObject('RequiredPlugin', name="Sofa.Component.SolidMechanics.Spring")
    root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
    root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Constant")
    root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
    root.addObject('DefaultAnimationLoop')

    Reference = root.addChild('Reference')
    Reference.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/truthcylinder1-bent.obj", scale="0.95", handleSeams="1")
    Reference.addObject('OglModel', src="@meshLoader_0", dx="0", dy="-1", dz="0", color="green")

    Springs = root.addChild('Springs')
    Springs.addObject('NewmarkImplicitSolver', rayleighMass="0", rayleighStiffness="0.1")
    Springs.addObject('SparseLDLSolver')
    Springs.addObject('MeshGmshLoader', name="loader", filename="mesh/truthcylinder1.msh")
    Springs.addObject('MeshTopology', src="@loader")
    Springs.addObject('MechanicalObject', src="@loader", dx="15")
    Springs.addObject('UniformMass', totalMass="15")
    Springs.addObject('FixedProjectiveConstraint', indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345")
    Springs.addObject('MeshSpringForceField', name="Spring", tetrasStiffness="1870", tetrasDamping="0")

    Springs = Springs.addChild('Springs')
    Springs.addObject('MeshOBJLoader', name="meshLoader_3", filename="mesh/truthcylinder1.obj", handleSeams="1")
    Springs.addObject('OglModel', name="Visual", src="@meshLoader_3", color="yellow", dx="15")
    Springs.addObject('BarycentricMapping', input="@..", output="@Visual")

    CoFEM = root.addChild('CoFEM')
    CoFEM.addObject('NewmarkImplicitSolver', rayleighMass="0", rayleighStiffness="0.1")
    CoFEM.addObject('CGLinearSolver', iterations="100", tolerance="1e-5", threshold="1e-5")
    CoFEM.addObject('MeshGmshLoader', name="loader", filename="mesh/truthcylinder1.msh")
    CoFEM.addObject('MeshTopology', src="@loader")
    CoFEM.addObject('MechanicalObject', src="@loader", dx="30")
    CoFEM.addObject('UniformMass', totalMass="15")
    CoFEM.addObject('FixedProjectiveConstraint', indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345")
    CoFEM.addObject('TetrahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.49", method="polar")

    CoFEM = CoFEM.addChild('CoFEM')
    CoFEM.addObject('MeshOBJLoader', name="meshLoader_2", filename="mesh/truthcylinder1.obj", handleSeams="1")
    CoFEM.addObject('OglModel', name="Visual", src="@meshLoader_2", color="cyan", dx="30")
    CoFEM.addObject('BarycentricMapping', input="@..", output="@Visual")

    LinearFEM = root.addChild('LinearFEM')
    LinearFEM.addObject('NewmarkImplicitSolver', rayleighMass="0", rayleighStiffness="0.1")
    LinearFEM.addObject('CGLinearSolver', iterations="100", tolerance="1e-5", threshold="1e-5")
    LinearFEM.addObject('MeshGmshLoader', name="loader", filename="mesh/truthcylinder1.msh")
    LinearFEM.addObject('MeshTopology', src="@loader")
    LinearFEM.addObject('MechanicalObject', src="@loader", dx="45")
    LinearFEM.addObject('UniformMass', totalMass="15")
    LinearFEM.addObject('FixedProjectiveConstraint', indices="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 268 269 270 271 343 345")
    LinearFEM.addObject('TetrahedronFEMForceField', name="FEM", youngModulus="1116", poissonRatio="0.49", method="small")

    LinearFEM = LinearFEM.addChild('LinearFEM')
    LinearFEM.addObject('MeshOBJLoader', name="meshLoader_1", filename="mesh/truthcylinder1.obj", handleSeams="1")
    LinearFEM.addObject('OglModel', name="Visual", src="@meshLoader_1", color="red", dx="45")
    LinearFEM.addObject('BarycentricMapping', input="@..", output="@Visual")