# contact of polyhedron

Asked by zhou qian on 2019-08-23

Hi:
I use polyhedrons in my simulation and it segmentation fault. I search where it got error and find that it got error in function: Simplify in Polyhedra_support.cpp.
However, I don't know in what situations will it get error. And it seems it is more likely to get error when the displacement is very small.
Can you provide some situations that this function will get error? I really want to paste my codes here but my codes contains other input files.
Yours,
Joe

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
zhou qian
Solved:
2019-08-23
Last query:
2019-08-23
2019-08-23
 zhou qian (zhoug15) said on 2019-08-23: #1

Since my problem is likely to be associated with the size of polyhedrons. Here is one of my polyhedrons:
4 vertices:
-0.01841946 -0.01834445 -0.01710164
-0.01667621 -0.016184 -0.007231501
-0.01121877 -0.01043363 -0.009731257
-0.01786081 -0.01001629 -0.01491588

My other polyhedrons are also 4 vertices and have the similar size of the polyhedron above.

 Robert Caulk (rcaulk) said on 2019-08-23: #2

 zhou qian (zhoug15) said on 2019-08-23: #3

Hi Robert:
I know my description may be unclear but I tried to provide more information.
I read the codes about polyhedron and found that my codes blocked in function Polyhedron Simplify(Polyhedron P,Real limit) in Polyhedra_support.cpp.
I want to know
1.what is this function used for?

I also checked the errored interaction and its relative polyhedrons, and found that the 2 polyhedrons,
Poly1 init dofs:
Vector3(-4.229972e-11,0.05,-0.01572352)
Vector3(-0.008409783,0.03956479,-0.025)
Vector3(-0.006184036,0.03689339,-0.01840207)
Vector3(-0.01039558,0.04890738,-0.01572352)

Poly2 init dofs:
Vector3(-8.637007e-10,0.04044868,-0.025)
Vector3(-4.229972e-11,0.05,-0.01572352)
Vector3(0.00397562,0.04082184,-0.01813537)
Vector3(0.005226423,0.04972609,-0.025)

the 2 polys have a common point and in my simulation, they will have a very very small intersection at this point after several steps.

I want to know
2. If the intersection is very very small, will it got wrong? and why?

In fact, if I adjust the time step to a larger one, it does run smoothly. I guess that's because the intersection is larger?

3.Will reducing SIMPLIFY_LIMIT work?
Yours,
Joe

 Robert Caulk (rcaulk) said on 2019-08-23: #4

Thank you so much for helping create a sustainable resource for future users.

"If you encounter an error, share it." In other words, copy and paste the error here.

Next, let's look at item 3) from [1]. Without an MWE, we cannot reproduce the "error" that you are referring to and therefore we are throwing darts at a pool table ;-)

If you prefer that we don't investigate your particular error, instead but you simply want to talk about the code, then at the very least we need to make sure we are looking at the same trunk, the same file, the same line. Can you link to the line number for this function "Simplify(Polyhedron P,Real limit)"?

 Jan Stránský (honzik) said on 2019-08-23: #5

Also please provide information about operating system, yade version, method installation (package/source) and CGAL version and how it was installed.
Thanks
Jan

 zhou qian (zhoug15) said on 2019-08-23: #6

Hi Robert Jan:
Here are my codes:

from minieigen import Vector3, Matrix3, Matrix6

# basic materials
matS = PolyhedraMat(young=1.e14,poisson=0.1,frictionAngle=0.2,density=1e7)
O.materials.append(matS)

POLY1=[
Vector3(-1.1252229043696602e-9,0.04044867969995926,-0.02500000014298641),
Vector3(-2.404624131217237e-10,0.0499995,-0.015723519897073306),
Vector3(0.003975620285304186,0.04082183933765579,-0.018135369824275445),
Vector3(0.005226423189199525,0.04972559,-0.02500000012427156)]

POLY2=[
Vector3(1.222315982854378e-10,0.0499995,-0.015723520027142578),
Vector3(-0.008409782917328579,0.03956479014801928,-0.02500000011219652),
Vector3(-0.006184036292741935,0.03689338966056221,-0.018402069868769105),
Vector3(-0.010395579966696341,0.0489073797989524,-0.015723519982404767)]

poly1 = utils.polyhedron(material=matS, vertices=POLY1,fixed=True)
poly2 = utils.polyhedron(material=matS, vertices=POLY2,fixed=True)
O.bodies.append(poly1)
O.bodies.append(poly2)

O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Facet_Aabb(),Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb()],verletDist=0.01),
InteractionLoop(
[Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()],
[Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys()], # collision "physics"
[Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()] # contact law -- apply forces
),

NewtonIntegrator(damping=0.1,gravity=(0,0,0.0)),
]

O.dt = 0.00001

O.step()

POLY1 and POLY2 contain the coordinates of the 2 polys when it got error. It got error in line 271-289 in function Simplify in /pkg/dem/Polyhedra_support.cpp

I use yade-2017.01a on Ubuntu16.04, but I can't get my CGAL version. CGAL is installed in 2015, so I think its version>4.5. I didn't enable lbmflow linsolv pfvflow sph which don't have any influence on polyhedron mudule.

Yours,
Joe

 Robert Caulk (rcaulk) said on 2019-08-23: #7

I run your code and I do not get an error. Is there a certain number of iterations required to reproduce the error? What is the error we are looking for....?

 zhou qian (zhoug15) said on 2019-08-23: #8

Hi Robert:
I still got segmentation fault (core dumped) even if I changed a device...
I decide to check the error myself but I want to know what is the function Simplify( line 271-289 /pkg/dem/Polyhedra_support.cpp) used for and how it works?
Yours,
Joe

 Jan Stránský (honzik) said on 2019-08-23: #9

I **think** (cannot find any reference but I am concerned I read it somewhere) that with newer CGAL, this kind of errors was solved..
Could you try the same code on a newer system (could be just virtual machine)?
Jan

 zhou qian (zhoug15) said on 2019-08-23: #10

Hi Jan:
It works!