for x in L:  #loop creating a set of sphere sticked at the bottom with a (uniform) random altitude comprised between 0.5 (diameter/12) and 5.5mm (11diameter/12) with steps of 0.5mm. The repartition along z is made around groundPosition.
    for y in W:
        n = rand.randrange(
            0, 12, 1
        ) / 12.0 * diameterPart  #Define a number between 0 and 11/12 diameter with steps of 1/12 diameter (0.5mm in the experiment)
        O.bodies.append(
            sphere((x * diameterPart, y * diameterPart,
                    groundPosition - 11 * diameterPart / 12.0 / 2.0 + n),
                   diameterPart / 2.,
                   color=(0, 0, 0),
                   fixed=True,
                   material='Mat'))

#Create a loose cloud of particle inside the cell
partCloud = pack.SpherePack()
partVolume = pi / 6. * pow(diameterPart, 3)  #Volume of a particle
partNumber = int(
    Nlayer * phiPartMax * diameterPart * length * width /
    partVolume)  #Volume of beads to obtain Nlayer layers of particles
partCloud.makeCloud(minCorner=(0, 0., groundPosition + diameterPart),
                    maxCorner=(length, width, groundPosition + fluidHeight),
                    rRelFuzz=0.,
                    rMean=diameterPart / 2.0,
                    num=partNumber)
partCloud.toSimulation(
    material='Mat')  #Send this packing to simulation with material Mat
#Evaluate the deposition time considering the free-fall time of the highest particle to the ground
depoTime = sqrt(fluidHeight * 2 / abs(gravityVector[2]))

# Collect the ids of the spheres which are dynamic to add a fluid force through HydroForceEngines
Esempio n. 2
0
# encoding: utf-8
# 2012 ©Bruno Chareyre <*****@*****.**>
# This variant of triax-basic.py shows the usage of cohesive contact laws and moments at contacts

from yade import pack

sp = pack.SpherePack()
## corners of the initial packing
mn, mx = Vector3(0, 0, 0), Vector3(10, 10, 10)

## box between mn and mx, avg radius ± ½(20%), 2k spheres
sp.makeCloud(minCorner=mn, maxCorner=mx, rRelFuzz=.2, num=600)

## create material #0, which will be used as default
O.materials.append(
    CohFrictMat(young=15e6,
                poisson=0.4,
                density=2600,
                frictionAngle=radians(30),
                normalCohesion=1e6,
                shearCohesion=1e6,
                momentRotationLaw=True,
                etaRoll=0.1,
                label='spheres'))
O.materials.append(
    FrictMat(young=15e6,
             poisson=.4,
             frictionAngle=0,
             density=0,
             label='frictionlessWalls'))
Esempio n. 3
0
#wallMask
#determines which walls will be created, in the order 
#-x(1), +x (2), -y (4), +y (8), -z (16), +z (32). The numbers are ANDed; the
#default 63 means to create all walls
#parameter1:center
#parameter2:half size
box = geom.facetBox(( box_length/2, box_height/2,box_depth/2), ( box_length/2, box_height/2,box_depth/2),
                    wallMask = 55,
                    material = frict)
                   
O.bodies.append(box)


#adding deposit -----
sample = pack.SpherePack()
#parameter1:left lower corner
#parameter2:right upper corner
sample.makeCloud((0.0, 0.0, 0.0), ( box_length, box_height,box_depth), rMean = 0.6, rRelFuzz = 0.12)
s = sample.toSimulation(material = temp_con)

#2019-01-19 weihuajing
#change to a real 2D simulation
# fix spin in y x 
# fix z-postion  


