Changeset 9734 for trunk/anuga_core/anuga/operators
- Timestamp:
- Sep 5, 2015, 4:03:54 PM (10 years ago)
- 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 54 54 elif(ts_method=='rk2'): 55 55 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]) 56 58 else: 57 59 raise Exception, 'Cannot compute boundary flux integral with this timestepping method' 58 60 59 61 # Zero the boundary_flux_sum 60 self.domain.boundary_flux_sum =self.domain.boundary_flux_sum*0.62 self.domain.boundary_flux_sum[:]=0. 61 63 62 64 def parallel_safe(self): -
trunk/anuga_core/anuga/operators/collect_max_quantities_operator.py
r9654 r9734 16 16 from anuga.parallel import myid 17 17 from anuga.config import velocity_protection 18 from anuga.config import max_float 18 19 19 20 … … 48 49 # Setup a quantity to store max_stage 49 50 #------------------------------------------ 50 self.max_stage = num.zeros(len(domain.centroid_coordinates[:,0])) 51 self.max_stage = num.zeros(len(domain.centroid_coordinates[:,0])) - max_float 51 52 self.max_depth = num.zeros(len(domain.centroid_coordinates[:,0])) 52 53 self.max_speed = num.zeros(len(domain.centroid_coordinates[:,0])) -
trunk/anuga_core/anuga/operators/erosion_operators.py
r9493 r9734 74 74 # bed and stage vertex values in dry region 75 75 #------------------------------------------ 76 self.domain.optimise_dry_cells = 0 76 if not self.domain.get_using_discontinuous_elevation(): 77 self.domain.optimise_dry_cells = 0 77 78 78 79 #----------------------------------------- … … 80 81 # continuity of elevation 81 82 #----------------------------------------- 82 self.setup_node_structures() 83 if not self.domain.get_using_discontinuous_elevation(): 84 self.setup_node_structures() 83 85 84 86 #----------------------------------------- -
trunk/anuga_core/anuga/operators/tests/test_boundary_flux_integral_operator.py
r9445 r9734 28 28 29 29 # Make the domain 30 anuga.create_mesh_from_regions(boundaryPolygon,30 domain = anuga.create_domain_from_regions(boundaryPolygon, 31 31 boundary_tags={'left': [0], 32 32 'top': [1], 33 33 'right': [2], 34 34 'bottom': [3]}, 35 mesh_filename='test_boundaryfluxintegral.msh', 35 36 maximum_triangle_area = 200., 36 37 minimum_triangle_angle = 28.0, 37 filename = 'test_boundaryfluxintegral.msh',38 38 use_cache=False, 39 39 verbose=verbose) 40 40 41 domain=anuga.create_domain_from_file('test_boundaryfluxintegral.msh')42 41 43 42 # 05/05/2014 -- riverwalls only work with DE0 and DE1 … … 67 66 This tests the calculation for euler timestepping 68 67 """ 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() 72 77 pass 73 78 # The domain was initially dry 74 79 vol=domain.get_water_volume() 75 80 boundaryFluxInt=domain.get_boundary_flux_integral() 81 82 if verbose: print flowalg, vol, boundaryFluxInt 83 assert(numpy.allclose(vol,boundaryFluxInt)) 84 76 85 77 assert(numpy.allclose(vol,boundaryFluxInt)) 78 86 79 87 def test_boundary_flux_operator_DE1(self): 80 88 """ … … 82 90 This tests the calculation for rk2 timestepping 83 91 """ 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() 87 99 pass 88 100 # The domain was initially dry 89 101 vol=domain.get_water_volume() 90 102 boundaryFluxInt=domain.get_boundary_flux_integral() 103 104 if verbose: print flowalg, vol, boundaryFluxInt 105 assert(numpy.allclose(vol,boundaryFluxInt)) 106 107 91 108 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 94 131 if __name__ == "__main__": 95 132 suite = unittest.makeSuite(Test_boundary_flux_integral_operator, 'test')
Note: See TracChangeset
for help on using the changeset viewer.