How to run deformableBodies examples

Asked by Paul Pircher

Hi there,

lately I tried to run some of the examples for deformable elements from the more-examples section.
To be precise: The testDeformableBodies.py file. [1]

Apparently something has to be done in order to run those examples as there is already a hint:
"Did you compile yade with cmake option -DENABLE_FEMLIKE=1 ?"

It's is kinda straight forward, but I still some more detailed instruction for that.
What exactly is that command doing?
Do I need to reinstall yade completely? Or just run the command?
Does running that command do anything that needs to be considered for future use?

When I run the script without doing anything prior (like the cmake command) I receive the following error message multiple times:
<ERROR> DeformableCohesiveElement:54 bool yade::DeformableCohesiveElement::nodepair::operator<(const yade::DeformableCohesiveElement::nodepair&) const: Incomplete 'if' sequence

Is that the error message to expect when running the script without recompiling it first or is this something different?

The simulation still builds up and the body is shown. It kinda looks like in the video of the example.

When starting the simulation the following error occurs:

IndexError Traceback (most recent call last)
~/yade2020/install/bin/yade2020 in <module>
~/yade2020/install/bin/yade2020 in addplot()
    104
    105 def addplot():
--> 106 plot.addData(force=O.forces.f(forcebodies[1])[0],pos=(O.bodies[forcebodies[1]].state.pos[0]-initialpositions[forcebodies[1]][0]),vel=O.bodies[forcebodies[1]].state.vel[0],t=O.time,time=O.time,tm=O.time)
    107
    108 for i in forcebodies:
IndexError: list index out of range

Can someone please help me to run that example?
This could be really helpful to me if I understand that approach and can start to try out my own deformable element stuff.

[1] https://yade-dem.org/doc/tutorial-more-examples-fast.html#deformableelem

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Paul Pircher
Solved:
Last query:
Last reply:
Revision history for this message
Janek Kozicki (cosurgi) said :
#1

Let's start with a simple thing [1]. Does the command:

printAllVersions()

work for you? What does it print if it works?

[1] https://yade-dem.org/doc/user.html#questions-and-answers

Revision history for this message
Paul Pircher (chabs300) said :
#2

Sorry, that I missed that. It works and here is the output:

In [1]: printAllVersions()

```
Yade version : 2020.01a
Yade features : BoostLog Odeint VTK OpenMP GTS GUI-Qt5 CGAL MPI FEMLIKE GL2PS PotentialParticles PotentialBlocks
Yade config dir: ~/.yade-2020.01a
```

Libraries used :

| library | cmake | C++ |
| ------------- | -------------------- | ------------------ |
| boost | 1.71.0 | 1.71.0 |
| cgal | | 5.0.2 |
| clp | | 1.17.5 |
| cmake | 3.16.3 | |
| compiler | /usr/bin/c++ 9.3.0 | gcc 9.3.0 |
| eigen | 3.3.7 | 3.3.7 |
| freeglut | 2.8.1 | |
| gl | | 20190805 |
| ipython | 7.13.0 | |
| metis | | 5.1.0 |
| mpi | 3.1 | ompi:4.0.3 |
| mpi4py | 3.0.3 | |
| openblas | | OpenBLAS 0.3.8 |
| python | 3.8.5 | 3.8.5 |
| qglviewer | | 2.6.3 |
| qt | | 5.12.8 |
| sphinx | 1.8.5-final-0 | |
| sqlite | | 3.31.1 |
| vtk | 6.3.0 | 6.3.0 |

Linux version: Ubuntu 20.04.1 LTS

Revision history for this message
Robert Caulk (rcaulk) said :
#3

The error mentioned by OP is not the error of interest. I *guess* it is just a product of the main issue. When I test the same test script [1] on yadedaily 20201203-4444~b1faaf9~bionic1 and latest compiled trunk I get the following error first:

`
<ERROR> DeformableCohesiveElement:56 bool yade::DeformableCohesiveElement::nodepair::operator<(const yade::DeformableCohesiveElement::nodepair&) const: Incomplete 'if' sequence
`

Which suggests there is a problem somewhere in the function called "addNode()" [2]. Not sure I believe the "Incomplete 'if' sequence" complaint. But I'll try a couple changes to source to see if I can fix it.

[1]https://gitlab.com/yade-dev/trunk/-/blob/master/examples/deformableelem/testDeformableBodies.py
[2]https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/fem/DeformableElement.cpp#L45

Revision history for this message
Robert Caulk (rcaulk) said :
#4
Revision history for this message
Paul Pircher (chabs300) said :
#5

Thank you for your answer and for your time!

Is there something I can do in the meantime?

The approach with deformable elements would be really interesting and helpful for my project.
Until now I tried playing around with Nodes, CylinderConnections and PFacets to model a simple deformable cantilever beam. Quite similar to one of the PFacets examples [1] [2].
Since it seams that it is not quite possible to achieve correct mechanical (or phyiscal) behaviour, I wanted to try out deformable elements to compare it with my previous approach.

