Exemple #1
0
    def __init__(self, domain=None, function=None, default_stage=0.0):
        """ Instantiate a
            Characteristic_stage_boundary.
            domain is the domain containing the boundary
            function is the function to apply the wave
            default_stage is the assumed stage pre the application of wave
        """

        raise Exception, 'This boundary type is not implemented yet'

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
        self.default_stage = default_stage

        self.Elev = domain.quantities['elevation']
        self.Stage = domain.quantities['stage']
        self.Height = domain.quantities['height']
    def __init__(self, domain=None, function=None, default_stage = 0.0):
        """ Instantiate a
            Characteristic_stage_boundary.
            domain is the domain containing the boundary
            function is the function to apply the wave
            default_stage is the assumed stage pre the application of wave
        """

        raise Exception, 'This boundary type is not implemented yet'
    
        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
        self.default_stage = default_stage

        self.Elev  = domain.quantities['elevation']
        self.Stage = domain.quantities['stage']
        self.Height = domain.quantities['height']
Exemple #3
0
    def __init__(
            self,
            domain=None,
            #f=None, # Should be removed and replaced by function below
            function=None,
            default_boundary=None,
            verbose=False):
        Boundary.__init__(self)

        self.default_boundary = default_boundary
        self.default_boundary_invoked = False  # Flag
        self.domain = domain
        self.verbose = verbose

        if domain is None:
            raise Exception(
                'You must specify a domain to Time_stage_zero_momemtum_boundary'
            )

        if function is None:
            raise Exception(
                'You must specify a function to Time_stage_zero_momemtum_boundary'
            )

        try:
            q = function(0.0)
        except Exception, e:
            msg = 'Function for time stage boundary could not be executed:\n%s' % e
            raise Exception(msg)
Exemple #4
0
    def __init__(self, domain=None):
        """ Instantiate a Transmissive (zero momentum) boundary. """

        Boundary.__init__(self)

        if domain is None:
            msg = ('Domain must be specified for '
                   'Transmissive_stage_zero_momentum boundary')
            raise Exception, msg

        self.domain = domain
    def __init__(self, domain=None):
        """ Instantiate a Transmissive (zero momentum) boundary. """

        Boundary.__init__(self)

        if domain is None:
            msg = ('Domain must be specified for '
                   'Transmissive_stage_zero_momentum boundary')
            raise Exception, msg

        self.domain = domain
    def __init__(self, domain=None, rate=0.0):
        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for '
            msg += 'Inflow boundary'
            raise Exception, msg

        self.domain = domain
        
        # FIXME(Ole): Allow rate to be time dependent as well
        self.rate = rate
        self.tag = None # Placeholder for tag associated with this object.
Exemple #7
0
    def __init__(self, domain=None, rate=0.0):
        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for '
            msg += 'Inflow boundary'
            raise Exception, msg

        self.domain = domain

        # FIXME(Ole): Allow rate to be time dependent as well
        self.rate = rate
        self.tag = None  # Placeholder for tag associated with this object.
    def __init__(self, domain=None):
        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for reflective boundary'
            raise Exception, msg

        # Handy shorthands
        self.stage = domain.quantities['stage'].edge_values
        self.xmom = domain.quantities['xmomentum'].edge_values
        self.ymom = domain.quantities['ymomentum'].edge_values
        self.normals = domain.normals

        self.conserved_quantities = num.zeros(3, num.float)
Exemple #9
0
    def __init__(self, domain=None):
        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for reflective boundary'
            raise Exception, msg

        # Handy shorthands
        self.stage = domain.quantities['stage'].edge_values
        self.xmom = domain.quantities['xmomentum'].edge_values
        self.ymom = domain.quantities['ymomentum'].edge_values
        self.normals = domain.normals

        self.conserved_quantities = num.zeros(3, num.float)
Exemple #10
0
    def __init__(self, domain=None, function=None):
        Boundary.__init__(self)
        """ Instantiate a Transmissive_momentum_set_stage_boundary. """

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain

        if isinstance(function, (int, float)):
            tmp = function
            function = lambda t: tmp

        self.function = function
