← Back to team overview

yade-users team mailing list archive

Re: [Question #661063]: repeat scripts cause the problem? how to solve

 

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

De zhang posted a new comment:
Thank you! Jan~
     My friend and I checked the scripts each line and find that a bracket was missing in one line (x_x||) for my careless. But there is another problem for loading process. I want to use a plate to apply a 'sin' load on a ballast sample. Then, the script was simply shows as :

###the process
from yade import qt,plot,utils,polyhedra_utils,ymport,export,pack

#materials define
 sample = PolyhedraMat()
sample.density=3000
....(omit)
steel = PolyhedraMat()
steel.density = 7850
....(omit)

#shape generation
loadingplate=polyhedra_utils.polyhedra(steel,v=Vesctor(3),fixed=False,color=(0.75,0.75,0.75))
O.bodies.append(loadingplate)

O.bodies.append(utils.wall(0,axis=2,sense=1, material = steel))

ballast_up=polyhedra_utils.fillBox((-0.15,-0.15,0.4), (0.15,0.15,0.7),sample,sizemin=[0.025,0.025,0.025],sizemax=[0.05,0.05,0.05],ratio=[1,1,1],seed=4,mask=1)
...(omit)

#engines
## engines ##
O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Polyhedra_Aabb(),Bo1_Wall_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      [Ig2_Wall_Polyhedra_PolyhedraGeom(), Ig2_Polyhedra_Polyhedra_PolyhedraGeom(), Ig2_Facet_Polyhedra_PolyhedraGeom()], 
      [Ip2_PolyhedraMat_PolyhedraMat_PolyhedraPhys(), Ip2_FrictMat_PolyhedraMat_FrictPhys()], 
      [Law2_PolyhedraGeom_PolyhedraPhys_Volumetric()],   # contact law -- apply forces #Bo1_Cylinder_Aabb()
   ),
   #GravityEngine(gravity=(0,0,-9.81)),
   NewtonIntegrator(damping=0.3,gravity=(0,0,-9.81)),
   PolyhedraSplitter(iterPeriod=1,label='Splitter'), # allow splittering ballast
   PyRunner(command='checkUnbalancedI()',realPeriod=1,label='checker')
]

#O.dt=0.25*polyhedra_utils.PWaveTimeStep()
#O.dt=0.0025*polyhedra_utils.PWaveTimeStep()
O.dt=0.1*polyhedra_utils.PWaveTimeStep()

# loading
def checkUnbalancedI():
	print "iter %d, time elapsed %f,  time step %.5e, unbalanced forces = %.5f"%(O.iter, O.realtime, O.dt, utils.unbalancedForce())
	if O.iter<5000: return 
	# the rest will be run only if unbalanced is < .1 (stabilized packing)
	if unbalancedForce()>0.1: return 
	# start plotting the data now, it was not interesting before
	O.engines=O.engines+[PyRunner(command='addPlotData()',iterPeriod=50)]
	# next time, do not call this function anymore, but the next one (unloadPlate) instead
	checker.command='cyclicloadingI()'

def addPlotData():
    Fz=O.forces.setPermF(O.bodies[0].id,(0,0,-200-100*sin((15/pi)*O.time)))
    W=loadingplate.state.pos[2]-loadingplate.state.refPos[2]
    plot.addData(Fz=Fz,w=W,i=O.iter,unbalanced=unbalancedForce(),**O.energy)

def cyclicloadingI():
    O.forces.setPermF(O.bodies[0].id,(0,0,(0,0,-200-100*sin((15/pi)*O.time))))

#view
qt.Controller()
V = qt.View()

#plot
plot.plots={'i':('unbalanced',),'w':('Fz',)}
plot.plot()

#
O.wait()

######over

The results warning shows
The warn:
ArgumentError: Python argument types in
ForceContainer.setPermF(ForceContainer, int, tuple)
did not match C++ signature:
setPermF(pyForceContainer {lvalue}, long, Eigen::Matrix<double, 3,1, 0, 3,1>)

How to deal this problem? and I search the previous similar problem
about 'setPermF' module, you provide the 'addF' module. Moreover, I read
the 'InterpolatingDirectedForceEngine' and was it fit for 'sin' loading?
What's the difference between them and is there the priority of them?

Thanks again for your help~ I follow and adore your papers on the
researchgate net~

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.