DistanceGridForceField
Force applied by a distancegrid toward the exterior, the interior, or the surface
Vec3d
Templates:
- Vec3d
Target: SofaDistanceGrid
namespace: sofa::component::forcefield
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 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 |
rayleighStiffness | Rayleigh damping - stiffness matrix coefficient | 0 |
filename | load distance grid from specified file | |
scale | scaling factor for input file | 1 |
box | Field bounding box defined by xmin,ymin,zmin, xmax,ymax,zmax | |
nx | number of values on X axis | 64 |
ny | number of values on Y axis | 64 |
nz | number of values on Z axis | 64 |
stiffnessIn | force stiffness when inside of the object | 500 |
stiffnessOut | force stiffness when outside of the object | 0 |
damping | force damping coefficient | 0.01 |
maxdist | max distance of the surface after which no more force is applied | 1 |
minArea | minimal area for each triangle, as seen from the direction of the local surface (i.e. a flipped triangle will have a negative area) | 0 |
stiffnessArea | force stiffness if a triangle have an area less than minArea | 100 |
minVolume | minimal volume for each tetrahedron (a flipped triangle will have a negative volume) | 0 |
stiffnessVolume | force stiffness if a tetrahedron have an volume less than minVolume | 0 |
color | display color.(default=[0.0,0.5,0.2,1.0]) | 0 0.5 0.2 1 |
localRange | optional range of local DOF indices. Any computation involving only indices outside of this range are discarded (useful for parallelization using mesh partitioning) | -1 -1 |
Visualization | ||
draw | enable/disable drawing of distancegrid | 0 |
drawPoints | enable/disable drawing of distancegrid | 0 |
drawSize | display size if draw is enabled | 10 |
Links
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 | BaseObject |
master | nullptr for regular objects, or master object for which this object is one sub-objects | BaseObject |
mechanicalStates | List of mechanical states to which this component is associated | BaseMechanicalState |
mstate | MechanicalState used by this component | MechanicalState<Vec3d> |
Examples
DistanceGridForceField-liver.scn
<Node name="root" dt="0.01" showBoundingTree="0" gravity="0 -9.81 0">
<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 [MinProximityIntersection] -->
<RequiredPlugin name="Sofa.Component.Collision.Response.Contact"/> <!-- Needed to use components [CollisionResponse] -->
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshGmshLoader] -->
<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 [DiagonalMass] -->
<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.FEM.Elastic"/> <!-- Needed to use components [TetrahedronFEMForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TetrahedronSetGeometryAlgorithms TetrahedronSetTopologyContainer TetrahedronSetTopologyModifier] -->
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualStyle] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="SofaDistanceGrid"/> <!-- Needed to use components [DistanceGridForceField] -->
<VisualStyle displayFlags="showBehaviorModels showForceFields showCollisionModels" />
<CollisionPipeline verbose="0" />
<BruteForceBroadPhase/>
<BVHNarrowPhase/>
<CollisionResponse response="PenalityContactForceField" />
<MinProximityIntersection name="Proximity" alarmDistance="2" contactDistance="0.1" />
<Node name="Simulation">
<Node name="CubeObstacle">
<OglModel name="cubeVisual" filename="mesh/cube.obj" color="green"/>
</Node>
<Node name="liver">
<EulerImplicitSolver name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" />
<CGLinearSolver iterations="150" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" />
<MeshGmshLoader name="loader" filename="mesh/liver.msh"/>
<TetrahedronSetTopologyContainer name="tetras" src="@loader"/>
<TetrahedronSetTopologyModifier name="Modifier" />
<TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" />
<MechanicalObject name="meca"/>
<DiagonalMass vertexMass="100"/>
<TetrahedronFEMForceField youngModulus="1000000" poissonRatio="0.45"/>
<DistanceGridForceField filename="mesh/cubeDistanceGrid.fmesh" stiffnessIn="100000000" stiffnessOut="0" draw="true" drawPoints="true" printLog="false" drawSize="2"/>
<Node name="visual">
<OglModel name="visu" filename="mesh/liver.obj"/>
<BarycentricMapping input="@../meca" output="@visu"/>
</Node>
<PlaneForceField stiffness="1000000" d="-1"/>
</Node>
</Node>
</Node>
def createScene(root_node):
root = root_node.addChild('root', dt="0.01", showBoundingTree="0", gravity="0 -9.81 0")
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.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.FEM.Elastic")
root.addObject('RequiredPlugin', name="Sofa.Component.StateContainer")
root.addObject('RequiredPlugin', name="Sofa.Component.Topology.Container.Dynamic")
root.addObject('RequiredPlugin', name="Sofa.Component.Visual")
root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
root.addObject('RequiredPlugin', name="SofaDistanceGrid")
root.addObject('VisualStyle', displayFlags="showBehaviorModels showForceFields showCollisionModels")
root.addObject('CollisionPipeline', verbose="0")
root.addObject('BruteForceBroadPhase', )
root.addObject('BVHNarrowPhase', )
root.addObject('CollisionResponse', response="PenalityContactForceField")
root.addObject('MinProximityIntersection', name="Proximity", alarmDistance="2", contactDistance="0.1")
simulation = root.addChild('Simulation')
cube_obstacle = Simulation.addChild('CubeObstacle')
cube_obstacle.addObject('OglModel', name="cubeVisual", filename="mesh/cube.obj", color="green")
liver = Simulation.addChild('liver')
liver.addObject('EulerImplicitSolver', name="cg_odesolver", printLog="false", rayleighStiffness="0.1", rayleighMass="0.1")
liver.addObject('CGLinearSolver', iterations="150", name="linear solver", tolerance="1.0e-9", threshold="1.0e-9")
liver.addObject('MeshGmshLoader', name="loader", filename="mesh/liver.msh")
liver.addObject('TetrahedronSetTopologyContainer', name="tetras", src="@loader")
liver.addObject('TetrahedronSetTopologyModifier', name="Modifier")
liver.addObject('TetrahedronSetGeometryAlgorithms', name="GeomAlgo", template="Vec3d")
liver.addObject('MechanicalObject', name="meca")
liver.addObject('DiagonalMass', vertexMass="100")
liver.addObject('TetrahedronFEMForceField', youngModulus="1000000", poissonRatio="0.45")
liver.addObject('DistanceGridForceField', filename="mesh/cubeDistanceGrid.fmesh", stiffnessIn="100000000", stiffnessOut="0", draw="true", drawPoints="true", printLog="false", drawSize="2")
visual = liver.addChild('visual')
visual.addObject('OglModel', name="visu", filename="mesh/liver.obj")
visual.addObject('BarycentricMapping', input="@../meca", output="@visu")
liver.addObject('PlaneForceField', stiffness="1000000", d="-1")