Changeset 7976
 Timestamp:
 Aug 26, 2010, 10:50:36 AM (8 years ago)
 Location:
 trunk/anuga_core/source/anuga/structures
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/anuga_core/source/anuga/structures/culvert_operator.py
r7975 r7976 1 import sys 2 3 from anuga.shallow_water.forcing import Inflow, General_forcing 4 from anuga.utilities.system_tools import log_to_file 5 from anuga.geometry.polygon import inside_polygon, is_inside_polygon 6 from anuga.geometry.polygon import plot_polygons, polygon_area 7 8 from anuga.utilities.numerical_tools import mean 9 from anuga.utilities.numerical_tools import ensure_numeric, sign 10 11 from anuga.config import g, epsilon 12 from anuga.config import minimum_allowed_height, velocity_protection 1 from anuga.geometry.polygon import inside_polygon, polygon_area 2 from anuga.config import g 13 3 import anuga.utilities.log as log 14 15 4 import inlet 16 17 5 import numpy as num 18 6 import math … … 37 25 end_point0=None, 38 26 end_point1=None, 39 enquiry_gap_factor=0.2,40 27 width=None, 41 28 height=None, … … 49 36 50 37 self.end_points = [end_point0, end_point1] 51 self.enquiry_gap_factor = enquiry_gap_factor52 38 53 39 if height is None: … … 58 44 59 45 self.verbose=verbose 60 self.filename = None61 46 62 47 # Create the fundamental culvert polygons and create inlet objects … … 66 51 self.inlets = [] 67 52 polygon0 = self.inlet_polygons[0] 68 enquiry_pt0 = self.enquiry_points[0]69 53 inlet0_vector = self.culvert_vector 70 self.inlets.append(inlet.Inlet(self.domain, polygon0 , enquiry_pt0, inlet0_vector))54 self.inlets.append(inlet.Inlet(self.domain, polygon0)) 71 55 72 56 polygon1 = self.inlet_polygons[1] 73 enquiry_pt1 = self.enquiry_points[1]74 57 inlet1_vector =  self.culvert_vector 75 self.inlets.append(inlet.Inlet(self.domain, polygon1, enquiry_pt1, inlet1_vector)) 76 77 58 self.inlets.append(inlet.Inlet(self.domain, polygon1)) 78 59 79 60 self.print_stats() … … 146 127 print 'Generic Culvert Operator' 147 128 print '=====================================' 148 print "enquiry_gap_factor"149 print self.enquiry_gap_factor150 129 151 130 for i, inlet in enumerate(self.inlets): … … 161 140 print inlet.polygon 162 141 163 print 'enquiry_point'164 print inlet.enquiry_point165 166 142 print '=====================================' 167 143 … … 196 172 h = self.height*self.culvert_vector # Vector of length=height in the 197 173 # direction of the culvert 198 gap = (1 + self.enquiry_gap_factor)*h199 174 200 175 self.inlet_polygons = [] 201 self.enquiry_points = []202 176 203 177 # Build exchange polygon and enquiry points 0 and 1 … … 209 183 p3 = p0 + i0*h 210 184 self.inlet_polygons.append(num.array([p0, p1, p2, p3])) 211 self.enquiry_points.append(self.end_points[i] + i0*gap)212 185 213 186 # Check that enquiry points are outside inlet polygons … … 219 192 area = polygon_area(polygon) 220 193 221 222 194 msg = 'Polygon %s ' %(polygon) 223 195 msg += ' has area = %f' % area 224 196 assert area > 0.0, msg 225 226 for j in [0,1]:227 point = self.enquiry_points[j]228 msg = 'Enquiry point falls inside a culvert polygon.'229 230 assert not inside_polygon(point, polygon), msg231 232 197 233 198 
trunk/anuga_core/source/anuga/structures/inlet.py
r7975 r7976 10 10 """ 11 11 12 def __init__(self, domain, polygon , enquiry_point, inlet_vector):12 def __init__(self, domain, polygon): 13 13 14 14 self.domain = domain 15 15 self.domain_bounding_polygon = self.domain.get_boundary_polygon() 16 16 self.polygon = polygon 17 self.enquiry_point = enquiry_point18 self.inlet_vector = inlet_vector19 17 20 18 # FIXME (SR) Using get_triangle_containing_point which needs to be sped up 21 self.enquiry_index = self.domain.get_triangle_containing_point(self.enquiry_point)22 19 23 20 self.compute_triangle_indices()
Note: See TracChangeset
for help on using the changeset viewer.