Example #1
0
# peri3dController_shear.py
# script, that explains funcionality and input parameters of Peri3dController on the example of
# shear test with rotated periodic cell (that enables strain localization).
#   The simulation is run on rotated cell to enable localization and strain softening
# (you can also try simulation with different angles of rotation to obtain different results.


from yade import pack,plot,qt

# define material
O.materials.append(CpmMat(young=25e9,poisson=.2,sigmaT=3e6,epsCrackOnset=1e-4,relDuctility=1e-6))

# create periodic assembly of particles
initSize=1.2
sp=pack.randomPeriPack(radius=.05,initSize=Vector3(initSize,initSize,initSize),memoizeDb='/tmp/packDb.sqlite')
angle=0.
#angle=pi/4
rot=Matrix3(cos(angle),-sin(angle),0, sin(angle),cos(angle),0, 0,0,1)
sp.toSimulation(rot=rot)

# plotting 
plot.live=False
plot.plots={'iter':('sx','sy','sz','syz','szx','sxy',),'iter_':('ex','ey','ez','eyz','ezx','exy',),'exy':('sxy',)}
def plotAddData():
	plot.addData(
		iter=O.iter,iter_=O.iter,
		sx=p3d.stress[0],sy=p3d.stress[1],sz=p3d.stress[2],
		syz=p3d.stress[3],szx=p3d.stress[4],sxy=p3d.stress[5],
		ex=p3d.strain[0],ey=p3d.strain[1],ez=p3d.strain[2],
		eyz=p3d.strain[3],ezx=p3d.strain[4],exy=p3d.strain[5],
	)
Example #2
0
	doModes=3,
	biaxial=True,

	# isotropic confinement (should be negative)
	isoPrestress=0
)

from yade.params.table import *

if 'description' in O.tags.keys(): O.tags['id']=O.tags['id']+O.tags['description']

packingFile='periCube.pickle'
# got periodic packing? Memoization not (yet) supported, so just generate it if there is not the right file
# Save and reuse next time.
if not os.path.exists(packingFile):
	sp=pack.randomPeriPack(radius=.05e-3,rRelFuzz=0.,initSize=Vector3(1.5e-3,1.5e-3,1.5e-3))
	dd=dict(cell=(sp.cellSize[0],sp.cellSize[1],sp.cellSize[2]),spheres=sp.toList())
	import cPickle as pickle
	pickle.dump(dd,open(packingFile,'w'))
#
# load the packing (again);
#
import cPickle as pickle
concreteId=O.materials.append(CpmMat(young=young, frictionAngle=frictionAngle, density=4800, sigmaT=sigmaT, crackOpening=crackOpening, epsCrackOnset=epsCrackOnset, poisson=poisson, isoPrestress=isoPrestress))
sphDict=pickle.load(open(packingFile))
from yade import pack
sp=pack.SpherePack()
sp.fromList(sphDict['spheres'])
sp.cellSize=sphDict['cell']

import numpy
Example #3
0
doModes = 3
biaxial = True

# isotropic confinement (should be negative)
isoPrestress = 0
#)

if 'description' in O.tags.keys():
    O.tags['id'] = O.tags['id'] + O.tags['description']

packingFile = 'periCube.pickle'
# got periodic packing? Memoization not (yet) supported, so just generate it if there is not the right file
# Save and reuse next time.
if not os.path.exists(packingFile):
    sp = pack.randomPeriPack(radius=.05e-3,
                             rRelFuzz=0.,
                             initSize=Vector3(1.5e-3, 1.5e-3, 1.5e-3))
    dd = dict(cell=(sp.cellSize[0], sp.cellSize[1], sp.cellSize[2]),
              spheres=sp.toList())
    import cPickle as pickle
    pickle.dump(dd, open(packingFile, 'w'))
#
# load the packing (again);
#
import cPickle as pickle
concreteId = O.materials.append(
    CpmMat(young=young,
           frictionAngle=frictionAngle,
           poisson=poisson,
           density=4800,
           sigmaT=sigmaT,
Example #4
0
from yade import pack, plot

# create some material
O.materials.append(
    CpmMat(young=25e9,
           frictionAngle=.7,
           poisson=.2,
           sigmaT=3e6,
           epsCrackOnset=1e-4,
           relDuctility=30))

# create periodic assembly of particles
initSize = 1.2
sp = pack.randomPeriPack(radius=.05,
                         initSize=Vector3(initSize, initSize, initSize),
                         memoizeDb='/tmp/packDb.sqlite')
sp.toSimulation()

# plotting
#plot.live=False
plot.plots = {
    'progress': (
        'sx',
        'sy',
        'sz',
        'syz',
        'szx',
        'sxy',
    ),
    'progress_': (
Example #5
0
# Seed was not used in the end. The rerun will not produce exactly the same results, but should give very similar results
import sys
from yade import pack, plot

utils.readParamsFromTable(noTableOk = True,
	nums = (50,100,200,400),
	radius = .1234,
	seed = 1,
)
from yade.params.table import *

for num in nums:
	print num
	sys.stdout.flush()
	O.reset()
	#sp = myRandomPeriPack(radius,num,seed=seed,initSizeFactor=2.4+.0002*num)
	sp = pack.randomPeriPack(radius,2.4*num**(1/3.)*radius*Vector3.Ones)
	seed += 1
	sp.toSimulation()
	n = len(O.bodies)
	v = O.cell.volume
	f = n*4/3.*pi*pow(radius,3) / v
	plot.addData(
		numberOfParticles = n,
		packingFraction = f,
	)
plot.saveDataTxt('/tmp/randomPeriPack_packingFraction.dat')