Changeset 7398
- Timestamp:
- Aug 21, 2009, 1:27:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r7347 r7398 6262 6262 """test_volumetric_balance_computation 6263 6263 6264 Test that total in and out flows are computed correctly 6265 FIXME(Ole): This test is more about looking at the printed report6264 Test that total in and out flows are computed correctly 6265 in a steady state situation 6266 6266 """ 6267 6267 6268 # Set to True if volumetric output is sought 6268 6269 verbose = False 6269 6270 … … 6285 6286 #---------------------------------------------------------------------- 6286 6287 6287 finaltime = 300.06288 finaltime = 500.0 6288 6289 length = 300. 6289 6290 width = 20. … … 6310 6311 #---------------------------------------------------------------------- 6311 6312 6312 slope = 0.0 6313 def topography(x, y): 6314 z=-x * slope 6315 return z 6316 6317 # Use function for elevation 6318 domain.set_quantity('elevation', topography) 6319 domain.set_quantity('friction', 0.0) # Constant friction 6313 domain.set_quantity('elevation', 0.0) # Flat bed 6314 domain.set_quantity('friction', 0.0) # Constant zero friction 6320 6315 6321 domain.set_quantity('stage', expression='elevation ')6316 domain.set_quantity('stage', expression='elevation + %d' % d) 6322 6317 6323 6318 #---------------------------------------------------------------------- … … 6327 6322 Br = Reflective_boundary(domain) # Solid reflective wall 6328 6323 6329 # Constant flow in todomain6324 # Constant flow in and out of domain 6330 6325 # Depth = 1m, uh=1 m/s, i.e. a flow of 20 m^3/s 6331 6332 6326 Bi = Dirichlet_boundary([d, uh, vh]) 6333 Bo = Dirichlet_boundary([ 0, 0, 0])6327 Bo = Dirichlet_boundary([d, uh, vh]) 6334 6328 6335 6329 domain.set_boundary({'left': Bi, 'right': Bo, 'top': Br, 'bottom': Br}) … … 6339 6333 #---------------------------------------------------------------------- 6340 6334 6341 for t in domain.evolve(yieldstep= 100.0, finaltime=finaltime):6335 for t in domain.evolve(yieldstep=50.0, finaltime=finaltime): 6342 6336 S = domain.volumetric_balance_statistics() 6343 6337 if verbose : 6344 6338 print domain.timestepping_statistics() 6345 6339 print S 6340 6341 if t > 300: 6342 # Steady state reached 6343 6344 # Square on flowline at 200m 6345 q = domain.get_flow_through_cross_section([[200.0, 0.0], 6346 [200.0, 20.0]]) 6347 6348 assert num.allclose(q, ref_flow) 6346 6349 6347 6350 … … 7223 7226 7224 7227 if __name__ == "__main__": 7225 #suite = unittest.makeSuite(Test_Shallow_Water, 'test_variable_elevation')7226 suite = unittest.makeSuite(Test_Shallow_Water, 'test')7228 suite = unittest.makeSuite(Test_Shallow_Water, 'test_volumetric_balance') 7229 #suite = unittest.makeSuite(Test_Shallow_Water, 'test') 7227 7230 runner = unittest.TextTestRunner(verbosity=1) 7228 7231 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.