Changeset 2379
- Timestamp:
- Feb 13, 2006, 12:12:04 PM (19 years ago)
- Location:
- development/momentum_sink
- Files:
-
- 14 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
development/momentum_sink/compare_sww.py
r2369 r2379 11 11 gauge_locations = [[10,10],[20,20]] 12 12 13 quantities = ['stage' ]13 quantities = ['stage','elevation'] 14 14 gauges = file_function(swwfile, 15 15 quantities = quantities, -
development/momentum_sink/create_buildings.py
r2341 r2379 1 1 2 3 2 import Numeric 3 import math 4 4 # add inundation dir to your pythonpath 5 5 from pmesh.mesh import Mesh … … 18 18 19 19 # Boundary of problem 20 WidtH = 200 # width of boudary in metres20 WidtH = 500 # width of boudary in metres 21 21 #W = WidtH/8 22 22 #L = W 23 outer_polygon = [[0,0],[ 2*WidtH,0],[2*WidtH,WidtH],[0,WidtH]]23 outer_polygon = [[0,0],[1.5*WidtH,0],[1.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 = 1 5# depth of building side to oncoming wave28 depth = 18 # depth of building side to oncoming wave 29 29 wh = depth/2 30 breadth = 1 5# breadth of building30 breadth = 18 # breadth of building 31 31 lh = breadth/2 32 32 33 print "building footprint" 33 34 print depth * breadth , "m^2" 34 35 block = 625 35 36 BL = block**0.5 36 print BL 37 #[12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5] 38 D = WidtH/2 + BL/2 39 B = BL/2 40 for D in [112.5,137.5,162.5,187.5]: 41 for B in [12.5,37.5,62.5,87.5,112.5,137.5,162.5,187.5]: 37 ForDep = (0.2*WidtH) + (BL/2) 38 RearDep = 1.2*WidtH 39 porosity = breadth/BL 40 print porosity, " Building porosity" 41 42 Breadths = Numeric.arrayrange( (BL/2), WidtH, (BL)) 43 print Breadths, "Breadths" 44 Depths = Numeric.arrayrange( ForDep, RearDep, BL ) 45 print Depths, "Depths" 46 47 for D in Depths: 48 Breadths = Breadths + BL/2 49 for B in Breadths: 42 50 polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]] 43 51 m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries. 52 53 44 54 #print polygon 45 46 print B47 48 print D49 50 55 m.generate_mesh(maximum_triangle_area=maximum_triangle_area) 51 56 triangle_count = m.get_triangle_count() -
development/momentum_sink/friction_block.py
r2341 r2379 18 18 19 19 # Boundary of problem 20 WidtH = 20 2# width of boudary in metres20 WidtH = 200 # width of boudary in metres 21 21 #W = WidtH/8 22 22 #L = W … … 28 28 #Boundary 29 29 dict = {} 30 dict['points'] = [[0,0],[0. 5*WidtH,0],[1.5*WidtH,0],[2*WidtH,0],[2*WidtH,WidtH] \31 ,[1. 5*WidtH,WidtH],[0.5*WidtH,WidtH],[0,WidtH]]30 dict['points'] = [[0,0],[0.2*WidtH,0],[1.2*WidtH,0],[3.5*WidtH,0],[3.5*WidtH,WidtH] \ 31 ,[1.2*WidtH,WidtH],[0.2*WidtH,WidtH],[0,WidtH]] 32 32 33 33 dict['segments'] = [[0,1], [1,2], [2,3], [3,4], -
development/momentum_sink/run_buildings.py
r2341 r2379 25 25 t0 = time.time() 26 26 27 meshname, triagle_count = cache(create_mesh,(10 ),27 meshname, triagle_count = cache(create_mesh,(100), 28 28 {'mesh_file':meshname, 29 29 'triangles_in_name':True} … … 55 55 56 56 #Setup Initial Conditions 57 domain.set_quantity('friction', 0 )57 domain.set_quantity('friction', 0.01) 58 58 domain.set_quantity('stage', 0) 59 59 … … 65 65 Br = Reflective_boundary(domain) 66 66 Bt = Transmissive_boundary(domain) 67 Bd = Dirichlet_boundary([ 6,0,0])67 Bd = Dirichlet_boundary([10,0,0]) 68 68 Bw = Time_boundary(domain=domain, 69 69 f=lambda t: [(60<t<660)*4, 0, 0]) 70 70 71 71 domain.set_boundary( {'wall': Br,'wave': Bd, 'back': Bt, 'exterior':Bd} ) 72 domain.set_region(Set_region('mound', 'friction', 3, location='unique vertices')) 72 73 73 #Evolve 74 74 t0 = time.time() 75 75 76 for t in domain.evolve(yieldstep = 1, finaltime = 40):76 for t in domain.evolve(yieldstep = 1, finaltime = 20): 77 77 domain.write_time() 78 78 -
development/momentum_sink/run_friction.py
r2341 r2379 6 6 import time 7 7 8 import project 8 import project_friction 9 9 10 10 from pyvolution.pmesh2domain import pmesh_to_domain_instance … … 21 21 from pmesh.mesh import importMeshFromFile 22 22 23 meshname = project .meshname24 outputname = project .outputname23 meshname = project_friction.meshname 24 outputname = project_friction.outputname 25 25 26 26 t0 = time.time() … … 47 47 48 48 49 domain.set_name(project .basename + '_%d' %triagle_count)50 domain.set_datadir(project .outputdir)49 domain.set_name(project_friction.basename + '_%d' %triagle_count) 50 domain.set_datadir(project_friction.outputdir) 51 51 domain.store = True 52 52 domain.quantities_to_be_stored = ['stage'] … … 56 56 57 57 #Setup Initial Conditions 58 domain.set_quantity('friction', 0 )58 domain.set_quantity('friction', 0.01) 59 59 domain.set_quantity('stage', 0) 60 domain.set_region(Set_region('mound', 'friction', 700, location='unique vertices'))60 domain.set_region(Set_region('mound', 'friction', 0.8)) #, location='unique vertices')) 61 61 #Setup Boundary Conditions 62 62 print domain.get_boundary_tags() … … 66 66 Br = Reflective_boundary(domain) 67 67 Bt = Transmissive_boundary(domain) 68 Bd = Dirichlet_boundary([ 6,0,0])68 Bd = Dirichlet_boundary([36,0,0]) 69 69 Bw = Time_boundary(domain=domain, 70 70 f=lambda t: [(60<t<660)*4, 0, 0]) … … 75 75 t0 = time.time() 76 76 77 for t in domain.evolve(yieldstep = 1, finaltime = 40):77 for t in domain.evolve(yieldstep = 1, finaltime = 80): 78 78 domain.write_time() 79 79
Note: See TracChangeset
for help on using the changeset viewer.