Changeset 6102
- Timestamp:
- Dec 23, 2008, 2:55:11 PM (16 years ago)
- Location:
- anuga_core/source/anuga/culvert_flows
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/culvert_flows/culvert_class.py
r6079 r6102 753 753 754 754 opening.total_energy = 0.5*(u*u + v*v)/g + stage 755 # FIXME(Ole): What happens if this is negative? 755 756 #print 'Et = %.3f m' %opening.total_energy 756 757 -
anuga_core/source/anuga/culvert_flows/test_culvert_class.py
r6079 r6102 5 5 import os.path 6 6 7 from anuga.utilities.system_tools import get_pathname_from_package 7 from anuga.utilities.system_tools import get_pathname_from_package 8 from anuga.utilities.polygon import Polygon_function 9 8 10 from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross 11 from anuga.abstract_2d_finite_volumes.quantity import Quantity 9 12 10 13 from anuga.shallow_water import Domain, Reflective_boundary,\ … … 333 336 334 337 338 339 340 def test_predicted_flow(self): 341 """test_predicted_flow 342 343 Test that flows predicted are consistent with what what 344 is calculated in engineering codes. 345 The data was supplied by Petar Milevski 346 """ 347 348 path = get_pathname_from_package('anuga.culvert_flows') 349 350 length = 12. 351 width = 5. 352 353 dx = dy = 0.5 # Resolution: Length of subdivisions on both axes 354 355 points, vertices, boundary = rectangular_cross(int(length/dx), 356 int(width/dy), 357 len1=length, 358 len2=width) 359 domain = Domain(points, vertices, boundary) 360 361 domain.set_name('test_culvert') # Output name 362 domain.set_default_order(2) 363 364 365 #---------------------------------------------------------------------- 366 # Setup initial conditions 367 #---------------------------------------------------------------------- 368 369 def topography(x, y): 370 # General Slope of Topography 371 z=-x/10 372 373 return z 374 375 376 domain.set_quantity('elevation', topography) 377 domain.set_quantity('friction', 0.01) # Constant friction 378 domain.set_quantity('stage', expression='elevation') 379 380 381 Q0 = domain.get_quantity('stage') 382 Q1 = Quantity(domain) 383 384 # Add depths to stage 385 head_water_depth = 0.169 386 tail_water_depth = 0.089 387 388 inlet_poly = [[0,0], [6,0], [6,5], [0,5]] 389 outlet_poly = [[6,0], [12,0], [12,5], [6,5]] 390 391 Q1.set_values(Polygon_function([(inlet_poly, head_water_depth), 392 (outlet_poly, tail_water_depth)])) 393 394 domain.set_quantity('stage', Q0 + Q1) 395 396 397 if True: 398 filename=os.path.join(path, 'example_rating_curve2.csv') 399 culvert = Culvert_flow_rating(domain, 400 culvert_description_filename=filename, 401 end_point0=[4.0, 2.5], 402 end_point1=[8.0, 2.5], 403 verbose=True) 404 else: 405 culvert = Culvert_flow_energy(domain, 406 label='Test culvert', 407 description='4 m test culvert', 408 end_point0=[4.0, 2.5], 409 end_point1=[8.0, 2.5], 410 width=1.20, 411 height=0.75, 412 culvert_routine=boyd_generalised_culvert_model, 413 number_of_barrels=1, 414 verbose=True) 415 416 417 domain.forcing_terms.append(culvert) 418 419 # Call 420 culvert(domain) 421 422 #print 'Inlet flow', culvert.inlet.rate 423 #print 'Outlet flow', culvert.outlet.rate 424 425 335 426 336 427 #------------------------------------------------------------- 337 428 if __name__ == "__main__": 429 #suite = unittest.makeSuite(Test_Culvert, 'test_predicted_flow') 338 430 suite = unittest.makeSuite(Test_Culvert, 'test') 339 431 runner = unittest.TextTestRunner()
Note: See TracChangeset
for help on using the changeset viewer.