예제 #1
0
def randomPeriPack(radius,initSize,rRelFuzz=0.0,memoizeDb=None,noPrint=False):
	"""Generate periodic dense packing.

	A cell of initSize is stuffed with as many spheres as possible, then we run periodic compression with PeriIsoCompressor, just like with
	randomDensePack.

	:param radius: mean sphere radius
	:param rRelFuzz: relative fuzz of sphere radius (equal distribution); see the same param for randomDensePack.
	:param initSize: initial size of the periodic cell.

	:return: SpherePack object, which also contains periodicity information.
	"""
	from math import pi
	sp=_getMemoizedPacking(memoizeDb,radius,rRelFuzz,initSize[0],initSize[1],initSize[2],fullDim=Vector3(0,0,0),wantPeri=True,fillPeriodic=False,spheresInCell=-1,memoDbg=True,noPrint=noPrint)
	if sp: return sp
	O.switchScene(); O.resetThisScene()
	sp=SpherePack()
	O.periodic=True
	#O.cell.refSize=initSize
	O.cell.setBox(initSize)
	sp.makeCloud(Vector3().Zero,O.cell.refSize,radius,rRelFuzz,-1,True)
	O.engines=[ForceResetter(),InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius),InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_ScGeom_FrictPhys_CundallStrack()]),PeriIsoCompressor(charLen=2*radius,stresses=[-100e9,-1e8],maxUnbalanced=1e-2,doneHook='O.pause();',globalUpdateInt=20,keepProportions=True),NewtonIntegrator(damping=.8)]
	O.materials.append(FrictMat(young=30e9,frictionAngle=.1,poisson=.3,density=1e3))
	for s in sp: O.bodies.append(utils.sphere(s[0],s[1]))
	O.dt=utils.PWaveTimeStep()
	O.timingEnabled=True
	O.run(); O.wait()
	ret=SpherePack()
	ret.fromSimulation()
	_memoizePacking(memoizeDb,ret,radius,rRelFuzz,wantPeri=True,fullDim=Vector3(0,0,0),noPrint=noPrint) # fullDim unused
	O.switchScene()
	return ret
예제 #2
0
	def testErasedAndNewlyCreatedSphere(self):
		"Bodies: The bug is described in LP:1001194. If the new body was created after deletion of previous, it has no bounding box"
		O.reset()
		id1 = O.bodies.append(utils.sphere([0.0, 0.0, 0.0],0.5))
		id2 = O.bodies.append(utils.sphere([0.0, 2.0, 0.0],0.5))
		O.engines=[
			ForceResetter(),
			InsertionSortCollider([Bo1_Sphere_Aabb()]),
			InteractionLoop(
				[Ig2_Sphere_Sphere_L3Geom()],
				[Ip2_FrictMat_FrictMat_FrictPhys()],
				[Law2_L3Geom_FrictPhys_ElPerfPl()]
			),
			NewtonIntegrator(damping=0.1,gravity=(0,0,-9.81))
		]
		O.dt=.5e-4*utils.PWaveTimeStep()
		#Before first step the bodies should not have bounds
		self.assert_(O.bodies[id1].bound==None and O.bodies[id2].bound==None)
		O.run(1, True)
		#After first step the bodies should have bounds
		self.assert_(O.bodies[id1].bound!=None and O.bodies[id2].bound!=None)
		#Add 3rd body
		id3 = O.bodies.append(utils.sphere([0.0, 4.0, 0.0],0.5))
		O.run(1, True)
		self.assert_(O.bodies[id1].bound!=None and O.bodies[id2].bound!=None and O.bodies[id3].bound!=None)
		#Remove 3rd body
		O.bodies.erase(id3)
		O.run(1, True)
		#Add 4th body
		id4 = O.bodies.append(utils.sphere([0.0, 6.0, 0.0],0.5))
		O.run(1, True)
		self.assert_(O.bodies[id1].bound!=None and O.bodies[id2].bound!=None and O.bodies[id4].bound!=None)
