← Back to team overview

yade-users team mailing list archive

Re: [Question #268691]: Apply force only once

 

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

rayolau posted a new comment:
Hi Jan, thanks for your reply!

Respect "I think that the force was applied correctly. The only problem is that the
force was was applied for one time step (I assume very short time), so it
has almost no effect.." You were right . I've changed the IterPeriod and the value of O.force, and works ok. 

PyRunner(command='force()',
		iterPeriod=1000000,initRun=True,label='checker'), 

def force():
	piedraensayo=[]
	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=10000
			fy=0
			fz=0
			O.forces.addF(id_ball, (fx, fy, fz))

However, maybe I should apply a velocity in x direction. In this sense,
I tried this, and not working. The problem is I don't know how putting
the identity of the green sphere to apply the velocity vector only on
her.

def force():
	piedraensayo=[]
	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			
			b.state.vel(id_ball,(1,0,0))

Error: b.state.vel(id_ball, (10,0,0))
TypeError: 'Vector3' object is not callable


Thanks for your help , as always! =)

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.


Follow ups

References