yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #11219
[Question #266939]: Stop conditions failed
New question #266939 on Yade:
https://answers.launchpad.net/yade/+question/266939
hi brothers,
i tried imposed a stop condition that is K_i -K_(i+1)<1e-5 for example, and i need obtain this K_i and K_(i+1), but with my scrypt i can't to get k_i calculated in def of my PyRunner. i can't to define ki variable as global and then i can't read this variable in parar() PyRunner. this is scrypt
from yade import geom, utils, export, pack
global rmean, D, h, load, Sd, mu, Pi, rhoh, ki
rmean=0.003
D=rmean*38.
h=rmean*60.
load=5e-4
Sd=0.17
mu=0.001
Pi=1/6.
g=9.81
rhoh=1000
R=D/2.
H=2.*h
mn,mx=Vector3(0,0,0),Vector3(D,D,H)
young=1e6
compFricDegree = 3 #ojo con este parametro
finalFricDegree = 30
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='sph'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)
cuadr=pack.inAlignedBox((0,0,0),(D,D,H))
spheres=pack.randomDensePack(cuadr,spheresInCell=3000,radius=rmean,rRelFuzz=Sd,returnSpherePack=True)
spheres.toSimulation(material='sph')
newton=NewtonIntegrator(damping=0.2,gravity=(0,0,-9.81))
O.bodies[5].state.vel[2]=-0.05
def parar():
carga=O.forces.f(5)[2]
if O.bodies[5].state.vel[2]==0: muro.dead=1
else:
if carga>5e-4:
O.bodies[5].state.vel[2]=0
O.pause()
flow.dead=0
flow.defTolerance=0.03
flow.useSolver=3
flow.permeabilityFactor=1
flow.viscosity=mu
flow.bndCondIsPressure=[0,0,0,0,1,1]
flow.bndCondValue=[0,0,0,0,0,Pi]
flow.boundaryUseMaxMin=[0,0,0,0,0,0]
O.run()
def flujest():
if flow.getBoundaryFlux(4)==0: Err=100
else: Err=(flow.getBoundaryFlux(5)+flow.getBoundaryFlux(4))/flow.getBoundaryFlux(4)*100
if abs(Err)<0.1:
Qout=flow.getBoundaryFlux(5)
Qin=flow.getBoundaryFlux(4)
dh=O.bodies[5].bound.refPos[2]
k1=mu*Qin*1./Pi/(D*D)*dh
k2=g*rhoh*Qin*1./Pi/(D*D)*dh*100
n=flow.porosity
print "Qin=",Qin," k1=",k1 ,"k2=",k2 ," Porosity=",n
def kant():
Qin=flow.getBoundaryFlux(4)
dh=O.bodies[5].bound.refPos[2]
if Qin==0: ki=1000
else: ki=mu*Qin*1./Pi/(D*D)*dh
#globals(ki)['kant']=locals(ki)['kant']
def final():
Qin=flow.getBoundaryFlux(4)
dh=O.bodies[5].bound.refPos[2]
kf=mu*Qin*1./Pi/(D*D)*dh
if abs(kf-ki)<1e-5: O.pause()
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()],
),
FlowEngine(dead=1, label="flow"),
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
PyRunner(command='flujest()', iterPeriod=500, initRun=8000, label="agua"),
newton,
PyRunner(command='parar()', iterPeriod=50, label="muro"),
PyRunner(command='kant()', iterPeriod=200, initRun=8000, label="kini"),
PyRunner(command='final()', iterPeriod=200, initRun=8300, label="kfin")
]
O.run()
thanks
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.