Last change
on this file since 6373 was
6373,
checked in by ole, 14 years ago
|
Added unit test work for Boyd culvert routine.
The test fails at this stage and is disabled.
|
File size:
2.1 KB
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | |
---|
4 | import unittest |
---|
5 | import os.path |
---|
6 | import sys |
---|
7 | |
---|
8 | from anuga.utilities.system_tools import get_pathname_from_package |
---|
9 | from anuga.culvert_flows.culvert_routines import boyd_generalised_culvert_model |
---|
10 | import Numeric as num |
---|
11 | |
---|
12 | |
---|
13 | class Test_culvert_routines(unittest.TestCase): |
---|
14 | def setUp(self): |
---|
15 | pass |
---|
16 | |
---|
17 | def tearDown(self): |
---|
18 | pass |
---|
19 | |
---|
20 | |
---|
21 | def NOtest_boyd_1(self): |
---|
22 | """test_boyd_1 |
---|
23 | |
---|
24 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
25 | """ |
---|
26 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
27 | |
---|
28 | g=9.81 |
---|
29 | culvert_slope=0.1 # Downward |
---|
30 | |
---|
31 | inlet_depth=0.1 |
---|
32 | outlet_depth=0.09 |
---|
33 | |
---|
34 | culvert_length=4.0 |
---|
35 | culvert_width=1.2 |
---|
36 | culvert_height=0.75 |
---|
37 | |
---|
38 | culvert_type='box' |
---|
39 | manning=0.013 |
---|
40 | sum_loss=0.0 |
---|
41 | |
---|
42 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
43 | z_in = 0.0 |
---|
44 | z_out = -culvert_length*culvert_slope/100 |
---|
45 | E_in = z_in+inlet_depth # + |
---|
46 | E_out = z_out+outlet_depth # + |
---|
47 | delta_total_energy = E_in-E_out |
---|
48 | |
---|
49 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
50 | outlet_depth, |
---|
51 | inlet_specific_energy, |
---|
52 | delta_total_energy, |
---|
53 | g, |
---|
54 | culvert_length, |
---|
55 | culvert_width, |
---|
56 | culvert_height, |
---|
57 | culvert_type, |
---|
58 | manning, |
---|
59 | sum_loss) |
---|
60 | |
---|
61 | print Q, v, d |
---|
62 | assert num.allclose(Q, 0.1) |
---|
63 | assert num.allclose(v, 0.93) |
---|
64 | assert num.allclose(d, 0.09) |
---|
65 | |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | #------------------------------------------------------------- |
---|
70 | if __name__ == "__main__": |
---|
71 | suite = unittest.makeSuite(Test_culvert_routines, 'test') |
---|
72 | runner = unittest.TextTestRunner() |
---|
73 | runner.run(suite) |
---|
74 | |
---|
Note: See
TracBrowser
for help on using the repository browser.