yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #22809
[Question #690058]: Apply force on sphere particles
New question #690058 on Yade:
https://answers.launchpad.net/yade/+question/690058
Hello,
I would like to apply a force on particles. I tried with this following code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from yade import pack,ymport,export,geom,bodiesHandling,qt
import array as arr
import numpy
import math
import os
import errno
rad,gap=.15,.02
#Add material
O.materials.append(FrictMat(young=10e9,poisson=.25,frictionAngle=0.5,density=1e3,label='Par'))
#Parameters, which will be passed into facets creators
kwMeshes={'color':[1,1,0],'wire':True,'dynamic':False,'material':0}
oriBody = Quaternion(Vector3(1,0,0),(pi/2.0))
# Cylinder
O.bodies.append(geom.facetCylinder((0.0,0.0,0.0),radius=2.0,height=20.0,orientation=oriBody,segmentsNumber=10,wallMask=4,**kwMeshes))
# Sphere Particles
s1=utils.sphere([0,1.7,1.0],.5,color=(1,0,1),material='Par')
s1.state.blockedDOFs='y'
s1.state.vel=(0,0.0,0)
O.bodies.append(s1)
s2=utils.sphere([1.2,3.7,0.8],.35,color=(0,1,1),material='Par')
s2.state.blockedDOFs='y'
s2.state.vel=(0,0.0,0)
O.bodies.append(s2)
O.bodies.append(wall((0,0,-10),axis=2))
def LorrentzForce():
# define the force applied on particles caused by magnetic fields
for b in O.bodies:
if isinstance(b.shape,Sphere):
ftest=(0,20000.0,0)
O.forces.addF(b.id,ftest)
print(O.forces.f(b.id))
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()],label='collider'),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],
[Ip2_ViscElMat_ViscElMat_ViscElPhys()],
[Law2_ScGeom_ViscElPhys_Basic()]
,label = 'interactionLoop'),
PyRunner(command='LorrentzForce()',iterPeriod=1,label='ApplyForce'),
NewtonIntegrator(damping=.1,exactAsphericalRot=True,gravity=(0.0,0.0,0.0)),
O.dt=PWaveTimeStep()
O.run(1,True)
But particles didn't move at all.
Could you please explain what i have done wrong?
Thanks!
--
You received this question notification because your team yade-users is
an answer contact for Yade.