Changeset 488 for inundation/ga/storm_surge/pyvolution/cornell_room.py
- Timestamp:
- Nov 5, 2004, 4:42:19 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/cornell_room.py
r320 r488 12 12 Transmissive_boundary, Time_boundary, Constant_height 13 13 14 from mesh_factory import from_polyfile 14 from mesh_factory import from_polyfile, rectangular 15 15 from Numeric import array 16 from math import sqrt 17 from least_squares import Interpolation 16 18 17 19 18 20 print 'Creating domain' 19 #points, triangles, values = from_polyfile('cornell_room_medres') 20 points, triangles, values = from_polyfile('hires2') 21 #data_points, _, data_values = from_polyfile('cornell_room_medres') 22 #points, triangles, values = from_polyfile('hires2') 23 data_points, _, data_values = from_polyfile('hires2') 21 24 22 25 26 #Regrid onto numerically stable mesh 27 # 28 #Compute regular mesh based on resolution and extent of data 29 data_points = array(data_points) 30 pmax = max(data_points) 31 pmin = min(data_points) 32 33 M = len(data_points) 34 35 N = int(0.8*sqrt(M)) 36 37 #print N 38 39 mesh_points, vertices, boundary = rectangular(N, N, 40 len1=pmax[0]-pmin[0], 41 len2=pmax[1]-pmin[1], 42 origin = pmin) 43 44 45 #Compute smooth surface on new mesh based on values from old (regrid) 46 print 'Interp' 47 interp = Interpolation(mesh_points, vertices, data_points, alpha=0.1) 48 mesh_values = interp.fit(data_values) 49 print 'Len mesh values', len(mesh_values) 50 print 'Len mesh points', len(mesh_points) 51 52 23 53 #Create shallow water domain 24 domain = Domain(points, triangles) 25 54 print 'Creating domain' 55 domain = Domain(mesh_points, vertices) #, boundary) 56 26 57 domain.check_integrity() 27 58 domain.default_order = 2 … … 47 78 48 79 print 'Field values' 49 domain.set_quantity('elevation', values)80 domain.set_quantity('elevation', mesh_values) 50 81 domain.set_quantity('friction', manning) 51 82
Note: See TracChangeset
for help on using the changeset viewer.