Changeset 2429
- Timestamp:
- Feb 21, 2006, 8:33:21 AM (19 years ago)
- Location:
- development/momentum_sink
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
development/momentum_sink/CCS.py
r2418 r2429 10 10 # from run_friction import fric 11 11 from pylab import * 12 12 from numerical_tools import norm, corr, err 13 13 14 swwfile_B = project.outputdir + sep + 'Buildings_3 662.sww'14 swwfile_B = project.outputdir + sep + 'Buildings_3260.sww' 15 15 16 16 17 gauge_depth = Numeric.arrayrange(0, 2.5*WidtH, 5) 17 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 20) 18 print len(gauge_depth),"gauge_depth length" 18 19 gauge_breadth = 100 19 20 gauge_locations = [] … … 27 28 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'] 28 29 29 30 31 30 f_B = file_function(swwfile_B, 32 31 quantities = quantities, … … 34 33 verbose = True, 35 34 use_cache = True) 35 36 Corr_OK=[] 36 37 fric_OK=[] 37 Friction = [1,2,3,5,7,10,20,30,50] 38 least_norm=[1] 39 norm_OK=[] 40 Friction = Numeric.arrayrange(1,51,1) 38 41 for fric in Friction: 39 42 swwfile_F = project.outputdir + sep + 'friction_n=' + repr(fric) + '_3135.sww' … … 48 51 stages_B = [] 49 52 stages_F = [] 50 elevations = []51 momenta = []52 velocity = []53 53 for i, GL in enumerate(gauge_depth): 54 54 … … 70 70 71 71 72 73 diff = abs(Numeric.array(stages_B) - Numeric.array(stages_F)) 72 Ar_B = Numeric.array(stages_B) 73 Ar_F = Numeric.array(stages_F) 74 diff = abs(Ar_B - Ar_F) 75 norm_F = err(Ar_B, Ar_F, 2, relative = True) 76 77 print " " 78 print norm_F, "norm N_F" 79 print " " 80 G = corr(Ar_F, Ar_B) 81 norm_OK.append(norm_F) 74 82 75 if max(diff) < 1.2: 76 print "_-_-_-_-_-_-_-_-_-_-_-_" 77 print fric, " this file is OK" 78 print "-_-_-_-_-_-_-_-_-_-_-_-" 79 fric_OK.append(fric) 80 #print swwfile_F, "this file OK" 83 if norm_F < least_norm: 84 least_norm = norm_F 85 fric_OK = fric 81 86 else: 82 print fric, " this file is definelty NOT OK" 83 print fric_OK, "THESE FRICTION VALUES ARE OK" 87 print fric, " NOT OK" 84 88 85 89 90 91 print " " 92 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 93 print fric_OK, " <- This Manning's n is OK" 94 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 95 print least_norm, "2nd normal of Friction vs Buildings " 96 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 86 97 87 -
development/momentum_sink/PCS.py
r2417 r2429 11 11 from pylab import * 12 12 13 fric = 113 fric = 40 14 14 #swwfile = project.newoutputname + '.sww' 15 15 #swwfile = project.outputname 16 16 17 17 #swwfile_B = project.outputdir + sep + 'Buildings_3790.sww' 18 #swwfile_B = project.outputdir + sep + 'Buildings_3662.sww'19 swwfile_B = project.outputdir + sep + 'friction_n=10_3135.sww'20 swwfile_F = project.outputdir + sep + 'friction_n= 20_3135.sww'18 swwfile_B = project.outputdir + sep + 'Buildings_3662.sww' 19 #swwfile_B = project.outputdir + sep + 'friction_n=10_3135.sww' 20 swwfile_F = project.outputdir + sep + 'friction_n=40_3135.sww' 21 21 22 gauge_depth = Numeric.arrayrange(0, 2.5*WidtH, 5)22 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 5) 23 23 gauge_breadth = 100 24 24 gauge_locations = [] … … 45 45 46 46 47 T = Numeric.arrayrange(0, 500,20)47 T = Numeric.arrayrange(0,1000,20) 48 48 #T = [ 20, 50, 100, 150, 200 ] 49 49 -
development/momentum_sink/create_buildings.py
r2417 r2429 8 8 9 9 WidtH = 200 # width of boudary in metres 10 depth = 20# depth of building side to oncoming wave11 breadth = 20# breadth of building10 depth = 15 # depth of building side to oncoming wave 11 breadth = 15 # breadth of building 12 12 print "building footprint" 13 13 print depth * breadth , "m^2" … … 37 37 # inner polygons => building boundaries 38 38 39 wh = depth/240 41 lh = breadth/242 39 whs = depth/2 40 lhs = breadth/2 41 #Th = (45 *(3.142/180)) # sets an initial rotation 42 Th = 0 43 43 ForDep = (0.2*WidtH) + (BL/2) 44 44 RearDep = 1.2*WidtH 45 45 46 Breadths = Numeric.arrayrange( (BL/2), WidtH, (BL))46 Breadths = Numeric.arrayrange( -(BL/2), WidtH+(BL/2), (BL)) 47 47 print Breadths, "Breadths" 48 48 Depths = Numeric.arrayrange( ForDep, RearDep, BL ) 49 49 print Depths, "Depths" 50 50 51 for D in Depths:52 #Breadths = Breadths + BL/2#Used to offset buildings51 for i,D in enumerate(Depths): 52 Breadths = Breadths + ((-1)**i)*(BL/2) #Used to offset buildings 53 53 for B in Breadths: 54 polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]] 54 wh1 = (-whs) * math.cos(Th) + (-lhs) * math.sin(Th) 55 lh1 = (-lhs) * math.cos(Th) - (-whs) * math.sin(Th) 56 wh2 = (+whs) * math.cos(Th) + (-lhs) * math.sin(Th) 57 lh2 = (-lhs) * math.cos(Th) - (+whs) * math.sin(Th) 58 wh3 = (+whs) * math.cos(Th) + (+lhs) * math.sin(Th) 59 lh3 = (+lhs) * math.cos(Th) - (+whs) * math.sin(Th) 60 wh4 = (-whs) * math.cos(Th) + (+lhs) * math.sin(Th) 61 lh4 = (+lhs) * math.cos(Th) - (-whs) * math.sin(Th) 62 polygon = [[D+wh1,B+lh1],[D+wh2,B+lh2],[D+wh3,B+lh3],[D+wh4,B+lh4]] 63 #polygon = [[D-wh,B-lh],[D+wh,B-lh],[D+wh,B+lh],[D-wh,B+lh]] 55 64 m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries. 56 65 Th = Th + (37.3 *(3.142/180)) # keeps rotating individual buildings. 57 66 58 67 #print polygon -
development/momentum_sink/loop_friction.py
r2417 r2429 7 7 # set friction value for zone 8 8 9 # fwojhrt10 9 import time 11 10 12 11 import project_friction 13 12 import Numeric 14 13 from pyvolution.pmesh2domain import pmesh_to_domain_instance 15 14 from caching import cache … … 25 24 from pmesh.mesh import importMeshFromFile 26 25 27 Friction = [1,2,3,5,7,10,20,30,50]26 Friction = Numeric.arrayrange(1,50,1) 28 27 for fric in Friction: 29 28 meshname = project_friction.meshname 30 29 outputname = project_friction.outputname 31 30 print " " 31 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 32 print fric, "Manning friction value" 33 print "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-" 32 34 t0 = time.time() 33 35 … … 84 86 t0 = time.time() 85 87 86 for t in domain.evolve(yieldstep = 10, finaltime = 500):88 for t in domain.evolve(yieldstep = 10, finaltime = 1000): 87 89 domain.write_time() 88 90
Note: See TracChangeset
for help on using the changeset viewer.