Skip to content

EulerExplicitIntegrationScheme

A simple explicit time integrator.

Target: Sofa.Component.IntegrationScheme.Forward

namespace: sofa::component::integrationscheme::forward

parents:

  • ExplicitIntegrationScheme

Data

Name Description Default value
name object name unnamed
printLog if true, emits extra messages at runtime. 0
tags list of the subsets the object 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
symplectic If true (default), the velocities are updated before the positions and the method is symplectic, more robust. If false, the positions are updated before the velocities (standard Euler, less robust). 1
threadSafeVisitor If true, do not use realloc and free visitors in fwdInteractionForceField. 0
Name Description Destination type name
context Graph Node containing this object (or BaseContext::getDefault() if no graph is used) BaseContext
slaves Sub-objects used internally by this object BaseComponent
master nullptr for regular objects, or master object for which this object is one sub-objects BaseComponent
linearSolver Linear IntegrationScheme used by this component LinearSolver

Examples

EulerExplicitIntegrationScheme.scn

<!--
This scene shows an example of a forward Euler integration scheme.
This is the variant of the component EulerExplicitIntegrationScheme where the Data
'symplectic' is set to false (true by default).
In this example, the mass is not diagonal. Since it cannot be inverted
trivially, it requires a linear solver, here SparseLDLSolver.
-->

<Node name="root" gravity="0 -9.81 0" dt="0.00001">
    <RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin pluginName="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin pluginName="Sofa.Component.LinearSolver.Direct"/> <!-- Needed to use components [SparseLDLSolver] -->
    <RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
    <RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [MeshMatrixMass] -->
    <RequiredPlugin pluginName="Sofa.Component.IntegrationScheme.Forward"/> <!-- Needed to use components [EulerExplicitIntegrationScheme] -->
    <RequiredPlugin pluginName="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
    <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [HexahedronSetGeometryAlgorithms QuadSetTopologyContainer QuadSetTopologyModifier] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2QuadTopologicalMapping] -->
    <RequiredPlugin pluginName="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <DefaultAnimationLoop/>

    <VisualStyle displayFlags="showBehaviorModels showForceFields" />

    <Node name="DeformableObject">

        <EulerExplicitIntegrationScheme name="odeExplicitSolver" symplectic="false"/>
        <SparseLDLSolver />

        <MechanicalObject name="dofs"/>

        <RegularGridTopology name="topology" nx="4" ny="4" nz="11" xmin="-1.5" xmax="1.5" ymin="-1.5" ymax="1.5" zmin="0" zmax="10" />
        <HexahedronSetGeometryAlgorithms/>
        <MeshMatrixMass totalMass="15"/>

        <BoxROI box="-1.5 -1.5 0 1.5 1.5 0.0001" name="box"/>
        <FixedProjectiveConstraint indices="@box.indices" />
        <MeshSpringForceField stiffness="3E2"/>

        <Node name="visual">
            <QuadSetTopologyContainer  name="Container" />
            <QuadSetTopologyModifier/>
            <Hexa2QuadTopologicalMapping input="@../topology" output="@Container" />
            <OglModel name="Visual" color="yellow" quads="@Container.quads" />
            <IdentityMapping input="@../dofs" output="@Visual" />
        </Node>

    </Node>

    <Node name="floor-visual">
        <MeshOBJLoader name="meshLoader" filename="mesh/floorFlat.obj" scale3d="0.5 0.5 0.5"/>
        <OglModel src="@meshLoader" dy="-8" dz="10"/>
        <OglModel src="@meshLoader" rx="90" dy="2"/>
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0 -9.81 0", dt="0.00001")

   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Engine.Select")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.IO.Mesh")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.LinearSolver.Direct")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Mapping.Linear")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Mass")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.IntegrationScheme.Forward")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.SolidMechanics.Spring")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Dynamic")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Grid")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Mapping")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', pluginName="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields")

   deformable_object = root.addChild('DeformableObject')

   deformable_object.addObject('EulerExplicitIntegrationScheme', name="odeExplicitSolver", symplectic="false")
   deformable_object.addObject('SparseLDLSolver', )
   deformable_object.addObject('MechanicalObject', name="dofs")
   deformable_object.addObject('RegularGridTopology', name="topology", nx="4", ny="4", nz="11", xmin="-1.5", xmax="1.5", ymin="-1.5", ymax="1.5", zmin="0", zmax="10")
   deformable_object.addObject('HexahedronSetGeometryAlgorithms', )
   deformable_object.addObject('MeshMatrixMass', totalMass="15")
   deformable_object.addObject('BoxROI', box="-1.5 -1.5 0 1.5 1.5 0.0001", name="box")
   deformable_object.addObject('FixedProjectiveConstraint', indices="@box.indices")
   deformable_object.addObject('MeshSpringForceField', stiffness="3E2")

   visual = DeformableObject.addChild('visual')

   visual.addObject('QuadSetTopologyContainer', name="Container")
   visual.addObject('QuadSetTopologyModifier', )
   visual.addObject('Hexa2QuadTopologicalMapping', input="@../topology", output="@Container")
   visual.addObject('OglModel', name="Visual", color="yellow", quads="@Container.quads")
   visual.addObject('IdentityMapping', input="@../dofs", output="@Visual")

   floor_visual = root.addChild('floor-visual')

   floor_visual.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/floorFlat.obj", scale3d="0.5 0.5 0.5")
   floor_visual.addObject('OglModel', src="@meshLoader", dy="-8", dz="10")
   floor_visual.addObject('OglModel', src="@meshLoader", rx="90", dy="2")

