 Timestamp:
 Jun 25, 2008, 5:57:01 PM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r5315 r5436 1527 1527 negative values indicate decreases. 1528 1528 Rate can be None at initialisation but must be specified 1529 before forc ting term is applied (i.e. simulation has started).1529 before forcing term is applied (i.e. simulation has started). 1530 1530 1531 1531 center [m]: Coordinates at center of flow point … … 1565 1565 1566 1566 # Update area if applicable 1567 self. area = None1567 self.exchange_area = None 1568 1568 if center is not None and radius is not None: 1569 1569 assert len(center) == 2 … … 1571 1571 assert polygon is None, msg 1572 1572 1573 self. area = radius**2*pi1573 self.exchange_area = radius**2*pi 1574 1574 1575 1575 if polygon is not None: 1576 self. area = polygon_area(self.polygon)1576 self.exchange_area = polygon_area(self.polygon) 1577 1577 1578 1578 … … 1584 1584 points = domain.get_centroid_coordinates(absolute=True) 1585 1585 1586 self.indices = None 1586 # Calculate indices in exchange area for this forcing term 1587 self.exchange_indices = None 1587 1588 if self.center is not None and self.radius is not None: 1588 1589 # Inlet is circular 1589 1590 1590 self. indices = []1591 self.exchange_indices = [] 1591 1592 for k in range(N): 1592 1593 x, y = points[k,:] # Centroid 1593 1594 if ((xself.center[0])**2+(yself.center[1])**2) < self.radius**2: 1594 self. indices.append(k)1595 self.exchange_indices.append(k) 1595 1596 1596 1597 if self.polygon is not None: 1597 1598 # Inlet is polygon 1598 self. indices = inside_polygon(points, self.polygon)1599 self.exchange_indices = inside_polygon(points, self.polygon) 1599 1600 1600 1601 … … 1621 1622 1622 1623 1623 if self. indices is None:1624 if self.exchange_indices is None: 1624 1625 self.update[:] += rate 1625 1626 else: 1626 1627 # Brute force assignment of restricted rate 1627 for k in self. indices:1628 for k in self.exchange_indices: 1628 1629 self.update[k] += rate 1629 1630 … … 1645 1646 """Return values for specified quantity restricted to opening 1646 1647 """ 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) 1648 1649 1649 1650 … … 1651 1652 """Set values for specified quantity restricted to opening 1652 1653 """ 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) 1654 1655 1655 1656 … … 1811 1812 1812 1813 if callable(self.rate): 1813 _rate = self.rate(t)/self. area1814 _rate = self.rate(t)/self.exchange_area 1814 1815 else: 1815 _rate = self.rate/self. area1816 _rate = self.rate/self.exchange_area 1816 1817 1817 1818 return _rate
Note: See TracChangeset
for help on using the changeset viewer.