Skip to content

PlaneForceField

Repulsion applied by a plane toward the exterior (half-space) Supports GPU-side computations using CUDA

Templates:

  • Rigid3d
  • Vec1d
  • Vec2d
  • Vec3d
  • Vec6d

Target: Sofa.Component.MechanicalLoad

namespace: sofa::component::mechanicalload

parents:

  • ForceField

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
isCompliance Consider the component as a compliance, else as a stiffness 0
rayleighStiffness Rayleigh damping - stiffness matrix coefficient 0
normal plane normal. (default=[0,1,0])
d plane d coef. (default=0) 0
stiffness force stiffness. (default=500) 500
damping force damping. (default=5) 5
maxForce if non-null , the max force that can be applied to the object. (default=0) 0
bilateral if true the plane force field is applied on both sides. (default=false) 0
localRange optional range of local DOF indices. Any computation involving indices outside of this range are discarded (useful for parallelization using mesh partitionning) -1 -1
planeColor plane color. (default=[0.0,0.5,0.2,1.0]) 0 0.5 0.2 1
Visualization
showPlane enable/disable drawing of plane. (default=false) 0
showPlaneSize plane display size if draw is enabled. (default=10) 10

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
mechanicalStates List of mechanical states to which this component is associated
mstate MechanicalState used by this component

Examples

Component/MechanicalLoad/PlaneForceField.scn

<Node name="root" dt="0.01">
    <RequiredPlugin name="Sofa.Component.Collision.Detection.Algorithm"/> <!-- Needed to use components [BVHNarrowPhase BruteForceBroadPhase CollisionPipeline] -->
    <RequiredPlugin name="Sofa.Component.Collision.Detection.Intersection"/> <!-- Needed to use components [NewProximityIntersection] -->
    <RequiredPlugin name="Sofa.Component.Collision.Geometry"/> <!-- Needed to use components [TriangleCollisionModel] -->
    <RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
    <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.MechanicalLoad"/> <!-- Needed to use components [PlaneForceField] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <RequiredPlugin name="Sofa.Component.SolidMechanics.Spring"/> <!-- Needed to use components [RegularGridSpringForceField] -->
    <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.Component.Topology.Container.Grid"/> <!-- Needed to use components [RegularGridTopology] -->
    <RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

    <DefaultAnimationLoop/>
    <VisualStyle displayFlags="showBehaviorModels showForceFields" />
    <CollisionPipeline depth="6" verbose="0" draw="0" />
    <BruteForceBroadPhase/>
    <BVHNarrowPhase/>
    <NewProximityIntersection name="Proximity" alarmDistance="0.3" contactDistance="0.2" />
    <CollisionResponse name="Response" response="PenalityContactForceField" />
    <Node name="M1">
        <EulerImplicitSolver name="cg_odesolver" printLog="false"  rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
        <MechanicalObject />
        <UniformMass totalMass="10" />
        <RegularGridTopology nx="2" ny="2" nz="2" xmin="-3.5" xmax="3.5" ymin="-3.5" ymax="3.5" zmin="-3.5" zmax="3.5" />
        <RegularGridSpringForceField name="Springs" stiffness="1000" />
        <PlaneForceField normal="0 1 0" d="-10" stiffness="100000" showPlane="1" showPlaneSize="20"/>
        <Node name="Visu">
            <MeshOBJLoader name="meshLoader_0" filename="mesh/smCube125.obj" handleSeams="1" />
            <OglModel name="Visual" src="@meshLoader_0" color="blue" />
            <BarycentricMapping input="@.." output="@Visual" />
        </Node>
        <Node name="Collis">
            <MeshOBJLoader name="loader" filename="mesh/smCube125.obj" />
            <MeshTopology src="@loader" />
            <MechanicalObject src="@loader" />
            <TriangleCollisionModel />
            <BarycentricMapping input="@.." output="@Collis" />
        </Node>
    </Node>
</Node>
def createScene(rootNode):

    root = rootNode.addChild('root', dt="0.01")
    root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Algorithm")
    root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Detection.Intersection")
    root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
    root.addObject('RequiredPlugin', name="Sofa.Component.Collision.Response.Contact")
    root.addObject('RequiredPlugin', name="Sofa.Component.IO.Mesh")
    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.MechanicalLoad")
    root.addObject('RequiredPlugin', name="Sofa.Component.ODESolver.Backward")
    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.Component.Topology.Container.Grid")
    root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
    root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
    root.addObject('DefaultAnimationLoop')
    root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields")
    root.addObject('CollisionPipeline', depth="6", verbose="0", draw="0")
    root.addObject('BruteForceBroadPhase')
    root.addObject('BVHNarrowPhase')
    root.addObject('NewProximityIntersection', name="Proximity", alarmDistance="0.3", contactDistance="0.2")
    root.addObject('CollisionResponse', name="Response", response="PenalityContactForceField")

    M1 = root.addChild('M1')
    M1.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
    M1.addObject('CGLinearSolver', iterations="25", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
    M1.addObject('MechanicalObject')
    M1.addObject('UniformMass', totalMass="10")
    M1.addObject('RegularGridTopology', nx="2", ny="2", nz="2", xmin="-3.5", xmax="3.5", ymin="-3.5", ymax="3.5", zmin="-3.5", zmax="3.5")
    M1.addObject('RegularGridSpringForceField', name="Springs", stiffness="1000")
    M1.addObject('PlaneForceField', normal="0 1 0", d="-10", stiffness="100000", showPlane="1", showPlaneSize="20")

    Visu = M1.addChild('Visu')
    Visu.addObject('MeshOBJLoader', name="meshLoader_0", filename="mesh/smCube125.obj", handleSeams="1")
    Visu.addObject('OglModel', name="Visual", src="@meshLoader_0", color="blue")
    Visu.addObject('BarycentricMapping', input="@..", output="@Visual")

    Collis = M1.addChild('Collis')
    Collis.addObject('MeshOBJLoader', name="loader", filename="mesh/smCube125.obj")
    Collis.addObject('MeshTopology', src="@loader")
    Collis.addObject('MechanicalObject', src="@loader")
    Collis.addObject('TriangleCollisionModel')
    Collis.addObject('BarycentricMapping', input="@..", output="@Collis")