← Back to team overview

yade-users team mailing list archive

Re: [Question #678668]: O.load Error

 

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

jamespaul posted a new comment:
I am so sorry about that,Jan. I've modified my code and now it runs.

############################
The first script:

# encoding: utf-8
from yade import pack, qt, plot

sigmaIso=-25000

O.periodic=True

frictionAngle1= 2.862405226
frictionAngle2= 14.03624347

sphere=O.materials.append(FrictMat(young=1e7,poisson=0.3,density=1000,frictionAngle=radians(frictionAngle1),label='sphere'))

multiple=.01
length=1.5

psdSizes=[.18*multiple,.2*multiple,.21*multiple,.25*multiple,.27*multiple,.30*multiple,.31*multiple,.34*multiple,.38*multiple]
psdCumm=[0.11,0.27,0.45,0.73,0.88,0.95,0.98,0.99,1]

sp=pack.SpherePack()
sp.makeCloud((0,0,0),(length*multiple,length*multiple,length*multiple),psdSizes=psdSizes,psdCumm=psdCumm,distributeMass=True,periodic=True)
n=sp.toSimulation()

O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom()],
  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]
 ),
 PeriTriaxController(label='triax',
  goal=(sigmaIso,sigmaIso,sigmaIso),stressMask=7,
  dynCell=True,maxStrainRate=(1000,1000,1000),
  maxUnbalanced=1e-3,relStressTol=1e-3,
  doneHook='changeMaterial()'
 ),
 NewtonIntegrator(damping=.1),
]
O.dt=.5*PWaveTimeStep()

def changeMaterial():
 O.cell.trsf=Matrix3.Identity
 for i in n:
         O.bodies[i].material.frictionAngle=radians(frictionAngle2)
 triax.doneHook='triaxFinished()'

def triaxFinished():
    print 'Finished'
    O.pause()

qt.Controller()
O.run()
O.wait()
O.save('four.yade.gz')
O.saveTmp()

#############
My second script:

#!/usr/bin/python
from yade import pack, qt, plot

O.load('four.yade.gz')
#O.run()
O.dt=1e-9

O.engines += [PeriTriaxController(
 goal=(0,0,-1000000),stressMask=4,maxStrainRate=(0,0,.1),
 maxUnbalanced=1e-8,doneHook='functionToRunWhenFinished()')]

O.engines += [PyRunner(command='addPlotData2()',iterPeriod=100000)];

def functionToRunWhenFinished():
    print 'Finished'
    O.pause()

def addPlotData2():
 plot.addData(unbalanced=unbalancedForce(),i=O.iter,
  sxx=-triax.stress[0],syy=-triax.stress[1],szz=-triax.stress[2],
  exx=-triax.strain[0],eyy=-triax.strain[1],ezz=-triax.strain[2],
  q=-triax.stress[2]+0.5*(triax.stress[0]+triax.stress[1]),
  p=-(triax.stress[0]+triax.stress[1]+triax.stress[2])/3,
 )

plot.plots={'i':('unbalanced',),'i ':('sxx','syy','szz'),' i':('ezzs'),' p ':('q'),}
plot.plot()

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