yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #25091
Re: [Question #695821]: PeriTriaxController Load
Question #695821 on Yade changed:
https://answers.launchpad.net/yade/+question/695821
Johannes Welsch posted a new comment:
Hello,
I think I found the solution.
I added the definition of O.engines to the if clause of saved State as it is also saved in the yade.gz file. Now everything works properly.
if not savedState:
O.engines=[
...
]
I also tried to output len(O.engines) in UnbalancedForce() at every 1000
iterations, but i wasn't showing me that I loaded the engines twice. It
was still showing 6 engines. When I added O.engines = [..] in the if
clause everything works.
Thank you very much for your help Jan Stransky
Here the working MWE:
# encoding: utf-8
from yade import pack, qt, plot
sigmaIso=-25000
Filename = 'three.yade.gz'
savedState = os.path.exists(Filename)
if not savedState:
O.periodic=True
O.cell.setBox(5,5,10)
compFricDegree = 35
sphere=O.materials.append(FrictMat(young=1e7,poisson=0.5,density=2650,frictionAngle=radians(compFricDegree),label='sphere'))
psdSizes,psdCumm = [0.99,1.01],[0,1.0]
sp=pack.SpherePack()
sp.makeCloud(Vector3(0,0,0),O.cell.refSize,psdSizes=psdSizes,psdCumm=psdCumm,num=500,seed=1,distributeMass=True,periodic=True)
sp.toSimulation()
else:
O.load(Filename)
if not savedState:
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='triaxFinished()'
),
PyRunner(command='UnbalancedForce()',iterPeriod=100),
NewtonIntegrator(damping=.1),
]
O.dt=.5*PWaveTimeStep()
def triaxFinished():
print 'Making decision'
if not savedState:
print 'Going to Phase 1'
triax.doneHook = 'Phase_1()'
else:
print 'Going to Phase 2'
triax.doneHook = 'Phase_2()'
def Phase_2():
print 'Phase 2'
O.cell.setBox(O.cell.size[0],O.cell.size[1],O.cell.size[2])
triax.goal = (sigmaIso,sigmaIso,-0.2)
triax.stressMask = 3
triax.StrainRate = (0,0,-0.01)
triax.maxStrainRate = (0.05,0.05,0.05)
triax.maxUnbalanced = 0.01
print unbalancedForce(), triax.strain[2]
print triax.stress[2]
print triax.stressMask
print triax.strainRate
#print triax.doneHook
triax.doneHook='Stop()'
def Phase_1():
print 'Phase 1'
O.save(Filename)
print 'Saved'
triax.doneHook = 'Phase_2()'
def Stop():
print 'Stop'
O.pause()
def UnbalancedForce():
print unbalancedForce(), triax.strain[2], len(O.engines)
O.run()
--
You received this question notification because your team yade-users is
an answer contact for Yade.