Changeset 8873


Ignore:
Timestamp:
May 22, 2013, 5:16:27 PM (11 years ago)
Author:
steve
Message:

Added in invert_elevation to inlet_enquiry

Location:
trunk/anuga_core/source/anuga
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/operators/run_set_elevation.py

    r8872 r8873  
    104104#------------------------------------------------------------------------------
    105105
    106 from anuga.operators.set_elevation_operators import Circular_set_elevation_operator
     106from anuga.operators.set_elevation_operators import Set_elevation_operator
    107107
    108 op1 = Circular_set_elevation_operator(domain, elevation=pole, radius=0.5, center = (12.0,3.0))
     108op1 = Set_elevation_operator(domain, elevation=pole, radius=0.5, center = (12.0,3.0))
    109109
    110110from anuga.operators.set_elevation_operators import Set_elevation
  • trunk/anuga_core/source/anuga/structures/inlet.py

    r8623 r8873  
    1010    """
    1111
    12     def __init__(self, domain, line, verbose=False):
     12    def __init__(self, domain, poly, verbose=False):
    1313
    1414        self.domain = domain
    1515        self.domain_bounding_polygon = self.domain.get_boundary_polygon()
    16         self.line = num.asarray(line, dtype=num.float64)
     16        self.poly = num.asarray(poly, dtype=num.float64)
    1717        self.verbose = verbose
     18
     19        self.line = True
     20        if len(self.poly) > 2:
     21            self.line = False
    1822
    1923        self.compute_triangle_indices()
    2024        self.compute_area()
    21         self.compute_inlet_length()
     25        #self.compute_inlet_length()
    2226
    2327
     
    3034        vertex_coordinates = self.domain.get_vertex_coordinates(absolute=True)
    3135
    32         # Check that line lies within the mesh.
    33         for point in self.line: 
     36        if self.line: # poly is a line
     37            # Check that line lies within the mesh.
     38            for point in self.poly:
    3439                msg = 'Point %s ' %  str(point)
    3540                msg += ' did not fall within the domain boundary.'
    3641                assert is_inside_polygon(point, bounding_polygon), msg
    3742               
    38 
    39 
    40         self.triangle_indices = line_intersect(vertex_coordinates, self.line)
     43            self.triangle_indices = line_intersect(vertex_coordinates, self.poly)
     44
     45        else: # poly is a polygon
     46
     47            self.triangle_indices = inside_polygon(domain_centroids, self.poly)
    4148
    4249        if len(self.triangle_indices) == 0:
    43             msg = 'Inlet line=%s ' % (self.line)
     50            msg = 'Inlet poly=%s ' % (self.poly)
    4451            msg += 'No triangles intersecting line '
    4552            raise Exception, msg
     53
    4654
    4755
     
    6674
    6775
    68     def compute_inlet_length(self):
    69         """ Compute the length of the inlet (as
    70         defined by the input line
    71         """
    72 
    73         point0 = self.line[0]
    74         point1 = self.line[1]
    75 
    76         self.inlet_length = anuga.geometry.polygon.line_length(self.line)
    77 
    78 
    79     def get_inlet_length(self):
    80 
    81         return self.inlet_length
    82 
    83     def get_line(self):
    84 
    85         return self.line
     76#    def compute_inlet_length(self):
     77#        """ Compute the length of the inlet (as
     78#        defined by the input line
     79#        """
     80#
     81#        self.inlet_length = anuga.geometry.polygon.line_length(self.poly)
     82
     83
     84#    def get_inlet_length(self):
     85#
     86#        return self.inlet_length
     87
     88
     89
     90    def get_poly(self):
     91
     92        return self.poly
    8693       
    8794    def get_area(self):
  • trunk/anuga_core/source/anuga/structures/inlet_enquiry.py

    r8680 r8873  
    1111    """
    1212
    13     def __init__(self, domain, polyline, enquiry_pt, outward_culvert_vector=None, verbose=False):
     13    def __init__(self,
     14                 domain,
     15                 poly,
     16                 enquiry_pt,
     17                 invert_elevation = None,
     18                 outward_culvert_vector=None,
     19                 verbose=False):
     20        """
     21        poly can be a line or a polygon
     22        """
    1423
    1524
    16         inlet.Inlet.__init__(self, domain, polyline, verbose)
    17 
     25        inlet.Inlet.__init__(self, domain, poly, verbose)
    1826
    1927        self.enquiry_pt = enquiry_pt
     28        self.invert_elevation = invert_elevation
    2029        self.outward_culvert_vector = outward_culvert_vector
    21 
    2230
    2331        self.compute_enquiry_index()
     
    7886
    7987
     88    def get_enquiry_invert_elevation(self):
     89
     90        if  self.invert_elevation == None:
     91            return self.get_enquiry_elevation()
     92        else:
     93            return self.invert_elevation
     94
     95
    8096    def get_enquiry_velocity(self):
    8197
  • trunk/anuga_core/source/anuga/structures/run_wide_bridge.py

    r8851 r8873  
    4848domain = Domain(points, vertices, boundary)   
    4949domain.set_name('Test_WIDE_BRIDGE')                 # Output name
    50 domain.set_default_order(2)
    51 domain.H0 = 0.01
    52 domain.tight_slope_limiters = 1
     50#domain.set_default_order(2)
     51#omain.H0 = 0.01
     52#domain.tight_slope_limiters = 1
     53
     54domain.set_flow_algorithm('2_0')
    5355
    5456print 'Size', len(domain)
     
    184186    culvert_width = 50.0/number_of_culverts
    185187    y = 100-i*culvert_width - culvert_width/2.0
    186     ep0 = num.array([40.0, y])
    187     ep1 = num.array([50.0, y])
     188    ep0 = num.array([37.0, y])
     189    ep1 = num.array([53.0, y])
    188190    culverts.append(anuga.Boyd_box_operator(domain,
    189191                                            losses=1.5,
     
    255257    for i, culvert in enumerate(culverts):
    256258        print 'culvert: ', i
    257         print culvert.statistics()
     259        print culvert.timestepping_statistics()
    258260   
    259261
  • trunk/anuga_core/source/anuga/structures/structure_operator.py

    r8861 r8873  
    116116        self.inlets = []
    117117        line0 = self.exchange_lines[0] #self.inlet_lines[0]
     118        if self.invert_elevations is None:
     119            invert_elevation0 = None
     120        else:
     121            invert_elevation0 = self.invert_elevations[0]
     122
    118123        enquiry_point0 = self.enquiry_points[0]
     124
    119125        #outward_vector0 = - self.culvert_vector
    120         self.inlets.append(inlet_enquiry.Inlet_enquiry(self.domain, line0,
    121                            enquiry_point0, self.outward_vector_0, self.verbose))
     126        self.inlets.append(inlet_enquiry.Inlet_enquiry(
     127                           self.domain,
     128                           line0,
     129                           enquiry_point0,
     130                           invert_elevation = invert_elevation0,
     131                           outward_culvert_vector = self.outward_vector_0,
     132                           verbose = self.verbose))
     133
     134
    122135
    123136        line1 = self.exchange_lines[1]
     137        if self.invert_elevations is None:
     138            invert_elevation1 = None
     139        else:
     140            invert_elevation1 = self.invert_elevations[1]
    124141        enquiry_point1 = self.enquiry_points[1]
     142
    125143        #outward_vector1  = - self.culvert_vector
    126         self.inlets.append(inlet_enquiry.Inlet_enquiry(self.domain, line1,
    127                            enquiry_point1, self.outward_vector_1, self.verbose))
     144        self.inlets.append(inlet_enquiry.Inlet_enquiry(
     145                           self.domain,
     146                           line1,
     147                           enquiry_point1,
     148                           invert_elevation = invert_elevation1,
     149                           outward_culvert_vector = self.outward_vector_1,
     150                           verbose = self.verbose))
    128151
    129152        self.set_logging(logging)
     153
     154
     155
    130156
    131157    def __call__(self):
Note: See TracChangeset for help on using the changeset viewer.