Use PotentialBlock to create polyhedrons of different sizes and let them fall freely
Dear all,
I use the PotentialBlocks module to create polyhedrons of different sizes. The sizes of the three polyhedrons are 0.0035, 0.0075, and 0.02. Let these polyhedrons accumulate under the action of gravity, but I found that the polyhedrons will have problems when falling under gravity. Specifically, they do not conform to free fall. Some polyhedrons rotate during the fall. The kinetic energy I generated in the script The figure also illustrates this problem. I think it may be related to the time step, but this problem will arise no matter how the time step is adjusted.
Could you please tell me how to adjust so that many polyhedrons of different sizes can fall freely correctly?
Thanks in advance.
Jie
Here's my script
##################
from yade import polyhedra_
import numpy as np
import math
import random
import os
import errno
try:
os.mkdir('./vtk/')
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
pass
# Engines
Kn=1e8
Ks=Kn/10
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegrat
]
#------
#Material
n = PolyhedraMat(
O.materials.
#------
#Dimensions
meanSize = 0.05
wallThickness = 0.5*meanSize
distanceToCentre = 0.05
lengthOfBase =0.25
heightOfBase = 0.6
#------
#Make Cloud
sp=pack.
mn,mx=Vector3(
sp.makeCloud(
for center,radius in sp:
if radius<0.015 :
aa= [-0.14777172323
bb= [0.962716291198134, -0.554650457413
cc= [-0.22658521680
dd= [ 0.01046852, 0.00727971, 0.003921, 0.00489801, 0.00656607, 0.00419807, 0.00729218, 0.00571139, 0.00905, 0.00527244, 0.00897574, 0.00696368]
r=min(dd)/2 #Suggested value
b=Body()
b.mask=1
b.state.pos =center #s[0] stores center
b.state.ori = Quaternion(
if radius>0.015:
aa= [0.301189915214
bb= [-0.91216196547
cc= [-0.27793017777
dd= [ 0.01006424, 0.00638965, 0.00577747, 0.00372272, 0.00676639 , 0.0088564, 0.00358511, 0.00330544, 0.00560061, 0.00452511, 0.00683327, 0.01007156, 0.00563036 , 0.00749891]
r=min(dd)/2 #Suggested value
b=Body()
b.mask=1
b.state.pos =center #s[0] stores center
b.state.ori = Quaternion(
countPBs=0
for b in O.bodies:
if isinstance(
countPBs=
print("number of PotentialBlocks = ", countPBs)
color=[0,0.5,1]
r=0.15*
bbb=Body()
bbb.mask=3
wire=False
bbb.shape=
utils._
bbb.state.pos = [2*lengthOfBase
O.bodies.
bA=Body()
bA.mask=3
bA.shape=
utils._
bA.state.pos = [0.5*lengthOfBa
lid=O.bodies.
bB=Body()
bB.mask=3
bB.shape=
utils._
bB.state.pos = [-0.5*lengthOfB
O.bodies.append(bB)
bC=Body()
bC.mask=3
bC.shape=
utils._
bC.state.pos = [2*lengthOfBase
O.bodies.append(bC)
bD=Body()
bD.mask=3
bD.shape=
utils._
bD.state.pos = [2*lengthOfBase
O.bodies.append(bD)
O.dt =2e-5
#------
# Plot results
def myAddPlotData():
global wallThickness
global meanSize
uf=
if isnan(uf):
uf = 1.0
KE = utils.kineticEn
plot.
from yade import plot
plot.plots=
plot.plot() #Uncomment to view plots
O.engines=
#------
# exportPotential
from yade import export
vtkExporter_
def vtkExport():
vtkExporter_
O.engines=
from yade import qt
v=qt.View()
v.sceneRadius=10.0
v.ortho=True # I activate orthotropic projection, to make visual comparisons easier
O.saveTmp()
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Jan Stránský
- Solved:
- 2020-09-21
- Last query:
- 2020-09-21
- Last reply:
- 2020-09-21
Jan Stránský (honzik) said : | #1 |
Hello,
could you please try to create a MWE [1], a minimal example, i.e. with just a few polyhedrons, but still reproducing your problem?
thanks
Jan
weijie (amandajoe) said : | #2 |
Hi Jan,
I simplified my script and deleted many unnecessary parts, leaving only a few polyhedra. But I found that the more polyhedrons, the more serious the problem.
Best regards
Jie
Below is my script:
########
from yade import polyhedra_
import numpy as np
import math
import random
#------
# Engines
Kn=1e8
Ks=Kn/10
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegrat
]
O.materials.
#------
# Dimensions
lengthOfBase = 0.250
heightOfBase = 0.600
#------
# Make cloud
sp=pack.
mn,mx=Vector3(
sp.makeCloud(
#Generate polyhedrons of different sizes
for center,radius in sp:
if radius<0.0025 :
b=Body()
b.mask=1
b.state.pos =center #s[0] stores center
b.state.ori = Quaternion(
if radius>0.0025 and radius<0.005 :
b=Body()
b.mask=1
b.state.pos =center #s[0] stores center
b.state.ori = Quaternion(
if radius>0.01 and radius<0.02 :
aa= [0.083769848814
bb= [-0.84138210746
cc= [0.533908945106932, -0.041788054719
dd= [0.012044189,
r=min(dd)/2 #Suggested value
b=Body()
b.mask=1
b.state.pos =center #s[0] stores center
b.state.ori = Quaternion(
#------
# Bottom plate
color=[0,0.5,1]
wallThickness=0.025
r=0.15*
bbb=Body()
bbb.mask=3
wire=False
bbb.shape=
utils._
bbb.state.pos = [1*lengthOfBase
O.bodies.
#------
# Plot results
def myAddPlotData():
KE = utils.kineticEn
plot.
from yade import plot
plot.plots=
plot.plot()
O.engines=
#Timestep
O.dt = 1e-5
#------
from yade import qt
v=qt.View()
v.sceneRadius=3.0
O.saveTmp()
Jan Stránský (honzik) said : | #3 |
> I simplified my script and deleted many unnecessary parts, leaving only a few polyhedra. But I found that the more polyhedrons, the more serious the problem.
Are you able to reproduce the problem with single / really only a few polyhedrons?
If a single particle does not have this problem, I see no reason why many **non-interacting** polyhedrons would have a problem.
> Specifically, they do not conform to free fall.
> Some polyhedrons rotate during the fall
Are you sure your particles has no interaction? this would be the symptoms of initial interactions..
> I think it may be related to the time step
free fall should be independent of time step
cheers
Jan
weijie (amandajoe) said : | #4 |
Hi Jan,
>Are you able to reproduce the problem with single / really only a few polyhedrons?
This is what makes me feel strange. I only used three polyhedrons in the following script, and the size of the polyhedron is the same as #2. I found that when there are only three polyhedrons, it can fall freely normally. If the number of polyhedrons is increased to the number of #2, it will not conform to free fall, which makes me very confused.
>Are you sure your particles has no interaction? this would be the symptoms of initial interactions..
During the initial generation of particles, enough space is left so that the particles do not touch each other.
>free fall should be independent of time step
This is another point that puzzles me. When there are many polyhedrons, when I use a smaller time step, the situation improves a little, for example, the rotation is not so great.
Best regards
Jie
Below is my script:
#############
from yade import polyhedra_
import numpy as np
import math
import random
#------
# Engines
Kn=1e8
Ks=Kn/10
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
NewtonIntegrat
]
O.materials.
#------
# Dimensions
lengthOfBase = 0.250
heightOfBase = 0.600
#------
#Generate polyhedrons of different sizes
#polyhedron A
r=0.01*0.0025
b=Body()
b.mask=1
b.aspherical=True
color=[
distanceToCentr
b.shape=
utils._
b.state.pos =[lengthOfBase,
b.state.ori = Quaternion(
O.bodies.append(b)
#polyhedron B
r=0.01*0.0025
b=Body()
b.mask=1
b.aspherical=True
color=[0.1,0.2,0.3]
distanceToCentr
b.shape=
utils._
b.state.pos =[lengthOfBase+
b.state.ori = Quaternion(
O.bodies.append(b)
#polyhedron C
aa= [0.083769848814
bb= [-0.84138210746
cc= [0.533908945106932, -0.041788054719
dd= [0.012044189,
r=min(dd)/2 #Suggested value
b=Body()
b.mask=1
b.aspherical=True
color=[0.5,0.4,0.3]
b.shape=
utils._
b.state.pos =[lengthOfBase+
b.state.ori = Quaternion(
O.bodies.append(b)
#------
# Bottom plate
color=[0,0.5,1]
wallThickness=0.025
r=0.15*
bbb=Body()
bbb.mask=3
wire=False
bbb.shape=
utils._
bbb.state.pos = [lengthOfBase,0,0]
O.bodies.
#------
# Plot results
def myAddPlotData():
KE = utils.kineticEn
plot.
from yade import plot
plot.plots=
plot.plot()
O.engines=
#Timestep
O.dt = 1e-5
#------
from yade import qt
v=qt.View()
v.sceneRadius=3.0
O.saveTmp()
|
#5 |
> I found that when there are only three polyhedrons, it can fall freely normally
then the initial overlaps are most suspicious
> During the initial generation of particles, enough space is left so that the particles do not touch each other.
In your original code, if I add this at the end
###
O.step()
for i in O.interactions:
pd = i.geom.
b1,b2 = [O.bodies[id] for id in (i.id1,i.id2)]
c1,c2 = [b.shape.
print(pd,c1,c2)
###
I got something like (depending on the run and makeCloud mood, sometimes there is no interaction, sometimes there are more interactions)
###
3.3656901430446
0.0002137593708
###
meaning that you DO have some non-negligible initial interactions (and therefore the space left is NOT enough), disturbing the perfect free fall.
Under the presence of interactions, time step of course does have some influence.
cheers
Jan
weijie (amandajoe) said : | #6 |
Thanks Jan Stránský, that solved my question.