예제 #3
0
 def testEraseBodiesInInteraction(self):
     O.reset()
     id1 = O.bodies.append(utils.sphere([0.5, 0.5, 0.0 + 0.095], .1))
     id2 = O.bodies.append(utils.sphere([0.5, 0.5, 0.0 + 0.250], .1))
     O.engines = [
         ForceResetter(),
         InsertionSortCollider([Bo1_Sphere_Aabb()]),
         InteractionLoop([Ig2_Sphere_Sphere_L3Geom()],
                         [Ip2_FrictMat_FrictMat_FrictPhys()],
                         [Law2_L3Geom_FrictPhys_ElPerfPl()]),
         NewtonIntegrator(damping=0.1, gravity=(0, 0, -9.81))
     ]
     O.dt = .5e-4 * utils.PWaveTimeStep()
     O.step()
     O.bodies.erase(id1)
     O.step()
예제 #4
0
	print '!joint cohesion total degradation!', ' | iteration=', O.iter
	degrade=False
	for i in O.interactions:
	    if i.phys.isOnJoint : 
		if i.phys.isCohesive:
		  i.phys.isCohesive=False
		  i.phys.FnMax=0.
		  i.phys.FsMax=0.
		
#### YADE windows
from yade import qt
v=qt.Controller()
v=qt.View()

#### time step definition (low here to create cohesive links without big changes in the assembly)
O.dt=0.1*utils.PWaveTimeStep()

#### set cohesive links with interaction radius>=1
O.step();
#### initializes now the interaction detection factor to strictly 1
ss2d3dg.interactionDetectionFactor=-1.
is2aabb.aabbEnlargeFactor=-1.
#### if you want to avoid contact detection (Lattice like)
#O.engines=O.engines[:1]+O.engines[3:]

#### RUN!!!
O.dt=-0.1*utils.PWaveTimeStep()

