Changeset 9281
- Timestamp:
- Aug 5, 2014, 12:11:23 PM (11 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/generic_domain.py
r9261 r9281 184 184 # Create an empty list for fractional step operators 185 185 self.fractional_step_operators = [] 186 186 self.fractional_step_volume_influx=0. 187 187 188 188 -
trunk/anuga_core/source/anuga/operators/rate_operators.py
r9280 r9281 79 79 # Mass tracking 80 80 self.local_rate=0. 81 self.rate_integral=0.81 #self.volume_added=self.domain.fractional_step_volume_influx 82 82 83 83 def __call__(self): … … 139 139 self.stage_c[indices] = num.maximum(self.stage_c[indices] \ 140 140 + factor*rate*timestep, self.elev_c[indices]) 141 142 self. rate_integral=self.rate_integral+self.local_rate141 # Update mass inflows from fractional steps 142 self.domain.fractional_step_volume_influx+=self.local_rate 143 143 144 144 def get_non_spatial_rate(self, t=None): -
trunk/anuga_core/source/anuga/operators/test_rate_operators.py
r9280 r9281 87 87 assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0) 88 88 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 89 assert num.allclose( operator.rate_integral, factor*domain.timestep*(rate*domain.areas[indices]).sum())89 assert num.allclose(domain.fractional_step_volume_influx, factor*domain.timestep*(rate*domain.areas[indices]).sum()) 90 90 91 91 … … 149 149 assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0) 150 150 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 151 assert num.allclose( operator.rate_integral, factor*domain.timestep*(rate*domain.areas[indices]).sum())151 assert num.allclose(domain.fractional_step_volume_influx, factor*domain.timestep*(rate*domain.areas[indices]).sum()) 152 152 153 153 … … 271 271 assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0) 272 272 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 273 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas[indices]).sum())273 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas[indices]).sum()) 274 274 275 275 … … 301 301 assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0) 302 302 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 303 assert num.allclose( operator.rate_integral, (d*domain.areas[indices]).sum())303 assert num.allclose(domain.fractional_step_volume_influx, (d*domain.areas[indices]).sum()) 304 304 305 305 … … 373 373 assert num.allclose(domain.quantities['xmomentum'].centroid_values, 0.0) 374 374 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 375 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas[indices]).sum())375 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas[indices]).sum()) 376 376 377 377 domain.set_starttime(30.0) … … 560 560 assert num.allclose(Q_ex_all, Q_all) 561 561 assert num.allclose(Q_ex_full, Q_full) 562 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas).sum())562 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas).sum()) 563 563 564 564 def test_rate_operator_functions_spatial_indices(self): … … 639 639 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 640 640 assert num.allclose(Q_ex, Q) 641 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas[indices]).sum())641 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas[indices]).sum()) 642 642 643 643 … … 719 719 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 720 720 assert num.allclose(Q_ex, Q) 721 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas[indices]).sum())721 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas[indices]).sum()) 722 722 723 723 … … 800 800 assert num.allclose(domain.quantities['ymomentum'].centroid_values, 0.0) 801 801 assert num.allclose(Q_ex, Q) 802 assert num.allclose( operator.rate_integral, ((d-1.)*domain.areas[indices]).sum())802 assert num.allclose(domain.fractional_step_volume_influx, ((d-1.)*domain.areas[indices]).sum()) 803 803 804 804 if __name__ == "__main__": -
trunk/anuga_core/source/anuga/structures/inlet_operator.py
r9009 r9281 82 82 if volume >= 0.0 : 83 83 self.inlet.set_stages_evenly(volume) 84 self.domain.fractional_step_volume_influx+=volume 84 85 if self.velocity is not None: 85 86 depths = self.inlet.get_depths() 86 87 self.inlet.set_xmoms(self.inlet.get_xmoms()+depths*self.velocity[0]) 87 88 self.inlet.set_ymoms(self.inlet.get_ymoms()+depths*self.velocity[1]) 88 89 89 elif current_volume + volume >= 0.0 : 90 90 depth = (current_volume + volume)/total_area 91 91 self.inlet.set_depths(depth) 92 self.domain.fractional_step_volume_influx+=volume 92 93 else: #extracting too much water! 93 94 self.inlet.set_depths(0.0) 95 self.domain.fractional_step_volume_influx-=current_volume 94 96 self.applied_Q = current_volume/timestep 95 97 -
trunk/anuga_core/source/anuga/structures/test_inlet_operator.py
r8974 r9281 126 126 127 127 assert numpy.allclose((Q1+Q2)*finaltime, vol1-vol0, rtol=1.0e-8) 128 assert numpy.allclose((Q1+Q2)*finaltime, domain.fractional_step_volume_influx, rtol=1.0e-8) 128 129 129 130 … … 172 173 173 174 assert numpy.allclose((Q1)*finaltime, vol1-vol0, rtol=1.0e-8) 175 assert numpy.allclose((Q1)*finaltime, domain.fractional_step_volume_influx, rtol=1.0e-8) 174 176 175 177 … … 235 237 236 238 assert numpy.allclose(13.5, vol1-vol0, rtol=1.0e-8) 239 assert numpy.allclose(vol1-vol0, domain.fractional_step_volume_influx, rtol=1.0e-8) 237 240 238 241 def test_inlet_variable_Q_default(self): … … 296 299 297 300 assert numpy.allclose(31.5, vol1-vol0, rtol=1.0e-8) 301 assert numpy.allclose(vol1-vol0, domain.fractional_step_volume_influx, rtol=1.0e-8) 298 302 299 303 # =========================================================================
Note: See TracChangeset
for help on using the changeset viewer.