Rigidification problem - Constraint rigidified part #129
-
Hi everyone, I am currently working on the deformation of a bloc in SOFA. I want to simulate a bloc clamped at both end where on side is totally fixed and the other side is clamped to a rigid part that can move. I am struggling to model the rigid moving part (modeled as a box). I tried to use the rigidify function but it is not working as I want. The thing is the rigidication constrain the rigid part such as it cannot move anymore. The thing I want is a moving part acting as a rigid component (such as I could apply forces and displacements on it and get a uniform response). I looked on the example of rigidication with the liver. It is exactly what I want to do (without the fixedConstraint function). I do not see why the top part of my block is totally constraint. Please, could you help me to understand and solve my problem? Here is the code that I am currently running: Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @bmauze Thanks for your question. As the yours scene is using the SofaPython2 binding and that this binding is now deprecated I prefered to translate it to SofaPython3. Which leads to the following simulation. The scene used is the following import Sofa
import numpy
from splib3.constants import Key
from math import sin, cos, sqrt
from stlib3.physics.constraints import *
from stlib3.physics.deformable import ElasticMaterialObject
from stlib3.physics.mixedmaterial import Rigidify
from splib3.objectmodel import SofaPrefab, SofaObject, setData
PI = 3.14159265359
meshRobot='bloc_v2_mesh1.vtk'
def createScene(rootNode):
# Root node
rootNode.dt = 0.05
rootNode.gravity =[0, 0, -9.81]
rootNode.addObject('VisualStyle', displayFlags='showBehaviorModels showCollision showVisualModels showForceFields showInteractionForceFields hideCollisionModels hideBoundingCollisionModels hideWireframe')
rootNode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight")
#Required plugin
rootNode.addObject('RequiredPlugin', pluginName=' SoftRobots SoftRobots.Inverse SofaPython3 SofaPreconditioner SofaSparseSolver')
rootNode.addObject('FreeMotionAnimationLoop')
rootNode.addObject('DefaultPipeline', verbose=0)
rootNode.addObject('DefaultContactManager', response='FrictionContactConstraint')
rootNode.addObject('LocalMinDistance', name="Proximity", alarmDistance=3, contactDistance=0.5)
modelling = rootNode.addChild("Modelling")
elasticobject = ElasticMaterialObject(volumeMeshFileName=meshRobot, translation=[0.0, 0.0, 0.0], rotation=[0.0, 0.0, 0.0],
youngModulus=180.0, poissonRatio=0.45, totalMass=0.050, solverName="")
modelling.addChild(elasticobject)
modelling.init()
# Fixed box
FixedBox(elasticobject, atPositions=[[-2.51, -0.01, -11.01],[2.51, 1.01, -10.00]], doVisualization=True)
# Selection box
selection = modelling.addChild("Selection")
commandBox=selection.addObject('BoxROI', name="box",
position=elasticobject.dofs.position.getLinkPath(),
box=[[-2.51, -0.01, 0.701], [2.51, 1.01, 1.01]], drawBoxes=True)
#commandBox.init()
# Rigidification management
rigidifiedstruct = Rigidify(modelling, elasticobject ,
groupIndices=[selection.box.indices.value.tolist()],
frames=[[0,0.5,1,0,0,0,1]],
name="RigidifiedStructure")
rigidifiedstruct.DeformableParts.addObject("UncoupledConstraintCorrection")
rigidifiedstruct.RigidParts.RigidifiedParticules.addObject("UncoupledConstraintCorrection")
rigidifiedstruct.RigidParts.addObject("UncoupledConstraintCorrection")
setData(rigidifiedstruct.RigidParts.RigidifiedParticules.dofs, showObject=True, showObjectScale=0.1, drawMode=1, showColor=[1., 1., 0., 1.])
setData(rigidifiedstruct.DeformableParts.dofs, showObject=True, showObjectScale=0.1, drawMode=2)
setData(rigidifiedstruct.RigidParts.dofs, showObject=True, showObjectScale=1, drawMode=1)
simulationNode = rootNode.addChild("Simulation")
simulationNode.addObject("EulerImplicitSolver")
simulationNode.addObject("CGLinearSolver")
simulationNode.addChild(rigidifiedstruct)
return rootNode |
Beta Was this translation helpful? Give feedback.
Hi @bmauze
Thanks for your question.
As the yours scene is using the SofaPython2 binding and that this binding is now deprecated I prefered to translate it to SofaPython3. Which leads to the following simulation.
The scene used is the following