yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #28532
Re: [Question #703571]: How to reset the stiffness of the particles at a later stage?
Question #703571 on Yade changed:
https://answers.launchpad.net/yade/+question/703571
孙灿 posted a new comment:
>'Omega' object has no attribute 'bodise'?
What's the meaning of this? Does "Omega" here refer to the Greek letter
Ω? What I add to the list is the particle ID (shuzu. append (b.id)), and
I use O. bodies [I] Material=mat2, which cannot solve this problem.
The code is as follows:
#Material constants(1)
Density1 = 1836
FrictionAngle1 = 5
PoissonRatio1 = 0.4
Young1 = 1e8
Damp = 0.5
AvgRadius1 = 0.05
N_particles = 10000
#Material constants(23)
Density23 = 2000
FrictionAngle23 = 27
PoissonRatio23 = 0.35
Young23 = 1e9
Damp = 0.5
AvgRadius1 = 0.05
N_particles = 10000
#Wall constants
WDensity = 0
WFrictionAngle = 0.0
WPoissonRatio = 0.1
WYoung = 50e9
#time calculation
startT = O.time
endT = O.time
timeSpent = endT - startT
mat1 = O.materials.append(FrictMat(young = Young1, poisson = PoissonRatio1, frictionAngle = radians(FrictionAngle1), density = Density1))
mat2 = O.materials.append(FrictMat(young = Young23, poisson = PoissonRatio1, frictionAngle = radians(FrictionAngle1), density = Density1))
WallMat = O.materials.append(FrictMat(young = WYoung, poisson = WPoissonRatio, frictionAngle = radians(WFrictionAngle)))
from yade import pack,plot
O.bodies.append(geom.facetBox((0.05, 15, 15), (0.5, 15, 15), wallMask=63,material=WallMat))
sp = pack.SpherePack()
sp.makeCloud(Vector3(0.05,0,0),Vector3(0.05,30,30), rMean=0.3, rRelFuzz=0)
sp.toSimulation(material = mat1)
(xdim,ydim,zdim)= aabbDim()
print("Height is ",zdim)
for b in O.bodies:
if isinstance(b.shape,Sphere):
b.state.blockedDOFs='ZxY'
b.shape.color=(0,0,1.)
circleRadius=2
circleCenter = Vector3(0.05,15,6)
circleRadius1=2.5
#myEngine.dead = True
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
PyRunner(command='checkUnbalanced()', realPeriod=2,label="myEngine"),
PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = 0.5 * PWaveTimeStep()
O.trackEnergy = True
shuzu=[]
def checkUnbalanced():
if unbalancedForce() < .0001:
O.pause()
zMax = max(b.state.pos[2] for b in O.bodies if isinstance(b.shape,Sphere))
print("Z ",zMax)
ceng = zMax-0.4
for b in O.bodies:
if isinstance(b.shape,Sphere):
#b.state.blockedDOFs='zxy'
b.state.vel=(0,0,0)
b.state.angVel=(0,0,0)
if b.state.pos[2]>ceng:
print(b.id,b.state.pos)
shuzu.append(b.id)
#selectedSpheres+=(b,)
print(shuzu)
#zMax = max(b.state.pos[2] for b in O.bodies)
#zMax = max(b.state.pos[2] for b in O.bodies)
#print("Z ",zMax)
#(xdim,ydim,zdim)= aabbDim()
#print("Height is ",zdim)
def printInfo():
print("=============")
print("step",O.iter)
for i,body in enumerate(O.bodies):
print("body",i,"young",body.mat.young)
for i,intr in enumerate(O.interactions):
print("interaction",intr.id1,intr.id2,"kn",intr.phys.kn)
O.step()
printInfo()
def li():
for i in shuzu:
#i.mat = mat2
O.bodies[i].material = mat2
for intr in body.intrs():
O.interactions.erase(intr.id1,intr.id2)
printInfo()
def addPlotData():
plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)
def duqu():
for i in shuzu:
b = O.bodies[i]
print("voila",i,b.state.pos)
def wadong1():
for b in O.bodies:
d = (b.state.pos - circleCenter).norm()
if d < circleRadius:
O.bodies.erase(b.id)
O.saveTmp()
from yade import qt
qt.Controller()
qt.View()
The code is as follows: Error will be reported:
ArgumentError: Python argument types in
BodyContainer.__getitem__(BodyContainer, Body)
did not match C++ signature:
__getitem__(pyBodyContainer {lvalue}, int)
When I directly add the particles themselves to the list (shuzu. append (b)), and use i mat=mat2, error will still be reported:
ArgumentError: Python argument types in
BodyContainer.__getitem__(BodyContainer, Body)
did not match C++ signature:
__getitem__(pyBodyContainer {lvalue}, int)
The code is as follows:
#Material constants(1)
Density1 = 1836
FrictionAngle1 = 5
PoissonRatio1 = 0.4
Young1 = 1e8
Damp = 0.5
AvgRadius1 = 0.05
N_particles = 10000
#Material constants(23)
Density23 = 2000
FrictionAngle23 = 27
PoissonRatio23 = 0.35
Young23 = 1e9
Damp = 0.5
AvgRadius1 = 0.05
N_particles = 10000
#Wall constants
WDensity = 0
WFrictionAngle = 0.0
WPoissonRatio = 0.1
WYoung = 50e9
#time calculation
startT = O.time
endT = O.time
timeSpent = endT - startT
mat1 = O.materials.append(FrictMat(young = Young1, poisson = PoissonRatio1, frictionAngle = radians(FrictionAngle1), density = Density1))
mat2 = O.materials.append(FrictMat(young = Young23, poisson = PoissonRatio1, frictionAngle = radians(FrictionAngle1), density = Density1))
WallMat = O.materials.append(FrictMat(young = WYoung, poisson = WPoissonRatio, frictionAngle = radians(WFrictionAngle)))
from yade import pack,plot
O.bodies.append(geom.facetBox((0.05, 15, 15), (0.5, 15, 15), wallMask=63,material=WallMat))
sp = pack.SpherePack()
sp.makeCloud(Vector3(0.05,0,0),Vector3(0.05,30,30), rMean=0.3, rRelFuzz=0)
sp.toSimulation(material = mat1)
(xdim,ydim,zdim)= aabbDim()
print("Height is ",zdim)
for b in O.bodies:
if isinstance(b.shape,Sphere):
b.state.blockedDOFs='ZxY'
b.shape.color=(0,0,1.)
circleRadius=2
circleCenter = Vector3(0.05,15,6)
circleRadius1=2.5
#myEngine.dead = True
O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(), Bo1_Facet_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(), Ig2_Facet_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(gravity=(0, 0, -9.81), damping=0.4),
PyRunner(command='checkUnbalanced()', realPeriod=2,label="myEngine"),
PyRunner(command='addPlotData()', iterPeriod=100)
]
O.dt = 0.5 * PWaveTimeStep()
O.trackEnergy = True
shuzu=[]
def checkUnbalanced():
if unbalancedForce() < .0001:
O.pause()
zMax = max(b.state.pos[2] for b in O.bodies if isinstance(b.shape,Sphere))
print("Z ",zMax)
ceng = zMax-0.4
for b in O.bodies:
if isinstance(b.shape,Sphere):
#b.state.blockedDOFs='zxy'
b.state.vel=(0,0,0)
b.state.angVel=(0,0,0)
if b.state.pos[2]>ceng:
print(b.id,b.state.pos)
shuzu.append(b)
#selectedSpheres+=(b,)
print(shuzu)
#zMax = max(b.state.pos[2] for b in O.bodies)
#zMax = max(b.state.pos[2] for b in O.bodies)
#print("Z ",zMax)
#(xdim,ydim,zdim)= aabbDim()
#print("Height is ",zdim)
def printInfo():
print("=============")
print("step",O.iter)
for i,body in enumerate(O.bodies):
print("body",i,"young",body.mat.young)
for i,intr in enumerate(O.interactions):
print("interaction",intr.id1,intr.id2,"kn",intr.phys.kn)
O.step()
printInfo()
def li():
for i in shuzu:
i.mat = mat2
#O.bodies[i].material = mat2
for intr in body.intrs():
O.interactions.erase(intr.id1,intr.id2)
printInfo()
def addPlotData():
plot.addData(i=O.iter, unbalanced=unbalancedForce(), **O.energy)
def duqu():
for i in shuzu:
b = O.bodies[i]
print("voila",i,b.state.pos)
def wadong1():
for b in O.bodies:
d = (b.state.pos - circleCenter).norm()
if d < circleRadius:
O.bodies.erase(b.id)
O.saveTmp()
from yade import qt
qt.Controller()
qt.View()
--
You received this question notification because your team yade-users is
an answer contact for Yade.