Clump with wall

Asked by Xin Wu

Dear Sir,
I have now some Problems with Clump. I will try Box-Experiment with Clump and write the Code. But the Programme stop and warnt NameError: name 'makeClumpTemplate' is not defined. Can anyone help me. Thank you.

from yade import utils
from numpy import linspace
from numpy import arange
import gts
import itertools
from yade import pack

rMean=.0096
rRelFuzz=.0016
maxLoad=4500

frictionAngleSt=radians(35)
frictionAngleBo=radians(23.5)

a=0.05
spheremat=O.materials.append(FrictMat(density=2650,young=210e6,poisson=0.3,frictionAngle=frictionAngleBo))
id_Mat=O.materials.append(FrictMat(density=2650,young=175e6,poisson=0.3,frictionAngle=frictionAngleBo))
Mat=O.materials[id_Mat]
steel=O.materials.append(FrictMat(young=210e9, poisson=.25,frictionAngle=frictionAngleSt,density=8000))

from yade import pack, plot,qt

sp=pack.SpherePack()
sp.makeCloud((0.005,0.005,0),(0.3,0.3,0.30),rMean=.0096,rRelFuzz=.0016,periodic=False)
O.bodies.append([sphere(a,r,material=Mat) for a,r in sp])

print len(sp),' particles generated.'

fIDSI=O.bodies.append(utils.geom.facetBox((.15,.15,.135),(.15,.15,.045),wallMask=15,material=steel))
fIDSII=O.bodies.append(utils.geom.facetBox((.15,.15,.045),(.15,.15,.045),wallMask=31,material=steel))

O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
   InteractionLoop(
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
   NewtonIntegrator(damping=0.7,gravity=[0,0,-9.810]),
   #qt.SnapshotEngine(iterPeriod=60000,fileBase='/home/wuxin/Desktop/Clump/78Fr07-',label='snapshooter'),
   PyRunner(command='checkUnbalanced()',iterPeriod=1,label='checker'),
   TranslationEngine(translationAxis=[1,0,0],velocity=0,ids=fIDSI,label='Transl'),
]
O.dt=.25*utils.PWaveTimeStep()

plot.plots={'i':('w','Fz',),'PX':('Fx',)}
plot.plot()

qt.Controller()
qt.View()
r=qt.Renderer()

O.run()

utils.waitIfBatch()

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
Xin Wu (wuxin2de) said :
#1

And i think tha zhe wall cann't work with Clump.

regards
Xin

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#2

Hi,

In your script you create walls and new engines in each step, since O.iter > 500

if O.iter<500: return
fIDSIII=O.bodies.append(utils.wall(max([b.state.pos[2]+b.shape.radius+0.020 for b in O.bodies if isinstance(b.shape,Sphere)]),axis=2,sense=-1,material=Mat))
...
O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=1000)]

I think this is not what you wanted.

Try to call this commands once, not every step ...

Regards,

Christian

P.s. I did not get the NameError ... typo?

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

Hello,
at the end of your script, try:

O.run(602) # instead of O.run()

first error you eould get is:

RuntimeError: Clump::updateProperties: NaNs in eigen-decomposition of
inertia matrix?!

so this is the first problem to solve.

cheers
Jan

2013/4/14 Xin Wu <email address hidden>

