[6553] | 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 |
---|
[6790] | 10 | import numpy as num |
---|
[6553] | 11 | |
---|
| 12 | |
---|
| 13 | class Test_culvert_routines(unittest.TestCase): |
---|
| 14 | def setUp(self): |
---|
| 15 | pass |
---|
| 16 | |
---|
| 17 | def tearDown(self): |
---|
| 18 | pass |
---|
| 19 | |
---|
| 20 | |
---|
[6902] | 21 | def test_boyd_0(self): |
---|
| 22 | """test_boyd_0 |
---|
[6553] | 23 | |
---|
[6902] | 24 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 25 | This test is the only one that passed in late February 2009 |
---|
[6553] | 26 | """ |
---|
[6902] | 27 | |
---|
[6553] | 28 | g=9.81 |
---|
| 29 | culvert_slope=0.1 # Downward |
---|
| 30 | |
---|
[6689] | 31 | inlet_depth=2.0 |
---|
| 32 | outlet_depth=0.0 |
---|
[6553] | 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 | |
---|
[6689] | 61 | #print Q, v, d |
---|
| 62 | assert num.allclose(Q, 3.118, rtol=1.0e-3) |
---|
[6553] | 63 | |
---|
| 64 | |
---|
[6689] | 65 | #assert num.allclose(v, 0.93) |
---|
| 66 | #assert num.allclose(d, 0.0) |
---|
| 67 | |
---|
| 68 | |
---|
[6902] | 69 | def Xtest_boyd_00(self): |
---|
| 70 | """test_boyd_00 |
---|
[6689] | 71 | |
---|
| 72 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 73 | """ |
---|
| 74 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 75 | |
---|
| 76 | g=9.81 |
---|
| 77 | culvert_slope=0.1 # Downward |
---|
| 78 | |
---|
| 79 | inlet_depth=0.2 |
---|
| 80 | outlet_depth=0.0 |
---|
| 81 | |
---|
| 82 | culvert_length=4.0 |
---|
| 83 | culvert_width=1.2 |
---|
| 84 | culvert_height=0.75 |
---|
| 85 | |
---|
| 86 | culvert_type='box' |
---|
| 87 | manning=0.013 |
---|
| 88 | sum_loss=0.0 |
---|
| 89 | |
---|
| 90 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 91 | z_in = 0.0 |
---|
| 92 | z_out = -culvert_length*culvert_slope/100 |
---|
| 93 | E_in = z_in+inlet_depth # + |
---|
| 94 | E_out = z_out+outlet_depth # + |
---|
| 95 | delta_total_energy = E_in-E_out |
---|
| 96 | |
---|
| 97 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 98 | outlet_depth, |
---|
| 99 | inlet_specific_energy, |
---|
| 100 | delta_total_energy, |
---|
| 101 | g, |
---|
| 102 | culvert_length, |
---|
| 103 | culvert_width, |
---|
| 104 | culvert_height, |
---|
| 105 | culvert_type, |
---|
| 106 | manning, |
---|
| 107 | sum_loss) |
---|
| 108 | |
---|
| 109 | #print Q, v, d |
---|
[6902] | 110 | assert num.allclose(Q, 0.185, rtol=1.0e-3) |
---|
[6689] | 111 | #assert num.allclose(v, 0.93) |
---|
| 112 | #assert num.allclose(d, 0.0) |
---|
| 113 | |
---|
[6902] | 114 | def Xtest_boyd_1(self): |
---|
| 115 | """test_boyd_1 |
---|
| 116 | |
---|
| 117 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 118 | """ |
---|
| 119 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 120 | |
---|
| 121 | g=9.81 |
---|
| 122 | culvert_slope=0.01 # Downward |
---|
| 123 | |
---|
| 124 | inlet_depth=0.263 |
---|
| 125 | outlet_depth=0.0 |
---|
| 126 | |
---|
| 127 | culvert_length=4.0 |
---|
| 128 | culvert_width=0.75 |
---|
| 129 | culvert_height=0.75 |
---|
| 130 | |
---|
| 131 | culvert_type='pipe' |
---|
| 132 | manning=0.013 |
---|
| 133 | sum_loss=1.5 |
---|
| 134 | |
---|
| 135 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 136 | z_in = 0.0 |
---|
| 137 | z_out = -culvert_length*culvert_slope/100 |
---|
| 138 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 139 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 140 | delta_total_energy = E_in-E_out |
---|
| 141 | |
---|
| 142 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 143 | outlet_depth, |
---|
| 144 | inlet_specific_energy, |
---|
| 145 | delta_total_energy, |
---|
| 146 | g, |
---|
| 147 | culvert_length, |
---|
| 148 | culvert_width, |
---|
| 149 | culvert_height, |
---|
| 150 | culvert_type, |
---|
| 151 | manning, |
---|
| 152 | sum_loss) |
---|
| 153 | |
---|
| 154 | print Q, v, d |
---|
| 155 | assert num.allclose(Q, 0.10, rtol=1.0e-2) #inflow |
---|
| 156 | assert num.allclose(v, 1.13, rtol=1.0e-2) #outflow velocity |
---|
| 157 | assert num.allclose(d, 0.15, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 158 | |
---|
| 159 | def Xtest_boyd_2(self): |
---|
| 160 | """test_boyd_2 |
---|
| 161 | |
---|
| 162 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 163 | """ |
---|
| 164 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 165 | |
---|
| 166 | g=9.81 |
---|
| 167 | culvert_slope=0.01 # Downward |
---|
| 168 | |
---|
| 169 | inlet_depth=1.135 |
---|
| 170 | outlet_depth=0.0 |
---|
| 171 | |
---|
| 172 | culvert_length=4.0 |
---|
| 173 | culvert_width=0.75 |
---|
| 174 | culvert_height=0.75 |
---|
| 175 | |
---|
| 176 | culvert_type='pipe' |
---|
| 177 | manning=0.013 |
---|
| 178 | sum_loss=1.5 |
---|
| 179 | |
---|
| 180 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 181 | z_in = 0.0 |
---|
| 182 | z_out = -culvert_length*culvert_slope/100 |
---|
| 183 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 184 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 185 | delta_total_energy = E_in-E_out |
---|
| 186 | |
---|
| 187 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 188 | outlet_depth, |
---|
| 189 | inlet_specific_energy, |
---|
| 190 | delta_total_energy, |
---|
| 191 | g, |
---|
| 192 | culvert_length, |
---|
| 193 | culvert_width, |
---|
| 194 | culvert_height, |
---|
| 195 | culvert_type, |
---|
| 196 | manning, |
---|
| 197 | sum_loss) |
---|
| 198 | |
---|
| 199 | print Q, v, d |
---|
| 200 | assert num.allclose(Q, 1.00, rtol=1.0e-2) #inflow |
---|
| 201 | assert num.allclose(v, 2.59, rtol=1.0e-2) #outflow velocity |
---|
| 202 | assert num.allclose(d, 0.563, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 203 | |
---|
| 204 | def Xtest_boyd_3(self): |
---|
| 205 | """test_boyd_3 |
---|
| 206 | |
---|
| 207 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 208 | """ |
---|
| 209 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 210 | |
---|
| 211 | g=9.81 |
---|
| 212 | culvert_slope=0.01 # Downward |
---|
| 213 | |
---|
| 214 | inlet_depth=12.747 |
---|
| 215 | outlet_depth=0.0 |
---|
| 216 | |
---|
| 217 | culvert_length=4.0 |
---|
| 218 | culvert_width=0.75 |
---|
| 219 | culvert_height=0.75 |
---|
| 220 | |
---|
| 221 | culvert_type='pipe' |
---|
| 222 | manning=0.013 |
---|
| 223 | sum_loss=1.5 |
---|
| 224 | |
---|
| 225 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 226 | z_in = 0.0 |
---|
| 227 | z_out = -culvert_length*culvert_slope/100 |
---|
| 228 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 229 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 230 | delta_total_energy = E_in-E_out |
---|
| 231 | |
---|
| 232 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 233 | outlet_depth, |
---|
| 234 | inlet_specific_energy, |
---|
| 235 | delta_total_energy, |
---|
| 236 | g, |
---|
| 237 | culvert_length, |
---|
| 238 | culvert_width, |
---|
| 239 | culvert_height, |
---|
| 240 | culvert_type, |
---|
| 241 | manning, |
---|
| 242 | sum_loss) |
---|
| 243 | |
---|
| 244 | print Q, v, d |
---|
| 245 | assert num.allclose(Q, 5.00, rtol=1.0e-2) #inflow |
---|
| 246 | assert num.allclose(v, 11.022, rtol=1.0e-2) #outflow velocity |
---|
| 247 | assert num.allclose(d, 0.72, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 248 | |
---|
| 249 | def Xtest_boyd_4(self): |
---|
| 250 | """test_boyd_4 |
---|
| 251 | |
---|
| 252 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 253 | """ |
---|
| 254 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 255 | |
---|
| 256 | g=9.81 |
---|
| 257 | culvert_slope=0.01 # Downward |
---|
| 258 | |
---|
| 259 | inlet_depth=1.004 |
---|
| 260 | outlet_depth=1.00 |
---|
| 261 | |
---|
| 262 | culvert_length=4.0 |
---|
| 263 | culvert_width=0.75 |
---|
| 264 | culvert_height=0.75 |
---|
| 265 | |
---|
| 266 | culvert_type='pipe' |
---|
| 267 | manning=0.013 |
---|
| 268 | sum_loss=1.5 |
---|
| 269 | |
---|
| 270 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 271 | z_in = 0.0 |
---|
| 272 | z_out = -culvert_length*culvert_slope/100 |
---|
| 273 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 274 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 275 | delta_total_energy = E_in-E_out |
---|
| 276 | |
---|
| 277 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 278 | outlet_depth, |
---|
| 279 | inlet_specific_energy, |
---|
| 280 | delta_total_energy, |
---|
| 281 | g, |
---|
| 282 | culvert_length, |
---|
| 283 | culvert_width, |
---|
| 284 | culvert_height, |
---|
| 285 | culvert_type, |
---|
| 286 | manning, |
---|
| 287 | sum_loss) |
---|
| 288 | |
---|
| 289 | print Q, v, d |
---|
| 290 | assert num.allclose(Q, 0.10, rtol=1.0e-2) #inflow |
---|
| 291 | assert num.allclose(v, 0.22, rtol=1.0e-2) #outflow velocity |
---|
| 292 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 293 | |
---|
| 294 | def Xtest_boyd_5(self): |
---|
| 295 | """test_boyd_5 |
---|
| 296 | |
---|
| 297 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 298 | """ |
---|
| 299 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 300 | |
---|
| 301 | g=9.81 |
---|
| 302 | culvert_slope=0.01 # Downward |
---|
| 303 | |
---|
| 304 | inlet_depth=1.401 |
---|
| 305 | outlet_depth=1.00 |
---|
| 306 | |
---|
| 307 | culvert_length=4.0 |
---|
| 308 | culvert_width=0.75 |
---|
| 309 | culvert_height=0.75 |
---|
| 310 | |
---|
| 311 | culvert_type='pipe' |
---|
| 312 | manning=0.013 |
---|
| 313 | sum_loss=1.5 |
---|
| 314 | |
---|
| 315 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 316 | z_in = 0.0 |
---|
| 317 | z_out = -culvert_length*culvert_slope/100 |
---|
| 318 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 319 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 320 | delta_total_energy = E_in-E_out |
---|
| 321 | |
---|
| 322 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 323 | outlet_depth, |
---|
| 324 | inlet_specific_energy, |
---|
| 325 | delta_total_energy, |
---|
| 326 | g, |
---|
| 327 | culvert_length, |
---|
| 328 | culvert_width, |
---|
| 329 | culvert_height, |
---|
| 330 | culvert_type, |
---|
| 331 | manning, |
---|
| 332 | sum_loss) |
---|
| 333 | |
---|
| 334 | print Q, v, d |
---|
| 335 | assert num.allclose(Q, 1.00, rtol=1.0e-2) #inflow |
---|
| 336 | assert num.allclose(v, 2.204, rtol=1.0e-2) #outflow velocity |
---|
| 337 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 338 | |
---|
| 339 | |
---|
| 340 | def Xtest_boyd_6(self): |
---|
| 341 | """test_boyd_5 |
---|
| 342 | |
---|
| 343 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 344 | """ |
---|
| 345 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 346 | |
---|
| 347 | g=9.81 |
---|
| 348 | culvert_slope=0.01 # Downward |
---|
| 349 | |
---|
| 350 | inlet_depth=12.747 |
---|
| 351 | outlet_depth=1.00 |
---|
| 352 | |
---|
| 353 | culvert_length=4.0 |
---|
| 354 | culvert_width=0.75 |
---|
| 355 | culvert_height=0.75 |
---|
| 356 | |
---|
| 357 | culvert_type='pipe' |
---|
| 358 | manning=0.013 |
---|
| 359 | sum_loss=1.5 |
---|
| 360 | |
---|
| 361 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 362 | z_in = 0.0 |
---|
| 363 | z_out = -culvert_length*culvert_slope/100 |
---|
| 364 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 365 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 366 | delta_total_energy = E_in-E_out |
---|
| 367 | |
---|
| 368 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 369 | outlet_depth, |
---|
| 370 | inlet_specific_energy, |
---|
| 371 | delta_total_energy, |
---|
| 372 | g, |
---|
| 373 | culvert_length, |
---|
| 374 | culvert_width, |
---|
| 375 | culvert_height, |
---|
| 376 | culvert_type, |
---|
| 377 | manning, |
---|
| 378 | sum_loss) |
---|
| 379 | |
---|
| 380 | print Q, v, d |
---|
| 381 | assert num.allclose(Q, 5.00, rtol=1.0e-2) #inflow |
---|
| 382 | assert num.allclose(v, 11.022, rtol=1.0e-2) #outflow velocity |
---|
| 383 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 384 | |
---|
| 385 | |
---|
| 386 | def Xtest_boyd_7(self): |
---|
| 387 | """test_boyd_7 |
---|
| 388 | |
---|
| 389 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 390 | """ |
---|
| 391 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 392 | |
---|
| 393 | g=9.81 |
---|
| 394 | culvert_slope=0.1 # Downward |
---|
| 395 | |
---|
| 396 | inlet_depth=0.303 |
---|
| 397 | outlet_depth=0.00 |
---|
| 398 | |
---|
| 399 | culvert_length=4.0 |
---|
| 400 | culvert_width=0.75 |
---|
| 401 | culvert_height=0.75 |
---|
| 402 | |
---|
| 403 | culvert_type='pipe' |
---|
| 404 | manning=0.013 |
---|
| 405 | sum_loss=1.5 |
---|
| 406 | |
---|
| 407 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 408 | z_in = 0.0 |
---|
| 409 | z_out = -culvert_length*culvert_slope/100 |
---|
| 410 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 411 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 412 | delta_total_energy = E_in-E_out |
---|
| 413 | |
---|
| 414 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 415 | outlet_depth, |
---|
| 416 | inlet_specific_energy, |
---|
| 417 | delta_total_energy, |
---|
| 418 | g, |
---|
| 419 | culvert_length, |
---|
| 420 | culvert_width, |
---|
| 421 | culvert_height, |
---|
| 422 | culvert_type, |
---|
| 423 | manning, |
---|
| 424 | sum_loss) |
---|
| 425 | |
---|
| 426 | print Q, v, d |
---|
| 427 | assert num.allclose(Q, 0.10, rtol=1.0e-2) #inflow |
---|
| 428 | assert num.allclose(v, 1.13, rtol=1.0e-2) #outflow velocity |
---|
| 429 | assert num.allclose(d, 0.19, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 430 | |
---|
| 431 | |
---|
| 432 | def Xtest_boyd_8(self): |
---|
| 433 | """test_boyd_8 |
---|
| 434 | |
---|
| 435 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 436 | """ |
---|
| 437 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 438 | |
---|
| 439 | g=9.81 |
---|
| 440 | culvert_slope=0.1 # Downward |
---|
| 441 | |
---|
| 442 | inlet_depth=1.135 |
---|
| 443 | outlet_depth=0.00 |
---|
| 444 | |
---|
| 445 | culvert_length=4.0 |
---|
| 446 | culvert_width=0.75 |
---|
| 447 | culvert_height=0.75 |
---|
| 448 | |
---|
| 449 | culvert_type='pipe' |
---|
| 450 | manning=0.013 |
---|
| 451 | sum_loss=1.5 |
---|
| 452 | |
---|
| 453 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 454 | z_in = 0.0 |
---|
| 455 | z_out = -culvert_length*culvert_slope/100 |
---|
| 456 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 457 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 458 | delta_total_energy = E_in-E_out |
---|
| 459 | |
---|
| 460 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 461 | outlet_depth, |
---|
| 462 | inlet_specific_energy, |
---|
| 463 | delta_total_energy, |
---|
| 464 | g, |
---|
| 465 | culvert_length, |
---|
| 466 | culvert_width, |
---|
| 467 | culvert_height, |
---|
| 468 | culvert_type, |
---|
| 469 | manning, |
---|
| 470 | sum_loss) |
---|
| 471 | |
---|
| 472 | print Q, v, d |
---|
| 473 | assert num.allclose(Q, 1.00, rtol=1.0e-2) #inflow |
---|
| 474 | assert num.allclose(v, 2.204, rtol=1.0e-2) #outflow velocity |
---|
| 475 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 476 | |
---|
| 477 | def Xtest_boyd_9(self): |
---|
| 478 | """test_boyd_9 |
---|
| 479 | |
---|
| 480 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 481 | """ |
---|
| 482 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 483 | |
---|
| 484 | g=9.81 |
---|
| 485 | culvert_slope=0.1 # Downward |
---|
| 486 | |
---|
| 487 | inlet_depth=1.1504 |
---|
| 488 | outlet_depth=1.5 |
---|
| 489 | |
---|
| 490 | culvert_length=4.0 |
---|
| 491 | culvert_width=0.75 |
---|
| 492 | culvert_height=0.75 |
---|
| 493 | |
---|
| 494 | culvert_type='pipe' |
---|
| 495 | manning=0.013 |
---|
| 496 | sum_loss=1.5 |
---|
| 497 | |
---|
| 498 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 499 | z_in = 0.0 |
---|
| 500 | z_out = -culvert_length*culvert_slope/100 |
---|
| 501 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 502 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 503 | delta_total_energy = E_in-E_out |
---|
| 504 | |
---|
| 505 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 506 | outlet_depth, |
---|
| 507 | inlet_specific_energy, |
---|
| 508 | delta_total_energy, |
---|
| 509 | g, |
---|
| 510 | culvert_length, |
---|
| 511 | culvert_width, |
---|
| 512 | culvert_height, |
---|
| 513 | culvert_type, |
---|
| 514 | manning, |
---|
| 515 | sum_loss) |
---|
| 516 | |
---|
| 517 | print Q, v, d |
---|
| 518 | assert num.allclose(Q, 0.10, rtol=1.0e-2) #inflow |
---|
| 519 | assert num.allclose(v, 0.22, rtol=1.0e-2) #outflow velocity |
---|
| 520 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
| 521 | |
---|
| 522 | |
---|
| 523 | def Xtest_boyd_10(self): |
---|
| 524 | """test_boyd_9 |
---|
| 525 | |
---|
| 526 | This tests the Boyd routine with data obtained from ??? by Petar Milevski |
---|
| 527 | """ |
---|
| 528 | # FIXME(Ole): This test fails (20 Feb 2009) |
---|
| 529 | |
---|
| 530 | g=9.81 |
---|
| 531 | culvert_slope=0.1 # Downward |
---|
| 532 | |
---|
| 533 | inlet_depth=1.901 |
---|
| 534 | outlet_depth=1.5 |
---|
| 535 | |
---|
| 536 | culvert_length=4.0 |
---|
| 537 | culvert_width=0.75 |
---|
| 538 | culvert_height=0.75 |
---|
| 539 | |
---|
| 540 | culvert_type='pipe' |
---|
| 541 | manning=0.013 |
---|
| 542 | sum_loss=1.5 |
---|
| 543 | |
---|
| 544 | inlet_specific_energy=inlet_depth #+0.5*v**2/g |
---|
| 545 | z_in = 0.0 |
---|
| 546 | z_out = -culvert_length*culvert_slope/100 |
---|
| 547 | E_in = z_in+inlet_depth #+ 0.5*v**2/g |
---|
| 548 | E_out = z_out+outlet_depth #+ 0.5*v**2/g |
---|
| 549 | delta_total_energy = E_in-E_out |
---|
| 550 | |
---|
| 551 | Q, v, d = boyd_generalised_culvert_model(inlet_depth, |
---|
| 552 | outlet_depth, |
---|
| 553 | inlet_specific_energy, |
---|
| 554 | delta_total_energy, |
---|
| 555 | g, |
---|
| 556 | culvert_length, |
---|
| 557 | culvert_width, |
---|
| 558 | culvert_height, |
---|
| 559 | culvert_type, |
---|
| 560 | manning, |
---|
| 561 | sum_loss) |
---|
| 562 | |
---|
| 563 | print Q, v, d |
---|
| 564 | assert num.allclose(Q, 1.00, rtol=1.0e-2) #inflow |
---|
| 565 | assert num.allclose(v, 2.204, rtol=1.0e-2) #outflow velocity |
---|
| 566 | assert num.allclose(d, 0.76, rtol=1.0e-2) #depth at outlet used to calc v |
---|
[6553] | 567 | |
---|
| 568 | |
---|
| 569 | #------------------------------------------------------------- |
---|
| 570 | if __name__ == "__main__": |
---|
| 571 | suite = unittest.makeSuite(Test_culvert_routines, 'test') |
---|
| 572 | runner = unittest.TextTestRunner() |
---|
| 573 | runner.run(suite) |
---|
| 574 | |
---|