#import the ESyS-Particle modules:
from esys.lsm import *
from esys.lsm.util import *

class WallMoverRunnable (Runnable):
   def __init__ (self, 
      sim, 
      wallName, 
      speed = 1.0, 
      dirn = Vec3 (1,0,0), 
      rampTime = 10000
   ):
      Runnable.__init__(self)

      self.sim = sim
      self.wallName = wallName
      self.speed = speed
      self.dirn = dirn
      self.rampTime = rampTime

      self.nt = 0

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

   def run (self):
      if (self.nt <= self.rampTime):
         f_ramp = float(self.nt) / float(self.rampTime)      
      else:
         f_ramp = 1.0

      wall_displacement = self.displaceIncr * f_ramp

      self.sim.moveWallBy (self.wallName, wall_displacement)

      self.nt = self.nt + 1


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