O.run(maxIter)
plot.plot()
예제 #5
0
파일: pack.py 프로젝트: Zhijie-YU/yade-copy
def randomDensePack(predicate,
                    radius,
                    material=-1,
                    dim=None,
                    cropLayers=0,
                    rRelFuzz=0.,
                    spheresInCell=0,
                    memoizeDb=None,
                    useOBB=False,
                    memoDbg=False,
                    color=None,
                    returnSpherePack=None,
                    seed=0):
    """Generator of random dense packing with given geometry properties, using TriaxialTest (aperiodic)
	or PeriIsoCompressor (periodic). The periodicity depens on whether	the spheresInCell parameter is given.

	*O.switchScene()* magic is used to have clean simulation for TriaxialTest without deleting the original simulation.
	This function therefore should never run in parallel with some code accessing your simulation.

	:param predicate: solid-defining predicate for which we generate packing
	:param spheresInCell: if given, the packing will be periodic, with given number of spheres in the periodic cell.
	:param radius: mean radius of spheres
	:param rRelFuzz: relative fuzz of the radius -- e.g. radius=10, rRelFuzz=.2, then spheres will have radii 10 ± (10*.2)), with an uniform distribution.
		0 by default, meaning all spheres will have exactly the same radius.
	:param cropLayers: (aperiodic only) how many layers of spheres will be added to the computed dimension of the box so that there no
		(or not so much, at least) boundary effects at the boundaries of the predicate.
	:param dim: dimension of the packing, to override dimensions of the predicate (if it is infinite, for instance)
	:param memoizeDb: name of sqlite database (existent or nonexistent) to find an already generated packing or to store
		the packing that will be generated, if not found (the technique of caching results of expensive computations
		is known as memoization). Fuzzy matching is used to select suitable candidate -- packing will be scaled, rRelFuzz
		and dimensions compared. Packing that are too small are dictarded. From the remaining candidate, the one with the
		least number spheres will be loaded and returned.
	:param useOBB: effective only if a inGtsSurface predicate is given. If true (not default), oriented bounding box will be
		computed first; it can reduce substantially number of spheres for the triaxial compression (like 10× depending on
		how much asymmetric the body is), see examples/gts-horse/gts-random-pack-obb.py
	:param memoDbg: show packings that are considered and reasons why they are rejected/accepted
	:param returnSpherePack: see the corresponding argument in :yref:`yade.pack.filterSpherePack`

	:return: SpherePack object with spheres, filtered by the predicate.
	"""
    import sqlite3, os.path, pickle, time, sys, numpy
    from math import pi
    from yade import _packPredicates
    wantPeri = (spheresInCell > 0)
    if 'inGtsSurface' in dir(_packPredicates) and type(
            predicate) == inGtsSurface and useOBB:
        center, dim, orientation = gtsSurfaceBestFitOBB(predicate.surf)
        print(
            "Best-fit oriented-bounding-box computed for GTS surface, orientation is",
            orientation)
        dim *= 2  # gtsSurfaceBestFitOBB returns halfSize
    else:
        if not dim: dim = predicate.dim()
        if max(dim) == float('inf'):
            raise RuntimeError(
                "Infinite predicate and no dimension of packing requested.")
        center = predicate.center()
        orientation = None
    if not wantPeri:
        fullDim = tuple([dim[i] + 4 * cropLayers * radius for i in (0, 1, 2)])
    else:
        # compute cell dimensions now, as they will be compared to ones stored in the db
        # they have to be adjusted to not make the cell to small WRT particle radius
        fullDim = dim
        cloudPorosity = 0.25  # assume this number for the initial cloud (can be underestimated)
        beta, gamma = fullDim[1] / fullDim[0], fullDim[2] / fullDim[
            0]  # ratios β=y₀/x₀, γ=z₀/x₀
        N100 = spheresInCell / cloudPorosity  # number of spheres for cell being filled by spheres without porosity
        x1 = radius * (1 / (beta * gamma) * N100 * (4 / 3.) * pi)**(1 / 3.)
        y1, z1 = beta * x1, gamma * x1
        vol0 = x1 * y1 * z1
        maxR = radius * (1 + rRelFuzz)
        x1 = max(x1, 8 * maxR)
        y1 = max(y1, 8 * maxR)
        z1 = max(z1, 8 * maxR)
        vol1 = x1 * y1 * z1
        N100 *= vol1 / vol0  # volume might have been increased, increase number of spheres to keep porosity the same
        sp = _getMemoizedPacking(memoizeDb,
                                 radius,
                                 rRelFuzz,
                                 x1,
                                 y1,
                                 z1,
                                 fullDim,
                                 wantPeri,
                                 fillPeriodic=True,
                                 spheresInCell=spheresInCell,
                                 memoDbg=False)
        if sp:
            if orientation:
                sp.cellSize = (
                    0, 0, 0)  # resetting cellSize avoids warning when rotating
                sp.rotate(*orientation.toAxisAngle())
            return filterSpherePack(predicate,
                                    sp,
                                    material=material,
                                    returnSpherePack=returnSpherePack)
        else:
            print("No suitable packing in database found, running",
                  'PERIODIC compression' if wantPeri else 'triaxial')
        sys.stdout.flush()
    O.switchScene()
    O.resetThisScene()  ### !!
    if wantPeri:
        # x1,y1,z1 already computed above
        sp = SpherePack()
        O.periodic = True
        #O.cell.refSize=(x1,y1,z1)
        O.cell.setBox((x1, y1, z1))
        #print cloudPorosity,beta,gamma,N100,x1,y1,z1,O.cell.refSize
        #print x1,y1,z1,radius,rRelFuzz
        O.materials.append(FrictMat(young=3e10, density=2400))
        num = sp.makeCloud(Vector3().Zero, O.cell.refSize, radius, rRelFuzz,
                           spheresInCell, True)
        O.engines = [
            ForceResetter(),
            InsertionSortCollider([Bo1_Sphere_Aabb()],
                                  verletDist=.05 * radius),
            InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],
                            [Ip2_FrictMat_FrictMat_FrictPhys()],
                            [Law2_ScGeom_FrictPhys_CundallStrack()]),
            PeriIsoCompressor(charLen=2 * radius,
                              stresses=[-100e9, -1e8],
                              maxUnbalanced=1e-2,
                              doneHook='O.pause();',
                              globalUpdateInt=5,
                              keepProportions=True),
            NewtonIntegrator(damping=.6)
        ]
        O.materials.append(
            FrictMat(young=30e9, frictionAngle=.5, poisson=.3, density=1e3))
        for s in sp:
            O.bodies.append(utils.sphere(s[0], s[1]))
        O.dt = utils.PWaveTimeStep()
        O.run()
        O.wait()
        sp = SpherePack()
        sp.fromSimulation()
        #print 'Resulting cellSize',sp.cellSize,'proportions',sp.cellSize[1]/sp.cellSize[0],sp.cellSize[2]/sp.cellSize[0]
        # repetition to the required cell size will be done below, after memoizing the result
    else:
        assumedFinalDensity = 0.6
        V = (4.0 / 3.0) * pi * radius**3.0
        N = assumedFinalDensity * fullDim[0] * fullDim[1] * fullDim[2] / V
        TriaxialTest(
            numberOfGrains=int(N),
            radiusMean=radius,
            radiusStdDev=rRelFuzz,
            # upperCorner is just size ratio, if radiusMean is specified
            upperCorner=fullDim,
            seed=seed,
            ## no need to touch any the following
            noFiles=True,
            lowerCorner=[0, 0, 0],
            sigmaIsoCompaction=-4e4,
            sigmaLateralConfinement=-5e2,
            compactionFrictionDeg=1,
            StabilityCriterion=.02,
            strainRate=.2,
            thickness=0,
            maxWallVelocity=.1,
            wallOversizeFactor=1.5,
            autoUnload=True,
            autoCompressionActivation=False,
            internalCompaction=True).load()
        while (numpy.isnan(utils.unbalancedForce())
               or utils.unbalancedForce() > 0.005):
            O.run(500, True)
        sp = SpherePack()
        sp.fromSimulation()
    O.switchScene()  ### !!
    _memoizePacking(memoizeDb, sp, radius, rRelFuzz, wantPeri, fullDim)
    if wantPeri: sp.cellFill(Vector3(fullDim[0], fullDim[1], fullDim[2]))
    if orientation:
        sp.cellSize = (0, 0, 0)
        # reset periodicity to avoid warning when rotating periodic packing
        sp.rotate(*orientation.toAxisAngle())
    return filterSpherePack(predicate,
                            sp,
                            material=material,
                            color=color,
                            returnSpherePack=returnSpherePack)
