Changeset 274 for inundation/ga/storm_surge/pyvolution/shallow_water.py
- Timestamp:
- Sep 6, 2004, 1:57:41 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r273 r274 386 386 387 387 def distribute_to_vertices_and_edges(domain): 388 389 protect_against_infintesimal_and_negative_heights(domain) 390 if domain.order == 1: 391 extrapolate_first_order(domain) 392 elif domain.order == 2: 393 extrapolate_second_order(domain) 394 else: 395 raise 'Unknown order' 396 397 #Compute edge values 388 """Distribution from centroids to vertices specific to the 389 shallow water wave 390 equation. 391 392 It will ensure that h (w-z) is always non-negative even in the 393 presence of steep bed-slopes by taking a weighted average between shallow 394 and deep cases. 395 396 In addition, all conserved quantities get distributed as per either a 397 constant (order==1) or a piecewise linear function (order==2). 398 399 FIXME: more explanation about removal of artificial variability etc 400 401 Precondition: 402 All quantities defined at centroids and bed elevation defined at 403 vertices. 404 405 Postcondition 406 Conserved quantities defined at vertices 407 408 """ 409 410 #Remove very thin layers of water 411 protect_against_infintesimal_and_negative_heights(domain) 412 413 #Extrapolate all conserved quantities 414 for name in domain.conserved_quantities: 415 Q = domain.quantities[name] 416 if domain.order == 1: 417 Q.extrapolate_first_order() 418 elif domain.order == 2: 419 Q.extrapolate_second_order() 420 Q.limit() 421 else: 422 raise 'Unknown order' 423 424 #Take bed slevation into account when heights are small 425 balance_deep_and_shallow(domain) 426 427 #Compute edge values by interpolation 398 428 for name in domain.conserved_quantities: 399 429 Q = domain.quantities[name] 400 430 Q.interpolate_from_vertices_to_edges() 401 431 402 #domain.w.interpolate_from_vertices_to_edges()403 #domain.uh.interpolate_from_vertices_to_edges()404 #domain.vh.interpolate_from_vertices_to_edges()405 432 406 433 … … 443 470 protect(domain.minimum_allowed_height, wc, zc, xmomc, ymomc) 444 471 445 446 447 def extrapolate_first_order(domain):448 """First order extrapolator function, specific449 to the shallow water wave equation.450 451 It will ensure that h (w-z) is always non-negative even in the452 presence of steep bed-slopes (see comment in code)453 In addition, momemtums get distributed as constant values.454 455 Precondition:456 All quantities defined at centroids and bed elevation defined at457 vertices.458 459 Postcondition460 Conserved quantities defined at vertices461 """462 463 #Shortcuts464 wc = domain.quantities['level'].centroid_values465 zc = domain.quantities['elevation'].centroid_values466 xmomc = domain.quantities['xmomentum'].centroid_values467 ymomc = domain.quantities['ymomentum'].centroid_values468 hc = wc - zc #Water depths at centroids469 470 471 #Update conserved quantities using straight first order472 for name in domain.conserved_quantities:473 Q = domain.quantities[name]474 Q.extrapolate_first_order()475 476 477 478 479 balance_deep_and_shallow(domain)480 481 482 483 484 485 def extrapolate_second_order(domain):486 """Second order limiter function, specific to the shallow water wave487 equation.488 489 It will ensure that h (w-z) is always non-negative even in the490 presence of steep bed-slopes (see comment in code)491 492 A weighted average between shallow493 and deep cases is as in the first order case.494 495 In addition, all conserved quantities get distributed as per a496 piecewise linear function.497 FIXME: more explanation about removal of artificial variability etc498 499 Precondition:500 All quantities defined at centroids and bed elevation defined at501 vertices.502 503 Postcondition504 Conserved quantities defined at vertices505 506 """507 508 509 #Update conserved quantities using straight second order with limiter510 for name in domain.conserved_quantities:511 Q = domain.quantities[name]512 Q.extrapolate_second_order()513 Q.limit()514 515 balance_deep_and_shallow(domain)516 517 472 518 473 def balance_deep_and_shallow(domain):
Note: See TracChangeset
for help on using the changeset viewer.