Skip to content

TetrahedronDiffusionFEMForceField

Isotropic or anisotropic diffusion on Tetrahedral Meshes.

Vec1d

Templates:

  • Vec1d

Target: Sofa.Component.Diffusion

namespace: sofa::component::diffusion

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
constantDiffusionCoefficient Constant diffusion coefficient 1
tetraDiffusionCoefficient Diffusion coefficient for each tetrahedron, by default equal to constantDiffusionCoefficient.
anisotropyRatio Anisotropy ratio (r²>1). Default is 1.0 = isotropy. 1
transverseAnisotropyArray Data to handle topology on tetrahedra
tagMechanics Tag of the Mechanical Object. meca
Visualization
drawConduc To display conductivity map. 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 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<Vec1d>
topology link to the topology container BaseMeshTopology

Vec2d

Templates:

  • Vec2d

Target: Sofa.Component.Diffusion

namespace: sofa::component::diffusion

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
constantDiffusionCoefficient Constant diffusion coefficient 1
tetraDiffusionCoefficient Diffusion coefficient for each tetrahedron, by default equal to constantDiffusionCoefficient.
anisotropyRatio Anisotropy ratio (r²>1). Default is 1.0 = isotropy. 1
transverseAnisotropyArray Data to handle topology on tetrahedra
tagMechanics Tag of the Mechanical Object. meca
Visualization
drawConduc To display conductivity map. 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 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<Vec2d>
topology link to the topology container BaseMeshTopology

Vec3d

Templates:

  • Vec3d

Target: Sofa.Component.Diffusion

namespace: sofa::component::diffusion

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
constantDiffusionCoefficient Constant diffusion coefficient 1
tetraDiffusionCoefficient Diffusion coefficient for each tetrahedron, by default equal to constantDiffusionCoefficient.
anisotropyRatio Anisotropy ratio (r²>1). Default is 1.0 = isotropy. 1
transverseAnisotropyArray Data to handle topology on tetrahedra
tagMechanics Tag of the Mechanical Object. meca
Visualization
drawConduc To display conductivity map. 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 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>
topology link to the topology container BaseMeshTopology

Examples

TetrahedronDiffusionFEMForceField.scn

<Node name="root" dt="0.00001" gravity="0 0 0" >
    <RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [LinearMovementProjectiveConstraint] -->
    <RequiredPlugin name="Sofa.Component.Diffusion"/> <!-- Needed to use components [TetrahedronDiffusionFEMForceField] -->
    <RequiredPlugin name="Sofa.Component.Engine.Select"/> <!-- Needed to use components [BoxROI] -->
    <RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader MeshVTKLoader] -->
    <RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
    <RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
    <RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [MeshMatrixMass] -->
    <RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
    <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.Engine"/> <!-- Needed to use components [TextureInterpolation] -->
    <RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->

    <VisualStyle displayFlags="showBehaviorModels"/>

    <MeshVTKLoader name="meshLoader" filename="mesh/raptorTetra_8418.vtu" />
    <MeshOBJLoader name="potentialLoader" filename="mesh/raptorTemperature.obj" />

    <TetrahedronSetTopologyContainer name="topo" src="@meshLoader" tags="mechanics"/>
    <MechanicalObject template="Vec3" name="raptorDOFs" src="@meshLoader" tags="mechanics" />
    <TetrahedronSetTopologyModifier name="Modifier" tags="mechanics"/>
    <TetrahedronSetGeometryAlgorithms template="Vec3" name="GeomAlgo"  tags="mechanics"/>
    <BoxROI name="box-hot" box="-3 4 4 3 8 8" drawBoxes="1" position="@raptorDOFs.position"/>
    <BoxROI name="box-cold" box="-3 4 -4 3 8 -10" drawBoxes="1" position="@raptorDOFs.position"/>
    <DefaultAnimationLoop/>


    <Node name="Temperature" gravity="0 0 0"  >

        <EulerImplicitSolver name="EulerExplicitSolver" firstOrder="1" tags="heat" rayleighStiffness="0.1" rayleighMass="0.1" />
        <CGLinearSolver name="CG" iterations="1000" tolerance="1.0e-10" threshold="1.0e-30" tags="heat"/>
        <MechanicalObject template="Vec1" position="@../potentialLoader.position"  name="gridTemperature" bbox="0 0 0 0 0 0" tags="heat"/>
        <TetrahedronDiffusionFEMForceField template="Vec1" name="DiffusionForceField" topology="@../topo" constantDiffusionCoefficient="1500" printLog="0" drawConduc="0" tagMechanics="mechanics" tags="heat"/>
        <MeshMatrixMass name="Mass" template="Vec1,Vec3" lumping="0" massDensity="1.0" printLog="0" tags="heat" topology="@../topo" geometryState="@../raptorDOFs"/>

        <LinearMovementProjectiveConstraint template="Vec1" keyTimes="0 0.005 0.006" movements="0 0 1" indices="@../box-cold.indices" />
        <LinearMovementProjectiveConstraint template="Vec1" keyTimes="0.001 0.002 0.004 0.005 0.006" movements="0 1 0.5 1 0" indices="@../box-hot.indices" />

        <Node name="Visu">
            <TextureInterpolation template="Vec1" name="EngineInterpolation"  input_states="@../gridTemperature.position"  input_coordinates="@../../raptorDOFs.position"  min_value="0.0"  max_value="1.0"  manual_scale="1"  drawPotentiels="0"  showIndicesScale="5e-05" />
            <OglModel template="Vec3" name="oglPotentiel" texcoords="@EngineInterpolation.output_coordinates" handleDynamicTopology="0" texturename="textures/heatColor.bmp" scale3d="1 1 1"  material="Default Diffuse 1 1 1 1 0.5 Ambient 1 1 1 1 0.3 Specular 0 0.5 0.5 0.5 1 Emissive 0 0.5 0.5 0.5 1 Shininess 0 45 No texture linked to the material No bump texture linked to the material "/>
            <IdentityMapping input="@../../raptorDOFs" output="@oglPotentiel" />
        </Node>
    </Node>