> New question #226679 on Yade:
> https://answers.launchpad.net/yade/+question/226679
>
> Dear Sir,
> I have now some Problems with Clump. I will try Box-Experiment with Clump
> and write the Code. But the Programme stop and warnt NameError: name
> 'makeClumpTemplate' is not defined. Can anyone help me. Thank you.
>
> from yade import utils
> from numpy import linspace
> from numpy import arange
> import gts
> import itertools
> from yade import pack
>
> rMean=.0096
> rRelFuzz=.0016
> maxLoad=4500
>
> frictionAngleSt=radians(35)
> frictionAngleBo=radians(23.5)
>
> a=0.05
>
> spheremat=O.materials.append(FrictMat(density=2650,young=210e6,poisson=0.3,frictionAngle=frictionAngleBo))
>
> id_Mat=O.materials.append(FrictMat(density=2650,young=175e6,poisson=0.3,frictionAngle=frictionAngleBo))
> Mat=O.materials[id_Mat]
> steel=O.materials.append(FrictMat(young=210e9,
> poisson=.25,frictionAngle=frictionAngleSt,density=8000))
>
> from yade import pack, plot,qt
>
> sp=pack.SpherePack()
>
> sp.makeCloud((0.005,0.005,0),(0.3,0.3,0.30),rMean=.0096,rRelFuzz=.0016,periodic=False)
> O.bodies.append([sphere(a,r,material=Mat) for a,r in sp])
>
> print len(sp),' particles generated.'
>
>
> fIDSI=O.bodies.append(utils.geom.facetBox((.15,.15,.135),(.15,.15,.045),wallMask=15,material=steel))
>
> fIDSII=O.bodies.append(utils.geom.facetBox((.15,.15,.045),(.15,.15,.045),wallMask=31,material=steel))
>
> O.engines=[
> ForceResetter(),
>
> InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
> InteractionLoop(
>
> [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
> [Ip2_FrictMat_FrictMat_FrictPhys()],
> [Law2_ScGeom_FrictPhys_CundallStrack()]
> ),
> NewtonIntegrator(damping=0.7,gravity=[0,0,-9.810]),
>
> #qt.SnapshotEngine(iterPeriod=60000,fileBase='/home/wuxin/Desktop/Clump/78Fr07-',label='snapshooter'),
> PyRunner(command='checkUnbalanced()',iterPeriod=1,label='checker'),
>
> TranslationEngine(translationAxis=[1,0,0],velocity=0,ids=fIDSI,label='Transl'),
> ]
> O.dt=.25*utils.PWaveTimeStep()
>
> def makeClumpTemplate():
> relRadList1 = [.007,.0036]
> relPosList1 = [[0,0,0],[0.0075,0,0]]
> relRadList2 = [.0036,0.007,.0036]
> relPosList2 = [[0.0060,0,0],[0,0,0],[-0.0060,0,0]]
> templates= []
>
> templates.append(clumpTemplate(relRadii=relRadList1,relPositions=relPosList1))
>
> templates.append(clumpTemplate(relRadii=relRadList2,relPositions=relPosList2))
> O.bodies.replaceByClumps(templates,[.1,.15])
>
> def checkUnbalanced():
> if O.iter==600: checker.command='makeClumpTemplate()'
> if O.iter<500: return
>
> fIDSIII=O.bodies.append(utils.wall(max([b.state.pos[2]+b.shape.radius+0.020
> for b in O.bodies if
> isinstance(b.shape,Sphere)]),axis=2,sense=-1,material=Mat))
> global plate
> plate=O.bodies[fIDSIII]
> plate.state.vel=(0,0,-.025)
> O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=1000)]
> if abs(O.forces.f(plate.id)[2])>=maxLoad:
> Fzs=O.forces.f(plate.id)[2]
> if Fzs==0:
> Fzs=0.000000000000001
> G
> KN
> KN=0.000000000000000001
> for i in plate.intrs():
> KN=KN+i.phys.kn
> G=a/(KN*(O.dt))
> plate.state.vel[2]=(G*(Fzs-maxLoad))
> for b in O.bodies:
> if isinstance(b.shape,Sphere):
> b.state.angVel[1]=0
> if abs(O.forces.f(plate.id)[2])>(maxLoad-1):
> if abs(O.forces.f(plate.id)[2])<(maxLoad+1):
> Transl.velocity=0.0010
>
>
>
> def addPlotData():
> Fz=O.forces.f(plate.id)[2]
> F = 0
> global i
> for i in fIDSI:
> F += O.forces.f(i)[0]
> PX1=(O.bodies[i].state.pos[0]-O.bodies[i].state.refPos[0])
> SF=((0.30-PX1)*0.30)
>
> plot.addData(t=O.time,Fx=(-F/SF),PX=PX1,Fz=Fz,w=plate.state.pos[2]-plate.state.refPos[2],i=O.iter)
> if (O.bodies[i].state.pos[0]-O.bodies[i].state.refPos[0])>0.050:
> plot.saveDataTxt('175e6p03RW235.txt',vars=('i','PX','Fx','w','Fz'))
> O.pause()
>
> plot.plots={'i':('w','Fz',),'PX':('Fx',)}
> plot.plot()
>
> qt.Controller()
> qt.View()
> r=qt.Renderer()
>
> O.run()
>
> utils.waitIfBatch()
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#4

@jan:

> RuntimeError: Clump::updateProperties: NaNs in eigen-decomposition of inertia matrix?!

This was solved in

https://github.com/yade/trunk/commit/164769edd61da2056434f890d7f5de5f1568aaaf

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

Ok, sorry, I have not updated for some time..
btw, Xin, what version of Yade are you using?
Jan

2013/4/15 Christian Jakob <email address hidden>

> Question #226679 on Yade changed:
> https://answers.launchpad.net/yade/+question/226679
>
> Christian Jakob posted a new comment:
> @jan:
>
> > RuntimeError: Clump::updateProperties: NaNs in eigen-decomposition of
> inertia matrix?!
>
> This was solved in
>
>
> https://github.com/yade/trunk/commit/164769edd61da2056434f890d7f5de5f1568aaaf
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

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

With the newest version, I did not get this error
Jan

2013/4/15 Jan Stránský <email address hidden>

> Question #226679 on Yade changed:
> https://answers.launchpad.net/yade/+question/226679
>
> Jan Stránský proposed the following answer:
> Ok, sorry, I have not updated for some time..
> btw, Xin, what version of Yade are you using?
> Jan
>
>
> 2013/4/15 Christian Jakob <email address hidden>
>
> > Question #226679 on Yade changed:
> > https://answers.launchpad.net/yade/+question/226679
> >
> > Christian Jakob posted a new comment:
> > @jan:
> >
> > > RuntimeError: Clump::updateProperties: NaNs in eigen-decomposition of
> > inertia matrix?!
> >
> > This was solved in
> >
> >
> >
> https://github.com/yade/trunk/commit/164769edd61da2056434f890d7f5de5f1568aaaf
> >
> > --
> > You received this question notification because you are a member of
> > yade-users, which is an answer contact for Yade.
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~yade-users
> > Post to : <email address hidden>
> > Unsubscribe : https://launchpad.net/~yade-users
> > More help : https://help.launchpad.net/ListHelp
> >
>
> --
> You received this question notification because you are a member of
> yade-users, which is an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
Xin Wu (wuxin2de) said :
#7

hallo Jan, Christian,
I have used the Version 0.95.0. I have corrected the Code what Christian have showed.
And now the Facet work with Clump. But I want to use the wall in the Simulation and it cann't play.
I donn't know why, but I think that wall cann't work with Clump.

regards
xin

Revision history for this message
Christian Jakob (jakob-ifgt) said :
#8

> But the Programme stop and warnt NameError: name 'makeClumpTemplate' is not defined.

The command is clumpTemplate(), not makeClumpTemplate() ...

hih

c

Can you help with this problem?

Provide an answer of your own, or ask Xin Wu for more information if necessary.

To post a message you must log in.