Changeset 5586 for anuga_core/source/anuga/culvert_flows
- Timestamp:
- Jul 30, 2008, 4:59:59 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/culvert_flows/culvert_class.py
r5585 r5586 107 107 label += '_' + str(id(self)) 108 108 109 # Open log file for storing some specific results...110 self.log_filename = label + '.log'111 109 self.label = label 112 113 # Print something 110 111 # File for storing culvert quantities 112 self.timeseries_filename = label + '_timeseries.csv' 113 fid = open(self.timeseries_filename, 'w') 114 fid.write('time, E0, E1, Velocity, Discharge\n') 115 fid.close() 116 117 # Log file for storing general textual output 118 self.log_filename = label + '.log' 114 119 log_to_file(self.log_filename, self.label) 115 120 log_to_file(self.log_filename, description) … … 142 147 bounding_polygon = domain.get_boundary_polygon() 143 148 for key in P.keys(): 144 print 'Key', key145 149 if key in ['exchange_polygon0', 146 150 'exchange_polygon1', … … 149 153 for point in P[key]: 150 154 151 print 'Passing in:', point152 155 msg = 'Point %s in polygon %s for culvert %s did not'\ 153 156 %(str(point), key, self.label) … … 271 274 ux = xmomentum/(depth+velocity_protection/depth) # Velocity (x-direction) 272 275 uy = ymomentum/(depth+velocity_protection/depth) # Velocity (y-direction) 273 print 'Velocity in culvert:', ux, uy, depth, xmomentum, ymomentum276 #print 'Velocity in culvert:', ux, uy, depth, xmomentum, ymomentum 274 277 v = mean(sqrt(ux**2+uy**2)) # Average velocity 275 278 w = mean(stage) # Average stage … … 390 393 log_to_file(log_filename, s) 391 394 395 # Log timeseries to file 396 fid = open(self.timeseries_filename, 'a') 397 fid.write('%f, %f, %f, %f, %f\n'\ 398 %(time, 399 openings[0].total_energy, 400 openings[1].total_energy, 401 barrel_velocity, 402 Q)) 403 fid.close() 404 405 # Update momentum 392 406 delta_t = time - self.last_time 393 407 if delta_t > 0.0:
Note: See TracChangeset
for help on using the changeset viewer.