Changeset 5112
 Timestamp:
 Mar 4, 2008, 3:58:41 PM (17 years ago)
 Files:

 2 added
 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/documentation/user_manual/demos/runup.py
r4883 r5112 10 10 # 11 11 12 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular _cross12 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular 13 13 from anuga.shallow_water import Domain 14 14 from anuga.shallow_water import Reflective_boundary … … 22 22 # 23 23 24 points, vertices, boundary = rectangular _cross(10, 10,len1=1.0, len2= 1.0) # Basic mesh24 points, vertices, boundary = rectangular(10, 10) # Basic mesh 25 25 26 26 domain = Domain(points, vertices, boundary) # Create domain … … 37 37 38 38 def topography(x,y): 39 return x/2 39 return x/2 # linear bed slope 40 40 #return x*((2.0x)*.5) # curved bed slope 41 41 … … 54 54 Bd = Dirichlet_boundary([0.2,0.,0.]) # Constant boundary values 55 55 Bw = Time_boundary(domain=domain, # Time dependent boundary 56 f=lambda t: [(.1*sin(t*2*pi)0.3) , 0.0, 0.0])56 f=lambda t: [(.1*sin(t*2*pi)0.3) * exp(t), 0.0, 0.0]) 57 57 58 58 # Associate boundary tags with boundary objects 59 59 domain.set_boundary({'left': Br, 'right': Bw, 'top': Br, 'bottom': Br}) 60 60 61 #===============================================================================62 from anuga.visualiser import RealtimeVisualiser63 vis = RealtimeVisualiser(domain)64 vis.render_quantity_height("elevation", zScale=1.0, dynamic=False)65 vis.render_quantity_height("stage", dynamic=True)66 vis.colour_height_quantity('stage', (lambda q:q['stage'], 0.5, 0.5))67 vis.start()68 #===============================================================================69 61 70 import time71 t0 = time.time()72 62 # 73 63 # Evolve system through time … … 76 66 for t in domain.evolve(yieldstep = 0.1, finaltime = 10.0): 77 67 domain.write_time() 78 vis.update()68 79 69 80 vis.evolveFinished()81 print 'That took %.2f seconds' %(time.time()t0)82 70
Note: See TracChangeset
for help on using the changeset viewer.