Changeset 7984 for trunk/anuga_core/source/anuga/structures/culvert.py
- Timestamp:
- Sep 1, 2010, 6:11:25 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/culvert.py
r7980 r7984 20 20 domain, 21 21 end_points, 22 width=None, 23 height=None, 24 verbose=False): 22 width, 23 height, 24 apron, 25 enquiry_gap, 26 verbose): 25 27 26 28 # Input check 27 29 28 30 self.domain = domain 29 30 31 self.end_points = end_points 31 32 self.width = width 32 self.width = width 33 33 self.height = height 34 34 self.apron = apron 35 self.enquiry_gap = enquiry_gap 35 36 self.verbose=verbose 36 37 … … 42 43 self.inlets = [] 43 44 polygon0 = self.inlet_polygons[0] 45 ep0 = self.inlet_equiry_pts[0] 44 46 outward_vector0 = self.culvert_vector 45 self.inlets.append(inlet.Inlet(self.domain, polygon0, outward_vector0))47 self.inlets.append(inlet.Inlet(self.domain, polygon0, ep0, outward_vector0)) 46 48 47 49 polygon1 = self.inlet_polygons[1] 50 ep1 = self.inlet_equiry_pts[1] 48 51 outward_vector1 = - self.culvert_vector 49 self.inlets.append(inlet.Inlet(self.domain, polygon1, outward_vector1))52 self.inlets.append(inlet.Inlet(self.domain, polygon1, ep1, outward_vector1)) 50 53 51 54 … … 78 81 # Short hands 79 82 w = 0.5*self.width*self.culvert_normal # Perpendicular vector of 1/2 width 80 h = 0.5*self.height*self.culvert_vector # Vector of length=height in the83 h = self.apron*self.culvert_vector # Vector of length=height in the 81 84 # direction of the culvert 82 85 86 gap = (1 + self.enquiry_gap)*h 87 83 88 self.inlet_polygons = [] 89 self.inlet_equiry_pts = [] 84 90 85 # Build exchange polygon and enquiry point s 0 and 191 # Build exchange polygon and enquiry point 86 92 for i in [0, 1]: 87 93 i0 = (2*i-1) … … 90 96 p2 = p1 + i0*h 91 97 p3 = p0 + i0*h 98 ep = self.end_points[i] + i0*gap 99 92 100 self.inlet_polygons.append(num.array([p0, p1, p2, p3])) 101 self.inlet_equiry_pts.append(ep) 93 102 94 103 # Check that enquiry points are outside inlet polygons 95 104 for i in [0,1]: 96 105 polygon = self.inlet_polygons[i] 97 # FIXME (SR) Probably should calculate the area of all the triangles 98 # associated with this polygon, as there is likely to be some 99 # inconsistency between triangles and ploygon 106 ep = self.inlet_equiry_pts[i] 107 100 108 area = polygon_area(polygon) 101 109 … … 103 111 msg += ' has area = %f' % area 104 112 assert area > 0.0, msg 105 113 114 msg = 'Enquiry point falls inside an exchange polygon.' 115 assert not inside_polygon(ep, polygon), msg 106 116 107 117 def get_inlets(self): … … 123 133 124 134 return self.height 135 136 137 def get_culvert_apron(self): 138 139 return self.apron 125 140
Note: See TracChangeset
for help on using the changeset viewer.