Changeset 1834


Ignore:
Timestamp:
Sep 15, 2005, 5:06:08 PM (19 years ago)
Author:
steve
Message:

Added inflow BC Dirichlet_Discharge_boundary

Location:
inundation
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/shallow_water.py

    r1704 r1834  
    10091009
    10101010
     1011class Dirichlet_Discharge_boundary(Boundary):
     1012    """Returns same momentum conserved quantities as
     1013    those present in its neighbour volume. Sets stage
     1014
     1015    Underlying domain must be specified when boundary is instantiated
     1016    """
     1017
     1018    def __init__(self, domain = None, h0=None, wh0=None):
     1019        Boundary.__init__(self)
     1020
     1021        if domain is None:
     1022            msg = 'Domain must be specified for this type boundary'
     1023            raise msg
     1024
     1025        if h0 is None:
     1026            h0 = 0.0
     1027
     1028        if wh0 is None:
     1029            wh0 = 0.0
     1030
     1031        self.domain   = domain
     1032        self.h0  = h0
     1033        self.wh0 = wh0
     1034
     1035    def __repr__(self):
     1036        return 'Dirichlet_Discharge_boundary(%s)' %self.domain
     1037
     1038    def evaluate(self, vol_id, edge_id):
     1039        """Dirichlet_Discharge_boundary boundaries return the edge momentum
     1040        values of the volume they serve.
     1041        """
     1042
     1043        normal = self.domain.get_normal(vol_id,edge_id)
     1044        q = [self.h0, -self.wh0*normal[0], -self.wh0*normal[1]]
     1045        return q
     1046
     1047
     1048        #FIXME: Consider this (taken from File_boundary) to allow
     1049        #spatial variation
     1050        #if vol_id is not None and edge_id is not None:
     1051        #    i = self.boundary_indices[ vol_id, edge_id ]
     1052        #    return self.F(t, point_id = i)
     1053        #else:
     1054        #    return self.F(t)
    10111055
    10121056
Note: See TracChangeset for help on using the changeset viewer.