Forum Replies Created
-
AuthorPosts
-
nickljBlocked
@btt
For question 1. Just search the “constraint” in the collision MechanicalObject, and find all the node 55 related rows, for each row, multiples the lambda value to get the force vector in global coordinate, then add all these values together to get the total reaction force related to node 55.12 April 2021 at 04:32 in reply to: [SOLVED] Question on TetrahedronHyperelasticityFEMForceField #19139nickljBlockedI think applyElasticityTensor is more tricky than what you described.
Could be, but looking quickly on how it is used, i.e. called 3 times (1 per coordinates), this looks a lot like a kind of “optimization” to compute where is the 6×3 strain variation matrix. It is like the applyElasticityTensor computes the product with one column (one coordinate) of . We could probably check this by comparing/printing it against the caribou forcefield since both of them produce exactly the same stiffness matrix (I validated it).
Thanks for explaining. I think the main problem is the code is a bit difficult to read. The formulation is OK for me, just the detailed implementation is not easy to trace without document. But anyway this is not a big problem. I’ll work it out.
I understand your point 2, but I think the code in TetrahedronHyperelasticityFEMForceField did not compute K_ii in updateTangentMatrix (maybe I’m wrong…).
Yeah it only computes the upper part of the diagonal matrix (K_ij with i!=j). The K_ii coefficients should be the accumulation of each “edges” connected to the node “i”. So no need to compute/store it.
I overlooked. Makes sense. Thanks.
Anyway, maybe there is no need to dig it in more detail, as I think Caribou is an excellent replacement. Actually I’ve read the code of Caribou these days, and the way you did in HyperelasticForcefield is clear and tide. It follows the standard and generic approach and is a very good reference on how to write a decent hyperelastic model in SOFA.
Thanks a lot ! There is still a lot of work to do, but I very happy to learn that it is still useful to some people 🙂
When I compile it with the latest version of SOFA(and in-tree build of SofaPython3), it shows the following errors
Hum I’m not sure, it looks like a SOFA compilation error… Can you re-post your error here so we can look at it together without polluting this forum? It will also be a good occasion to create the first github discussion on the caribou repo 😉
Thanks. I’ll try to figure it out and will turn to the github discussion if I cannot solve it by myself.
11 April 2021 at 16:32 in reply to: [SOLVED] Question on TetrahedronHyperelasticityFEMForceField #19137nickljBlockedMay I just take this thread to inquire about the compiling of Caribou? When I compile it with the latest version of SOFA(and in-tree build of SofaPython3), it shows the following errors:
CMake Error at /home/liuj/opt/SOFA/master/lib/cmake/SofaGui/SofaGuiConfig.cmake:40 (find_package): Found package configuration file: /home/liuj/opt/SOFA/master/plugins/SofaGuiQt/lib/cmake/SofaGuiQt/SofaGuiQtConfig.cmake but it set SofaGuiQt_FOUND to FALSE so package "SofaGuiQt" is considered to be NOT FOUND. Reason given by package: The following imported targets are referenced, but are missing: QGLViewer
It bothers me for quite a long time…
11 April 2021 at 16:28 in reply to: [SOLVED] Question on TetrahedronHyperelasticityFEMForceField #19136nickljBlockedhi, @jnbrunet,
Thanks a lot for your kind reply and your excellent work on Caribou. I think applyElasticityTensor is more tricky than what you described. I understand your point 2, but I think the code in TetrahedronHyperelasticityFEMForceField did not compute K_ii in updateTangentMatrix (maybe I’m wrong…).
Anyway, maybe there is no need to dig it in more detail, as I think Caribou is an excellent replacement. Actually I’ve read the code of Caribou these days, and the way you did in HyperelasticForcefield is clear and tide. It follows the standard and generic approach and is a very good reference on how to write a decent hyperelastic model in SOFA. I really would like to try it in my work. However, I spent this whole weekend and still not successfully compile it together with SOFA……
nickljBlockedI think I may have a better understanding on the program now. lambda is the force in local contact space, and the first component is always the normal force. The “constraint” values in the “mechanicalObject” of the collision model, is actaully a transformation from local space to global coordinate.
Besides, the force obtained in constraint problem is actually dt*lambda. So in order to obtain the force in terms of unit Newton, we need to divided by dt.
Please kindly help to correct if I have any misunderstanding. Thanks.
nickljBlockedHi @Hugo
Sorry for continuing to ask questions on this “SOLVED” thread as I think my question is highly relevant to this one.
According to your reply in this post, “constraintForces” is a vector which size equals the number of constraints, and should have the form “Contact1_ForceInX Contact1_ForceInY Contact1_ForceInZ…”.
I’ve checked the source code of “GenericConstraintSolver.cpp” and “ConstraintSolverImpl.h”. It seems this “constraintForces” is nothing but read out the lambda value for Lagrange multipliers, as: “current_cp->getF()” which is actually “current_cp->f.ptr()”.
As a result, I think your reply in this thread seems different from that you posted before, as in:
which lambda also needs to be multiplied by the constraint values in the collision model to retrieve the contact force, which seems more reasonable to me.However, I’ve tried both, and in any way, I still cannot successfully extract the contact force correctly. The values seem to be more than an order lower than that I simulated in Abaqus, or measured in the experiment.
By the way, I used FreeMotionAnimationLoop and GenericConstraintSolver in my simulation.
Much appreciate if you may help to explain a bit more on this. I’ve been troubled by this problem for months…
3 November 2020 at 12:39 in reply to: Question about Neo-Hookean Strain Energy function implemented in Sofa. #17536nickljBlockedHyperelastic model derivation is always a nightmare……I’ll try to explain according to my knowledge. This topic is very complex, so I’ll try to explain point by point, and also raise some of my question at the end.
1. In TetrahedronHyperelasticityFEMForceField, the Neo-Hookean material parameters used are the initial shear module \mu, and initial bulk module K. You may easily do the conversion as
\mu=2C10, K=2/D12. All the three models you showed are “compressible model”. So your argument that “Abaqus model is uncompressible assumption” which is not correct. This is because it has the volumetric contribution, and so the I1 in the formulation should be I1\bar, which is the modified invariant of I1.
3. SOFA use a same strain energy form as the wiki for the deriatoric part. I seldom use this strain energy form, generally many continuum mechanics books use the form with C10(I1\bar-3) for the deviatoric part and also because I use Abaqus a lot… Some references show that the wiki (SOFA) form also gives the same form of PK2 stress, so maybe they are equivalent? Maybe need some derivation and verification.
4. Let’s compare the sofa version and abaqus version, they have different form of strain energy for the volumetric part. As long as the material is nearly in-compressible, they are somewhat equivalent and doesn’t matter.
5. I’m currently also working on understanding how SOFA deals with the elastic tangent tensor. It seems ElasticityTensor is implemented in NeoHookean.h, but not used in the
TetrahedronHyperelasticityFEMForceField, and only applyElasticityTensor is used. Is it some kind of matrix-free method? If any developers may help to give some simple explanation on this, I’ll appreciate a lot.nickljBlockedHi, Hugo,
Thanks a lot for your answer. I think that is something I need.
Sorry I did not successfully find where is the PM function….. Could you PM me first so I can reply, or may I know you email address so I can send you email?
Best regards,
Liu JunnickljBlockedDear @Noura
Thanks a lot for your reply. It seems something I need. I’ll take a look and see whether it is possible to extend with 3 different component.
Another question regarding to the implementation. I’d like to introduce two plate with different mateiral. They are stick together, and I need to introduce prestretch on only one of them. Is there a function in SOFA to define two surface tie/stick with each other?
Thanks.
nickljBlockedHi, Hugo,
Thanks a lot for your kind guidance. Works well if I specify the triangle indices directly. Anyway there is a way work. Thanks a lot.
nickljBlockedDear Hugo,
Thanks a lot for prompt reply. Really helped a lot. Sorry for the confusion. Please just ignore the release/version questions I mentioned previously.
Here is my main concern.
Question 1
Thanks a lot for your confirmation. Do you mean Tetra2TriangleTopologicalMapping? Actually I’ve searched this in the examples folder, and found that it seems this component can only extract all the external surface from the input body (Please correct me if I’m wrong). What I need is to apply the pressure only on some prescribed surface. Is it possible to use Tetra2TriangleTopologicalMapping for this?Question 2
Sorry for the confusion. Please just forget the version things I previously mentioned.What I want to implement here is: I want to move the finger while applying pressure at the same time. I think this is a quite common scenario. However it seems not work in my model (I tried the versions downloaded from https://github.com/sofa-framework/sofa/releases, as well as compiled from github master branch). Is there any ways to implement this in SOFA by using some other ways?
Thanks a lot.
nickljBlockedHi, @Hugo,
Thanks a lot. Based on your suggestion, I tried GenerateRigidMass and can move the MechanicalObject to the mass center of imported geometry, and it seems work fine.
14 December 2019 at 15:08 in reply to: [SOLVED] How to extract reaction force for certain nodes #14692nickljBlockedThnaks. I’ve marked this topic as resolved.
3 December 2019 at 06:51 in reply to: [SOLVED] How to extract reaction force for certain nodes #14680nickljBlockedDear @hugo,
Thanks a lot for your time and your reply. Really helpful and that’s exactly what I want. Your PS is also helpful and I will play with them.
28 November 2019 at 04:05 in reply to: [SOLVED] How to extract reaction force for certain nodes #14653nickljBlockedDear @Hugo,
Thanks a lot for your kind reply. Firstly congratulations on the successful SOFA week. It was very pity that I cannot join the activity this year as the half earth distance:( Hopfully there is chance next year and I can do some contribution with my knowledge. Actually I’ve watched the live streaming on the Symposium day and it was amazing. I’ve learnt many state-of-art work progress using SOFA and very exicted with the active community.
For my problem, please find a (reletively) complete program from the following dropbox link:
https://www.dropbox.com/sh/l40p8sqznedv6va/AABQCwRdEUfN5uKa5TdgqGXCa?dl=0I successfully run it using the master branch (up to today) “13e61c5″. ctrl+”+”/”-” is used to squzzing/relexing the grasper. For some details questions, I’ve commented in the code with
####################
# QUESTION #
#******************#
####################
There is one small question in gripper.pyscn, and one detailed question in controller.pyComing up to answer your question:
I understood that you are interesting in recovering the force applied on the rigid grasper. Is this correct?
– Yes. More specificly I’d like to know the force applied on certain vertex points (assuming where sensor is attached). But for now the force on the whole rigid grasper is good enough. In abaqus we do this by “applying rigid body constrain on the rigid body to a reference point”, then “output the value of reaction force on that reference point”.When you say the “force” data field provides extremely large values, how much is this? what are your units?
– It will be up to the value I used in the RestShapeSpringsForceField. I’ve already commened in the program.
– For the unit, I used the mm/N/tonne/MPa system.Much appriciate for your kind help.
25 November 2019 at 08:19 in reply to: [SOLVED] How to extract reaction force for certain nodes #14623nickljBlockedAnyone may help me on this?
nickljBlocked@guillaumeparan. Thanks a lot for your kind explanation.
For problem 1, the problem is already solved without SoftRobots and STLIB plugins. However, if I tried to run the examples required SoftRobots/STLIB plugins from the SOFA install dir, the same error occurs (but if I run in the SOFA build dir, it will be fine)For problem 2, sorry that it still exists. Previously I though it has been solved by running in the SOFA build dir, but I’ve tried again and it seems the problem still exists no matter in build dir or install dir.
Actually, after some search on the internet on this “staticmethod” problem, if I changed the file elasticmaterialobject.py line 28,
from “ElasticMaterialObject” to “self.__class__.”, the problem has gone, but I’m not an expert of Python and not sure whether this will influence other places….nickljBlockedHi, @damien-marchaluniv-lille1-fr
Thank for very much your reply. I’ve commented in the issue.
Actually there is another problem I met for using the latest version, but it’s not relevant to this topic and I’ll create a new one.
nickljBlockedHi, @damien-marchaluniv-lille1-fr
Thanks a lot for your reply. Firstly, I’ve downloaded the binary version and it works greatly. So anyway I’m now able to work on it.However, I still would like to figure out the reason why I’m not able to compile myself and get it work. As SOFA and SoftRobots are both in active development, and I would like to follow the state-of-art of these great work.
Come to my problem. Much apologize that I did not make it clear. The 1 and 2 floor in this topic are the problem I met when loading the SofaPython. After that, I rebuild the whole project together with SoftRobots and STLIB plugins. So it is actually an ‘in-tree’ build. Here I would like to re-explain my problem (Should I open a new thread specifically on this problem?)
Currently I’m trying to build the SoftRobots and STLIB plugins together with sofa platform (master branch). The cmake options I used is:
cmake ../ -DCMAKE_INSTALL_PREFIX=/home/liuj/opt/SOFA/master -DPLUGIN_SOFAPYTHON=ON -DSOFA_BUILD_METIS=ON -DSOFA_EXTERNAL_DIRECTORIES="/home/liuj/github/sofa/master/plugins/STLIB;/home/liuj/github/sofa/master/plugins/SoftRobots"
After successfully compiling and installing, I met some errors on
ImportError: No module named SofaPython
as I already mentioned above. I’ve found a workaround to solve this problem by setting
plugins/SofaPython/lib/python2.7/site-packages plugins/STLIB/python plugins/SoftRobots/lib/python2.7/site-packages
to the $PYTHONPATH environment.
Then, I can run ./runSofa successfully. However, when I try to run the examples in the SoftRobots plugins, I met some problems as:
[INFO] [runSofa] PluginRepository paths = /home/liuj/opt/SOFA/master/plugins:/home/liuj/opt/SOFA/master/lib [INFO] [runSofa] DataRepository paths = /home/liuj/opt/SOFA/master/share/sofa:/home/liuj/opt/SOFA/master/share/sofa/examples [INFO] [runSofa] GuiDataRepository paths = /home/liuj/opt/SOFA/master/share/sofa/gui/runSofa:/home/liuj/opt/SOFA/master/share/sofa/gui/qt [INFO] [runSofa] Loading automatically plugin list in /home/liuj/opt/SOFA/master/lib/plugin_list.conf.default [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaExporter.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaSparseSolver.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaPreconditioner.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaHaptics.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SofaPython/lib/libSofaPython.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/CImgPlugin/lib/libCImgPlugin.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SofaMiscCollision/lib/libSofaMiscCollision.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/MultiThreading/lib/libMultiThreading.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaAllCommonComponents.so The constructor with a QGLFormat is deprecated, use the regular contructor instead. [INFO] [SofaPython] Added '/home/liuj/opt/SOFA/master/plugins/STLIB/python' to sys.path [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/STLIB/lib/libSTLIB.so [INFO] [SofaPython] Added '/home/liuj/opt/SOFA/master/plugins/SoftRobots/lib/python2.7/site-packages' to sys.path [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SoftRobots/lib/libSoftRobots.so [ERROR] [PythonScript] TypeError: 'staticmethod' object is not callable File "cablegripper_banana.pyscn", line 19, in createScene Gripper(rootNode) File "gripper.py", line 14, in Gripper pullPointLocation=[3, 10.5, 3]) File "finger.py", line 39, in Finger translation=translation) File "/home/liuj/opt/SOFA/master/plugins/STLIB/python/splib/objectmodel/__init__.py", line 47, in __call__ o = self.cls(*args, **kwargs) File "/home/liuj/opt/SOFA/master/plugins/STLIB/python/stlib/physics/deformable/elasticmaterialobject.py", line 30, in __init__ collisionMesh, withConstrain, surfaceColor, poissonRatio, youngModulus, totalMass, solver) [INFO] [SceneCheckerVisitor] Validating node "root" with checks: [SceneCheckAPIChange, SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias] [INFO] [SceneCheckAPIChange] No 'APIVersion' component in scene. Using the default APIVersion level: 17.06 [INFO] [SceneCheckerVisitor] Finished validating node "root". [WARNING] [RealGUI] Global Bounding Box seems very small; Your viewer settings (based on the bbox) are likely invalid, switching to default value of [-1,-1,-1,1,1,1].This is caused by using component which does not implement properly the updateBBox function.You can remove this warning by manually forcing a value in the parameter bbox="minX minY minZ maxX maxY maxZ" in your root node
It seems something related to static method. I’m not an expert of python. Much appreciate if you could help me on this.
nickljBlockedI’ve already solved this problem by modify some PYTHONPATH environment. It works very nice.
Now my problem is about the SoftRobots and STLIB plugin. When I run the SoftRobots tutorial (such as CableGripper), there is always errors showing that “TypeError: ‘staticmethod’ object is not callable”.
The detailed log file related to this error is as follows:
[INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SoftRobots/lib/libSoftRobots.so [ERROR] [PythonScript] TypeError: ‘staticmethod’ object is not callable File “cablegripper.pyscn”, line 11, in createScene Gripper(rootNode) File “gripper.py”, line 14, in Gripper pullPointLocation=[3, 10.5, 3]) File “finger.py”, line 39, in Finger translation=translation) File “/home/liuj/opt/SOFA/master/plugins/STLIB/python/splib/objectmodel/__init__.py”, line 47, in __call__ o = self.cls(*args, **kwargs) File “/home/liuj/opt/SOFA/master/plugins/STLIB/python/stlib/physics/deformable/elasticmaterialobject.py”, line 30, in __init__ collisionMesh, withConstrain, surfaceColor, poissonRatio, youngModulus, totalMass, solver)
nickljBlockedI have already installed python2.7/numpy/scipy on my Ubuntu18.04 (gcc7.3) through apt
Actually exactly the same problem also occurs on my MacOS, with python installed through brew.The log file after running ./runSofa is attached as follows:
[INFO] [runSofa] PluginRepository paths = /home/liuj/opt/SOFA/master/plugins:/home/liuj/opt/SOFA/master/lib [INFO] [runSofa] DataRepository paths = /home/liuj/opt/SOFA/master/share/sofa:/home/liuj/opt/SOFA/master/share/sofa/examples [INFO] [runSofa] GuiDataRepository paths = /home/liuj/opt/SOFA/master/share/sofa/gui/runSofa:/home/liuj/opt/SOFA/master/share/sofa/gui/qt Created directory: /home/liuj/opt/SOFA/master/config Created directory: /home/liuj/opt/SOFA/master/screenshots [INFO] [runSofa] Loading automatically plugin list in /home/liuj/opt/SOFA/master/lib/plugin_list.conf.default [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaExporter.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaSparseSolver.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaPreconditioner.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaHaptics.so Traceback (most recent call last): File “<string>”, line 1, in <module> ImportError: No module named SofaPython.livecoding Traceback (most recent call last): File “<string>”, line 1, in <module> ImportError: No module named SofaPython [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SofaPython/lib/libSofaPython.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/CImgPlugin/lib/libCImgPlugin.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/plugins/SofaMiscCollision/lib/libSofaMiscCollision.so [INFO] [PluginManager] Loaded plugin: /home/liuj/opt/SOFA/master/lib/libSofaAllCommonComponents.so [INFO] [GUIManager] INFO(SofaGUI): lastUsedGUI.ini not found; using default GUI. The constructor with a QGLFormat is deprecated, use the regular contructor instead. Traceback (most recent call last): File “<string>”, line 1, in <module> NameError: name ‘SofaPython’ is not defined [INFO] [SceneCheckerVisitor] Validating node “root” with checks: [SceneCheckAPIChange, SceneCheckDuplicatedName, SceneCheckMissingRequiredPlugin, SceneCheckUsingAlias] [INFO] [SceneCheckAPIChange] No ‘APIVersion’ component in scene. Using the default APIVersion level: 17.06 [INFO] [SceneCheckerVisitor] Finished validating node “root”.
29 January 2019 at 09:48 in reply to: Problem when running SoftRobots python script (SOFA v18.12 on Ubuntu 16.04) #12924 -
AuthorPosts