Ignore:
Timestamp:
Jun 25, 2008, 5:57:01 PM (15 years ago)
Author:
ole
Message:

Moved culvert routines into own area

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r5315 r5436  
    15271527                negative values indicate decreases.
    15281528                Rate can be None at initialisation but must be specified
    1529                 before forcting term is applied (i.e. simulation has started).
     1529                before forcing term is applied (i.e. simulation has started).
    15301530
    15311531    center [m]: Coordinates at center of flow point
     
    15651565
    15661566        # Update area if applicable
    1567         self.area = None       
     1567        self.exchange_area = None       
    15681568        if center is not None and radius is not None:
    15691569            assert len(center) == 2
     
    15711571            assert polygon is None, msg
    15721572
    1573             self.area = radius**2*pi
     1573            self.exchange_area = radius**2*pi
    15741574       
    15751575        if polygon is not None:
    1576             self.area = polygon_area(self.polygon)
     1576            self.exchange_area = polygon_area(self.polygon)
    15771577
    15781578
     
    15841584        points = domain.get_centroid_coordinates(absolute=True)
    15851585
    1586         self.indices = None
     1586        # Calculate indices in exchange area for this forcing term
     1587        self.exchange_indices = None
    15871588        if self.center is not None and self.radius is not None:
    15881589            # Inlet is circular
    15891590           
    1590             self.indices = []
     1591            self.exchange_indices = []
    15911592            for k in range(N):
    15921593                x, y = points[k,:] # Centroid
    15931594                if ((x-self.center[0])**2+(y-self.center[1])**2) < self.radius**2:
    1594                     self.indices.append(k)
     1595                    self.exchange_indices.append(k)
    15951596                   
    15961597        if self.polygon is not None:                   
    15971598            # Inlet is polygon
    1598             self.indices = inside_polygon(points, self.polygon)
     1599            self.exchange_indices = inside_polygon(points, self.polygon)
    15991600           
    16001601
     
    16211622
    16221623
    1623         if self.indices is None:
     1624        if self.exchange_indices is None:
    16241625            self.update[:] += rate
    16251626        else:
    16261627            # Brute force assignment of restricted rate
    1627             for k in self.indices:
     1628            for k in self.exchange_indices:
    16281629                self.update[k] += rate
    16291630
     
    16451646        """Return values for specified quantity restricted to opening
    16461647        """
    1647         return self.domain.quantities[self.quantity_name].get_values(indices=self.indices)
     1648        return self.domain.quantities[self.quantity_name].get_values(indices=self.exchange_indices)
    16481649   
    16491650
     
    16511652        """Set values for specified quantity restricted to opening
    16521653        """
    1653         self.domain.quantities[self.quantity_name].set_values(val, indices=self.indices)   
     1654        self.domain.quantities[self.quantity_name].set_values(val, indices=self.exchange_indices)   
    16541655
    16551656
     
    18111812       
    18121813        if callable(self.rate):
    1813             _rate = self.rate(t)/self.area
     1814            _rate = self.rate(t)/self.exchange_area
    18141815        else:
    1815             _rate = self.rate/self.area
     1816            _rate = self.rate/self.exchange_area
    18161817
    18171818        return _rate
Note: See TracChangeset for help on using the changeset viewer.