#slump.txt:
#=========
#
#An ESyS-Particle script to simulate gravitational collapse 
# of a box of elastic particles
#
#D. Weatherley, UQ, 2018.
#
#Import the ESyS-Particle modules:
from esys.lsm import * 
from esys.lsm.util import *

#set the type of simulation (either "elastic" or "friction"):
simType = "elastic"

#toggle whether to use artificial damping:
useDamping = True

#define the range of particle sizes:
Rmin = 0.2
Rmax = 0.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 (10000)
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)

#Prevent motion of particles with tag=2:
sim.setParticleNonDynamic(2)

#Specify linear elastic repulsion between particles:
if (simType == "elastic"):
   sim.createInteractionGroup (
      NRotElasticPrms (
         name = "repulsion", 
         normalK = 1.0e7, 
         scaling = True
      )
   )
elif (simType == "friction"):
   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 artificial damping (always add Damping as last Interaction Group):
if (useDamping == True):
   sim.createInteractionGroup (
      LocalDampingPrms (name = "damping", viscosity = 0.8)
   )

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

#Execute the simulation:
sim.run()

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