Forum Replies Created
-
AuthorPosts
-
NouraBlocked
Hi nicklj,
Have you tried the
restScale
parameter in MechanicalObject.h ?
Data< SReal > restScale;
Example:
<MechanicalObject name="MO" src="@MO_loader" template="Vec3d" restScale="0.8" />
default value equals to 1.
Best,
Noura15 June 2020 at 23:49 in reply to: SOFA scene with imposed displacements and Von Mises stress computation in 2D #16641NouraBlockedHi @hugo,
I haven’t implemented it. I only had a look at the code to propose a quick solution. But I’ll try to dedicate some time to implement it (because I have to upgrade to the latest SOFA version first).
Noura
13 June 2020 at 01:09 in reply to: SOFA scene with imposed displacements and Von Mises stress computation in 2D #16618NouraBlockedHi Pierre,
I have no clue how to export the stress values directly via the “VTKExporter” component. Maybe it is possible !
Also, I’m not sure if it is possible to get the stresses directly in the scene since that there is no data field called “stress” in the “TriangularFEMForceField” (FF).Nevertheless, the stress values can be accessed and exported to an output stream by slightly modifying Sofa code.
I’ll explain in detail how to do it, but it is really simple.
1- There is a parameter called
f_computePrincipalStress
in “TriangularFEMForceField.h”2- The previous parameter is not activated by default in the constructor of the FF in “TriangularFEMForceField.inl”
,f_computePrincipalStress(initData(&f_computePrincipalStress,false,"computePrincipalStress","Compute principal stress for each triangle"))
3- In your scene, assign “true” to the attribute “computePrincipalStress” in the FF
<TriangularFEMForceField name="FEM" youngModulus="10000" poissonRatio="0.3" method="large" showStressValue="true" computePrincipalStress = "true" />
4- Note that a handy class called
TriangleInformation
is defined in “TriangularFEMForceField.h”. The latter contains many information related to the FF (including the stresses).
Further, this class has an output stream operatoroperator<<
which enables writing/exporting the values to an output file for instance.5- Then, you have to seek where to export them in Sofa code. An option would be to do that in the “AddForce” function where the boolean is examined, there you have
if (f_computePrincipalStress.getValue()) ... for(unsigned int i=0; i<nbTriangles; ++i) computePrincipalStress(i, triangleInf[i].stress); ...
You may replace it by
... std::ofstream file_principal_stresses ("stress.csv",std::ios::app ); if (f_computePrincipalStress.getValue()) for(unsigned int i=0; i<nbTriangles; ++i){ computePrincipalStress(i, triangleInf[i].stress); file_principal_stresses<<triangleInf[i].stress<<","; } ...
Finally, that was a quick way to get them, BUT I would not do it that way to avoid unnecessary writing to a stream each time “AddForce” is called!
Instead, you can define an additional parameter in “TriangularFEMForceField.h” to be activated only when writing to a file is desiredData<bool> f_exportStressValuesToFile;
Then, you initialize it in “TriangularFEMForceField.inl” as all other attributes:
TriangularFEMForceField<DataTypes>::TriangularFEMForceField() ... ,f_exportStressValuesToFile(initData(&f_exportStressValuesToFile,false,"exportPrincipalStress","Export principal stress for each triangle")) ...
You include exportPrincipalStress = “true” in the FF component in the scene, and you check if it is true somewhere in the code to write the stresses or not.
An additional parameter to hold the name of the file can be added in the same manner.Hope that this solves your issue in case you couldn’t figure out how to do it in a simpler way, otherwise I would be glad to learn how 🙂
Noura
12 June 2020 at 01:32 in reply to: SOFA scene with imposed displacements and Von Mises stress computation in 2D #16607NouraBlockedHello Pierre,
I think that you should be able to visualize the stresses using the following parameters from “TriangularFEMForceField.h”
Data<bool> showStressValue; Data<bool> showStressVector;
Try this:
<TriangularFEMForceField name="FEM" youngModulus="100000" poissonRatio="0.3" method="large" showStressValue="true" showStressVector="false" />
You can refer to the function “computePrincipalStress” from “TriangularFEMForceField.h” to verify if this is what you need.
Otherwise, for Von Mises stresses, I’m not sure if they are implemented for the triangular FF. In the case of a tetrahedron FF you can visualize them for a FF assigned on a given volume mesh by:
<TetrahedronFEMForceField template="Vec3d" name="FEM" printLog="1" method="svd" poissonRatio="0.48" youngModulus="16.34" computeVonMisesStress="1" isToPrint="false" showVonMisesStressPerNode="false" showStressColorMap="blue 1 0 0 1 1 0.5 0.5 1" updateStiffness="true" />
Hope this helps!
Noura
NouraBlockedHi Nancy,
you may have a look at this open source database from the IRCAD institute.
Best,
Noura13 April 2020 at 13:36 in reply to: Best Way to Implement Ligaments Attaching Finger Bones Together #15689NouraBlockedHello,
I came through this topic and I worked on muskuloskeletal simulations before, so I can share some thoughts which might be of interest.
I’m not familiar with Sofa Soft Robotics plugin, so I can not advice in this direction. Though, I think that it could be a convenient option.
@jayyang
– You mentioned that you are trying to implementattachConstraint
to connect the bones to the ligaments, I think that they are not the suitable choice.
These constraints are pretty simple, and don’t allow the propagation of forces in both directions.
Instead, you may need to use theBilateralInteractionConstraint
to connect bones with ligaments. The latter are implemented in SOFA based on Lagrange multipliers. A great documentation about them could be found here.
Note that if you go for this option, you have to useFreeMotionAnimationLoop
instead of theDefaultAnimationLoop
which is the default loop set in any simulation.
In addition, you have to include the the constraint correction to define the way the compliance matrix is computed. A component calledUncoupledConstraintCorrection
could be used for that, and an example scene called “BilateralInteractionConstraint.scn” is provided in SOFA.Following this approach assumes that you model the soft tissue as 3D meshes and not as simple springs, you can get something like this simulation.
– Further, I noticed that you are using
RestShapeSpringsForceField
in your simulation, If you mean If you intend to use simple springs, I’m not sure why you need to set attachment constraints?
By usingStiffSpringForceField
for example, you can get a simple simuation like this (with the springs in green and red).Hope this could inspire you!
@NickHock
Thanks for the interesting details about your approach. I totally agree with you that the segmentation and modelling of the wrist and carpal soft tissue are extremely challenging. I’ll have a look to the “swept spline tool” you referred to. It looks very interesting.Noura
NouraBlockedMe neither not an expert 😉 I usually use Paraview in the same way you described, but I thought that there might be some magic configurations I don’t know. If I learned something interesting, I’ll share it.
Thanks,
Noura
NouraBlockedHi @Hugo,
The setting using the TetrahedronSetGeometryAlgorithms seems not bad at all !
BTW, when you mentioned ParaView, Do you mean by selecting the volume representation from the drop box in the toolbar, or am I missing something? A brief explanation of setting steps would be helpful as well.
Thanks,
Noura
20 October 2019 at 13:11 in reply to: [SOLVED] What are the build options in SOFA Dashboard ? #14423NouraBlockedHi Hugo,
Exactly, I was looking for this config file for the CI.
Thanks,
Noura
NouraBlockedHello all,
I join Thabita clarifying the current state of configuring Sofa since that we are trying it together.
As @taro has already mentioned, the compilation is fine right now. However, a run time error happens when executing runSofa.exe, and which is probably related to the
qwindows.dll
which can not be located! I include the complete error message:[INFO] [GUIManager] INFO(SofaGUI): lastUsedGUI.ini not found; using default GUI. This application failed to start because it could not find or load the Qt platform plugin "windows" in "". Reinstalling the application may fix this problem. ########## SIG 22 - SIGABRT: usually caused by an abort() or assert() ##########
`
I noticed that a similar error was posted long time ago on the <a href=”http://www.sofa-framework.org/community/forum/topic/sofa-cannot-be-executed-modelerrunsofa/”>threqd</a>
I tried the temporary solution suggested by @guillaumeparan and placed the “plugins/platforms” copied fromQt/5.12.3/msvc2017_64/plugins/platforms
inside the sofa bin folder, but this did not unfortunately solved the issue.
However, I noticed that our Sofa project is created using visual studio 2019 to which our Qt version does not has specific dll libraries! Could this be an issue between QT and MSVS versions?Any experinence facing similar issues is welcomed!
Thanks,Noura
NouraBlockedHi all,
It is always an interesting topic.
In a simple simulation scenario, I applied a linear tensile force on a deformable object in the direction of its main axis. Using a Neo-Hookean behavior model, I noticed that the deformation is influenced by the number and size of elements (tetrahedrons).
However, it is possible to control the resolution of simple geometries if there is a ground truth to compare to, but it becomes a challenge in case of small detailed shapes with the absence of a ground truth.
Any observations regarding the choice of the resolution would be appreciated!
Noura
NouraBlockedFine for me. Marked as resolved!
NouraNouraBlockedHi Hugo,
I see. Thanks!
This means that I have to set youngModulus in MPa. and the force in Newton.You also mentioned:
If the file mesh you load has values between 0 and 40
Non, they are not! The shape is not necessarily translated to the origin (0,0,0). The bounding box of the cuboid could be for instance [200 100 50 , 240 130 55]. Still, the dimensions remain 40*30*5 mm. Right? Should I care about the coordinates as well?
Thanks,
Noura
17 May 2019 at 16:17 in reply to: [SOLVED] Compilation error while setValue to d_force in linearFF #13495NouraBlockedSolved!
Actually It should be simply :l_forceField->d_force.setValue(initForce.getValue());
Noura
NouraBlockedHello minj,
You can apply a constant force field to a certain node in your mesh (let say on the node with index 5), you supply the force direction and value (for instance 7 N. in the positive direction of Y axis), I included the “arrowSizeCoef” parameter which is optional just to help visualizing the force direction.
<ConstantForceField indices="5" totalForce="0 7 0" arrowSizeCoef="0.1"/>
Hope this helps,
Noura
15 November 2018 at 15:38 in reply to: [SOLVED] Using "FreeMotionAnimationLoop" is stopping "TetrahedronFEMForceField" #12492NouraBlockedHi Hugo,
Yes, that’s true. I forgot to include a ConstraintCorrection in the deformed object node. Now it works fine.
Thanks for the quick hint!
Noura
NouraBlockedHello,
I faced the same issue before with CGAL. Fortunately, I noticed that I could compile SOFA with CGAL successfully using
clang
I know that this doesn’t solve the problem, but it could be a temporary solution until the issue is fixed.I’m running:
Ubuntu 18.04.1 LTS
CGAL-4.11
clang version 6.0.0-1ubuntu2In order to compile using clang: In the cmake-gui interface, you have to define clang instead of gcc.
CMAKE_CXX_COMPILER /usr/bin/clang++
CMAKE_C_COMPILER /usr/bin/clangHope this helps!
Noura
30 October 2018 at 11:37 in reply to: How to exclude certain mesh elements from the collision test? #12310NouraBlockedHello Antonin,
Thanks for the clear detailed reply. Yes, it helps!
For the moment, the collision models are static along the simulation, and splitting the mesh into 2 parts sounds a good approach.
The hint concerning “doCollisionDetection” method is also handy, I may need to implement a specific collision pipeline with an adapted narrow phase detection in the future.
Concerning the response, I agree that it is not the appropriate solution because it may introduce numerical instability when applying penalty after the detection.
Best,
Noura
NouraBlockedHi Zahra,
In general, you can use the python debugger
pdb
directly in the terminal
https://docs.python.org/2.0/lib/module-pdb.htmlOr inside an IDE such as Spyder which supports
pdb
as well
https://pythonhosted.org/spyder/debugging.htmlI hope this will help,
Noura
NouraBlockedHi Zahra,
I’m running Sofa v18.06. If you compile the core of sofa successfully, you should have
runSofa
binary in the bin directory as usual. Isn’t that the case?Noura
NouraBlockedGreat effort. Thanks!
The constraints page in particular is very helpful. In case of related suggestions or minor remarks, should we post them on this thread or on sofa doc github?
Noura
BTW, I noticed that the link of “Mapping” page doesn’t exist.
NouraBlockedHi Ben,
Did you defined the “constraintFactor” in the AttachConstraint component?
If not, please try something like this:<AttachConstraint object1="@obj1" object2="@obj2" indices1="0 1 2 3" indices2="0 1 2 3" constraintFactor="1 1 1 1" />
Best,
Noura
NouraBlockedHi Hugo,
Yes, it is working as desired right now! Thanks a lot.
Besides the sensitivity to the dt, mass and force values, I realized that the main issue was due to the absence of the “compliance” parameter in the “UncoupledConstraintCorrection”!.
I also noticed that by removing the mass and constraint correction from the “object1_surf” node, the simulation looks better because both objects will stay closely together even when pulling and interacting with one of them without contact “gap”.
Thanks also for the interesting thread which helps a lot understanding how these constraints work.
Best,
Noura
NouraBlockedHi Hugo,
Thanks for looking into the scene. Yes, I see your notice about the usage of different templates in a projective constraint is very relevant and now, at least, I understand why the behaviour is not as expected.
Concerning your question about the need of
MO_object1
:
I use it is because the cube should be a rigid object and not a deformable one as “object2”! so one point (the center of the cube should be sufficient for the mechaical object as far as I know). Then, I use theobject1_surf
just for the collision model and not as the master object for “object1”.
This is why I think that adding aMeshSpringForceField
inside theobject1_surf
as you suggested, even if it makes the simulation looks working, is not unfortunately the simulation I’m trying to get.To conclude, I already noticed that the attach constraints work fine in two way when both objects are deformble. However, they are not the suitable component to attach a rigid object with a deformable one! I’m trying to figure out a different way to do it.
Thanks again Hugo!
Noura
6 August 2018 at 16:40 in reply to: [SOLVED] How to set a FixedTranslationConstraint on a specific mesh index? #11645 -
AuthorPosts