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