Changeset 8050 for trunk/anuga_core/source/anuga/structures/inlet.py
- Timestamp:
- Oct 22, 2010, 5:10:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/inlet.py
r8049 r8050 9 9 """ 10 10 11 def __init__(self, domain, polyline, enquiry_pt, outward_culvert_vector=None,verbose=False):11 def __init__(self, domain, polyline, verbose=False): 12 12 13 13 self.domain = domain 14 14 self.domain_bounding_polygon = self.domain.get_boundary_polygon() 15 15 self.polyline = polyline 16 self.enquiry_pt = enquiry_pt17 self.outward_culvert_vector = outward_culvert_vector18 16 self.verbose = verbose 19 17 20 self.compute_ indices()18 self.compute_triangle_indices() 21 19 self.compute_area() 22 20 23 21 24 def compute_ indices(self):22 def compute_triangle_indices(self): 25 23 26 24 # Get boundary (in absolute coordinates) … … 35 33 assert is_inside_polygon(point, bounding_polygon), msg 36 34 37 point = self.enquiry_pt 38 msg = 'Enquiry Point %s ' % str(point) 39 msg += ' did not fall within the domain boundary.' 40 assert is_inside_polygon(point, bounding_polygon), msg 35 41 36 42 37 self.triangle_indices = polyline_overlap(vertex_coordinates, self.polyline) … … 46 41 msg += 'No triangles intersecting polyline ' 47 42 raise Exception, msg 48 49 self.enquiry_index = self.domain.get_triangle_containing_point(self.enquiry_pt)50 43 51 if self.enquiry_index in self.triangle_indices: 52 msg = 'Enquiry point %s' % (self.enquiry_pt) 53 msg += 'is in an inlet triangle' 54 raise Exception, msg 44 55 45 56 46 def compute_area(self): … … 180 170 181 171 182 def get_enquiry_stage(self):183 184 return self.domain.quantities['stage'].centroid_values[self.enquiry_index]185 186 187 def get_enquiry_xmom(self):188 189 return self.domain.quantities['xmomentum'].centroid_values[self.enquiry_index]190 191 def get_enquiry_ymom(self):192 193 return self.domain.quantities['ymomentum'].centroid_values[self.enquiry_index]194 195 196 def get_enquiry_elevation(self):197 198 return self.domain.quantities['elevation'].centroid_values[self.enquiry_index]199 200 def get_enquiry_height(self):201 202 return self.get_enquiry_stage() - self.get_enquiry_elevation()203 204 205 def get_enquiry_velocity(self):206 207 height = self.get_enquiry_height()208 u = self.get_enquiry_xmom()/(height + velocity_protection/height)209 v = self.get_enquiry_ymom()/(height + velocity_protection/height)210 211 return u, v212 213 214 def get_enquiry_xvelocity(self):215 216 height = self.get_enquiry_height()217 return self.get_enquiry_xmom()/(height + velocity_protection/height)218 219 def get_enquiry_yvelocity(self):220 221 height = self.get_enquiry_height()222 return self.get_enquiry_ymom()/(height + velocity_protection/height)223 224 225 def get_enquiry_speed(self):226 227 u, v = self.get_enquiry_velocity()228 229 return math.sqrt(u**2 + v**2)230 231 232 def get_enquiry_velocity_head(self):233 234 return 0.5*self.get_enquiry_speed()**2/g235 236 237 def get_enquiry_total_energy(self):238 239 return self.get_enquiry_velocity_head() + self.get_enquiry_stage()240 241 242 def get_enquiry_specific_energy(self):243 244 return self.get_enquiry_velocity_head() + self.get_enquiry_height()245 246 172 247 173 def set_heights(self,height):
Note: See TracChangeset
for help on using the changeset viewer.