예제 #6
0
         Ig2_Facet_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    ## Apply gravity
    ## NOTE: Non zero Cundall damping affected a dynamic simulation!
    NewtonIntegrator(damping=0.3, gravity=[0, -9.81, 0]),

    ## Apply kinematics to walls
    ## angularVelocity = 0.73 rad/sec = 7 rpm
    RotationEngine(ids=walls,
                   rotationAxis=[0, 0, 1],
                   rotateAroundZero=True,
                   angularVelocity=0.73)
]

for b in O.bodies:
    if isinstance(b.shape, Sphere):
        b.state.blockedDOFs = 'z'  # blocked movement along Z

O.dt = 0.02 * utils.PWaveTimeStep()

O.saveTmp('init')

from yade import qt
renderer = qt.Renderer()
renderer.wire = True
#qt.Controller()
qt.View()
O.run()
예제 #7
0
o.bodies.append(
    utils.box(center=[0, 0, 0],
              extents=[.5, .5, .5],
              color=[0, 0, 1],
              fixed=True))

## The sphere
##
## * First two arguments are radius and center, respectively. They are used as "positional arguments" here:
## python will deduce based on where they are what they mean.
##
## It could also be written without using utils.sphere - see gui/py/utils.py for the code of the utils.sphere function
o.bodies.append(utils.sphere([0, 0, 2], 1, color=[0, 1, 0]))

## Estimate timestep from p-wave speed and multiply it by safety factor of .2
o.dt = .01 * utils.PWaveTimeStep()

## Save the scene to file, so that it can be loaded later. Supported extension are: .xml, .xml.gz, .xml.bz2.
o.save('/tmp/a.xml.bz2')
#o.run(100000); o.wait(); print o.iter/o.realtime,'iterations/sec'


def onBodySelect(id):
    print "Selected:", id
    utils.highlightNone()
    for i in O.interactions.withBody(id):
        O.bodies[i.id2 if i.id1 == id else i.id1].shape.highlight = True
        print i.id1, i.id2, i.phys, i.geom


