Changeset 1691
- Timestamp:
- Aug 8, 2005, 2:37:37 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/validation/LWRU2/lwru2.py
r1688 r1691 7 7 http://www.cee.cornell.edu/longwave/index.cfm?page=benchmark&problem=2 8 8 9 Depth at western boundary is d = 13.5 cm 9 10 """ 10 11 … … 43 44 from Scientific.IO.NetCDF import NetCDFFile 44 45 45 printfilename[:-4] + '.sww'46 47 fid = NetCDFFile( filename[:-4] + '.sww', 'w')46 outfile = filename[:-4] + '.sww' 47 print 'Writing to', outfile 48 fid = NetCDFFile(outfile, 'w') 48 49 49 50 fid.institution = 'Geoscience Australia' … … 58 59 59 60 fid.createVariable('xmomentum', Float, ('number_of_timesteps',)) 60 fid.variables['xmomentum'][:] = 0.0 61 61 fid.variables['xmomentum'][:] = 0.0 #0.04 62 62 fid.createVariable('ymomentum', Float, ('number_of_timesteps',)) 63 63 fid.variables['ymomentum'][:] = 0.0 64 64 65 fid.close() 65 66 66 67 67 fid.close()68 68 69 69 … … 77 77 from cPickle import dump, load 78 78 79 80 boundary_file_name = 'Benchmark_2_input.txt' 81 bathymetry_file_name = 'Benchmark_2_Bathymetry.txt' 82 83 79 84 try: 85 raise Exception 80 86 print 'Read pickled domain' 81 87 fid = open(picklefile) … … 85 91 86 92 #Preparing time boundary 87 prepare_timeboundary( 'Benchmark_2_input.txt')93 prepare_timeboundary(boundary_file_name) 88 94 89 95 #Preparing points 90 96 from pyvolution.data_manager import xya2pts 91 xya2pts('Benchmark_2_Bathymetry.txt', verbose = True) 97 xya2pts(bathymetry_file_name, verbose = True, 98 z_func = lambda z: -z) 92 99 93 100 … … 95 102 # Domain 96 103 print 'Creating domain' 97 points, vertices, boundary = rectangular( 200, 200/5*3,104 points, vertices, boundary = rectangular(100, 100/5*3, 98 105 len1=5.448, len2=3.402) 99 106 domain = Domain(points, vertices, boundary) … … 111 118 #LS code to be included in set_quantity 112 119 from pyvolution import util, least_squares 113 points, attributes = util.read_xya( 'Benchmark_2_Bathymetry.pts')114 120 points, attributes = util.read_xya(bathymetry_file_name[:-4] + '.pts') 121 115 122 #Fit attributes to mesh 116 123 vertex_attributes = least_squares.fit_to_mesh(domain.coordinates, … … 118 125 points, 119 126 attributes['elevation'], 127 alpha = 0, 120 128 verbose=True) 121 129 122 130 print 'Initial values' 123 131 domain.set_quantity('elevation', vertex_attributes) 132 #domain.set_quantity('elevation', bathymetry_file_name[:-4] + '.pts') 124 133 domain.set_quantity('friction', 0.0) 125 134 domain.set_quantity('stage', 0.0) … … 137 146 print 'Boundaries' 138 147 Br = Reflective_boundary(domain) 139 Bf = File_boundary( 'Benchmark_2_input.sww', domain, verbose=True)148 Bf = File_boundary(boundary_file_name[:-4] + '.sww', domain, verbose=True) 140 149 141 150 #Set boundary conditions 142 151 domain.set_boundary({'left': Bf, 'right': Br, 'bottom': Br, 'top': Br}) 152 153 143 154 144 155 … … 148 159 domain.visualise = True 149 160 150 for t in domain.evolve(yieldstep = 1.0, finaltime = 22.5):161 for t in domain.evolve(yieldstep = 0.05, finaltime = 22.5): 151 162 domain.write_time() 152 163
Note: See TracChangeset
for help on using the changeset viewer.