← Back to team overview

yade-users team mailing list archive

Re: [Question #670255]: Modelling a Homogenous slope with properties of rock

 

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

    Status: Open => Answered

Luc Scholtès proposed the following answer:
Alright,

>From what I understand, your problem is related to the generation of a
packing of particles using the pack.inGtsSurface().

I am sorry but I don't understand this:

"But it's doesn't help me because he was adding in left out space which
doesn't consist facets."

I am a bit clueless but I'll give you an example script below that works
for a simple mesh (a cube) and I would suggest that you try to make the
script work (you will have to create the cube.gts on your own) before
going into a more complex configuration. At first, I would suggest that
you try to generate a "regular packing" in your previously generated
cube (using the regularHexa() function) and then, when you are sure that
it works, you can experiment with the random packing functions.


###

from yade import pack, export, ymport
import gts, os.path, locale

#### control parameters
mesh='cube' #name of gts mesh
sizeRatio=10. # defines discretisation (sizeRatio=meshLength/particleDiameter)

#### import mesh
locale.setlocale(locale.LC_ALL,'en_US.UTF-8')   #gts is locale-dependend.  If, for example, german locale is used, gts.read()-function does not import floats normally
surface=gts.read(open(mesh+'.gts'))

print 'closed? ', surface.is_closed()

#### generate packing
if surface.is_closed():
	pred=pack.inGtsSurface(surface)
	# get characteristic dimensions
	aabb=pred.aabb()
	dim=pred.dim()
	center=pred.center()
	minDim=min(dim[0],dim[1],dim[2])
	# define discretisation
	radius=minDim/(2*sizeRatio)
	print center, dim, ' | minDim=', minDim, ' | diameter=', 2*radius
	### packing functions
	O.bodies.append(pack.regularHexa(pred,radius=radius,gap=0.,color=(0.9,0.8,0.6)))
        #O.bodies.append(pack.regularOrtho(pred,radius=radius,gap=0.,color=(0.9,0.8,0.6)))
	# non periodic packing
	#O.bodies.append(pack.randomDensePack(pred,radius=radius,rRelFuzz=0.3,useOBB=True,memoizeDb='/tmp/gts-triax-packings.sqlite',returnSpherePack=False,color=(0.9,0.8,0.6))) # returnSpherePack=True(?),cropLayers=5 (not to use),'
	# periodic packing
        #O.bodies.append(pack.randomDensePack(pred,radius=radius,rRelFuzz=0.3,useOBB=True,spheresInCell=5000,memoizeDb='/tmp/gts-triax-packings.sqlite',returnSpherePack=False,color=(0.9,0.8,0.6))) # returnSpherePack=True(?),cropLayers=5 (not to use),'
        ### if you want to translate the surface away from the packing
	#surface.translate(dim[0],0,0) 
	
#### import mesh
O.bodies.append(pack.gtsSurface2Facets(surface,color=(0.8,0.8,0.8),wire=True))

#### export packing in a text file
export.text(mesh+'_'+str(int(sizeRatio))+'.spheres')

#### open the GUI to see the packing and the mesh

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