yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #09831
[Question #251510]: Loop - array -->Find out the strength needed to move each particle
New question #251510 on Yade:
https://answers.launchpad.net/yade/+question/251510
Hi guys! First I expose I try to do, and then my problem. Thanks in advance!!
I have a script that save the Id. of particles and others values of these particles like this:
array1 = [ id [0], [1], [2], [3], [4]] [C] = columns ; [R] = rows
This part of script works ok.
The problem comes now. For each particle of this array, I want apply a force which will increase until the displacement of the particle with respect to the x axis occurs. The objective is find out the force necessary for move each particle. I want to loop through the array by rows, so that when the particle in the first row meets the condition of displacement to the next particle in the next row, and up through the array completely and obtain for each of the particles the force required to move them. I have written this, but fails to apply force and also, I'm not sure that in this way through each of the rows, but it does for columns.
The part of script fails is this:
array2=[]
Xforce=0
for xx in range(0,len(array1)):
id_clump=O.bodies[array1[xx][0]] # [0] --> column Id array1
Xforce=Xforce+0.001
Yforce=0
Zforce=0
O.forces.addF(id_clump,(Xforce,Yforce,Zforce))
if id_clump.state.displ()[0]>0: #[0] --> X axis
value=Xforce/array[xx][2] #[2] --> column 2 of array 1
array2.append([array1[xx][0],value)
np.savetxt('forces_id.out',array2,delimiter=',')
Xforce=0 #to set the counter to zero force, before moving to the next particle.
The error:
Python argument types in
ForceContainer.addF(ForceContainer, Body, tuple)
did not match C++ signature:
addF(pyForceContainer {lvalue}, long id, Eigen::Matrix<double, 3, 1, 0, 3, 1> f, bool permanent=False)
Thanks for any ideas or suggestions!
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.