/[escript]/trunk/modellib/py_src/tsunami.py
ViewVC logotype

Diff of /trunk/modellib/py_src/tsunami.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 258 by gross, Tue Nov 29 05:54:06 2005 UTC revision 259 by gross, Tue Nov 29 07:14:41 2005 UTC
# Line 815  class TsunamiInDeepWater(Model): Line 815  class TsunamiInDeepWater(Model):
815                                   wave_velocity=0.,                                   wave_velocity=0.,
816                                   initial_time_step=None,                                   initial_time_step=None,
817                                   bathymetry=1.,                                   bathymetry=1.,
818                                   safety_factor=0.1)                                   safety_factor=1.)
819    
820         def doInitialization(self):         def doInitialization(self):
821             """             """
# Line 828  class TsunamiInDeepWater(Model): Line 828  class TsunamiInDeepWater(Model):
828             c_max=math.sqrt(Lsup(self.__c2))             c_max=math.sqrt(Lsup(self.__c2))
829             self.__dt=self.safety_factor*inf(self.domain.getSize()/(sqrt(self.__c2)+EPS*c_max))             self.__dt=self.safety_factor*inf(self.domain.getSize()/(sqrt(self.__c2)+EPS*c_max))
830             if self.initial_time_step==None: self.initial_time_step=self.__dt             if self.initial_time_step==None: self.initial_time_step=self.__dt
831             self.trace("maximum wave velocity %s m/sec^2"%c_max)             self.trace("maximum wave velocity %s m/sec"%c_max)
832             self.trace("Time step size is %s sec"%self.__dt)             self.trace("Time step size is %s sec"%self.__dt)
833    
834    
# Line 851  class TsunamiInDeepWater(Model): Line 851  class TsunamiInDeepWater(Model):
851             @type dt: C{float}             @type dt: C{float}
852             """             """
853             self.__pde.setValue(X=-self.__c2*grad(self.wave_height))             self.__pde.setValue(X=-self.__c2*grad(self.wave_height))
854    
855             new_height=self.wave_height+dt*self.wave_velocity+dt*(self.initial_time_step+dt)/2*self.__pde.getSolution()             new_height=self.wave_height+dt*self.wave_velocity+dt*(self.initial_time_step+dt)/2*self.__pde.getSolution()
856    
857             self.wave_velocity=(new_height-self.wave_height)/dt             self.wave_velocity=(new_height-self.wave_height)/dt
858             self.wave_height=new_height             self.wave_height=new_height
859             self.initial_time_step=dt             self.initial_time_step=dt
# Line 976  if __name__=="__main__": Line 978  if __name__=="__main__":
978     sm.filename="movie.mpg"     sm.filename="movie.mpg"
979        
980     s=Simulation([sq,oc,b,oreg,src,ts,sm])     s=Simulation([sq,oc,b,oreg,src,ts,sm])
981     s.writeXML()     # s.writeXML()
982     s.run()     s.run()

Legend:
Removed from v.258  
changed lines
  Added in v.259

  ViewVC Help
Powered by ViewVC 1.1.26