Changeset 7589
 Timestamp:
 Dec 10, 2009, 12:29:22 PM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_work/development/classroom/ripcurrent.py
r7588 r7589 175 175 # 176 176 177 # Read in gauge locations for interpolation and convert them to floats178 gauge_file = open('New_gauges.csv', 'r')179 G = [(float(x[0]), float(x[1])) for x in csv.reader(gauge_file,180 dialect='excel',181 delimiter=',')]182 gauges = numpy.array(G)183 number_of_gauges = len(gauges)184 185 177 # Allocate space for velocity values 186 u = numpy.zeros( number_of_gauges)187 v = numpy.zeros( number_of_gauges)178 u = numpy.zeros(len(domain)) 179 v = numpy.zeros(len(domain)) 188 180 189 181 t0 = time.time() 190 182 for t in domain.evolve(yieldstep = timestep, finaltime = simulation_length): 191 183 print domain.timestepping_statistics() 192 S = domain.get_quantity('stage').get_values(interpolation_points=gauges) 193 E = domain.get_quantity('elevation').get_values(interpolation_points=gauges) 184 185 S = domain.get_quantity('stage').get_values(location='centroids') 186 E = domain.get_quantity('elevation').get_values(location='centroids') 194 187 depth = SE 195 188 196 uh = domain.get_quantity('xmomentum').get_values( interpolation_points=gauges)197 vh = domain.get_quantity('ymomentum').get_values( interpolation_points=gauges)189 uh = domain.get_quantity('xmomentum').get_values(location='centroids') 190 vh = domain.get_quantity('ymomentum').get_values(location='centroids') 198 191 u += uh/depth 199 192 v += vh/depth … … 207 200 print 'There were %i time steps' % n_time_intervals 208 201 202 nodes = domain.get_nodes() 203 204 X = nodes[:,0] 205 Y = nodes[:,1] 209 206 U = u/n_time_intervals 210 207 V = v/n_time_intervals 211 X = gauges[:,0]212 Y = gauges[:,1]213 214 208 215 209 print 'Computation took %.2f seconds' % (time.time()t0)
Note: See TracChangeset
for help on using the changeset viewer.