</Node>
def createScene(root_node):

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

   root.addObject('RequiredPlugin', name="Sofa.Component.Constraint.Projective")
   root.addObject('RequiredPlugin', name="Sofa.Component.Diffusion")
   root.addObject('RequiredPlugin', name="Sofa.Component.Engine.Select")
   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.ODESolver.Backward")
   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.Engine")
   root.addObject('RequiredPlugin', name="Sofa.GL.Component.Rendering3D")
   root.addObject('VisualStyle', displayFlags="showBehaviorModels")
   root.addObject('MeshVTKLoader', name="meshLoader", filename="mesh/raptorTetra_8418.vtu")
   root.addObject('MeshOBJLoader', name="potentialLoader", filename="mesh/raptorTemperature.obj")
   root.addObject('TetrahedronSetTopologyContainer', name="topo", src="@meshLoader", tags="mechanics")
   root.addObject('MechanicalObject', template="Vec3", name="raptorDOFs", src="@meshLoader", tags="mechanics")
   root.addObject('TetrahedronSetTopologyModifier', name="Modifier", tags="mechanics")
   root.addObject('TetrahedronSetGeometryAlgorithms', template="Vec3", name="GeomAlgo", tags="mechanics")
   root.addObject('BoxROI', name="box-hot", box="-3 4 4 3 8 8", drawBoxes="1", position="@raptorDOFs.position")
   root.addObject('BoxROI', name="box-cold", box="-3 4 -4 3 8 -10", drawBoxes="1", position="@raptorDOFs.position")
   root.addObject('DefaultAnimationLoop', )

   temperature = root.addChild('Temperature', gravity="0 0 0")

   temperature.addObject('EulerImplicitSolver', name="EulerExplicitSolver", firstOrder="1", tags="heat", rayleighStiffness="0.1", rayleighMass="0.1")
   temperature.addObject('CGLinearSolver', name="CG", iterations="1000", tolerance="1.0e-10", threshold="1.0e-30", tags="heat")
   temperature.addObject('MechanicalObject', template="Vec1", position="@../potentialLoader.position", name="gridTemperature", bbox="0 0 0 0 0 0", tags="heat")
   temperature.addObject('TetrahedronDiffusionFEMForceField', template="Vec1", name="DiffusionForceField", topology="@../topo", constantDiffusionCoefficient="1500", printLog="0", drawConduc="0", tagMechanics="mechanics", tags="heat")
   temperature.addObject('MeshMatrixMass', name="Mass", template="Vec1,Vec3", lumping="0", massDensity="1.0", printLog="0", tags="heat", topology="@../topo", geometryState="@../raptorDOFs")
   temperature.addObject('LinearMovementProjectiveConstraint', template="Vec1", keyTimes="0 0.005 0.006", movements="0 0 1", indices="@../box-cold.indices")
   temperature.addObject('LinearMovementProjectiveConstraint', template="Vec1", keyTimes="0.001 0.002 0.004 0.005 0.006", movements="0 1 0.5 1 0", indices="@../box-hot.indices")

   visu = Temperature.addChild('Visu')

   visu.addObject('TextureInterpolation', template="Vec1", name="EngineInterpolation", input_states="@../gridTemperature.position", input_coordinates="@../../raptorDOFs.position", min_value="0.0", max_value="1.0", manual_scale="1", drawPotentiels="0", showIndicesScale="5e-05")
   visu.addObject('OglModel', template="Vec3", name="oglPotentiel", texcoords="@EngineInterpolation.output_coordinates", handleDynamicTopology="0", texturename="textures/heatColor.bmp", scale3d="1 1 1", material="Default Diffuse 1 1 1 1 0.5 Ambient 1 1 1 1 0.3 Specular 0 0.5 0.5 0.5 1 Emissive 0 0.5 0.5 0.5 1 Shininess 0 45 No texture linked to the material No bump texture linked to the material ")
   visu.addObject('IdentityMapping', input="@../../raptorDOFs", output="@oglPotentiel")