yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #15049
[Question #640434]: usage of O.forces.addF
New question #640434 on Yade:
https://answers.launchpad.net/yade/+question/640434
Hi, I am new here. I want to build a simple model in Yade to verify some thoughts. However, I don't know what is wrong in my model that the move of the spheres is not consistent with the actual situation.
The whole code is:
#!/usr/bin/python # This is server.py file
# initial yade and the socket
import string
from yade import plot,qt
from yade.pack import *
from yade import pack, plot
import socket # Import socket module
import numpy # initial the math of matrix compute (needed in ns)
O.materials.append(CpmMat(damLaw=0,young=24e9,density=4800,frictionAngle=atan(0.8),poisson=0.2,sigmaT=0,epsCrackOnset=1e-4,relDuctility=30))
O.bodies.append([
sphere((0.0,0.0,0),0.1),
sphere((0.2,0.0,0),0.1),
sphere((0.4,0.0,0),0.1),
sphere((0.6,0.0,0),0.1),
sphere((0.8,0.0,0),0.1),
sphere((1.0,0.0,0),0.1),
sphere((1.2,0.0,0),0.1),
sphere((0.1,0.173205080756888,0),0.1),
sphere((0.3,0.173205080756888,0),0.1),
sphere((0.5,0.173205080756888,0),0.1),
sphere((0.7,0.173205080756888,0),0.1),
sphere((0.9,0.173205080756888,0),0.1),
sphere((1.1,0.173205080756888,0),0.1),
sphere((0.0,0.346410161513776,0),0.1),
sphere((0.2,0.346410161513776,0),0.1),
sphere((0.4,0.346410161513776,0),0.1),
sphere((0.6,0.346410161513776,0),0.1),
sphere((0.8,0.346410161513776,0),0.1),
sphere((1.0,0.346410161513776,0),0.1),
sphere((1.2,0.346410161513776,0),0.1),
sphere((0.1,0.519615242270664,0),0.1),
sphere((0.3,0.519615242270664,0),0.1),
sphere((0.5,0.519615242270664,0),0.1),
sphere((0.7,0.519615242270664,0),0.1),
sphere((0.9,0.519615242270664,0),0.1),
sphere((1.1,0.519615242270664,0),0.1),
sphere((0.0,0.692820323027552,0),0.1),
sphere((0.2,0.692820323027552,0),0.1),
sphere((0.4,0.692820323027552,0),0.1),
sphere((0.6,0.692820323027552,0),0.1),
sphere((0.8,0.692820323027552,0),0.1),
sphere((1.0,0.692820323027552,0),0.1),
sphere((1.2,0.692820323027552,0),0.1)
])
for p in O.bodies:
p.state.blockedDOFs='zXY'
#p.state.mass = 2500*0.1*pi*p.shape.radius**2
#inertia = 0.5 * p.state.mass * p.shape.radius**2
#p.state.inertia = (0.5*inertia,0.5*inertia,inertia)
O.bodies[0].state.blockedDOFs='xyzXYZ'
O.bodies[1].state.blockedDOFs='xyzXYZ'
O.bodies[2].state.blockedDOFs='xyzXYZ'
O.bodies[3].state.blockedDOFs='xyzXYZ'
O.bodies[4].state.blockedDOFs='xyzXYZ'
O.bodies[5].state.blockedDOFs='xyzXYZ'
O.bodies[6].state.blockedDOFs='xyzXYZ'
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
# handle sphere+sphere
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_CpmMat_CpmMat_CpmPhys()],
[Law2_ScGeom_CpmPhys_Cpm()]
),
NewtonIntegrator(gravity=(0,0,-9.81),damping=0.2),
PyRunner(command='addForce()',iterPeriod=1),
PyRunner(command='plotAddData()',iterPeriod=99),
]
O.dt=PWaveTimeStep()
def addForce():
O.forces.addF(26,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(27,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(28,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(29,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(30,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(31,Vector3(0,-1e5,0),permanent=True)
O.forces.addF(32,Vector3(0,-1e5,0),permanent=True)
def plotAddData():
for i in O.interactions:
plot.addData(
id1=i.id1,id2=i.id2,fn=i.phys.normalForce,fs=i.phys.shearForce
)
for b in O.bodies:
pos = b.state.pos
plot.addData(
aa=b.id,x=pos[0],y=pos[1],z=pos[2]
)
plot.saveDataTxt('linchun.txt')
#O.run(10000,True)
Simply, it build a 2-dimensional model and vertical force( -1e5) is added at spheres (ids=26-32). However, it cannot move only if i change the O.dt to a lager one that the spheres will move towards the positive direction of y -axis. I don't know what is wrong with my model, i am wondering you can spend some time to help me,thanks a lot!
--
You received this question notification because your team yade-users is
an answer contact for Yade.