1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
\subsection{\texttt{shearcell.py}}\label{code:shearcell}
\begin{verbatim}
#shearcell.py: An annular shear cell simulation using ESyS-Particle
# Author: D. Weatherley
# Date: 24 April 2011
# Organisation: ESSCC, The University of Queensland, Brisbane, AUSTRALIA
# (C) All rights reserved, 2011.
#
#
#import the appropriate ESyS-Particle modules:
from esys.lsm import *
from esys.lsm.util import *
from esys.lsm.geometry import *
from WallLoader import WallLoaderRunnable
from ServoWallLoader import ServoWallLoaderRunnable
#create a simulation container object:
# N.B. there must be at least two sub-divisions
# in the X-direction for periodic boundaries
sim = LsmMpi (numWorkerProcesses=2, mpiDimList=[2,1,1])
sim.initNeighbourSearch (
particleType = "NRotSphere",
gridSpacing = 2.5,
verletDist = 0.5
)
#specify the number of timesteps and timestep increment:
sim.setNumTimeSteps(100000)
sim.setTimeStepSize(0.001)
#enforce two-dimensional computations:
sim.force2dComputations (True)
#specify the spatial domain and direction of periodic boundaries:
domain = BoundingBox ( Vec3 (0,0,0), Vec3 (10,10,0) )
sim.setSpatialDomain (
bBox = domain,
circDimList = [True, False, False]
)
#construct a rectangle of unbonded particles:
packer = RandomBoxPacker (
minRadius = 0.1,
maxRadius = 0.5,
cubicPackRadius = 2.2,
maxInsertFails = 1000,
bBox = BoundingBox(
Vec3(0.0, 0.0,0.0),
Vec3(10.0, 10.0, 0.0)
),
circDimList = [True, False, False],
tolerance = 1.0e-5
)
packer.generate()
particleList = packer.getSimpleSphereCollection()
#tag particles along base and top of rectangle
#then add the particles to the simulation object:
for pp in particleList:
centre = pp.getPosn()
radius = pp.getRadius()
Y = centre[1]
if (Y < 1.0): # particle is near the base (tag=2)
pp.setTag (2)
elif (Y > 9.0): # particle is near the top (tag=3)
pp.setTag (3)
else: # particle is inside the shear cell (tag=1)
pp.setTag (1)
sim.createParticle(pp) # add the particle to the simulation object
#set the density of all particles:
sim.setParticleDensity (
tag = 1,
mask = -1,
Density = 100.0
)
sim.setParticleDensity (
tag = 2,
mask = -1,
Density = 100.0
)
sim.setParticleDensity (
tag = 3,
mask = -1,
Density = 100.0
)
#add driving walls above and below the particle assembly:
sim.createWall (
name = "bottom_wall",
posn = Vec3 (0,0,0),
normal = Vec3 (0,1,0)
)
sim.createWall (
name = "top_wall",
posn = Vec3 (0,10,0),
normal = Vec3 (0,-1,0)
)
#unbonded particle-pairs undergo frictional interactions:
sim.createInteractionGroup (
NRotFrictionPrms (
name = "pp_friction",
normalK = 1000.0,
dynamicMu = 0.6,
shearK = 100.0,
scaling = True
)
)
#particles near the base (tag=2) are bonded to the bottom wall:
sim.createInteractionGroup (
NRotBondedWallPrms (
name = "bwall_bonds",
wallName = "bottom_wall",
normalK = 1000.0,
particleTag = 2
)
)
#particles near the base (tag=3) are bonded to the top wall:
sim.createInteractionGroup (
NRotBondedWallPrms (
name = "twall_bonds",
wallName = "top_wall",
normalK = 1000.0,
particleTag = 3
)
)
#add local damping to avoid accumulating kinetic energy:
sim.createInteractionGroup (
LinDampingPrms (
name = "damping",
viscosity = 1.0,
maxIterations = 100
)
)
#add ServoWallLoaderRunnables to apply constant normal stress:
servo_loader1 = ServoWallLoaderRunnable(
LsmMpi = sim,
interactionName = "twall_bonds",
force = Vec3 (0.0, -1000.0, 0.0),
startTime = 0,
rampTime = 5000
)
sim.addPreTimeStepRunnable (servo_loader1)
wall_loader1 = WallLoaderRunnable(
LsmMpi = sim,
wallName = "bottom_wall",
vPlate = Vec3 (0.125, 0.0, 0.0),
startTime = 30000,
rampTime = 10000
)
sim.addPreTimeStepRunnable (wall_loader1)
#add a FieldSaver to store total kinetic energy:
sim.createFieldSaver (
ParticleScalarFieldSaverPrms(
fieldName="e_kin",
fileName="ekin.dat",
fileFormat="SUM",
beginTimeStep=0,
endTimeStep=100000,
timeStepIncr=1
)
)
#add FieldSavers to store wall forces and positions:
posn_saver = WallVectorFieldSaverPrms(
wallName=["bottom_wall", "top_wall"],
fieldName="Position",
fileName="out_Position.dat",
fileFormat="RAW_SERIES",
beginTimeStep=0,
endTimeStep=100000,
timeStepIncr=1
)
sim.createFieldSaver(posn_saver)
force_saver = WallVectorFieldSaverPrms(
wallName=["bottom_wall", "top_wall"],
fieldName="Force",
fileName="out_Force.dat",
fileFormat="RAW_SERIES",
beginTimeStep=0,
endTimeStep=100000,
timeStepIncr=1
)
sim.createFieldSaver(force_saver)
#add a CheckPointer to store simulation data:
sim.createCheckPointer (
CheckPointPrms (
fileNamePrefix = "snapshot",
beginTimeStep = 0,
endTimeStep = 100000,
timeStepIncr = 5000
)
)
#execute the simulation:
sim.run()
\end{verbatim}
|