Changeset 2446
- Timestamp:
- Feb 24, 2006, 4:09:02 PM (19 years ago)
- Location:
- development/momentum_sink
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
development/momentum_sink/CCS.py
r2429 r2446 12 12 from numerical_tools import norm, corr, err 13 13 14 swwfile_B = project.outputdir + sep + 'Buildings_3260.sww'15 14 16 15 17 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 20) 16 17 gauge_depth = Numeric.arrayrange(46, 1.5*WidtH, 25) 18 18 print len(gauge_depth),"gauge_depth length" 19 19 gauge_breadth = 100 … … 24 24 gauge_locations.append(gauge_location) 25 25 26 27 swwfile_B = project.outputdir + sep + 'Straight_offset_11.sww' 26 28 27 29 #Read model output … … 38 40 least_norm=[1] 39 41 norm_OK=[] 40 Friction = Numeric.arrayrange(1, 51,1)42 Friction = Numeric.arrayrange(1,80,1) 41 43 for fric in Friction: 42 44 swwfile_F = project.outputdir + sep + 'friction_n=' + repr(fric) + '_3135.sww' … … 47 49 use_cache = True) 48 50 49 t= 50051 t=1000 # specifies times to look at cross sections 50 52 51 53 stages_B = [] … … 54 56 55 57 # mines data from specified time values in sww file 58 # Building file 56 59 wB = f_B(t, point_id = i)[0] 57 60 zB = f_B(t, point_id = i)[1] 58 61 uhB = f_B(t, point_id = i)[2] 59 62 vhB = f_B(t, point_id = i)[3] 60 63 # Friction file 61 64 wF = f_F(t, point_id = i)[0] 62 65 uhF = f_B(t, point_id = i)[2] 63 66 vhF = f_B(t, point_id = i)[3] 67 64 68 #m = sqrt(uh*uh + vh*vh) #Absolute momentum 65 69 velB = sqrt(uhB*uhB + vhB*vhB) / (wB + 1.e-30) #Absolute velocity 66 70 velF = sqrt(uhF*uhF + vhF*vhF) / (wF + 1.e-30) #Absolute velocity 67 68 71 stages_B.append(wB) 69 72 stages_F.append(wF) … … 73 76 Ar_F = Numeric.array(stages_F) 74 77 diff = abs(Ar_B - Ar_F) 75 norm_F = err(Ar_B, Ar_F, 2, relative = True) 78 norm_F = err(Ar_B, Ar_F, 2, relative = True)# 2nd norm (RMS) test 76 79 77 80 print " " 78 81 print norm_F, "norm N_F" 79 82 print " " 80 G = corr(Ar_F, Ar_B)81 83 norm_OK.append(norm_F) 82 84 … … 91 93 print " " 92 94 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 93 print fric_OK, " <- This Manning's n is OK"95 print fric_OK, " <- This Manning's n is best fit from 2nd norm test" 94 96 print "_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_" 95 97 print least_norm, "2nd normal of Friction vs Buildings " -
development/momentum_sink/PCS.py
r2429 r2446 11 11 from pylab import * 12 12 13 fric = 4013 fric = 25 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'18 swwfile_B = project.outputdir + sep + 'Straight_offset.sww' 19 19 #swwfile_B = project.outputdir + sep + 'friction_n=10_3135.sww' 20 swwfile_F = project.outputdir + sep + 'friction_n= 40_3135.sww'20 swwfile_F = project.outputdir + sep + 'friction_n=51_3135.sww' 21 21 22 gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 5) 22 gauge_depth = Numeric.arrayrange(46, 1.5*WidtH, 25) # Random special 23 #gauge_depth = Numeric.arrayrange(0, 1.5*WidtH, 25) 23 24 gauge_breadth = 100 24 25 gauge_locations = [] … … 45 46 46 47 47 T = Numeric.arrayrange(0,1000, 20)48 T = Numeric.arrayrange(0,1000,10) 48 49 #T = [ 20, 50, 100, 150, 200 ] 49 50 -
development/momentum_sink/create_buildings.py
r2429 r2446 2 2 import Numeric 3 3 import math 4 import random 4 5 # add inundation dir to your pythonpath 5 6 from pmesh.mesh import Mesh 6 7 from coordinate_transforms.geo_reference import Geo_reference 7 8 9 depth = 11 # depth of building side to oncoming wave 10 breadth = 11 # breadth of building, width of building to oncoming wave 11 #from loop_buildings import depth 8 12 9 13 WidtH = 200 # width of boudary in metres 10 depth = 15 # depth of building side to oncoming wave 11 breadth = 15 # breadth of building 14 #breadth = depth 15 12 16 print "building footprint" 13 17 print depth * breadth , "m^2" … … 15 19 BL = block**0.5 16 20 17 porosity = breadth/BL 21 porosity = breadth/BL 18 22 print porosity, " Building porosity" 23 24 #random.uniform(0,1) #proper implemantation of random generator 19 25 20 26 def create_mesh(maximum_triangle_area, … … 25 31 triangles in the mesh to the mesh file name. 26 32 """ 33 34 27 35 # create a mesh instance of class Mesh 28 36 m = Mesh() 37 29 38 # Boundary of problem 30 31 #W = WidtH/832 #L = W33 39 outer_polygon = [[0,0],[5*WidtH,0],[5*WidtH,WidtH],[0,WidtH]] 34 print outer_polygon35 40 m.add_region_from_polygon(outer_polygon, tags={'wall':[0,2], 'wave':[3], 'back':[1]}) 36 41 … … 41 46 #Th = (45 *(3.142/180)) # sets an initial rotation 42 47 Th = 0 43 ForDep = (0.2*WidtH) + (BL /2)48 ForDep = (0.2*WidtH) + (BL-whs) 44 49 RearDep = 1.2*WidtH 45 50 … … 61 66 lh4 = (+lhs) * math.cos(Th) - (-whs) * math.sin(Th) 62 67 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]] 64 m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]})# Adds holes with reflective boundaries. 65 Th = Th + (37.3 *(3.142/180)) # keeps rotating individual buildings. 68 m.add_hole_from_polygon(polygon, tags={'wall':[0,1,2,3]}) 69 #Th = Th + (90 *(3.14159/180)) # keeps rotating individual buildings. 66 70 67 #print polygon68 71 m.generate_mesh(maximum_triangle_area=maximum_triangle_area) 69 72 triangle_count = m.get_triangle_count() … … 73 76 else: 74 77 if triangles_in_name is True: 75 mesh_file = mesh_file[:-4] + '_ ' + str(triangle_count) \78 mesh_file = mesh_file[:-4] + '_Ran_' + str(depth) + '_' + str(triangle_count) \ 76 79 + mesh_file[-4:] 77 80 m.export_mesh_file(mesh_file) -
development/momentum_sink/loop_friction.py
r2429 r2446 24 24 from pmesh.mesh import importMeshFromFile 25 25 26 Friction = Numeric.arrayrange( 1,50,1)26 Friction = Numeric.arrayrange(50,80,1) 27 27 for fric in Friction: 28 28 meshname = project_friction.meshname -
development/momentum_sink/run_buildings.py
r2415 r2446 15 15 16 16 17 from create_buildings import create_mesh 17 from create_buildings import create_mesh, depth 18 18 #from building_generator import create_mesh 19 19 … … 46 46 47 47 48 domain.set_name(project.basename + '_ %d' %triagle_count)48 domain.set_name(project.basename + '_Br=%d_%d' %(depth, triagle_count)) 49 49 domain.set_datadir(project.outputdir) 50 50 domain.store = True … … 75 75 t0 = time.time() 76 76 77 for t in domain.evolve(yieldstep = 10, finaltime = 500):77 for t in domain.evolve(yieldstep = 10, finaltime = 1000): 78 78 domain.write_time() 79 79
Note: See TracChangeset
for help on using the changeset viewer.