try:
예제 #8
0
        pack.regularHexa(pack.inEllipsoid(
            (xyz[0] * (sizeBox + gapBetweenBoxes), xyz[1] *
             (sizeBox + gapBetweenBoxes) + sizeBox * 0.5, xyz[2] *
             (sizeBox + gapBetweenBoxes) - radiusKnife + sizeBox * 0.6),
            (sizeBox / 2, sizeBox / 2, sizeBox / 2)),
                         radius=radiusSph,
                         gap=0,
                         color=colorSph))
    if (colorSph == colorsph1):
        colorSph = colorsph2
    else:
        colorSph = colorsph1

from yade import qt

O.dt = 2 * utils.PWaveTimeStep()  # We do not need now a high accuracy
O.engines = [
    ForceResetter(),
    InsertionSortCollider([
        Bo1_Sphere_Aabb(),
        Bo1_Facet_Aabb(),
    ]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_L3Geom(),
         Ig2_Facet_Sphere_L3Geom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_L3Geom_FrictPhys_ElPerfPl()],
    ),
    TranslationEngine(translationAxis=[1, 0, 0], velocity=5,
                      ids=KnifeIDs),  # Buldozer motion
    NewtonIntegrator(damping=.3, gravity=(0, 0, -9.8)),
interactionRadius=1.;
O.engines=[

	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius,label='is2aabb'),Bo1_Facet_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius,label='ss2d3dg'),Ig2_Facet_Sphere_ScGeom()],
		[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
		[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(smoothJoint=True,label='interactionLaw')]
	),
	NewtonIntegrator(damping=1)

]

############################ timestep + opening yade windows
O.dt=0.001*utils.PWaveTimeStep()

from yade import qt
v=qt.Controller()
v=qt.View()

############################ Identification spheres on joint
#### color set for particles on joint
jointcolor1=(0,1,0)
jointcolor2=(1,0,0)
jointcolor3=(0,0,1)
jointcolor4=(1,1,1)
jointcolor5=(0,0,0)

#### first step-> find spheres on facet
O.step();
예제 #10
0
sphDict = pickle.load(open(packingFile))
from yade import pack
sp = pack.SpherePack()
sp.fromList(sphDict['spheres'])
sp.cellSize = sphDict['cell']

import numpy
avgRadius = numpy.average([r for c, r in sp])
O.bodies.append([utils.sphere(c, r, color=utils.randomColor()) for c, r in sp])
O.periodic = True
#O.cell.setBox=sp.cellSize	#doesnt work correctly, periodic cell is too big!!!!
O.cell.refSize = sp.cellSize
axis = 2
ax1 = (axis + 1) % 3
ax2 = (axis + 2) % 3
O.dt = dtSafety * utils.PWaveTimeStep()

import yade.plot as yp

O.engines = [
    ForceResetter(),
    InsertionSortCollider([
        Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius, label='is2aabb'),
    ]),
    #,sweepLength=.05*avgRadius,nBins=5,binCoeff=5),
    InteractionLoop(
        [Ig2_Sphere_Sphere_Dem3DofGeom(distFactor=intRadius, label='ss2d3dg')],
        [Ip2_CpmMat_CpmMat_CpmPhys()],
        [Law2_Dem3DofGeom_CpmPhys_Cpm()],
    ),
    NewtonIntegrator(damping=damping, label='newton'),
예제 #11
0
        Ig2_Box_Sphere_ScGeom()
    ], [
        Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,
                                        label='interactionPhys')
    ], [
        Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(
            smoothJoint=True,
            neverErase=1,
            recordCracks=True,
            Key=OUT,
            label='interactionLaw')
    ]),
    GlobalStiffnessTimeStepper(active=1,
                               timeStepUpdateInterval=10,
                               timestepSafetyCoefficient=0.8,
                               defaultDt=0.5 * utils.PWaveTimeStep()), triax,
    NewtonIntegrator(damping=0.25, label="newton")
]

O.dt = 0.5 * utils.PWaveTimeStep()

