def __init__(self,
                 domain,
                 friction=lambda h: 0.03,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description = None,
                 label = None,
                 logging = False,
                 verbose = False):


        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self, domain,
                indices=indices,
                polygon=polygon,
                center=center,
                radius=radius,
                verbose=verbose)

        #------------------------------------------
        # Local variables
        #------------------------------------------

        self.friction = friction
        self.friction_c = self.domain.get_quantity('friction').centroid_values
    def __init__(self,
                 domain,
                 friction=lambda h: 0.03,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        #------------------------------------------
        # Local variables
        #------------------------------------------

        self.friction = friction
        self.friction_c = self.domain.get_quantity('friction').centroid_values
    def __init__(self,
                 domain,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        # set some alaises
        self.stage = self.domain.quantities['stage'].centroid_values
        self.conc = self.domain.quantities['concentration'].centroid_values
        self.depth = self.domain.quantities['height'].centroid_values
        self.elev = self.domain.quantities['elevation'].centroid_values
        self.xmom = self.domain.quantities['xmomentum'].centroid_values
        self.ymom = self.domain.quantities['ymomentum'].centroid_values
Exemplo n.º 4
0
    def __init__(self,
                 domain,
                 threshold=0.0,
                 base=0.0,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 Ra=34.0,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        #-------------------------------------------
        # set some sand and water properties
        #-------------------------------------------
        self.Wd = 1000  # water mass density kg/m3
        self.Sd = 1800  # sediment mass density kg/m3
        self.G = 9.8  # acceleration due to gravity m/sec/sec
        self.n = 0.030  # sand mannings n - mostly bare with undulations
        self.Tau_crit = 2.1  # critical (detachment) bed shear stress Pa
        self.Kd = 0.025  # detachment factor Froelich Table 2 Kg/sec/m2/Pa
        self.Ra = Ra  # Repose angle in degrees for dry sand (note wet varies 30-45)

        #------------------------------------------
        # Local variables
        #------------------------------------------
        self.base = base

        if self.indices is not []:

            ind = self.indices

            neighbours = self.domain.surrogate_neighbours

            self.neighbourindices = neighbours[
                ind]  # get the neighbour Indices for each triangle in the erosion zone(s)

            self.n0 = self.neighbourindices[:, 0]  # separate into three lists
            self.n1 = self.neighbourindices[:, 1]
            self.n2 = self.neighbourindices[:, 2]

            k = self.n0.shape[0]  # Erosion poly lEN - num of triangles in poly

            self.e = num.zeros(
                (k, 3))  # create elev array k triangles, 3 neighbour elev

            self.ident = num.arange(k)  # ident is array 0.. k-1, step 1
    def __init__(self,
                 domain,
                 threshold= 0.0,
                 base=0.0,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description = None,
                 label = None,
                 logging = False,
                 verbose = False):


        Operator.__init__(self, domain, description, label, logging, verbose)



        Region.__init__(self, domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        #------------------------------------------
        # Local variables
        #------------------------------------------
        self.threshold = threshold
        self.base = base


        #------------------------------------------
        # Extra aliases for changing elevation at
        # vertices and edges
        #------------------------------------------
        self.elev_v  = self.domain.quantities['elevation'].vertex_values
        self.elev_e = self.domain.quantities['elevation'].edge_values

        #------------------------------------------
        # Need to turn off this optimization as it
        # doesn't fixup the relationship between
        # bed and stage vertex values in dry region
        #------------------------------------------
        if not self.domain.get_using_discontinuous_elevation():
            self.domain.optimise_dry_cells = 0

        #-----------------------------------------
        # Extra structures to support maintaining
        # continuity of elevation
        #-----------------------------------------
        if not self.domain.get_using_discontinuous_elevation():
            self.setup_node_structures()

        #-----------------------------------------
        # Some extras for reporting
        #-----------------------------------------
        self.max_change = 0
Exemplo n.º 6
0
    def __init__(self,
                 domain,
                 threshold=0.0,
                 base=0.0,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        #------------------------------------------
        # Local variables
        #------------------------------------------
        self.threshold = threshold
        self.base = base

        #------------------------------------------
        # Extra aliases for changing elevation at
        # vertices and edges
        #------------------------------------------
        self.elev_v = self.domain.quantities['elevation'].vertex_values
        self.elev_e = self.domain.quantities['elevation'].edge_values

        #------------------------------------------
        # Need to turn off this optimization as it
        # doesn't fixup the relationship between
        # bed and stage vertex values in dry region
        #------------------------------------------
        if not self.domain.get_using_discontinuous_elevation():
            self.domain.optimise_dry_cells = 0

        #-----------------------------------------
        # Extra structures to support maintaining
        # continuity of elevation
        #-----------------------------------------
        if not self.domain.get_using_discontinuous_elevation():
            self.setup_node_structures()

        #-----------------------------------------
        # Some extras for reporting
        #-----------------------------------------
        self.max_change = 0
    def __init__(
        self,
        domain,
        threshold=0.0,
        base=0.0,
        indices=None,
        polygon=None,
        center=None,
        radius=None,
        Ra=34.0,
        description=None,
        label=None,
        logging=False,
        verbose=False,
    ):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self, domain, indices=indices, polygon=polygon, center=center, radius=radius, verbose=verbose)

        # -------------------------------------------
        # set some sand and water properties
        # -------------------------------------------
        self.Wd = 1000  # water mass density kg/m3
        self.Sd = 1800  # sediment mass density kg/m3
        self.G = 9.8  # acceleration due to gravity m/sec/sec
        self.n = 0.030  # sand mannings n - mostly bare with undulations
        self.Tau_crit = 2.1  # critical (detachment) bed shear stress Pa
        self.Kd = 0.025  # detachment factor Froelich Table 2 Kg/sec/m2/Pa
        self.Ra = Ra  # Repose angle in degrees for dry sand (note wet varies 30-45)

        # ------------------------------------------
        # Local variables
        # ------------------------------------------
        self.base = base

        if self.indices is not []:

            ind = self.indices

            neighbours = self.domain.surrogate_neighbours

            self.neighbourindices = neighbours[
                ind
            ]  # get the neighbour Indices for each triangle in the erosion zone(s)

            self.n0 = self.neighbourindices[:, 0]  # separate into three lists
            self.n1 = self.neighbourindices[:, 1]
            self.n2 = self.neighbourindices[:, 2]

            k = self.n0.shape[0]  # Erosion poly lEN - num of triangles in poly

            self.e = num.zeros((k, 3))  # create elev array k triangles, 3 neighbour elev

            self.ident = num.arange(k)  # ident is array 0.. k-1, step 1
Exemplo n.º 8
0
    def __init__(self,
                 domain,
                 rate=0.0,
                 factor=1.0,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 relative_time=True,
                 default_rate=0.0,
                 description = None,
                 label = None,
                 logging = False,
                 verbose = False,
                 monitor = False):


        Operator.__init__(self, domain, description, label, logging, verbose)


        Region.__init__(self, domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)


        #------------------------------------------
        # Local variables
        #------------------------------------------
        self.monitor = monitor
        self.factor = factor
        self.relative_time = relative_time

        self.rate_callable = False
        self.rate_spatial = False

        self.set_rate(rate)
        self.set_default_rate(default_rate)


        self.default_rate_invoked = False    # Flag

        self.set_areas()
        self.set_full_indices()

        # Mass tracking
        self.local_influx=0.
Exemplo n.º 9
0
    def __init__(self,
                 domain,
                 quantity,
                 value=None,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 line=None,
                 verbose = False,
                 test_elevation=True,
                 test_stage=True):


        Region.__init__(self, domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        line=line,
                        verbose=verbose)
        

        self.set_value(value)

        #-------------------------------------------
        # Test quantity
        #-------------------------------------------
        self.quantity = quantity
        msg = 'quantity not found in domain'
        assert quantity in domain.quantities, msg

        if test_elevation:
            msg ='Use Set_elevation to maintain continuity'
            assert quantity is not 'elevation', msg
            
        if test_stage:
            msg ='Use Set_stage to maintain non-negative water depth'
            assert quantity is not 'stage', msg
        
        #-------------------------------------------
        # Useful quantity alias
        #------------------------------------------
        self.quantity_c = self.domain.quantities[quantity].centroid_values

        self.coord_c = self.domain.centroid_coordinates
        self.areas = self.domain.areas
Exemplo n.º 10
0
    def __init__(self,
                 domain,
                 rate=0.0,
                 factor=1.0,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 time_relative=True,
                 default_rate=0.0,
                 description = None,
                 label = None,
                 logging = False,
                 verbose = False):


        Operator.__init__(self, domain, description, label, logging, verbose)


        Region.__init__(self, domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)


        #------------------------------------------
        # Local variables
        #------------------------------------------
        self.factor = factor
        self.time_relative = time_relative

        self.rate_callable = False
        self.rate_spatial = False
        
        self.set_rate(rate)
        self.set_default_rate(default_rate)


        self.default_rate_invoked = False    # Flag

        self.set_areas()
        self.set_full_indices()
        
        # Mass tracking
        self.local_influx=0.
Exemplo n.º 11
0
    def __init__(self,
                 domain,
                 quantity,
                 value=None,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 line=None,
                 verbose=False,
                 test_elevation=True,
                 test_stage=True):

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        line=line,
                        verbose=verbose)

        self.set_value(value)

        #-------------------------------------------
        # Test quantity
        #-------------------------------------------
        self.quantity = quantity
        msg = 'quantity not found in domain'
        assert quantity in domain.quantities, msg

        if test_elevation:
            msg = 'Use Set_elevation to maintain continuity'
            assert quantity is not 'elevation', msg

        if test_stage:
            msg = 'Use Set_stage to maintain non-negative water depth'
            assert quantity is not 'stage', msg

        #-------------------------------------------
        # Useful quantity alias
        #------------------------------------------
        self.quantity_c = self.domain.quantities[quantity].centroid_values

        self.coord_c = self.domain.centroid_coordinates
        self.areas = self.domain.areas
Exemplo n.º 12
0
    def __init__(self,
                 domain,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)
Exemplo n.º 13
0
    def __init__(self,
                 domain,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description=None,
                 label=None,
                 logging=False,
                 verbose=False):

        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self,
                        domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        # set some alaises
        self.depth = self.domain.quantities['height'].centroid_values
    def __init__(self,
                 domain,
                 w_uh_vh=None,
                 indices=None,
                 polygon=None,
                 center=None,
                 radius=None,
                 description = None,
                 label = None,
                 logging = False,
                 verbose = False):


        Operator.__init__(self, domain, description, label, logging, verbose)

        Region.__init__(self, domain,
                        indices=indices,
                        polygon=polygon,
                        center=center,
                        radius=radius,
                        verbose=verbose)

        #print self.indices
        self.set_w_uh_vh(w_uh_vh)