#biaxial_test.txt:
#================
#
#An ESyS-Particle script to simulate biaxial compression 
# of a box of frictional elastic particles
#
#D. Weatherley, UQ, 2018.
#
#Import the ESyS-Particle modules:
from esys.lsm import * 
from esys.lsm.util import *
from wall_mover import WallMoverRunnable
from wall_piston import WallPistonRunnable

#define the range of particle sizes:
Rmin = 0.2
Rmax = 0.5

#define the lateral confining pressure:
pressure = 1.0e4 # (Pa)

#spatial domain boundaries:
minPoint = Vec3 (0,0,0)
maxPoint = Vec3 (5,5,5)

#Construct a simulation container:
sim = LsmMpi (1, [1,1,1])

#Initialise the neighbour search algorithm:
sim.initNeighbourSearch (
   particleType = "NRotSphere", 
   gridSpacing = 2.5*Rmax, 
   verletDist = 0.2*Rmin
)

#Specify the number of timesteps to compute and the timestep size:
sim.setNumTimeSteps (100000)
sim.setTimeStepSize (0.001)

#Read the initial particle geometry from a GenGeo geometry file:
sim.readGeometry("mybox.geo")

#Set the density of all particles:
sim.setParticleDensity (tag = 1, mask = -1, Density = 2600.0)
sim.setParticleDensity (tag = 2, mask = -1, Density = 2600.0)

#Construct walls surrounding the particles:
sim.createWall (
   name = "bottom_wall",
   posn = minPoint,
   normal = Vec3(0,1,0)
)
#(and the other walls, in shorthand:)
sim.createWall("left_wall",minPoint,Vec3(1,0,0))
sim.createWall("front_wall",minPoint,Vec3(0,0,1))
sim.createWall("back_wall", maxPoint, Vec3(0,0,-1))
sim.createWall("right_wall", maxPoint, Vec3(-1,0,0))
sim.createWall("top_wall", maxPoint, Vec3(0,-1,0))

#Add elastic repulsion between particles and walls:
sim.createInteractionGroup (
   NRotElasticWallPrms (
      name = "pw_bottom",
      wallName = "bottom_wall",
      normalK = 1.0e7
   )
)
#(and the rest...)
sim.createInteractionGroup ( NRotElasticWallPrms ("pw_top","top_wall",1.0e7) )
sim.createInteractionGroup ( NRotElasticWallPrms ("pw_left","left_wall",1.0e7) )
sim.createInteractionGroup ( NRotElasticWallPrms ("pw_right","right_wall",1.0e7) )
sim.createInteractionGroup ( NRotElasticWallPrms ("pw_back","back_wall",1.0e7) )
sim.createInteractionGroup ( NRotElasticWallPrms ("pw_front","front_wall",1.0e7) )

#Specify linear elastic repulsion between particles:
sim.createInteractionGroup (
   NRotFrictionPrms (
      name = "friction", 
      normalK = 1.0e7, 
      dynamicMu = 0.6,
      shearK = 1.0e7,
      scaling = True
   )
)

#Add gravity:
sim.createInteractionGroup (
   GravityPrms (name = "gravity", acceleration = Vec3(0,-9.81,0))
)

#Add a Runnable to move the top wall:
wall_mover = WallMoverRunnable (
   sim, 
   "top_wall", 
   speed = 0.01,
   dirn = Vec3 (0,-1,0),
   rampTime = 10000
)
sim.addPostTimeStepRunnable(wall_mover)

#Add a Runnable to apply constant pressure upon the right wall:
wall_piston = WallPistonRunnable (
   sim,
   "right_wall",
   "pw_right",
   pressure = pressure,
   dirn = Vec3 (-1,0,0),
   contactArea = 25.0,
   startTime = 10000,
   rampTime = 10000
)
sim.addPostTimeStepRunnable(wall_piston)

#Add a FieldSaver to record Positions of the top and right walls:
sim.createFieldSaver (
   WallVectorFieldSaverPrms (
      wallName = ["top_wall","right_wall"],
      fieldName = "Position",
      fileName = "wall_posn.csv",
      fileFormat = "RAW_SERIES",
      beginTimeStep = 0,
      endTimeStep = 100000,
      timeStepIncr = 1
   )
)

#Add a FieldSaver to record Forces of the top and right walls:
sim.createFieldSaver (
   WallVectorFieldSaverPrms (
      wallName = ["top_wall","right_wall"],
      fieldName = "Force",
      fileName = "wall_force.csv",
      fileFormat = "RAW_SERIES",
      beginTimeStep = 0,
      endTimeStep = 100000,
      timeStepIncr = 1
   )
)

#Attach a CheckPointer to record simulation data for visualisation:
sim.createCheckPointer (
   CheckPointPrms (
      fileNamePrefix = "snapshot", 
      beginTimeStep = 0, 
      endTimeStep = 100000, 
      timeStepIncr = 1000
   )
)

#Execute the simulation:
sim.run()

GlossyBlue theme adapted by David Gilbert
Powered by PmWiki
www.000webhost.com