Ignore:
Timestamp:
Sep 1, 2010, 6:11:25 PM (13 years ago)
Author:
steve
Message:

Added enquiry points to culverts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/structures/culvert.py

    r7980 r7984  
    2020                 domain,
    2121                 end_points,
    22                  width=None,
    23                  height=None,
    24                  verbose=False):
     22                 width,
     23                 height,
     24                 apron,
     25                 enquiry_gap,
     26                 verbose):
    2527       
    2628        # Input check
    2729       
    2830        self.domain = domain
    29 
    3031        self.end_points = end_points
    31  
    32         self.width = width
     32        self.width  = width
    3333        self.height = height
    34        
     34        self.apron  = apron
     35        self.enquiry_gap = enquiry_gap
    3536        self.verbose=verbose
    3637       
     
    4243        self.inlets = []
    4344        polygon0 = self.inlet_polygons[0]
     45        ep0 = self.inlet_equiry_pts[0]
    4446        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))
    4648
    4749        polygon1 = self.inlet_polygons[1]
     50        ep1 = self.inlet_equiry_pts[1]
    4851        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))
    5053
    5154
     
    7881        # Short hands
    7982        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 the
     83        h = self.apron*self.culvert_vector    # Vector of length=height in the
    8184                             # direction of the culvert
    8285
     86        gap = (1 + self.enquiry_gap)*h
     87
    8388        self.inlet_polygons = []
     89        self.inlet_equiry_pts = []
    8490
    85         # Build exchange polygon and enquiry points 0 and 1
     91        # Build exchange polygon and enquiry point
    8692        for i in [0, 1]:
    8793            i0 = (2*i-1)
     
    9096            p2 = p1 + i0*h
    9197            p3 = p0 + i0*h
     98            ep = self.end_points[i] + i0*gap
     99
    92100            self.inlet_polygons.append(num.array([p0, p1, p2, p3]))
     101            self.inlet_equiry_pts.append(ep)
    93102
    94103        # Check that enquiry points are outside inlet polygons
    95104        for i in [0,1]:
    96105            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           
    100108            area = polygon_area(polygon)
    101109           
     
    103111            msg += ' has area = %f' % area
    104112            assert area > 0.0, msg
    105            
     113
     114            msg = 'Enquiry point falls inside an exchange polygon.'
     115            assert not inside_polygon(ep, polygon), msg
    106116   
    107117    def get_inlets(self):
     
    123133   
    124134        return self.height
     135
     136
     137    def get_culvert_apron(self):
     138
     139        return self.apron
    125140       
Note: See TracChangeset for help on using the changeset viewer.