Changeset 2395
- Timestamp:
- Feb 14, 2006, 1:43:12 PM (19 years ago)
- Location:
- development/momentum_sink
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
development/momentum_sink/compare_sww.py
r2379 r2395 5 5 import project 6 6 from pyvolution.util import file_function 7 import Numeric 8 #from friction_block #import test 9 10 #print "test", test 11 #import sys 12 #sys.exit() 7 13 8 14 9 15 #swwfile = project.outputname + '.sww' 10 swwfile = project.outputdir + sep + 'friction_12330.sww' 11 gauge_locations = [[10,10],[20,20]] 16 #swwfile = project.outputdir + sep + 'FrictionBlock_0.01_3.sww' 17 swwfile = project.outputdir + sep + 'Buildings_3662.sww' 18 gauge_depth = Numeric.arrayrange(0, 700, 20) 19 gauge_breadth = 100 20 gauge_locations = [] 12 21 13 quantities = ['stage','elevation'] 22 for GD in gauge_depth: 23 gauge_location = [GD,gauge_breadth] 24 gauge_locations.append(gauge_location) 25 26 quantities = ['stage','elevation','xmomentum'] 14 27 gauges = file_function(swwfile, 15 28 quantities = quantities, … … 18 31 use_cache = True) 19 32 20 times = [ 0,1,2,3,4]33 times = [150,500] 21 34 22 35 for gauge, _ in enumerate(gauge_locations): -
development/momentum_sink/create_buildings.py
r2379 r2395 18 18 19 19 # Boundary of problem 20 WidtH = 500 # width of boudary in metres20 WidtH = 200 # width of boudary in metres 21 21 #W = WidtH/8 22 22 #L = W 23 outer_polygon = [[0,0],[ 1.5*WidtH,0],[1.5*WidtH,WidtH],[0,WidtH]]23 outer_polygon = [[0,0],[5*WidtH,0],[5*WidtH,WidtH],[0,WidtH]] 24 24 print outer_polygon 25 25 m.add_region_from_polygon(outer_polygon, tags={'wall':[0,1,2], 'wave':[3]}) 26 26 27 27 # inner polygons => building boundaries 28 depth = 18# depth of building side to oncoming wave28 depth = 20 # depth of building side to oncoming wave 29 29 wh = depth/2 30 breadth = 18# breadth of building30 breadth = 20 # breadth of building 31 31 lh = breadth/2 32 32 … … 46 46 47 47 for D in Depths: 48 Breadths = Breadths + BL/248 #Breadths = Breadths + BL/2 #Used to offset buildings 49 49 for B in Breadths: 50 50 polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]] -
development/momentum_sink/friction_block.py
r2379 r2395 6 6 from coordinate_transforms.geo_reference import Geo_reference 7 7 8 8 #test = 300 9 9 def create_mesh(maximum_triangle_area, 10 10 mesh_file=None, … … 16 16 # create a mesh instance of class Mesh 17 17 m = Mesh() 18 18 19 #print "test", test 19 20 # Boundary of problem 20 21 WidtH = 200 # width of boudary in metres … … 28 29 #Boundary 29 30 dict = {} 30 dict['points'] = [[0,0],[0.2*WidtH,0],[1.2*WidtH,0],[ 3.5*WidtH,0],[3.5*WidtH,WidtH] \31 dict['points'] = [[0,0],[0.2*WidtH,0],[1.2*WidtH,0],[5*WidtH,0],[5*WidtH,WidtH] \ 31 32 ,[1.2*WidtH,WidtH],[0.2*WidtH,WidtH],[0,WidtH]] 32 33 … … 37 38 'wall', 38 39 'wall', 39 ' wall',40 'back', 40 41 'wall', 41 42 'wall', … … 50 51 m.generate_mesh(maximum_triangle_area=maximum_triangle_area) 51 52 triangle_count = m.get_triangle_count() 53 54 52 55 53 56 if mesh_file is None: 54 return m, triangle_count 57 return m, triangle_count, Width 55 58 else: 56 59 if triangles_in_name is True: -
development/momentum_sink/run_buildings.py
r2379 r2395 65 65 Br = Reflective_boundary(domain) 66 66 Bt = Transmissive_boundary(domain) 67 Bd = Dirichlet_boundary([10,0,0]) 67 Bdw = Dirichlet_boundary([36,0,0]) 68 Bdb = Dirichlet_boundary([0,0,0]) 68 69 Bw = Time_boundary(domain=domain, 69 70 f=lambda t: [(60<t<660)*4, 0, 0]) 70 71 71 domain.set_boundary( {'wall': Br,'wave': Bd , 'back': Bt, 'exterior':Bd} )72 domain.set_boundary( {'wall': Br,'wave': Bdw, 'back': Bdb, 'exterior':Bdw} ) 72 73 73 74 #Evolve 74 75 t0 = time.time() 75 76 76 for t in domain.evolve(yieldstep = 1 , finaltime = 20):77 for t in domain.evolve(yieldstep = 10, finaltime = 1000): 77 78 domain.write_time() 78 79 -
development/momentum_sink/run_friction.py
r2379 r2395 26 26 t0 = time.time() 27 27 28 #meshname, triagle_count =create_mesh(100,mesh_file=meshname,triangles_in_name=True) 29 28 30 meshname, triagle_count = cache(create_mesh,(100), 29 31 {'mesh_file':meshname, … … 50 52 domain.set_datadir(project_friction.outputdir) 51 53 domain.store = True 52 domain.quantities_to_be_stored = ['stage' ]54 domain.quantities_to_be_stored = ['stage','xmomentum','ymomentum'] 53 55 54 56 print 'Number of triangles = ', len(domain) … … 58 60 domain.set_quantity('friction', 0.01) 59 61 domain.set_quantity('stage', 0) 60 domain.set_region(Set_region('mound', 'friction', 0.8)) #, location='unique vertices'))62 domain.set_region(Set_region('mound', 'friction', 3)) #, location='unique vertices')) 61 63 #Setup Boundary Conditions 62 64 print domain.get_boundary_tags() … … 66 68 Br = Reflective_boundary(domain) 67 69 Bt = Transmissive_boundary(domain) 68 Bd = Dirichlet_boundary([36,0,0]) 70 Bdw = Dirichlet_boundary([36,0,0]) 71 Bdb = Dirichlet_boundary([0,0,0]) 69 72 Bw = Time_boundary(domain=domain, 70 73 f=lambda t: [(60<t<660)*4, 0, 0]) 71 74 72 domain.set_boundary( {'wall': Br,'wave': Bd , 'back': Bt, 'exterior':Bd} )75 domain.set_boundary( {'wall': Br,'wave': Bdw, 'back': Bdb, 'exterior':Bdw} ) 73 76 74 77 #Evolve 75 78 t0 = time.time() 76 79 77 for t in domain.evolve(yieldstep = 1, finaltime = 80):80 for t in domain.evolve(yieldstep = 4, finaltime = 400): 78 81 domain.write_time() 79 82 -
development/momentum_sink/run_rotate.py
r2379 r2395 74 74 t0 = time.time() 75 75 76 for t in domain.evolve(yieldstep = 1, finaltime = 20):76 for t in domain.evolve(yieldstep = 1, finaltime = 60): 77 77 domain.write_time() 78 78
Note: See TracChangeset
for help on using the changeset viewer.