Why use ymport.textPolyhedra command make the simulation to slow?

Asked by Kun Zeng

I first prepare some polyhedra particle in my model and used 'export.textPolyhedra' to export the polyhedra layer into .txt file. When I use 'ymport.textPolyhedra' in a new input file to import the .txt file and run the model, it seems the simulation become to slow(much slower than the previous particle preparation step simulation)... What's the situation here? Thanks.

######################################################################
# INPUTS
######################################################################
gravity = 100

# box dimensions
widthl = 1.3
widthr = 1.3
widthc = 1.3
height = 1
thick = 3
deep = -.2

# size of grains
sizeMin = 40e-3
sizeMax = 95e-3

frictionAngle = .5
young = 45e9 # stiffness
density = 16000 #kg/m^3

dt = 1e-4 # time step

# how much larger the initial make box should be
fillBoxHFactor = 1
######################################################################
from yade import polyhedra_utils, export, ymport

width = widthl+widthc+widthr

# mat, engines, ...
mat = PolyhedraMat(young=young,poisson=.25,density=density,frictionAngle=frictionAngle)
O.materials.append(mat)

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   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.3,gravity=(0,0,-100)),

]

O.dt = dt

# box
p000 = Vector3(0,0,0)
p100 = Vector3(widthl,0,0)
p200 = Vector3(widthl+widthc,0,0)
p300 = Vector3(widthl+widthc+widthr,0,0)
pxs = (p000,p100,p200,p300)
p001,p101,p201,p301 = [p+Vector3(0,0,height) for p in pxs]
p010,p110,p210,p310 = [p+Vector3(0,thick,0) for p in pxs]
p011,p111,p211,p311 = [p+Vector3(0,thick,height) for p in pxs]
p00b,p10b,p20b,p30b = [p+Vector3(0,0,deep) for p in pxs]
p01b,p11b,p21b,p31b = [p+Vector3(0,thick,deep) for p in pxs]
def rect(vs,**kw):
 v1,v2,v3,v4 = vs
 return [
  facet((v1,v2,v3),**kw),
  facet((v1,v3,v4),**kw),
 ]
rects = (
 (p000,p300,p310,p010), # bottom
 (p000,p010,p011,p001), # left
 (p300,p310,p311,p301), # right
 (p000,p300,p301,p001), # front
 (p010,p310,p311,p011), # back
)
rects = sum((rect(r) for r in rects),[])
O.bodies.append(rects)

O.bodies.append(yade.ymport.textPolyhedra('try_new_layer1.txt', mat,shift=Vector3(0, 0, 0), scale=1.0, orientation=Quaternion((1, 0, 0), 0)))

Question information

Language:
English Edit question
Status:
Answered
For:
Yade Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello, the "speed" of simulation depends very much on yhe number of interactions. Could you compare the output of
len([i for i in O.interactions])
for both (faster and slower) cases?
cheers
Jan

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

Hi Jan,

I checked the interactions in my simulation(facet boundary and polyhedra particles), the poly particles number is 91361 and the interaction number is 416719. And the simulation is too slow even I used 8 threads.

And I notice the speed is iter #1 0.0/s. Is this because my interactions number is too much? Thanks

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

Hello,
Is it possible to see how you compared the two situations (with/without ymport)?
The above script does not show the reference (not "ymported") case.
Bruno

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

Hi Bruno,

Actually, I just run this two simulation individually and visually see the iteraction speed...One I directly generate polyhedra particles by using makeCloud to generate sphere particles and change the particles to polyhedra with the same size and free falling then save by using exportpolyhedra command. The other I use ymortpolyhedra to import the particles.

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

>I just run this two simulation individually

Since only you know what you are doing (you showed only one script), only you can find the reason I guess.
B

Can you help with this problem?

Provide an answer of your own, or ask Kun Zeng for more information if necessary.

To post a message you must log in.