← Back to team overview

yade-users team mailing list archive

Re: [Question #404048]: plot does not work correctly

 

Question #404048 on Yade changed:
https://answers.launchpad.net/yade/+question/404048

    Status: Open => Answered

Jan Stránský proposed the following answer:
Hello,
I could not reproduce the problem, I have tried your script, the plot
showed both increasing stress and strain..
What version of Yade and what system do you use?
Thanks
Jan

PS: just to be sure, did you actually run the simulation with O.run() or
GUI play button?


2016-11-14 2:52 GMT+01:00 xjin <question404048@xxxxxxxxxxxxxxxxxxxxx>:

> New question #404048 on Yade:
> https://answers.launchpad.net/yade/+question/404048
>
> I am trying to model a triaxial test.I write the script referred to the
> website:
> https://github.com/yade/trunk/blob/master/examples/concrete/triax.py.
>
> When I run my script,the plot-figure(whose codes is in the end) does not
> show the trend curves.The valuee in the figure are only zero as time goes.
> Could you give me some suggestion?
> The scripe is shown below.
> Thanks a lot!
>
>
>
>
>
> from yade import pack
> from yade import plot
> from yade import os
>
> densitytu=float(1600)
> youngtu=40e6
> potu=0.3
> frictionAngletu= float(atan(0.7))
> globals()['densitytu']=locals()['densitytu']
> globals()['youngtu']=locals()['youngtu']
> globals()['potu']=locals()['potu']
> globals()['frictionAngletu']=locals()['frictionAngletu']
>
> rParticle=float(2e-3)
> rRelFuzz=float(1.75/8.75)*1.5
> globals()['rParticle']=locals()['rParticle']
> globals()['rRelFuzz']=locals()['rRelFuzz']
>
> vel=1
> preStress=float(-60e3)
> fwire=True
> globals()['vel']=locals()['vel']
> globals()['preStress']=locals()['preStress']
> globals()['fwire']=locals()['fwire']
>
> L=float(25e-3)
> N=36
> A=float(360/N)
> H=float(100e-3)
> globals()['L']=locals()['L']
> globals()['N']=locals()['N']
> globals()['A']=locals()['A']
> globals()['H']=locals()['H']
>
> runGunplot=False
> runInGui=True
> globals()['runGunplot']=locals()['runGunplot']
> globals()['runInGui']=locals()['runInGui']
>
> tu=O.materials.append(FrictMat(density=densitytu,
> young=youngtu,poisson=potu,frictionAngle=frictionAngletu,label='tuti'))
> pred=pack.inCylinder((0,0,0),(0,0,H),L)
> sp=SpherePack()
> sp=pack.randomDensePack(pred,spheresInCell=3000,radius=
> rParticle,rRelFuzz=rRelFuzz,memoizeDb='/home/dj/yade/tmp/
> triaxTestOnCylinder.sqlite',returnSpherePack=True)
> spheres=sp.toSimulation(color=(0,0.5,0),material=tu)
>
> globals()['spheres']=locals()['spheres']
> sl1=len(O.bodies)
> globals()['sl1']=locals()['sl1']
>
> for i in range(0,N):
> O.bodies.append(facet([(0,0,0),(L*cos(i*2*pi/N),L*sin(i*2*pi/N),0),(L*cos((i+1)*
> 2*pi/N),L*sin((i+1)*2*pi/N),0)],wire=False,material=tu))
>
> sl2=len(O.bodies)
> globals()['sl2']=locals()['sl2']
>
> ti=[]
> globals()['ti']=locals()['ti']
> for i in xrange(sl1,sl2):
> ti=ti+[i]
>
> for xii in ti:
> O.bodies[xii].state.blockedDOFs='XYZxyz'
> O.bodies[xii].state.vel=(0,0,vel)
>
> for i in range(0,N):
> O.bodies.append(facet([(L*cos(i*2*pi/N),L*sin(i*2*pi/N),H),(0,0,H),(L*cos((i+1)*
> 2*pi/N),L*sin((i+1)*2*pi/N),H)],wire=False,material=tu))
>
> sl3=len(O.bodies)
> globals()['sl3']=locals()['sl3']
> tii1=[]
> globals()['tii1']=locals()['tii1']
> for iti in xrange(sl2,sl3):
> tii1=tii1+[iti]
>
> for i in tii1:
> O.bodies[i].state.blockedDOFs='XYZxyz'
> O.bodies[i].state.vel=(0,0,-1*vel)
>
> nw=36
> nh=20
> globals()['nw']=locals()['nw']
> globals()['nh']=locals()['nh']
>
> rCyl2=L*2*0.5/cos(pi/float(nw))
>
> facets=[]
> globals()['facets']=locals()['facets']
> for r in xrange(nw):
> for h in xrange(nh):
> v1=Vector3(rCyl2*cos(2*pi*(r+0)/float(nw)),rCyl2*sin(2*pi*(
> r+0)/float(nw)),H*(h+0)/float(nh))
> v2=Vector3(rCyl2*cos(2*pi*(r+1)/float(nw)),rCyl2*sin(2*pi*(
> r+1)/float(nw)),H*(h+0)/float(nh))
> v3=Vector3(rCyl2*cos(2*pi*(r+1)/float(nw)),rCyl2*sin(2*pi*(
> r+1)/float(nw)),H*(h+1)/float(nh))
> v4=Vector3(rCyl2*cos(2*pi*(r+0)/float(nw)),rCyl2*sin(2*pi*(
> r+0)/float(nw)),H*(h+1)/float(nh))
> f1=facet((v1,v2,v3),color=(0,0,0.1),material=tu,wire=fwire)
> f2=facet((v1,v3,v4),color=(0,0,0.1),material=tu,wire=fwire)
> facets.extend((f1,f2))
>
> O.bodies.append(facets)
>
> sl4=len(O.bodies)
> globals()['sl4']=locals()['sl4']
>
> mass=O.bodies[0].state.mass
> for f in facets:
> f.state.mass=(O.bodies[0].state.mass+O.bodies[1].state.
> mass+O.bodies[2].state.mass+O.bodies[3].state.mass+O.bodies[
> 4].state.mass+O.bodies[5].state.mass+O.bodies[6].state.
> mass+O.bodies[7].state.mass+O.bodies[8].state.mass)/float(9)
> f.state.blockedDOFs='XYZz'
>
> def addForces():
>   for f in facets:
>         n=f.shape.normal
>         a=f.shape.area
>         O.forces.addF(f.id,preStress*a*n)
>
> globals()['addForces']=locals()['addForces']
> def addForces1():
>   for stii in ti:
>         n=O.bodies[stii].shape.normal
>         a=O.bodies[stii].shape.area
>         O.forces.addF(O.bodies[stii].id,-1*preStress*a*n)
>
> globals()['addForces1']=locals()['addForces1']
> def addForces2():
>   for tstii in tii1:
>         n=O.bodies[tstii].shape.normal
>         a=O.bodies[tstii].shape.area
>         O.forces.addF(O.bodies[tstii].id,preStress*a*n)
>
> globals()['addForces2']=locals()['addForces2']
>
> plot.plots = {'e':('s',),}
> globals()['plot']=locals()['plot']
>
> ybz=float(max([O.bodies[s].state.pos[2] for s in
> spheres]))-min([O.bodies[s].state.pos[2] for s in spheres])
> globals()['ybz']=locals()['ybz']
>
> def plotAddData():
> f1= abs((sum(O.forces.f(b)[2] for b in tii1)-sum(O.forces.f(b)[2] for b in
> ti))/(pi*L*L))
> yb1=float(max([O.bodies[s].state.pos[2] for s in
> spheres])-min([O.bodies[s].state.pos[2] for s in spheres]))
> yb=ybz-yb1
> s=f1
> e=yb/ybz
> plot.addData(
>                        i=O.iter,
>                       s=s,
>                       e=e,
>                            )
>
> globals()['plotAddData']=locals()['plotAddData']
> O.dt=0.5*utils.PWaveTimeStep()
> enlargeFactor=1.5
>
> O.engines=[
> ForceResetter(),
> InsertionSortCollider([
> Bo1_Sphere_Aabb(aabbEnlargeFactor=enlargeFactor,label='bo1s'),
> Bo1_Facet_Aabb()
> ]),
> InteractionLoop(
> [
> Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=
> enlargeFactor,label='ss2d3dg'),
> Ig2_Facet_Sphere_ScGeom()
> ],
> [
> Ip2_FrictMat_FrictMat_FrictPhys(),
> ],
> [
> Law2_ScGeom_FrictPhys_CundallStrack()
> ],
> ),
> PyRunner(iterPeriod=1,command="addForces()"),
> PyRunner(iterPeriod=1,command="addForces1()"),
> PyRunner(iterPeriod=1,command="addForces2()"),
> NewtonIntegrator(gravity=(0,0,0),damping=0.3),
> PyRunner(iterPeriod=10,command='plotAddData()'),
> ]
> O.step()
>
> bo1s.aabbEnlargeFactor=ss2d3dg.interactionDetectionFactor=1.0
>
> if runInGui:
>     plot.plot()
>     try:
>          from yade import qt
>          renderer=qt.Renderer()
>     except:
>          pass
>
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.