EulerExplicitIntegrationScheme_diagonal.scn

<!--
This scene shows an example of a forward Euler integration scheme.
This is the variant of the component EulerExplicitIntegrationScheme where the Data
'symplectic' is set to false (true by default).
In this example, the mass is diagonal. Since it can be inverted
trivially, it does not require a linear solver.
-->

<Node name="root" gravity="0 -9.81 0" dt="0.00001">
    <RequiredPlugin pluginName="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
    <RequiredPlugin pluginName="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <RequiredPlugin pluginName="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <RequiredPlugin pluginName="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
    <RequiredPlugin pluginName="Sofa.Component.Mass"/> <!-- Needed to use components [UniformMass] -->
    <RequiredPlugin pluginName="Sofa.Component.IntegrationScheme.Forward"/> <!-- Needed to use components [EulerExplicitIntegrationScheme] -->
    <RequiredPlugin pluginName="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [MeshSpringForceField] -->
    <RequiredPlugin pluginName="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [HexahedronSetGeometryAlgorithms QuadSetTopologyContainer QuadSetTopologyModifier] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin pluginName="Sofa.Component.Topology.Mapping"/> <!-- Needed to use components [Hexa2QuadTopologicalMapping] -->
    <RequiredPlugin pluginName="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin pluginName="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
    <DefaultAnimationLoop/>
    <VisualStyle displayFlags="showBehaviorModels showForceFields" />

    <Node name="DeformableObject">

        <!-- Matrix system is diagonal because integration is explicit and Mass is diagonal -->
        <!-- No need for a LinearSolver -->
        <EulerExplicitIntegrationScheme name="odeExplicitSolver" symplectic="false"/>

        <MechanicalObject name="dofs"/>

        <RegularGridTopology name="topology" nx="4" ny="4" nz="11" xmin="-1.5" xmax="1.5" ymin="-1.5" ymax="1.5" zmin="0" zmax="10" />
        <HexahedronSetGeometryAlgorithms/>
        <UniformMass totalMass="15"/>

        <BoxROI box="-1.5 -1.5 0 1.5 1.5 0.0001" name="box"/>
        <FixedProjectiveConstraint indices="@box.indices" />
        <MeshSpringForceField stiffness="3E2"/>

        <Node name="visual">
            <QuadSetTopologyContainer  name="Container" />
            <QuadSetTopologyModifier/>
            <Hexa2QuadTopologicalMapping input="@../topology" output="@Container" />
            <OglModel name="Visual" color="yellow" quads="@Container.quads" />
            <IdentityMapping input="@../dofs" output="@Visual" />
        </Node>

    </Node>

    <Node name="floor-visual">
        <MeshOBJLoader name="meshLoader" filename="mesh/floorFlat.obj" scale3d="0.5 0.5 0.5"/>
        <OglModel src="@meshLoader" dy="-8" dz="10"/>
        <OglModel src="@meshLoader" rx="90" dy="2"/>
    </Node>
</Node>
def createScene(root_node):

   root = root_node.addChild('root', gravity="0 -9.81 0", dt="0.00001")

   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Engine.Select")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.IO.Mesh")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Mapping.Linear")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Mass")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.IntegrationScheme.Forward")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.SolidMechanics.Spring")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.StateContainer")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Dynamic")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Container.Grid")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Topology.Mapping")
   root.addObject('RequiredPlugin', pluginName="Sofa.Component.Visual")
   root.addObject('RequiredPlugin', pluginName="Sofa.GL.Component.Rendering3D")
   root.addObject('DefaultAnimationLoop', )
   root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields")

   deformable_object = root.addChild('DeformableObject')

   deformable_object.addObject('EulerExplicitIntegrationScheme', name="odeExplicitSolver", symplectic="false")
   deformable_object.addObject('MechanicalObject', name="dofs")
   deformable_object.addObject('RegularGridTopology', name="topology", nx="4", ny="4", nz="11", xmin="-1.5", xmax="1.5", ymin="-1.5", ymax="1.5", zmin="0", zmax="10")
   deformable_object.addObject('HexahedronSetGeometryAlgorithms', )
   deformable_object.addObject('UniformMass', totalMass="15")
   deformable_object.addObject('BoxROI', box="-1.5 -1.5 0 1.5 1.5 0.0001", name="box")
   deformable_object.addObject('FixedProjectiveConstraint', indices="@box.indices")
   deformable_object.addObject('MeshSpringForceField', stiffness="3E2")

   visual = DeformableObject.addChild('visual')

   visual.addObject('QuadSetTopologyContainer', name="Container")
   visual.addObject('QuadSetTopologyModifier', )
   visual.addObject('Hexa2QuadTopologicalMapping', input="@../topology", output="@Container")
   visual.addObject('OglModel', name="Visual", color="yellow", quads="@Container.quads")
   visual.addObject('IdentityMapping', input="@../dofs", output="@Visual")

   floor_visual = root.addChild('floor-visual')

   floor_visual.addObject('MeshOBJLoader', name="meshLoader", filename="mesh/floorFlat.obj", scale3d="0.5 0.5 0.5")
   floor_visual.addObject('OglModel', src="@meshLoader", dy="-8", dz="10")
   floor_visual.addObject('OglModel', src="@meshLoader", rx="90", dy="2")