#defining engines -----
thres = 1000	
O.engines = [
    ForceResetter(),
Esempio n. 4
0
from yade import pack, plot

utils.readParamsFromTable(useL3Geom=True,
                          nonviscDamp=0,
                          frictAngle=0,
                          useClumps=False,
                          noTableOk=True)
from yade.params import table

if 1:
    sp = pack.SpherePack()
    # bunch of balls, with an infinite plane just underneath
    if not table.useClumps:
        sp.makeCloud((0, 0, 0), (1, 1, 1), .05, .5)
        # use clumps of 2 spheres instead, to have rotation without friction
    else:
        sp.makeClumpCloud(
            (0, 0, 0), (1, 1, 1),
            [pack.SpherePack([((0, 0, 0), .05), ((0, 0, .08), .02)])],
            periodic=False)
    sp.toSimulation()
else:
    O.bodies.append(utils.sphere((0, 0, 2),
                                 radius=.5))  # one single bouncing ball
O.bodies.append(utils.wall(position=0, axis=2, sense=1))

O.engines = [
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),
                           Bo1_Wall_Aabb()]),
    InteractionLoop([
Esempio n. 5
0
# create a few clump configurations by hand
from yade import pack
c1 = pack.SpherePack([((0, 0, 0), .5), ((.5, 0, 0), .5), ((0, .5, 0), .3)])
c2 = pack.SpherePack([((0, 0, 0), .5), ((.7, 0, 0), .3), ((.9, 0, 0), .2)])
sp = pack.SpherePack()
print 'Generated # of clumps:', sp.makeClumpCloud((0, 0, 0), (15, 15, 15),
                                                  [c1, c2],
                                                  periodic=False)
sp.toSimulation()

O.bodies.append(utils.wall(position=0, axis=2))

O.engines = [
    #SubdomainBalancer(),
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb(),
                           Bo1_Wall_Aabb()]),
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),
                     Ig2_Wall_Sphere_ScGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_ScGeom_FrictPhys_CundallStrack()]),
    NewtonIntegrator(damping=.4, gravity=(0, 0, -100))
]
O.dt = .7 * utils.PWaveTimeStep()
O.saveTmp()
O.step()
Esempio n. 6
0
# -*- coding: utf-8 -*-
from yade import pack
num_spheres=1000
compFricDegree = 30
targetPorosity = 0.43
finalFricDegree = 30
rate=-0.02
damp=0.2
stabilityThreshold=0.01
young=5e6
mn,mx=Vector3(0,0,0),Vector3(1,1,1)
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)
sp=pack.SpherePack()


clumps=False
if clumps:
 volume = (mx[0]-mn[0])*(mx[1]-mn[1])*(mx[2]-mn[2])
 mean_rad = pow(0.09*volume/num_spheres,0.3333)
 c1=pack.SpherePack([((-0.2*mean_rad,0,0),0.5*mean_rad),((0.2*mean_rad,0,0),0.5*mean_rad)])
 sp.makeClumpCloud(mn,mx,[c1],periodic=False)
 sp.toSimulation(material='spheres')
 O.bodies.updateClumpProperties()
else:
 sp.makeCloud(mn,mx,-1,0.3333,num_spheres,False, 0.95,seed=1)
 O.bodies.append([sphere(center,rad,material='spheres') for center,rad in sp])
triax=TriaxialStressController(
	maxMultiplier=1.0+2e4/young,
Esempio n. 7
0
# encoding: utf-8
#
# demonstrate how to generate sphere packing based on arbitrary PSD (particle size distribution)
# show the difference between size-based and mass-based (≡ volume-based in our case) PSD
#
import matplotlib
matplotlib.rc('axes', grid=True)
from yade import pack
import pylab
# PSD given as points of piecewise-linear function
psdSizes, psdCumm = [.02, 0.04, 0.045, .05, .06, .08,
                     .12], [0., 0.1, 0.3, 0.3, .3, .7, 1.]
pylab.plot(psdSizes, psdCumm, label='precribed mass PSD')
sp0 = pack.SpherePack()
sp0.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True)
sp1 = pack.SpherePack()
sp1.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True,
              num=5000)
sp2 = pack.SpherePack()
sp2.makeCloud((0, 0, 0), (1, 1, 1),
              psdSizes=psdSizes,
              psdCumm=psdCumm,
              distributeMass=True,
              num=20000)