Exemple #11
0
    def __init__(self, domain=None, function=None):
        """ Instantiate a
            Flather_external_stage_zero_velocity_boundary.
            domain is the domain containing the boundary
            function is the function to apply
        """

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise_(Exception, msg)

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise_(Exception, msg)

        self.domain = domain
        self.function = function
    def __init__(self, domain=None, function=None):
        """ Instantiate a
            Transmissive_n_momentum_zero_t_momentum_set_stage_boundary.
            domain is the domain containing the boundary
            function is the function to apply
        """

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
    def __init__(self, domain=None, function=None):
        """ Instantiate a
            Nudge_boundary.
            domain is the domain containing the boundary
            function is the function to apply
        """

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
Exemple #14
0
    def __init__(self, domain=None, function=None):
        """ Instantiate a
            Nudge_boundary.
            domain is the domain containing the boundary
            function is the function to apply
        """

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
Exemple #15
0
    def __init__(self, domain=None, function=None):
        """ Instantiate a
            Transmissive_n_momentum_zero_t_momentum_set_stage_boundary.
            domain is the domain containing the boundary
            function is the function to apply
        """

        Boundary.__init__(self)

        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain
        self.function = function
    def __init__(self, domain=None, function=None):
        Boundary.__init__(self)
        """ Instantiate a Transmissive_momentum_set_stage_boundary. """


        if domain is None:
            msg = 'Domain must be specified for this type boundary'
            raise Exception, msg

        if function is None:
            msg = 'Function must be specified for this type boundary'
            raise Exception, msg

        self.domain = domain

        if isinstance(function, (int, float)):
            tmp = function
            function = lambda t: tmp
            
        self.function = function
Exemple #17
0
    def __init__(self, domain=None, stage0=None, wh0=None):
        Boundary.__init__(self)
        """ Instantiate a Dirichlet discharge boundary.
            domain underlying domain
            stage0 stag
            wh0 momentum in the inward normal direction.
            """

        if domain is None:
            msg = 'Domain must be specified for this type of boundary'
            raise Exception, msg

        if stage0 is None:
            raise Exception, 'Stage must be specified for this type of boundary'

        if wh0 is None:
            wh0 = 0.0

        self.domain = domain
        self.stage0 = stage0
        self.wh0 = wh0
    def __init__(self, domain=None, stage0=None, wh0=None):
        Boundary.__init__(self)
        """ Instantiate a Dirichlet discharge boundary.
            domain underlying domain
            stage0 stag
            wh0 momentum in the inward normal direction.
            """

        if domain is None:
            msg = 'Domain must be specified for this type of boundary'
            raise Exception, msg

        if stage0 is None:
            raise Exception, 'Stage must be specified for this type of boundary'

        if wh0 is None:
            wh0 = 0.0

        self.domain = domain
        self.stage0 = stage0
        self.wh0 = wh0
Exemple #19
0
    def __init__(
            self,
            domain=None,
            #f=None, # Should be removed and replaced by function below
            function=None,
            default_boundary=None,
            verbose=False):
        Boundary.__init__(self)

        self.default_boundary = default_boundary
        self.default_boundary_invoked = False  # Flag
        self.domain = domain
        self.verbose = verbose

        if domain is None:
            raise Exception(
                'You must specify a domain to Time_stage_zero_momemtum_boundary'
            )

        if function is None:
            raise Exception(
                'You must specify a function to Time_stage_zero_momemtum_boundary'
            )

        try:
            q = function(0.0)
        except Exception as e:
            msg = 'Function for time stage boundary could not be executed:\n%s' % e
            raise Exception(msg)

        try:
            q = float(q)
        except:
            msg = 'Return value from time boundary function could '
            msg += 'not be converted into a float.\n'
            msg += 'I got %s' % str(q)
            raise Exception(msg)

        self.f = function
        self.domain = domain
    def __init__(self, domain=None,
                 #f=None, # Should be removed and replaced by function below
                 function=None,
                 default_boundary=None,
                 verbose=False):
        Boundary.__init__(self)

        self.default_boundary = default_boundary
        self.default_boundary_invoked = False    # Flag
        self.domain = domain
        self.verbose = verbose

        if domain is None:
            raise Exception('You must specify a domain to Time_stage_zero_momemtum_boundary')
            
        if function is None:
            raise Exception('You must specify a function to Time_stage_zero_momemtum_boundary')
            
        
        try:
            q = function(0.0)
        except Exception, e:
            msg = 'Function for time stage boundary could not be executed:\n%s' %e
            raise Exception(msg)