Segmentation fault (core dumped) with gmshPFacet

Asked by Kun Zeng

Hi,

I am trying to import a .mesh file into yade. I learn from the example "mesh-pfacet.py" and change the "sphere.mesh" file with my own .mesh file.
And I got:

Segmentation fault (core dumped)

Do you know what's problem here? How can I get rid of this problem? Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#1

Hi,
With the limited info I have I would guess your .mesh file is corrupted.
Regards
Bruno

Revision history for this message
Jan Stránský (honzik) said :
#2

You can also try
catchsegv yade yourscript.py
the output can help to tell where the problem is
Jan

Revision history for this message
Kun Zeng (zkbread) said :
#3

Hi Jan and Bruno,

I run the command as Jan suggested:

catchsegv python yade mesh-pfacet.py and got output which I saved into a .txt file. Can you help me to see what's problem I got?

https://drive.google.com/file/d/1VgGxq6m-Hqk8ESdZt63nF88h7YqQGQAl/view?usp=sharing

Thanks.

Revision history for this message
Jan Stránský (honzik) said :
#4

Some problem with boost..
could you please provide your .mesh file?
thanks
Jan

Revision history for this message
Kun Zeng (zkbread) said :
#5

Hi Jan,

Sure.

1. Here is my .mesh file: https://drive.google.com/file/d/1pOcEOdSkoRUarihCZeZsX_7K_o3pShEd/view?usp=sharing

2. I tried to use ymport.gmsh to import the .mesh and it successed but it seems only import the wire of te mesh and no material properties imported.

3. I tried to run the example: examples/test/unv-read/unvRead.py. But I got:

  File "unvRead.py", line 3, in <module>
    facets = ymport.unv('shell.unv',shift=(100,200,300),scale=1000)
  File "/home/kun/femdem/yade/install/lib/x86_64-linux-gnu/yade/py/yade/ymport.py", line 379, in unv
    return facets
NameError: global name 'facets' is not defined

Why I got this ?

Thanks.

Revision history for this message
Kun Zeng (zkbread) said :
#6

Hi Jan,

I found for my question #3:

Here is a bug in /yade/ymport.py in line 379. It is now:

if returnConnectivityTable:
  return unvReader.facets, unvReader.nodes, unvReader.elements
 return facets ####line 379

I think there it should be changed to 'return unvReader.facets' .

1). And can I use the following code to import my file into yade and apply gravity on the facet? But when I add:

kwm={'color':[1,0,0],'wire':False,'material':0} and run the simulation, it seems no gravity on the structure I imported.

######################
Here is my code:

from yade import ymport,export
#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3))

#Parameters, which will be passed into spheres and facets creators

kwm={'color':[1,0,0],'wire':False,'material':0}

f,n,e = ymport.unv('shell.unv',returnConnectivityTable=True,**kwm)
O.bodies.append(f)
vtk = export.VTKExporter('test')
#vtk.exportFacetsAsMesh(elements=e)

O.engines=[
 #SubdomainBalancer(colorize=True,initRun=True,iterPeriod=100),
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider',verletDist=.1),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()],
 ),
 NewtonIntegrator(damping=.1,gravity=(1e-2,1e-2,-9.81)),
]

O.dt=0.0002

Revision history for this message
Best Jan Stránský (honzik) said :
#7

Hello,

a)
examples/test/unv-read/unvRead.py has been fixed some time ago [1] (probably later than your version of yade was released)

b)
> 2. I tried to use ymport.gmsh to import the .mesh and it successed but it seems only import the wire of te mesh and no material properties imported.

the ymport module functions usually import only geometry, no material properties.. As you wrote later, you can try kwarg wire=False to get filled facets rather than only the edges

c)
facets are non-dynamic bodies by default. To make them dynamic, you have to assiign mass and inertia to them:
###
for facet in f:
   facet.state.mass = 1
   facet.state.inertia = (1,1,1)
   facet.dynamic = True
###

cheers
Jan

[1] https://github.com/yade/trunk/blob/master/py/ymport.py#L379

Revision history for this message
Kun Zeng (zkbread) said :
#8

Thanks Jan Stránský, that solved my question.