Home › Forum › SOFA › Using SOFA › [SOLVED] How to give multi-physical properties to one tetrahedron object
Tagged: SOFA
- This topic has 7 replies, 4 voices, and was last updated 2 years, 10 months ago by
Shaswat.
-
AuthorPosts
-
5 September 2018 at 11:13 #11842
Suwan
BlockedHello,
I want to give multi-physical properties to one tetrahedron object.
For example, there is a tetrahedron object in a scene.
An area of the object reponses to an touch as flexibler behavior and other area of the object does as stiffer behavior.Could you give me an advice for making a scene which achieves my goal?
What components of SOFA do I have to use and what examples do I refer to?Thank you in advice.
Suwan
6 September 2018 at 12:03 #11852Binesh
BlockedHi @suwan
In TetrahedronFEMForcefield, you can use local stiffness factor for each element to get flexible behavior or stifferBest Wishes,
Behnam Binesh
7 September 2018 at 02:57 #11904Suwan
BlockedHi @Binesh
Thank you so much.
Sorry that I am a biginner in SOFA.
Could you explain how I can set local stiffness factor for each element?
I’d appreciate it if you’d show me an example like code snippt which uses TetrahedronFEMForcefield and sets local factor for each element.Best regards,
Suwan7 September 2018 at 18:18 #11908Hugo
KeymasterHi @suwan,
You can set a local stiffness factor in the TetrahedronFEMForcefield using the data called localStiffnessFactor. It is defined as a “vector allowing specification of different stiffness per element. If there are N element and M values are specified, the youngModulus factor for element i would be localStiffnessFactor[i*M/N]”
Hope this helps
Hugo
8 September 2018 at 02:10 #11913Suwan
BlockedThank @Hugo,
My questions are as allowing:
1. How to set localStiffnessFactor in the TetrahedronFEMForcefield
I haven’t found any SOFA scene example of localStiffnessFactor.
Is it just list of factor values?
Can I input it by reading a file?
Could you give me an example scene?2. Could you explain meaning of i*M/N more?
I understood the youngModulus index for element i, i*M/N, was ratio location of M values.
For example, there are a tetrahedral model of 30 elements and 3 numbers of local stiffness factors.
0-9 element ==> 0th index of local stiffness factors
10-19 element ==> 1st index of local stiffness factors
20-29 element ==> 2nd index of local stiffness factors
Is it right?I’m sorry to bother you for being just a beginner.
I need more time to know SOFA framework and usages.Best regards,
Suwan11 September 2018 at 19:39 #11927Hugo
KeymasterHey @suwan,
Let me reply point by point:
1) in TetrahedronFEMForcefield, the data localStiffnessFactor is a list of factor values, you can set a localStiffnessFactor for each tetrahedron. I think you could read this from a file using a trick:
<MeshObjLoader template="Vec1d" name="myStiffnessLoader" filename="myFileWithLocalStiffnessFactor.obj" /> ... <TetrahedronFEMForcefield localStiffnessFactor="@myStiffnessLoader.position" />
I am not sure it will work, do not hesitate to let me know.
2) Could you explain meaning of i*M/N more?
It means that if stiffness=1000, localStiffnessFactor = “0.5 2 3” and you have 1200 tetrahedra in your mesh, then:
– the stiffness of the first 400 (0-399) tetra (1/3) equals 1200*0.5=600
– the stiffness of the tetra 400-799 (2/3) equals 1200*2=2400
– the stiffness of the tetra 800-1199 (3/3) equals 1200*3=3600Best regards,
Hugo
12 September 2018 at 09:19 #11931Suwan
BlockedHi @hugo,
I solved this case by using IndexValueMapper component.
I implemented a scene consisted of multi-physical properties of objects.
Code snippt of the scene is as follows :<MeshGmshLoader name=”Loader” filename=”msh file location” scale=”0.2″/>
<MechanicalObject src=”@Loader” name=”mecaObj” restScale=”1″ />
<Node name=”MeshROI” >
<MeshObjLoader name=”ROIloader” filename=”obj file location” scale=”0.2″ translation=”0 0 0″ rotation=”0 0 0″/>
<MeshROI name=”ROIm”
drawROI=”0″
drawMesh=”0″
drawBox=”0″
drawEdges=”0″
drawTriangles=”1″
drawTetrahedra=”1″
drawOut=”0″
computeMeshROI=”1″
doUpdate=”0″
position=”@../mecaObj.position”
tetrahedra=”@../Loader.tetrahedra”
ROIposition=”@ROIloader.position”
localIndices=”1″
ROItriangles=”@ROIloader.triangles” />
<VisualModel name=”Visual” color=”blue” dx=”60″ />
</Node><IndexValueMapper name=”ind_Out” indices=”@MeshROI/ROIm.tetrahedronOutIndices” value=”the 1st youngModulus” />
<IndexValueMapper name=”ind_Total” inputValues=”@ind_Out.outputValues” indices=”@MeshROI/ROIm.tetrahedronIndices” value=”the 2nd youngModulus” />
…
<TetrahedronFEMForceField name=”FEM” youngModulus=”@../ind_Total.outputValues” poissonRatio=”0.49″ />Your advice was so helpful.
Thanks.Best regards,
Suwan30 October 2021 at 16:28 #20714Shaswat
BlockedHi @suwan,
Could you share your entire scene file?
I am getting a segmentation error when I am implementing IndexValueMapper.
Here is my scene file –
<Node name="root" dt="0.01" gravity="0 0 0"> <Node name="Disk1"> <MeshGmshLoader name="DiskLoader" filename="Mesh/Robot1.msh"/> <TetrahedronSetTopologyContainer name="topo1" src="@DiskLoader"/> <TetrahedronSetGeometryAlgorithms template="Vec3d" name="container"/> <MechanicalObject template="Vec3d" name="obj1" showObject="1"/> <TetrahedronFEMForceField name="FEM" youngModulus="1000" poissonRatio="0.49" /> <Node name="MeshROI" > <MeshObjLoader name="ROIloader" filename="Mesh/Spring.obj" translation="0 0 0" rotation="0 0 0"/> <MeshROI name="ROIm" drawROI="0" drawMesh="0" drawBox="0" drawEdges="0" drawTriangles="1" drawTetrahedra="1" drawOut="0" computeMeshROI="1" doUpdate="0" position="@../obj1.position" tetrahedra="@../DiskLoader.tetrahedra" ROIposition="@ROIloader.position" localIndices="1" ROItriangles="@ROIloader.triangles" /> <VisualModel name="Visual" color="blue" /> </Node> <IndexValueMapper name="ind_Out" indices="@MeshROI/ROIm.tetrahedronOutIndices" value="1e7" /> <IndexValueMapper name="ind_Total" inputValues="@ind_Out.outputValues" indices="@MeshROI/ROIm.tetrahedronIndices" value="100" /> <TetrahedronFEMForceField name="FEM1" youngModulus="@ind_Total.outputValues" poissonRatio="0.49" /> </Node> </Node>
Regards
-
AuthorPosts
- You must be logged in to reply to this topic.