#ball_mover.py:
#=============
#
# An ESyS-Particle Runnable to move a SphereBody at constant speed
#
# D. Weatherley, UQ , 2018
#
#import the ESyS-Particle modules:
from esys.lsm import *
from esys.lsm.util import *

class SphereBodyMoverRunnable (Runnable):
   def __init__ (self, 
      sim, 
      ballName, 
      speed = 1.0, 
      dirn = Vec3 (1,0,0)
   ):
      Runnable.__init__(self)

      self.sim = sim
      self.ballName = ballName
      self.speed = speed
      self.dirn = dirn

      self.nt = 0

      self.dt = self.sim.getTimeStepSize ()

      self.displaceIncr = self.dirn * (self.speed * self.dt)

   def run (self):
      ball_displacement = self.displaceIncr 

      self.sim.moveSphereBodyBy (self.ballName, ball_displacement)

      self.nt = self.nt + 1
GlossyBlue theme adapted by David Gilbert
Powered by PmWiki
www.000webhost.com