Changeset 7973


Ignore:
Timestamp:
Aug 25, 2010, 12:31:00 PM (8 years ago)
Author:
habili
Message:

Added more functionalities

File:
1 edited

Legend:

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

    r7972 r7973  
    11from anuga.geometry.polygon import inside_polygon, is_inside_polygon
    22from anuga.config import velocity_protection
     3import math
    34
    45import numpy as num
     
    7475        return self.domain.quantities['stage'].centroid_values.take(self.triangle_indices)
    7576       
     77       
    7678    def get_average_stage(self):
    7779       
     
    9193   
    9294        return self.domain.quantities['xmomentum'].centroid_values.take(self.triangle_indices)
     95       
    9396       
    9497    def get_average_xmom(self):
     
    131134           
    132135           
    133     def get_average_velocities(self):
     136    def get_average_velocity(self):
    134137 
    135             depths = self.get_stages() - self.get_elevations()
    136             u = self.get_xmoms()/(depths + velocity_protection/depths)
    137             v = self.get_ymoms()/(depths + velocity_protection/depths)
     138            u, v = self.get_velocities()
    138139           
    139             return num.sum(u)/self.triangle_indices.size, num.sum(v)/self.triangle_indices.size
     140            average_u = num.sum(u)/self.triangle_indices.size
     141            average_v = num.sum(v)/self.triangle_indices.size
     142           
     143            return math.sqrt(average_u**2 + average_v**2)
     144
     145
     146    def set_total_energy(self, total_energy):
     147       
     148        self.total_energy = total_energy
     149       
     150       
     151    def get_total_energy(self):
     152       
     153        return self.total_energy
     154       
     155       
     156    def set_specific_energy(self, specific_energy):
     157       
     158        self.specific_energy = specific_energy
     159
     160   
     161    def get_specific_energy(self):
     162       
     163        return self.specific_energy
     164       
     165       
Note: See TracChangeset for help on using the changeset viewer.