pylab.semilogx(*sp0.psd(bins=30, mass=True),
def stopSimulation(spheres_base):

    progress = O.iter // savePeriod

    print('iter', O.iter)
    print('')
    '''A'''
    if O.iter % savePeriod == 0:

        out_file = open(folder_name + '/A_progress=%d' % progress + ".txt",
                        'w')

        y_max_base = max(
            [this_sphere.state.pos[1] for this_sphere in spheres_base])

        print('max height of base is %.2f' % y_max_base)

        spheres = [
            O.bodies[k] for k in range(10, len(O.bodies))
            if O.bodies[k] != None
        ]

        if O.iter == savePeriod:

            #save the state every 10% of the progress
            x_max = np.max(
                [this_sphere.state.pos[0] for this_sphere in spheres])
            y_max = np.max(
                [this_sphere.state.pos[1] for this_sphere in spheres])
            x_min = np.min(
                [this_sphere.state.pos[0] for this_sphere in spheres])
            y_min = np.min(
                [this_sphere.state.pos[1] for this_sphere in spheres])

            x_aerolite = (x_min + x_max) * 0.5
            y_aerolite = 2 * y_max
            z_aerolite = box_depth / 2
            r_aerolite = 5

            #adding deposit -----
            deposit = pack.SpherePack()
            deposit.makeCloud((x_aerolite, y_aerolite, z_aerolite),
                              (x_aerolite, y_aerolite, z_aerolite),
                              rMean=r_aerolite,
                              rRelFuzz=0.0)
            deposit.toSimulation(material=m_rock)

            print('amount of deposit', len(deposit))

            a = len(O.bodies) - len(deposit)
            b = len(O.bodies)
            spheres_deposit = [O.bodies[idx] for idx in range(a, b)]

            color_idx = O.iter // savePeriod - 1

            for this_sphere in spheres_deposit:

                this_sphere.shape.color = deposit_rgb_list[color_idx]

        RecordData(out_file, spheres)
    '''B'''
    if O.iter % savePeriod == 3 * checkPeriod:

        #flag to deposit
        flag_deposit = True

        out_file = open(folder_name + '/B_progress=%d' % progress + ".txt",
                        'w')

        spheres = [
            O.bodies[k] for k in range(10, len(O.bodies))
            if O.bodies[k] != None
        ]

        RecordData(out_file, spheres)

        #end the loop
        if O.iter == 5 * savePeriod + 3 * checkPeriod:

            O.pause()

            print('')
            print('-- Simulation off')

            flag_deposit = False
Esempio n. 9
0
    InteractionLoop([Ig2_Sphere_Sphere_ScGeom(),
                     Ig2_Facet_Sphere_ScGeom()],
                    [Ip2_FrictMat_FrictMat_FrictPhys()],
                    [Law2_ScGeom_FrictPhys_CundallStrack()]),
    NewtonIntegrator(damping=0.7, gravity=[0, 0, -9.81])
]

#create a box:
O.bodies.append(
    geom.facetBox(center=(0.0, 0.0, 0.25),
                  extents=(0.125, 0.125, 0.25),
                  wallMask=31))

#add particles eiter spheres or clumps
if partType == 'spheres':
    sp = pack.SpherePack()
    sp.makeCloud((-0.125, -0.125, 0), (0.125, 0.125, 0.5),
                 rMean=37.6e-3 / 2.,
                 rRelFuzz=0.0,
                 num=100)
    sp.toSimulation()
    O.bodies.updateClumpProperties(
        discretization=10)  # correct mass, volume, inertia!!
elif partType == 'clumps':
    sp = pack.SpherePack()
    c1 = pack.SpherePack([((0., 0., 0.), 37.6e-3 / 2.),
                          ((37.6e-3 / 2., 0., 0.), 25e-3 / 2.)
                          ])  # overlap between both spheres
    sp.makeClumpCloud((-0.125, -0.125, 0), (0.125, 0.125, 0.5), [c1], num=80)
    sp.toSimulation()
    O.bodies.updateClumpProperties(
Esempio n. 10
0
# Controlling of strain and stresses is performed via PeriTriaxController,
# of which parameters determine type of control and also stability
# condition (maxUnbalanced) so that the packing is considered stabilized
# and the stage is done.
#

sigmaIso = -1e5

#import matplotlib
#matplotlib.use('Agg')

# generate loose packing
from yade import pack, qt, plot

O.periodic = True
sp = pack.SpherePack()
if 0:
    ## uniform distribution
    sp.makeCloud((0, 0, 0), (2, 2, 2), rMean=.1, rRelFuzz=.3, periodic=True)
else:
    ## create packing from clumps
    # configuration of one clump
    c1 = pack.SpherePack([((0, 0, 0), .03333), ((.03, 0, 0), .017),
                          ((0, .03, 0), .017)])
    # make cloud using the configuration c1 (there could c2, c3, ...; selection between them would be random)
    sp.makeClumpCloud((0, 0, 0), (2, 2, 2), [c1], periodic=True, num=500)

# setup periodic boundary, insert the packing
sp.toSimulation()

O.engines = [
Esempio n. 11
0
density1 = 2650

# Other Constants
g = -9.806  #Gravitational acceleration
numDamping = 0.6
numParticles = 100

# Material is created
O.materials.append((FrictMat(young=E1, poisson=poisson1, density=density1)))
mat1 = O.materials[0]

# Geometries (facets on 6 sides, two vectors correspond to center and extent)
O.bodies.append(utils.geom.facetBox((0.2, 0.2, 1), (0.2, 0.2, 1), wallMask=63))

# Particle cloud
sp1 = pack.SpherePack()
sp1.makeCloud((0, 0, 0), (0.4, 0.4, 2),
              rMean=.05,
              rRelFuzz=0,
              num=numParticles)
sp1.toSimulation()
for b in O.bodies:
    b.mat = mat1

# Engines
O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Sphere_Aabb(),
         Bo1_Facet_Aabb(),
         Bo1_Wall_Aabb()]),