###first step: compression#######
triax = TriaxialStressController(
    internalCompaction=True,
    stressMask=7,
    computeStressStrainInterval=10,
    goal1=Sxx,
    goal2=Syy,
    goal3=Szz,
)
예제 #12
0
#Creating a cylinder from facets
Cylinder=O.bodies.append(geom.facetCylinder(center=(0,0,0),radius=7,height=14,orientation=utils.Quaternion((1,0,0),pi/2),    segmentsNumber=15,wallMask=7,color=(0.3,0.3,0.3),angleRange=None,  closeGap=True))



O.engines=[
 ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb(),Bo1_Wall_Aabb()]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom(),Ig2_Wall_Sphere_ScGeom()],

  [Ip2_FrictMat_FrictMat_FrictPhys()],
  [Law2_ScGeom_FrictPhys_CundallStrack()]),
   NewtonIntegrator(gravity=(0,-9.8,0),damping=.4,label="newtonCustomLabel"),
   HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix),#HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix1),HelixEngine(rotateAroundZero=True,linearVelocity=0.0,rotationAxis=(0,1,0),angularVelocity=40, ids = Helix2),

qt.SnapshotEngine(fileBase='3d-', realPeriod=5000, label='snapshot'),
]



O.dt=0.6*utils.PWaveTimeStep()




print O.iter 
v=qt.View();

예제 #13
0
                     ]),
    PyRunner(iterPeriod=100,
             command='myAddPlotData()',
             label='plotDataCollector'),
    NewtonIntegrator(damping=0.4,
                     gravity=(0, 0,
                              gravity))  ## here we use the 'gravity' parameter
]
O.bodies.append([
    utils.box([0, 50, 0], extents=[1, 50, 1], fixed=True, color=[1, 0, 0]),
    utils.sphere([0, 0, 10], 1, color=[0, 1, 0])
])

O.bodies[1].state.vel = (0, initialSpeed, 0)  ## assign initial velocity

O.dt = .8 * utils.PWaveTimeStep()


## o.saveTmp('initial')
def myAddPlotData():
    s = O.bodies[1]
    plot.addData({
        't': O.time,
        'y_sph': s.state.pos[1],
        'z_sph': s.state.pos[2]
    })


plot.plots = {'y_sph': ('z_sph', )}

# run 30000 iterations
### with DFNFlow, we can block every cells not concerned with fractures with the following function: if these lines are commented (permeable matrix), you will get warning about cholmod: is it an issue? I am not sure yet but it is annoying...
def blockStuff():
	for k in range(flow.nCells()): flow.blockCell(k,True)
flow.blockHook="blockStuff()"

### Simulation is defined here (DEM loop, interaction law, servo control, recording, etc...)
O.engines=[
        ForceResetter(),
        InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb(aabbEnlargeFactor=intR,label='Saabb')]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intR,label='SSgeom'),Ig2_Box_Sphere_ScGeom()],
		[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,label='interactionPhys')],
		[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(smoothJoint=True,neverErase=1,recordCracks=True,Key=OUT,label='interactionLaw')]
	),
        GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=10,timestepSafetyCoefficient=0.8,defaultDt=0.1*utils.PWaveTimeStep()),
        triax,
        flow,
        NewtonIntegrator(damping=0.4,label="newton"),
        PyRunner(iterPeriod=int(1),initRun=True,command='crackCheck()',label='check'),
        PyRunner(iterPeriod=int(saveData),initRun=True,command='recorder()',label='recData'),
        PyRunner(iterPeriod=int(1),initRun=True,command='saveFlowVTK()',label='saveFlow',dead=1),
        #PyRunner(iterPeriod=int(1),initRun=True,command='saveAperture()',label='saveAperture',dead=1),
        VTKRecorder(iterPeriod=int(1),initRun=True,fileName=OUT+'-',recorders=['spheres','bstresses','cracks'],Key=OUT,label='saveSolid',dead=0)
]
 
# these lines can be a problem depending on the configuration of your computer
#from yade import qt
#v=qt.Controller()
#v=qt.View()
예제 #15
0
    NewtonIntegrator(damping=.2, gravity=(0, 0, -9.81)),
    ###
    ### NOTE this extra engine:
    ###
    ### You want snapshot to be taken every 1 sec (realTimeLim) or every 50 iterations (iterLim),
    ### whichever comes soones. virtTimeLim attribute is unset, hence virtual time period is not taken into account.
    PyRunner(iterPeriod=20, command='myAddPlotData()')
]
from yade import utils
O.bodies.append(
    utils.box(center=[0, 0, 0],
              extents=[.5, .5, .5],
              fixed=True,
              color=[1, 0, 0]))
