Ignore:
Timestamp:
Sep 5, 2015, 4:03:54 PM (10 years ago)
Author:
steve
Message:

Adding in multiple git commit

Location:
trunk/anuga_core/anuga/operators
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/anuga/operators/boundary_flux_integral_operator.py

    r9261 r9734  
    5454        elif(ts_method=='rk2'):
    5555            self.boundary_flux_integral = self.boundary_flux_integral + 0.5*dt*self.domain.boundary_flux_sum[0:2].sum()
     56        elif(ts_method=='rk3'):
     57            self.boundary_flux_integral = self.boundary_flux_integral + 1.0/6.0*dt*(self.domain.boundary_flux_sum[0] + self.domain.boundary_flux_sum[1] + 4.0*self.domain.boundary_flux_sum[2])
    5658        else:
    5759            raise Exception, 'Cannot compute boundary flux integral with this timestepping method'
    5860     
    5961        # Zero the boundary_flux_sum
    60         self.domain.boundary_flux_sum=self.domain.boundary_flux_sum*0.
     62        self.domain.boundary_flux_sum[:]=0.
    6163
    6264    def parallel_safe(self):
  • trunk/anuga_core/anuga/operators/collect_max_quantities_operator.py

    r9654 r9734  
    1616from anuga.parallel import myid
    1717from anuga.config import velocity_protection
     18from anuga.config import max_float
    1819
    1920
     
    4849        # Setup a quantity to store max_stage
    4950        #------------------------------------------
    50         self.max_stage = num.zeros(len(domain.centroid_coordinates[:,0]))
     51        self.max_stage = num.zeros(len(domain.centroid_coordinates[:,0])) - max_float
    5152        self.max_depth = num.zeros(len(domain.centroid_coordinates[:,0]))
    5253        self.max_speed = num.zeros(len(domain.centroid_coordinates[:,0]))
  • trunk/anuga_core/anuga/operators/erosion_operators.py

    r9493 r9734  
    7474        # bed and stage vertex values in dry region
    7575        #------------------------------------------
    76         self.domain.optimise_dry_cells = 0
     76        if not self.domain.get_using_discontinuous_elevation():
     77            self.domain.optimise_dry_cells = 0
    7778
    7879        #-----------------------------------------
     
    8081        # continuity of elevation
    8182        #-----------------------------------------
    82         self.setup_node_structures()
     83        if not self.domain.get_using_discontinuous_elevation():
     84            self.setup_node_structures()
    8385
    8486        #-----------------------------------------
  • trunk/anuga_core/anuga/operators/tests/test_boundary_flux_integral_operator.py

    r9445 r9734  
    2828
    2929        # Make the domain
    30         anuga.create_mesh_from_regions(boundaryPolygon,
     30        domain = anuga.create_domain_from_regions(boundaryPolygon,
    3131                                 boundary_tags={'left': [0],
    3232                                                'top': [1],
    3333                                                'right': [2],
    3434                                                'bottom': [3]},
     35                                   mesh_filename='test_boundaryfluxintegral.msh',
    3536                                   maximum_triangle_area = 200.,
    3637                                   minimum_triangle_angle = 28.0,
    37                                    filename = 'test_boundaryfluxintegral.msh',
    3838                                   use_cache=False,
    3939                                   verbose=verbose)
    4040
    41         domain=anuga.create_domain_from_file('test_boundaryfluxintegral.msh')
    4241
    4342        # 05/05/2014 -- riverwalls only work with DE0 and DE1
     
    6766        This tests the calculation for euler timestepping
    6867        """
    69        
    70         domain=self.create_domain('DE0')
    71         for t in domain.evolve(yieldstep=0.1,finaltime=1.0):
     68 
     69        flowalg = 'DE0'
     70         
     71        domain=self.create_domain(flowalg)
     72 
     73        #domain.print_statistics()
     74        for t in domain.evolve(yieldstep=1.0,finaltime=5.0):
     75            if verbose: domain.print_timestepping_statistics()
     76            if verbose: print domain.get_water_volume()
    7277            pass
    7378        # The domain was initially dry
    7479        vol=domain.get_water_volume()
    7580        boundaryFluxInt=domain.get_boundary_flux_integral()
     81 
     82        if verbose: print flowalg, vol, boundaryFluxInt       
     83        assert(numpy.allclose(vol,boundaryFluxInt))
     84         
    7685
    77         assert(numpy.allclose(vol,boundaryFluxInt))
    78    
     86       
    7987    def test_boundary_flux_operator_DE1(self):
    8088        """
     
    8290        This tests the calculation for rk2 timestepping
    8391        """
    84        
    85         domain=self.create_domain('DE1')
    86         for t in domain.evolve(yieldstep=0.1,finaltime=1.0):
     92        flowalg = 'DE1'
     93                 
     94        domain=self.create_domain(flowalg)
     95        #domain.print_statistics()
     96        for t in domain.evolve(yieldstep=1.0,finaltime=5.0):
     97            if verbose: domain.print_timestepping_statistics()
     98            if verbose: print domain.get_water_volume()
    8799            pass
    88100        # The domain was initially dry
    89101        vol=domain.get_water_volume()
    90102        boundaryFluxInt=domain.get_boundary_flux_integral()
     103         
     104        if verbose: print flowalg, vol, boundaryFluxInt
     105        assert(numpy.allclose(vol,boundaryFluxInt))
     106       
     107       
    91108
    92         assert(numpy.allclose(vol,boundaryFluxInt))
    93 
     109    def test_boundary_flux_operator_DE2(self):
     110        """
     111        A (the) boundary flux operator is instantiated when a domain is created.
     112        This tests the calculation for rk3 timestepping
     113        """
     114 
     115        flowalg = 'DE2'
     116 
     117        domain=self.create_domain(flowalg)
     118        #domain.print_statistics()
     119        for t in domain.evolve(yieldstep=1.0,finaltime=5.0):
     120            if verbose: domain.print_timestepping_statistics()
     121            if verbose: print domain.get_water_volume(), domain.get_boundary_flux_integral()
     122            pass
     123        # The domain was initially dry
     124        vol=domain.get_water_volume()
     125        boundaryFluxInt=domain.get_boundary_flux_integral()
     126 
     127        if verbose: print flowalg, vol, boundaryFluxInt
     128        assert(numpy.allclose(vol,boundaryFluxInt))       
     129         
     130       
    94131if __name__ == "__main__":
    95132    suite = unittest.makeSuite(Test_boundary_flux_integral_operator, 'test')
Note: See TracChangeset for help on using the changeset viewer.