------------------------------------------------------------ revno: 3868 committer: Jan Stransky <jan.stran...@fsv.cvut.cz> timestamp: Wed 2016-05-25 00:46:38 +0200 message: Added an example for generation of 'agglomerate' packing added: examples/agglomerate/ examples/agglomerate/README examples/agglomerate/compress.py examples/agglomerate/divide.py examples/agglomerate/makeCloud.py examples/agglomerate/simulation.py
-- lp:yade https://code.launchpad.net/~yade-pkg/yade/git-trunk Your team Yade developers is subscribed to branch lp:yade. To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== added directory 'examples/agglomerate' === added file 'examples/agglomerate/README' --- examples/agglomerate/README 1970-01-01 00:00:00 +0000 +++ examples/agglomerate/README 2016-05-24 22:46:38 +0000 @@ -0,0 +1,14 @@ +A series of scripts that prepare and agglomerate packing, i.e. cohesive elastic aggregates, each composed of dense particle packing + +A general idea: +- create a "macro" particles as large spheres using makeCloud +- "mesh" these macroparticles with smaller spheres +- run compression to make the loose packing denser +- save the result +- use the resulting packing in actual simulation + +Scripts in order to run: +- makeCloud.py ... a script to prepare loose packing of macro particles using makeCloud +- divide.py ... a script to divide the macro particles from previous step into clump of particles +- compress.py ... a script to create dense packing of agglomerates +- simulation.py ... use of prepared dense packing of agglomerates in a simple simulation === added file 'examples/agglomerate/compress.py' --- examples/agglomerate/compress.py 1970-01-01 00:00:00 +0000 +++ examples/agglomerate/compress.py 2016-05-24 22:46:38 +0000 @@ -0,0 +1,59 @@ +###################################################################### +# Compress the loose packing into dense packing. Each agglomerate is +# considered as clump in this stage +###################################################################### +from yade import export,ymport +import random +random.seed(1) + +# add walls first +dim = (15,15,15) +walls = aabbWalls(((0,0,0),(dim))) +wallIds = O.bodies.append(walls) + +# load spheres from file, including information of their agglomerates ids +attrs = [] +sp = ymport.textExt('/tmp/divided.txt',format='x_y_z_r_attrs',attrs=attrs) +n = max(int(a[0]) for a in attrs)+1 +colors = [randomColor() for _ in xrange(n)] +agglomerates = [[] for _ in xrange(n)] +for s,a in zip(sp,attrs): + aa = int(a[0]) + s.agglomerate = aa + s.shape.color = colors[aa] + agglomerates[aa].append(s) +for a in agglomerates: + O.bodies.appendClumped(a) + +O.engines = [ + ForceResetter(), + InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]), + InteractionLoop( + [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()], + [Ip2_FrictMat_FrictMat_FrictPhys()], + [Law2_ScGeom_FrictPhys_CundallStrack()] + ), + TriaxialStressController( + thickness = 0, + stressMask = 7, + internalCompaction = False, + label = 'compressor', + ), + NewtonIntegrator(damping=.6), +] +O.dt = PWaveTimeStep() + +# compress the sample +compressor.goal1 = compressor.goal2 = compressor.goal3 = -1e-7 +O.run(50000,True) +compressor.goal1 = compressor.goal2 = compressor.goal3 = -1e-5 +O.run(30000,True) + +# save the result, including information of agglomerates which the particle belongs to +export.textExt('/tmp/compressed.txt','x_y_z_r_attrs',attrs=['b.agglomerate']) + +try: + from yade import qt + qt.View() +except: + pass === added file 'examples/agglomerate/divide.py' --- examples/agglomerate/divide.py 1970-01-01 00:00:00 +0000 +++ examples/agglomerate/divide.py 2016-05-24 22:46:38 +0000 @@ -0,0 +1,36 @@ +###################################################################### +# A script for subdivision of macro perticles into a dense packing of +# smaller particles +# +# Each aggragate is a dense packing, but macroscopically the packing +# is loose +###################################################################### +from yade import export,ymport +import random +random.seed(1) # to make colors always the same + +# load macroparticles +sp = ymport.text('/tmp/cloud.txt') +colors = [randomColor() for s in sp] +# each macroparticle is filled randomDensePack +for si,s in enumerate(sp): + sphere = pack.inSphere(s.state.pos, s.shape.radius) + sp1 = pack.randomDensePack( + sphere, + spheresInCell = 500, + radius = .2, + memoizeDb = '/tmp/agglomeratepackaux.db', + returnSpherePack = True, + ) + ids = sp1.toSimulation(color=colors[si]) # add the result to simulation with uniform color + for i in ids: + O.bodies[i].agglomerate = si # tell each particle who is its agglomerate + +# save the result, including information of agglomerates which the particle belongs to +export.textExt('/tmp/divided.txt','x_y_z_r_attrs',attrs=['b.agglomerate']) + +try: + from yade import qt + qt.View() +except: + pass === added file 'examples/agglomerate/makeCloud.py' --- examples/agglomerate/makeCloud.py 1970-01-01 00:00:00 +0000 +++ examples/agglomerate/makeCloud.py 2016-05-24 22:46:38 +0000 @@ -0,0 +1,22 @@ +###################################################################### +# A script for prepare loose packing of macro particles +###################################################################### +from yade import export + +dim = (15,15,15) # dimensions for makeCloud +radius = 1 +fuzz = 0.2 + +# use of makeCloud function +sp = pack.SpherePack() +sp.makeCloud((0,0,0), dim, rMean=radius, rRelFuzz=fuzz, seed=1) +sp.toSimulation() + +# save the result +export.text('/tmp/cloud.txt') + +try: + from yade import qt + qt.View() +except: + pass === added file 'examples/agglomerate/simulation.py' --- examples/agglomerate/simulation.py 1970-01-01 00:00:00 +0000 +++ examples/agglomerate/simulation.py 2016-05-24 22:46:38 +0000 @@ -0,0 +1,53 @@ +###################################################################### +# Gravity deposition as a simple simulation illustrating creation of +# cohesive contacts and deleting the unwanted between different +# agglomerates +# +# Using CpmMat, but the same procedure can be used with any material +###################################################################### +from yade import ymport + +wall = O.bodies.append(wall((0,0,3),2)) + +O.materials.append(CpmMat(neverDamage=True,frictionAngle=0)) + +# load spheres from file, including information of their agglomerates ids +attrs = [] +sp = ymport.textExt('/tmp/compressed.txt',format='x_y_z_r_attrs',attrs=attrs) +n = max(int(a[0]) for a in attrs)+1 +colors = [randomColor() for _ in xrange(n)] +for s,a in zip(sp,attrs): + aa = int(a[0]) + s.agglomerate = aa + s.shape.color = colors[aa] +O.bodies.append(sp) + +factor=1.5 +O.engines=[ + ForceResetter(), + InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=factor,label='bo1aabbs'),Bo1_Wall_Aabb()]), + InteractionLoop( + [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=factor,label='ig2sss'),Ig2_Wall_Sphere_ScGeom()], + [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_CpmMat_CpmMat_CpmPhys(cohesiveThresholdIter=1)], + [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom_CpmPhys_Cpm()] + ), + NewtonIntegrator(gravity=(0,0,-30)), +] +O.dt = PWaveTimeStep() + +# create cohesive interactions, possible also between different agglomerates +O.step() +ig2sss.interactionDetectionFactor = bo1aabbs.aabbEnlargeFactor = 1 + +# delete the inter-agglomerate interactions +for i in O.interactions: + b1,b2 = [O.bodies[ii] for ii in (i.id1,i.id2)] + if b1.agglomerate != b2.agglomerate: + O.interactions.erase(i.id1,i.id2) +O.step() + +try: + from yade import qt + qt.View() +except: + pass
_______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : yade-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp