← Back to team overview

yade-users team mailing list archive

Re: [Question #662544]: How to clump spheres and facet

 

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

Description changed to:
I'd like to 
Step1. import a CT scanned surface to Yade as a facet
Step2. create spheres inside this surface.
Step3. clump this surface (facet) and interior spheres together to imitate the real CT scanned particle.

The outer surface (facet) is important to me because I need an accurate geometry and transfer it to finite element software.
this idea is from the PFC documents, the outer surface in PFC does not involve in the collision. 
I set the argument "noBound=True" when generateing the facet. However, the facet still collides with interior spheres. 

The evidence of collision between outersurface and interior spheres are:
1. the wires on the outer surface are shining.
2.  if the outersurface is igorned in the clump by modifing scripts as below, the clump of shperes drop quite faster.

	#O1=O.bodies.append(pack.gtsSurface2Facets(surf,fixed=False,noBound=True,material=m))	
	sp=pack.randomDensePack(pack.inGtsSurface(surf),radius=0.1,memoizeDb=memoizeDb,returnSpherePack=True)	
	Otemp=sp.toSimulation()		
	#O3=O1+Otemp	
	O3=Otemp


BTW, create a template and use  replaceByClumps() is also my expectation.

Looking forward to any suggestion.
Wenbin
#############Script##################
# modified script yade/examples/gts-horse/horse.py
from yade import pack,ymport
#import gts
m = PolyhedraMat()
m.density = 2600 #kg/m^3 
m.young = 1E6 #Pa
m.poisson = 20000/1E6
m.frictionAngle = 0.6 #rad

# create rectangular box from facets
O.bodies.append(geom.facetBox((-77.,-75.,-62.),(1.0,1.,1.),wallMask=31))


# parameters for radom packing in imported surface
memoizeDb='/tmp/gts-triax-packings.sqlite'
sp=SpherePack()
# import surface
surf=gts.read(open('OS-single.gts'))

# generate lists of spheres and outer surface
if surf.is_closed():	
	O1=O.bodies.append(pack.gtsSurface2Facets(surf,fixed=False,noBound=True,material=m))	
	sp=pack.randomDensePack(pack.inGtsSurface(surf),radius=0.1,memoizeDb=memoizeDb,returnSpherePack=True)	
	Otemp=sp.toSimulation()		
	O3=O1+Otemp	
	#O3=Otemp

#clump spheres and surface together	
idClump=O.bodies.clump(O3)


O.engines=[
   ForceResetter(),
   InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
   InteractionLoop(
      # handle sphere+sphere and facet+sphere collisions
      [Ig2_Sphere_Sphere_ScGeom(),Ig2_Facet_Sphere_ScGeom()],
      [Ip2_FrictMat_FrictMat_FrictPhys()],
      [Law2_ScGeom_FrictPhys_CundallStrack()]
   ),
	NewtonIntegrator(gravity=(0,0,-9.81),damping=0.4),
   	## save data for Paraview
  	#VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=5),

   	# call the checkUnbalanced function (defined below) every 2 seconds
  	PyRunner(command='checkUnbalanced()',realPeriod=2),
	#PyRunner(iterPeriod=10,command='addPlotData()')
	#PyRunner(realPeriod=100,command='finish()')
]

O.dt=.4*PWaveTimeStep()

# enable energy tracking; any simulation parts supporting it
# can create and update arbitrary energy types, which can be
# accessed as O.energy['energyName'] subsequently
O.trackEnergy=True

# if the unbalanced forces goes below .05, the packing
# is considered stabilized, therefore we stop collected
# data history and stop
def checkUnbalanced():
   if unbalancedForce()<.05:
      O.pause()
      plot.saveDataTxt('bbb.txt.bz2')
      # plot.saveGnuplot('bbb') is also possible


O.saveTmp()
O.timingEnabled=True
O.trackEnergy=True
from yade import plot
plot.plots={'i':('total',O.energy.keys,)}
# def addPlotData(): plot.addData(i=O.iter,total=O.energy.total(),**O.energy)
# plot.plot(subPlots=False)

# this function is called when the simulation is finished
def finish():
   # snapshot is label of qt.SnapshotEngine
   # the 'snapshots' attribute contains list of all saved files
   makeVideo(snapshot.snapshots,'3d.mpeg',fps=1,bps=100)
   O.pause()


from yade import qt
qt.View()

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