Home › Forum › SOFA › Programming with SOFA › Natural vibration problem using a cantilever beam
- This topic has 11 replies, 2 voices, and was last updated 3 years, 1 month ago by Hugo.
-
AuthorPosts
-
28 May 2021 at 12:40 #19589SrNaranjaBlocked
Hi @Hugo,
I am working with SOFA. I have created a beam with the
<BeamFEMForceField>
and a topology based on lines. The beam is connected in one of its corners to a simple mass. I have used the
BilateralInteractionConstraint
to connect the beam and the mass and it works perfectly.
The problem is when I put an
OscillatorConstraint
with the correct index in the beam, the mass doesn’t have a natural vibration, only falls and stop inmediatelly.
Moreover, I quit the
OscillatorConstraint
and I simulate with a perturbation (Shift + click). The mass falls again and it doesn’t vibrate as we expect (a natural way) and it stops.
In the code bellow, I have used a custom sphere, but you can put any other object from SOFA.
Thank you for your help. I wait your answer.
Juan.
Here I attach the code:
<!-- BeamFEMForceField example --> <?xml version="1.0"?> <Node name="root" gravity="0 0 -9810.0" dt="0.01"> <RequiredPlugin pluginName="SofaOpenglVisual"/> <RequiredPlugin pluginName='SofaBoundaryCondition'/> <RequiredPlugin pluginName='SofaEngine'/> <RequiredPlugin pluginName='SofaGeneralDeformable'/> <RequiredPlugin pluginName='SofaImplicitOdeSolver'/> <RequiredPlugin pluginName='SofaMeshCollision'/> <RequiredPlugin pluginName='SofaMiscCollision'/> <RequiredPlugin pluginName='SofaMiscFem'/> <RequiredPlugin pluginName='SofaLoader'/> <!-- Needed to use components [MeshObjLoader, ]--> <RequiredPlugin pluginName='SofaRigid'/> <!-- Needed to use components [RigidMapping, ]--> <RequiredPlugin pluginName='SofaSimpleFem'/> <!-- Needed to use components [HexahedronFEMForceField, ]--> <RequiredPlugin pluginName='SofaConstraint'/> <!-- Needed to use components [FreeMotionAnimationLoop, GenericConstraintSolver, BilateralInteractionConstraint, UncoupledConstraintCorrection, ]--> <RequiredPlugin pluginName='SofaGeneralLinearSolver'/> <!-- Needed to use components [BTDLinearSolver, ]--> <RequiredPlugin pluginName='SofaGeneralSimpleFem'/> <!-- Needed to use components [BeamFEMForceField, ]--> <FreeMotionAnimationLoop /> <GenericConstraintSolver tolerance="0.001" maxIterations="1000"/> <VisualStyle displayFlags="showBehavior showForceFields showCollision showWireframe" /> <OglGrid size="1000" name="grid"/> <OglLineAxis size="@grid.size"/> <OglSceneFrame/> <DefaultPipeline name="DefaultCollisionPipeline" verbose="0" draw="0" depth="6" /> <BruteForceDetection name="Detection" /> <MinProximityIntersection name="Proximity" alarmDistance="0.7" contactDistance="0.09" /> <DefaultContactManager name="Response" response="default" /> <DefaultCollisionGroupManager /> <Node name="AttachOneWay"> <!-- Beam with mass at free end --> <Node name="beam" gravity="0 0 -9810.0" > <EulerImplicitSolver rayleighStiffness="0.1" printLog="false" rayleighMass="0.1" /> <BTDLinearSolver template="BTDMatrix6d" printLog="false" verbose="false" /> <MechanicalObject template="Rigid3d" name="beam_DOFs" position="-732.9 0 0 0 0 0 1 -628.2 0 0 0 0 0 1 -523.5 0 0 0 0 0 1 -418.8 0 0 0 0 0 1 -314.1 0 0 0 0 0 1 -209.56 0 0 0 0 0 1 -104.7 0 0 0 0 0 1 0 0 0 0 0 0 1 104.7 0 0 0 0 0 1 209.56 0 0 0 0 0 1 314.1 0 0 0 0 0 1 418.8 0 0 0 0 0 1 523.5 0 0 0 0 0 1 628.2 0 0 0 0 0 1 732.9 0 0 0 0 0 1"/> <MeshTopology name="lines" lines="0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14"/> <UniformMass vertexMass="0.022375 1 [0.001 0 0,0 0.001 0,0 0 0.001]" /> <BeamFEMForceField name="FEM" radius="2.7" youngModulus="70e6" poissonRatio="0.33"/> <UncoupledConstraintCorrection/> <FixedConstraint name="FixedConstraint" indices="7" /> <OscillatorConstraint name="OscillatingConstraint1" oscillators="7 0 0 0 0 0 0 1 0 0 10 0 0 0 30 0" /> <Node name="ConstraintPoint_beam_2"> <MechanicalObject name="points_beam" template="Vec3d" position="0 0 0" /> <RigidMapping/> </Node> <Node name="ConstraintPoint_beam_1"> <MechanicalObject name="points_beam" template="Vec3d" position="0 0 0" /> <RigidMapping/> </Node> </Node> <Node name="Mass1" gravity="0 0 -9810.0"> <EulerImplicitSolver name="Implicit Euler Solver" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver name="Conjugate Gradient" iterations="25" tolerance="1e-5" threshold="1e-5"/> <MechanicalObject template="Rigid3d" name="DOF_Mass_1" position="-711 0 2.11 0.7071068 0 0 0.7071068"/> <UniformMass name="MassSolid1" totalMass="0.0464" /> <UncoupledConstraintCorrection /> <Node name="VisualNode_1"> <MeshObjLoader name="meshLoader_0" filename="/home/juan/Escritorio/SOFA-features/beam_1_0_meshmixer/Sphere.obj" handleSeams="1" /> <OglModel name="Visual" src="@meshLoader_0" /> <RigidMapping name="Visual Mapping 1" input="@../" output="@Visual"/> </Node> <Node name="ConstraintPoint_mass_1"> <MechanicalObject name="points_mass_1" template="Vec3d" position="0 0 0 0 0 0" /> <RigidMapping/> </Node> </Node> <BilateralInteractionConstraint template="Vec3d" object1="@beam/ConstraintPoint_beam_2/points_beam" object2="@Mass1/ConstraintPoint_mass_1/points_mass_1" first_point="0" second_point="0" /> </Node> </Node>
11 June 2021 at 11:39 #19675HugoKeymasterHi
I get the following simulation when I run it (I do not have your Sphere.obj mesh):
Is this correct?
I note that I receive a warning about the OscillatorConstraint saying that:[ERROR] [OscillatorConstraint(OscillatingConstraint1)] applyConstraint(mparams, matrix) not implemented.
This means that the OscillatorConstraint can not properly work with direct solvers (like BTD) or the the applyConstraint() function should be implemented.
Is this blocking for you?
However, I was not able to reproduce the “mass falling” as you are referring to.
Best,Hugo
11 June 2021 at 13:11 #19683SrNaranjaBlockedHi @Hugo,
In the same link, I have attached two videos showing the corresponding simulation.
Thanks,
Juan.
22 June 2021 at 21:57 #19795HugoKeymaster23 June 2021 at 10:21 #19813SrNaranjaBlockedHi @Hugo,
thank you for your response about the simulation.
I have fixed the movement of the beam with the masses, but I have still several problems with the simulation:1. The error you told about
[ERROR] [OscillatorConstraint(OscillatingConstraint1)] applyConstraint(mparams, matrix) not implemented.
is still remaining, but the oscillator works fine apparently. If I change the solver to a CGLinear solver, the error disappears. I don’t know if I have to change the solver to an indirect solver as you told me. I wonder what are these indirect solver because I have not found any indirect solvers in the documentation and the forum.
2. I have another issue about the beam mass. When I simulate the beam with its real mass (0.1796kg) the simulation is worse.
<UniformMass template="Rigid3d,RigidMass<3u,double>" name="MassBeam" totalMass="0.17906"/>
This scene is called beam_code_13.8 in the github repository attached below.
But when I change the mass property taking into account the SOFA example
<UniformMass vertexMass="1 1 0.01 0 0 0 0.1 0 0 0 0.1" printLog="false" />
the simulation runs ok but it is not the real mass. So how we can guarantee the natural vibrations using the real mass?
This scene is called beam_code_13.9 in the github repository attached below.3. Finally, I would like to know why if I change the simulation to real time, the beam goes away.
In the next link you have all the codes and the sphere object.
https://github.com/jruro/SOFA_Beam.git
Thank you so much for your help and I wait your answers,
Juan.5 July 2021 at 14:38 #19923HugoKeymasterOla @juan
Sorry for the delay of this reply, I am currently out of the office.
Let me reply your points:1. Regarding the OscillatorConstraint, indeed, using iterative (=indirect) solvers does not require to go through the applyConstraint API. However, changing the nature of the linear solver is a change of your numerical settings.
CGLinearSolver is an iterative one, as the MinResLinearSolver.2. To get the right total mass, all you need to give as input of the UniformMass is
totalMass="0.17906"
3. the checkbox “real time” actually enforces the time step DT to be equal to the actual time required to compute one time step. I advise NOT to use it.
Best wishes,
Hugo
6 July 2021 at 16:49 #19946SrNaranjaBlockedHi @Hugo
No problem for the delay of the reply 😉
About the points we are talking about:
1. Thank you so much, this problem is resolved.
2. The problem is when I put
<UniformMass template=”Rigid3d,RigidMass<3u,double>” name=”MassBeam” totalMass=”0.17906″/>
the behavior of the vibrations is shown in the video called
beam_code_14_3__r60_0001.mp4
But when I change the mass, from a totalMass to a vertexMass:
<UniformMass vertexMass=”1 1 0.01 0 0 0 0.1 0 0 0 0.1″ printLog=”false” />
the behavoir is shown in the video called
beam_code_14_3__r60_0002.mp4
This last simulation is what is expected, not the first one. I don’t know if there is a way to put the total mass of 0.1796 and then the behavior of the beam will look like the second video.
Both videos are uploaded in the Github repository attached below.
3. Thank you, I won’t use real time simulation. But I have another issue with that.
When the time step DT is set todt=”0.005″
the beam is bended to a maximum of 9.1cm at its furthest point from the center, as it shows the figure called dt_1.png in the Github repository.
But when I change the time step to a DT
dt=”0.0005″
the maximum bending point is at around 20cm, as it shows the figure called dt_2.png in the Github repository.
I think this is due to the linear solver, in this case I am using a direct solver. But with an indirect solver the behavior is the same. the objective is to obtain a maximum bending point of about 40cm, so I don’t know if this is possible with these linear solvers or I am trying something impossible.
Here you have the link to the github repository, where you can find the latest scenes and the figures I have mentioned above.
https://github.com/jruro/SOFA_Beam.gitThank you so much for help and I wait your answers,
Juan.
13 July 2021 at 18:12 #19945SrNaranjaBlockedHi @Hugo
No problem for the delay of the reply 😉
About the points we are talking about:
1. Thank you so much, this problem is resolved.
2. The problem is when I put
<UniformMass template=”Rigid3d,RigidMass<3u,double>” name=”MassBeam” totalMass=”0.17906″/>
the behavior of the vibrations is shown in the video called
beam_code_14_3__r60_0001.mp4
But when I change the mass, from a totalMass to a vertexMass:
<UniformMass vertexMass=”1 1 0.01 0 0 0 0.1 0 0 0 0.1″ printLog=”false” />
the behavoir is shown in the video called
beam_code_14_3__r60_0002.mp4
This last simulation is what is expected, not the first one. I don’t know if there is a way to put the total mass of 0.1796 and then the behavior of the beam will look like the second video.
Both videos are uploaded in the Github repository attached below.
3. Thank you, I won’t use real time simulation. But I have another issue with that.
When the time step DT is set todt=”0.005″
the beam is bended to a maximum of 9.1cm at its furthest point from the center, as it shows the figure below.
But when I change the time step to a DT
dt=”0.0005″
the maximum bending point is at around 20cm, as it shows the figure below.
I think this is due to the linear solver, in this case I am using a direct solver. But with an indirect solver the behavior is the same. the objective is to obtain a maximum bending point of about 40cm, so I don’t know if this is possible with these linear solvers or I am trying something impossible.
In the next link you have all the scenes. Last scenes are called “beam_code_14_1” and “beam_code_14_2”
https://github.com/jruro/SOFA_Beam.gitThank you so much for help and I wait your answers,
Juan.
23 July 2021 at 12:28 #19812SrNaranjaBlockedHi @Hugo,
thank you for your response about the simulation.
I have fixed the movement of the beam with the masses, but I have still several problems with the simulation:1. The error you told about
[ERROR] [OscillatorConstraint(OscillatingConstraint1)] applyConstraint(mparams, matrix) not implemented.
is still remaining, but the oscillator works fine apparently. If I change the solver to a CGLinear solver, the error disappears. I don’t know if I have to change the solver to an indirect solver as you told me. I wonder what are these indirect solver because I have not found any indirect solvers in the documentation and the forum.
2. I have another issue about the beam mass. When I simulate the beam with its real mass (0.1796kg) the simulation is worse.
<UniformMass template="Rigid3d,RigidMass<3u,double>", name="MassBeam", totalMass="0.17906"/>
This scene is called beam_code_13.8 in the github repository attached below.
But when I change the mass property taking into account the SOFA example<UniformMass vertexMass="1 1 0.01 0 0 0 0.1 0 0 0 0.1" printLog="false" />
the simulation runs ok but it is not the real mass. So how we can guarantee the natural vibrations using the real mass?
This scene is called beam_code_13.9 in the github repository attached below.3. Finally, I would like to know why if I change the simulation to real time, the beam goes away.
In the next link you have all the codes and the sphere object.
https://github.com/jruro/SOFA_Beam.gitThank you so much for your help and I wait your answers,
Juan.16 August 2021 at 09:47 #19811SrNaranjaBlockedHi @Hugo,
thank you for your response about the simulation.
I have fixed the movement of the beam with the masses, but I have still several problems with the simulation:1. The error you told about
[ERROR] [OscillatorConstraint(OscillatingConstraint1)] applyConstraint(mparams, matrix) not implemented.
is still remaining, but the oscillator works fine apparently. If I change the solver to a CGLinear solver, the error disappears. I don’t know if I have to change the solver to an indirect solver as you told me. I wonder what are these indirect solver because I have not found any indirect solvers in the documentation and the forum.2. I have another issue about the beam mass. When I simulate the beam with its real mass (0.1796kg) the simulation is worse.
<UniformMass template="Rigid3d,RigidMass<3u,double>" name="MassBeam" totalMass="0.17906"/>
This scene is called beam_code_13.8 in the github repository attached below.
But when I change the mass property taking into account the SOFA example<UniformMass vertexMass="1 1 0.01 0 0 0 0.1 0 0 0 0.1" printLog="false" />
the simulation runs ok but it is not the real mass. So how we can guarantee the natural vibrations using the real mass?
This scene is called beam_code_13.9 in the github repository attached below.3. Finally, I would like to know why if I change the simulation to real time, the beam goes away.
In the next link you have all the codes and the sphere object.
https://github.com/jruro/SOFA_Beam.gitThank you so much for your help and I wait your answers,
Juan.1 October 2021 at 09:42 #20474HugoKeymasterHey @juan
1. As explained in my previous message, this error comes from the fact that the
applyConstraint()
function is not implemented. But it is only called for direct solvers. Therefore, using an iterative (=indirect) linear solver like the CGLinearSolver makes the warning disappear.2. Changing the mass (m), changes the ratio k/m (where k is the stiffness of your system) related to the resonance frequency of your object. Therefore, the time step will have to be adapted for the simulation to remain stable:
decrease the mass –> higher frequency –> smaller time step is required
If you object mass is 0.1796kg then use this value in total mass but you have to choose an appropriate time step.
3. Advice : do not use this real-time option. It affects the time step. Dangerous.
Best wishes,
Hugo
PS: for me none of 13_8 or 13_9 is crashing
-
AuthorPosts
- You must be logged in to reply to this topic.