Thanks and best regards!

[1] https://gitlab.com/yade-dev/trunk/blob/master/examples/pfacet/mesh-pfacet.py
[2] https://yade-dem.org/doc/tutorial-more-examples-fast.html?highlight=more%20examples#pfacet

Revision history for this message
Paul Pircher (chabs300) said :
#6

Hi Robert,

I did recompile yade recently and also installed yadedaily to try out if the example for deformable elements now works.
Sadly I still receive the same error as in the original question. Details below:

In [1]: printAllVersions()

```
Yade version : 20210124-4946~5bc75e5~focal1
Yade features : BoostLog RealHP mpmath PrecisionDouble Odeint VTK OpenMP GTS GUI-Qt5 CGAL PFVFLOW PFVFLOW LINSOLV MPI TWOPHASEFLOW FEMLIKE GL2PS LBMFLOW THERMAL PARTIALSAT PotentialParticles PotentialBlocks
Yade config dir: ~/.yadedaily
Yade precision : 53 bits, 15 decimal places, with mpmath
Yade RealHP<…> : (15, 33, 45, 60, 120, 150, 300) decimal digits in C++, (15, 33) decimal digits accessible from python
```

Libraries used :

| library | cmake | C++ |
| ------------- | -------------------- | ------------------ |
| boost | 1.71.0 | 1.71.0 |
| cgal | | 5.0.2 |
| clp | 1.17.5 | 1.17.5 |
| cmake | 3.16.3 | |
| coinutils | 2.11.4 | 2.11.4 |
| compiler | /usr/bin/c++ 9.3.0 | gcc 9.3.0 |
| eigen | 3.3.7 | 3.3.7 |
| freeglut | 2.8.1 | |
| gl | | 20190805 |
| ipython | 7.13.0 | |
| metis | | 5.1.0 |
| mpi | 3.1 | ompi:4.0.3 |
| mpi4py | 3.0.3 | |
| mpmath | 1.1.0 | |
| openblas | | OpenBLAS 0.3.8 |
| python | 3.8.5 | 3.8.5 |
| qglviewer | | 2.6.3 |
| qt | | 5.12.8 |
| sphinx | 1.8.5-final-0 | |
| sqlite | | 3.31.1 |
| suitesparse | 5.7.1 | 5.7.1 |
| vtk | 6.3.0 | 6.3.0 |

```
Linux version : Ubuntu 20.04.1 LTS
Architecture : amd64
Little endian : True

<ERROR> DeformableCohesiveElement:52 bool yade::DeformableCohesiveElement::nodepair::operator<(const yade::DeformableCohesiveElement::nodepair&) const: Incomplete 'if' sequence

Did you have a look into the code?

Thanks and best regards,
Paul

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#7

Just a quick note: DeformableElement's is part of the code after a single man (Burak Er) pushed it. I'm afraid none of current core devs are really aware of how it works since the original author is no longer active here, and it is not frequent to receive questions about it. Nevertheless, it compiles and it is part of yade releases.

It means 1/ you are almost alone in understanding how it works, and 2/ you are welcome to declare issues with it and fix them. :)

Bruno

Revision history for this message
Janek Kozicki (cosurgi) said :
#8

yes. You are welcome to modify DeformableElement as you see fit, and become a new expert in the field :)

I just started examples/deformableelem/MinimalTensileTest.py and I see that the box is getting deformed. The displacement on the graph grows. It seems to work. I don't know what the error message "Incomplete 'if' sequence" means :)

Revision history for this message
Paul Pircher (chabs300) said :
#9

Hey there,

thanks Bruno for the insight information. That helps.

As you know from my other questions (bending beam mass computation [1] ) I am trying to model a simple elastic cuboid. On my way to find literature and possible methods I also wanted to try out the approach on this deformable elements, but I got stuck really quick.
Knowing that this might be too experimental for my current project, I will remain on using the node - connection - pfacet approach for now. :)

I gave a little more insight into my application in this launchpad question if anyone is interested [2].

> You are welcome to modify DeformableElement as you see fit, and become a new expert in the field.

Haha thanks Janek. I am currently trying to do so, but I am still in my very beginning and focusing to progess in my project/master thesis, as I rely on that.
As mentioned above, I will remain with the "simplier" PFacet approach for deformable bodies for now.
If the time and need allows it I will continue on deformable elements.
I basically wanted to make sure I at least tried the examples of all approaches I found, so I can decide on what to focus.
I hope that is understandable :)

> I just started examples/deformableelem/MinimalTensileTest.py and I see that the box is getting deformed.

I see. I tried it with testDeformableBodies.py and I received that error at the preprocessing.
I will give it another try.

Thanks to both of you for you input!
Your help is very much appreciated!

I will definitely need some more help in the future on that topic so stay tuned - I am gonna annoy you! :)

I will mark this thread as solved for now.

Cheers, Paul

Revision history for this message
Paul Pircher (chabs300) said :
#10