O.bodies.append(utils.sphere([0, 0, 2], 1, color=[0, 1, 0]))
O.dt = .002 * utils.PWaveTimeStep()

############################################
##### now the part pertaining to plots #####
############################################

from math import *
from yade import plot
## we will have 2 plots:
## 1. t as function of i (joke test function)
## 2. i as function of t on left y-axis ('|||' makes the separation) and z_sph, v_sph (as green circles connected with line) and z_sph_half again as function of t
plot.plots = {'i': ('t'), 't': ('z_sph', None, ('v_sph', 'go-'), 'z_sph_half')}


## this function is called by plotDataCollector
## it should add data with the labels that we will plot
예제 #16
0
     Ig2_Box_Sphere_ScGeom()
 ], [
     Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1,
                                     label='interactionPhys')
 ], [
     Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(
         smoothJoint=True,
         neverErase=1,
         recordCracks=True,
         Key=OUT,
         label='interactionLaw')
 ]),
 GlobalStiffnessTimeStepper(active=1,
                            timeStepUpdateInterval=10,
                            timestepSafetyCoefficient=0.8,
                            defaultDt=0.1 * utils.PWaveTimeStep()),
 triax,
 flow,
 NewtonIntegrator(damping=0.4, label="newton"),
 PyRunner(iterPeriod=int(1),
          initRun=True,
          command='crackCheck()',
          label='check'),
 PyRunner(iterPeriod=int(saveData),
          initRun=True,
          command='recorder()',
          label='recData'),
 PyRunner(iterPeriod=int(1),
          initRun=True,
          command='saveFlowVTK()',
          label='saveFlow',
예제 #17
0
qt.View()

O.engines = [
    ForceResetter(),
    InsertionSortCollider(
        [Bo1_Sphere_Aabb(),
         Bo1_Facet_Aabb(),
         Bo1_Wall_Aabb()]),
    InteractionLoop(
        [
            Ig2_Sphere_Sphere_ScGeom(),
            Ig2_Facet_Sphere_ScGeom(),
            Ig2_Wall_Sphere_ScGeom()
        ],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()],
    ),
    NewtonIntegrator(damping=0.01, gravity=[1e2, 1e2, 1e2]),
]

O.dt = utils.PWaveTimeStep()
O.save('/tmp/a.xml')
O.saveTmp()

O.run()
#O.bodies.append([
#	utils.facet([[-1,-1,0],[1,-1,0],[0,1,0]],dynamic=False,color=[1,0,0],young=1e3),
#	utils.facet([[1,-1,0],[0,1,0,],[1,.5,.5]],dynamic=False,young=1e3)
#])
#import random
예제 #18
0
         label='jcf',
         xSectionWeibullShapeParameter=xSectionShape,
         weibullCutOffMin=weibullCutOffMin,
         weibullCutOffMax=weibullCutOffMax)
 ], [
     Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(
         recordCracks=True,
         recordMoments=True,
         Key=identifier,
         label='interactionLaw'),
     Law2_ScGeom_FrictPhys_CundallStrack()
 ]),
 GlobalStiffnessTimeStepper(active=1,
                            timeStepUpdateInterval=100,
                            timestepSafetyCoefficient=0.4,
                            defaultDt=0.1 * utils.PWaveTimeStep()),
 TranslationEngine(ids=piston,
                   translationAxis=(1, 0, 0),
                   velocity=dispVel,
                   label='pistonEngine'),
 TranslationEngine(ids=block1,
                   translationAxis=(1, 0, 0),
                   velocity=0,
                   label='block1Engine'),
 TranslationEngine(ids=block2,
                   translationAxis=(1, 0, 0),
                   velocity=0,
                   label='block2Engine'),
 VTKRecorder(dead=0,
             iterPeriod=iterper * 2,
             initRun=True,