Changeset 8079
- Timestamp:
- Nov 19, 2010, 11:18:07 PM (14 years ago)
- Location:
- trunk/anuga_core/source/anuga/structures
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/structures/inlet_operator.py
r8077 r8079 89 89 90 90 for i,a in enumerate(areas[stages_order]): 91 print i,a, stages[stages_order[i]]91 #print i,a, stages[stages_order[i]] 92 92 if i == 0: 93 93 summed_areas[i] = a … … 102 102 diff_stage[i] = stages[stages_order[i]] - stages[stages_order[i-1]] 103 103 104 print summed_areas 105 print summed_amount 106 print diff_stage 104 #print 'amount ',amount 105 #print summed_areas 106 #print summed_amount 107 #print diff_stage 107 108 108 109 109 110 #index = len(summed_amount) 110 111 for i,a in enumerate(summed_amount): 112 #print 'a ',a 111 113 if amount > a : 112 114 index = i 113 115 114 print index 115 116 117 print stages_order 118 print stages 119 print areas 120 print stages[stages_order] 121 122 123 new_inlet_depth = self.inlet.get_average_depth() + (amount/self.inlet.get_area()) 124 self.inlet.set_depths(new_inlet_depth) 125 126 116 #print index 117 118 #print stages_order 119 #print stages 120 121 amount = (amount - summed_amount[index])/summed_areas[index] 122 123 stages[stages_order[0:index+1]] = stages[stages_order[index]]+amount 124 125 126 #print stages 127 #print areas 128 #print stages[stages_order] 129 130 131 #new_inlet_depth = self.inlet.get_average_depth() + (amount/self.inlet.get_area()) 132 #self.inlet.set_depths(new_inlet_depth) 133 134 self.inlet.set_stages(stages) 127 135 128 136 def statistics(self): -
trunk/anuga_core/source/anuga/structures/test_inlet_operator.py
r8073 r8079 96 96 domain_length = 200.0 97 97 domain_width = 200.0 98 99 culvert_length = 20.0100 culvert_width = 3.66101 culvert_height = 3.66102 culvert_losses = {'inlet':0.5, 'outlet':1.0, 'bend':0.0, 'grate':0.0, 'pier': 0.0, 'other': 0.0}103 culvert_mannings = 0.013104 105 culvert_apron = 0.0106 enquiry_gap = 10.0107 108 109 expected_Q = 6.23110 expected_v = 2.55111 expected_d = 0.66112 98 113 99 114 100 domain = self._create_domain(d_length=domain_length, 115 101 d_width=domain_width, 116 dx = 5.0,117 dy = 5.0,102 dx = 10.0, 103 dy = 10.0, 118 104 elevation_0 = elevation_0, 119 105 elevation_1 = elevation_1, … … 121 107 stage_1 = stage_1) 122 108 123 124 125 126 109 vol0 = domain.compute_total_volume() 127 110 111 finaltime = 3.0 112 line1 = [[95.0, 10.0], [105.0, 10.0]] 113 Q1 = 5.00 114 115 line2 = [[10.0, 90.0], [20.0, 90.0]] 116 Q2 = 10.0 117 118 Inlet_operator(domain, line1, Q1) 119 Inlet_operator(domain, line2, Q2) 128 120 129 line = [[0.0, 5.0], [0.0, 10.0]] 130 Q = 5.0 131 Inlet_operator(domain, line, Q) 132 133 134 for t in domain.evolve(yieldstep = 1.0, finaltime = 1.0): 121 for t in domain.evolve(yieldstep = 1.0, finaltime = finaltime): 135 122 #domain.write_time() 136 123 #print domain.volumetric_balance_statistics() … … 139 126 140 127 vol1 = domain.compute_total_volume() 141 142 128 143 assert numpy.allclose( Q, vol1-vol0, rtol=1.0e-8)129 assert numpy.allclose((Q1+Q2)*finaltime, vol1-vol0, rtol=1.0e-8) 144 130 145 131
Note: See TracChangeset
for help on using the changeset viewer.