yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #11413
[Question #268691]: Apply force one once time
New question #268691 on Yade:
https://answers.launchpad.net/yade/+question/268691
Hi guys!
I try to study the displacement of various spheres ( with different weight ) when on they apply the same force, on a surface which previously has been created and is composed of other spheres.
My problem is the IterPeriod of the PyRunner function that I create for apply the force on the sphere that I want, in this case, green spheres.
If I put the period = 1 , the force is constantly applied .How I can apply the force one once time only? PyRunner(command='force()',
¿?¿?¿?iterPeriod=¿?¿?¿,initRun=True,label='checker'),
My first choice was to put a high period (100000000 for example), but this way , the green sphere falls on the surface of spheres before the force is applied . What I need is to apply a force on green particle when it is "in the air " to describe a parabolic movement to fall on the surface and stop.
The second PyRunner is to store the position data ( x , y, z) and the green particle velocity .
Thanks in advance =)
the code:
O.load('/path/spheresurface.yade')
#/////////////////////////////////////////////////////
#////////////////// materials \\\\\\\\\\\\\\\\\\\\\\\
#/////////////////////////////////////////////////////
MatBal=O.materials.append(FrictMat(
young=27e9,poisson=0.30,density=1000,
frictionAngle=0.7,label='mat1'))
#/////////////////////////////////////////////////////
#////////////////// green sphere\\\\\\\\\\\\\\\\\\\\
#/////////////////////////////////////////////////////
### green sphere
O.bodies.append(utils.sphere((0.108,0.2289647116,0.7175),0.0199647116,color=(0,1,0),material='mat1'))
#/////////////////////////////////////////////////////
#//////////////// force on green sphere\\\\\\\\\\\\
#/////////////////////////////////////////////////////
def force():
piedraensayo=[]
###force on green sphere
for i in range(0,len(O.bodies)):
b=O.bodies[i]
if O.bodies[i].shape.color==(0,1,0):
piedraensayo.append([i])
id_ball=i
fx=1
fy=0
fz=0
O.forces.addF(id_ball, (fx, fy, fz))
#/////////////////////////////////////////////////////
#///////save position and velocity \\\\\\\\\\\\\\\\\
#/////////////////////////////////////////////////////
def guardar():
if O.iter==0:
global paso
matriz1=[]
for i in range(0,len(O.bodies)):
b=O.bodies[i]
if O.bodies[i].shape.color==(0,1,0):
matriz1.append([i,b.state.pos[1],b.state.pos[1],b.state.pos[2],b.state.vel.norm()])
np.savetxt('pruebaVERDE.out',matriz1,delimiter=',')
paso=1
if paso==1 and O.time>0.2:
matriz2=[]
for i in range(0,len(O.bodies)):
b=O.bodies[i]
if O.bodies[i].shape.color==(0,1,0):
matriz2.append([i,b.state.pos[0],b.state.pos[1],b.state.pos[2],b.state.vel.norm()])
np.savetxt('pruebaVERDE2.out',matriz2,delimiter=',')
paso=paso+1
if paso==2 and O.time>0.4:
matriz3=[]
for i in range(0,len(O.bodies)):
b=O.bodies[i]
if O.bodies[i].shape.color==(0,1,0):
matriz3.append([i,b.state.pos[0],b.state.pos[1],b.state.pos[2],b.state.vel.norm()])
np.savetxt('pruebaVERDE3.out',matriz3,delimiter=',')
paso=paso+1
#/////////////////////////////////////////////////////
#///////////////////// engines \\\\\\\\\\\\\\\\\\\\\\\
#/////////////////////////////////////////////////////
O.engines=[
ForceResetter(),
InsertionSortCollider(
[Bo1_Sphere_Aabb(),
Bo1_Facet_Aabb(),
Bo1_Box_Aabb(),
Bo1_Wall_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),
Ig2_Facet_Sphere_ScGeom(),
Ig2_Wall_Sphere_ScGeom(),
Ig2_Box_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
PyRunner(command='force()',
iterPeriod=1,initRun=True,label='checker'),
PyRunner(command='guardar()',
iterPeriod=1,initRun=True,label='checker'),
NewtonIntegrator(damping=0.5,gravity=(0,-9.81,0),label='newton'),
yade.qt.SnapshotEngine(fileBase='3d-',iterPeriod=1000,label='snapshot')
]
O.dt=utils.PWaveTimeStep()
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.