Home › Forum › SofaPython3 › Programming with SofaPython3 › Problems with ‘CubeTopology’ when using ‘BeamFEMForceField’
Tagged: SofaPython 3
- This topic has 6 replies, 2 voices, and was last updated 3 years, 1 month ago by Andrija.
-
AuthorPosts
-
7 October 2021 at 10:46 #20521AndrijaBlocked
Hi SOFA community,
We are trying to simulate a bending of a frame like structure that is just a set of connected beams i.e. beam elements. I am using
BeamFEMForceField
for this. Something like show in the image below:
Part of the code that defines this:
mechanics.createObject("MechanicalObject", template="Rigid3d", name="DOFs", position=[ [2, 2, 22, 0, 0.41321628, 0, 0.91063291], # 0 [12.5, 2, 10, 0, 0.41321628, 0, 0.91063291], # 1 [23, 2, -2, 0, 0.41321628, 0, 0.91063291], [35, 9.5, 8, 0.30643331, -0.28450399, 0.35283288, 0.83705739], [48, 17, 18, 0.30643331, -0.28450399, 0.35283288, 0.83705739], [50, 9, 10, 0. , -0.64262055, 0. , 0.76618459]]) mechanics.createObject("BeamFEMForceField", name="FEM", radius=0.1, youngModulus=800000000, poissonRatio=0.2) mechanics.createObject("MeshTopology", name="lines", lines="0 1 1 2 2 3 3 4 4 5", position="@DOFs.position", drawEdges="1")
This works fine. But we also want to simulate a contact, thus we used the
CubeTopology
to generate the mesh for the collision model. Part of the code:Visu.createObject("CubeTopology", nx="100", ny="3", nz="3", min="0 -0.02 -0.02", max="5 0.02 0.02") Visu.createObject("MechanicalObject") Visu.createObject("BeamLinearMapping", isMechanical="true") Visu.createObject("TriangleCollisionModel") Visu.createObject("LineCollisionModel") Visu.createObject("PointCollisionModel")
But then we get something like this:
My question. The collision model does not look good as there are some curvatures at the edges. I know that this is due to the orientation of the
DOFs
at nodes (points). But my question is there some workaround this? How to generate a nice mesh to deal with this edge cases and follow the lines? Or is there some other way to generate a better mesh? Or maybe are there some ways to attach already generated mesh (for example we would use some other softwares to generate a mesh likegmsh
) to this Beam model (similar like it is done when importing mesh externally)? In short, how to generate a mesh model for this frame structure to follow nicely the lines and deal with this edge cases?This is a part of our Master Student Project, and I would greatly appreciate for any help and suggestions!
Thanks!
Best,
Andrija7 October 2021 at 10:56 #20547HugoKeymasterHi @andrija987
Sorry it seems your CollisionModel image is not well loaded/referenced.
Could you post it again?But I am not sure the mapping coming with the BeamFEMFF will allow this. We should soon release new codes for beams that could work for you.
Best wishes,
Hugo
8 October 2021 at 07:49 #20554AndrijaBlockedHi @hugo,
Thank you for your fast reply. Yes sorry I don’t know why the images didn’t loaded.
Here are the images again:
If they don’t work again, here are the links:
https://drive.google.com/file/d/1aDP362Jc1GDRZkGJJMcVF_Bn8ApuA6CX/view?usp=sharing
https://drive.google.com/file/d/18sDEAdAExjIuAsUxlxSc3DTDsTkAWQJ-/view?usp=sharing
The only workourn so far that I manage to find is not to use any mesh for the collision model but rather just lines and point of the beams, i.e. to use this:
Visu = mechanics.addChild('Visu') Visu.addObject("MechanicalObject") Visu.addObject("IdentityMapping") Visu.addObject("LineCollisionModel") Visu.addObject("PointCollisionModel", name="FloorPoint")
But still the problem remains if I want to use a
CubeTopology
.It is great to hear if you will somehow enable this in the next version 🙂 !
Thanks again for the help!!!
Best regards,
Andrija8 October 2021 at 09:00 #20564HugoKeymasterHi @andrija987
It looks like the interpolation is just working fine. The third frame being aligned with the second frame, the interpolation between third and fourth seems logical.
Have you tried to change the orientation of this third frame so that its red (x) axis correspond to the derivative between frame 2 and 4 ?
Best
Hugo
8 October 2021 at 17:14 #20566AndrijaBlockedHi @hugo,
Thank again for the help.
I am not sure what you meant exactly. To avoid confusion (from my side), here are the images where I marked the frames / beams:
https://drive.google.com/file/d/1hjtRaWu0yc-qZAHnl6HKgTCkboEm_5uj/view?usp=sharing
https://drive.google.com/file/d/1rSxMR0pK3m6SJW34Amzya7D5yKqo2y1c/view?usp=sharing
Following this, yes it seems to me fine for the frame 1 and 2. The problem is when I go from frame 2 to frame 3, as you see there is an unwanted curvature in mesh for the collision model.
If we follow this numeration of frames, like I illustrated on the images, then I didn’t try what you suggested. I am not entirely sure how to do what you propose? In general I think I understand what you want to say, that by taking the derivative it should give the right orientation and then the mesh should be better. But don’t know how exactly to do this? To have a function that represents a line between the frame 2 and 4 (line through 2 points), then to find the derivative of this, which should give me the right orientation of frame 3?
Did I understood right?
Thanks!!!
Best,
Andrija2 November 2021 at 18:54 #20722HugoKeymasterDear @andrija987
Sorry for the delay. The organization of the SOFA Week 2021 is keeping us busy.
I thought again about your issue. The BeamLinearMapping is a mapping computing a non-linear interpolation between the rigid frames (see the code here). If you want to have a CubeTopology which curvature is locally discontinuous (90deg angles between beam 2 and 3) it will be interpolated following the function line 158. Using this BeamMapping you could try to change the orientation of the frame number 3:
[23, 2, -2, 0, 0.41321628, 0, 0.91063291],
and replace it by the linear interpolation of the orientation of the frame 2 and 4.
Else, I wonder if you are not interested in a RigidMapping instead (no interpolation, just mapping cubes over a rigid frame). You can see the example for instance using the RigidMapping example.
Hope this helps.
BestHugo
3 November 2021 at 20:56 #20737AndrijaBlockedHi @hugo,
Many thanks for your great help and for the reply (no worries with time of response I know you are busy).
Yes thanks for all the help, information and links! It makes sense, I will try what you proposed.
No we didn’t consider using RigidMapping, but thanks! Sounds like great idea, and actually something that maybe is more easier to implement. We will look into it. When we have the update I will post our solution here.
Thanks again!
Best,
Andrija -
AuthorPosts
- You must be logged in to reply to this topic.