Changeset 229 for inundation/ga/storm_surge/pyvolution/shallow_water.py
- Timestamp:
- Aug 26, 2004, 10:14:19 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r221 r229 273 273 def distribute_to_vertices_and_edges(domain): 274 274 275 # print 'Calling distrib within SW'275 ##print 'Calling distrib within SW' 276 276 if domain.order == 1: 277 #FIXME: This should be cleaned up, but we try to follow 278 #pyvolution 2 strictly for now 279 protect_against_negative_heights_centroid(domain) 277 280 protect_against_infinitesimal_heights_centroid(domain) 278 281 extrapolate_first_order(domain) 279 282 elif domain.order == 2: 280 protect_against_negative_heights_centroid(domain)283 #protect_against_negative_heights_centroid(domain) 281 284 extrapolate_second_order(domain) 282 285 else: … … 323 326 """ 324 327 325 #FIXME: USed only in second order328 326 329 #Water levels at centroids 327 330 wc = domain.quantities['level'].centroid_values … … 428 431 #Update water levels 429 432 for i in range(3): 430 #wv[k,i] = zv[k,i] + hc[k] + alpha*(zc[k]-zv[k,i]) 431 wv[k,i] = zv[k,i] + hc[k] + alpha*(hv[k,i]-hc[k]) 432 433 433 #FIXME: Use the original first-order one first, then switch 434 wv[k,i] = zv[k,i] + hc[k] + alpha*(zc[k]-zv[k,i]) 435 #wv[k,i] = zv[k,i] + hc[k] + alpha*(hv[k,i]-hc[k]) 436 437 #FIXME: What about alpha weighting of momentum?? 438 434 439 435 440 def extrapolate_second_order(domain): … … 462 467 Q = domain.quantities[name] 463 468 Q.extrapolate_second_order() 469 470 #print 'y1', Q.vertex_values[1,:] #OK 471 472 #FIXME - like pyvolution 2 ....................... 473 protect_against_negative_heights_centroid(domain) 474 475 #print 'y1', Q.vertex_values[1,:] #OK 476 477 for name in domain.conserved_quantities: 478 Q = domain.quantities[name] 464 479 Q.limit() 465 480 466 481 482 #print 'y1', Q.vertex_values[1,:] #OK 483 467 484 #Water levels at centroids 468 485 wc = domain.quantities['level'].centroid_values … … 507 524 #first order scheme and alpha==1 means using the limited 508 525 #second order scheme for the stage w 509 #If hmin < 0 then alpha=0 rever rting to first order.526 #If hmin < 0 then alpha=0 reverting to first order. 510 527 511 528 if z_range > 0.0: … … 513 530 else: 514 531 alpha = 1.0 515 532 533 ##if k==1: print 'alpha', alpha #OK 534 516 535 #Update water levels 517 536 # (1-alpha)*(zvi+hc) + alpha*(zvi+hvi) = 518 # zvi + hc + alpha*(hvi - hc) 519 for i in range(3): 520 wv[k,i] = zv[k,i] + hc[k] + alpha*(hv[k,i]-hc[k]) 521 522 523 #Momentums at centroids 524 xmomc = domain.quantities['xmomentum'].centroid_values 525 ymomc = domain.quantities['ymomentum'].centroid_values 526 527 #Momentums at vertices 528 xmomv = domain.quantities['xmomentum'].vertex_values 529 ymomv = domain.quantities['ymomentum'].vertex_values 530 531 # Update momentum as a linear combination of 532 # xmomc and ymomc (shallow) and momentum 533 # from extrapolator xmomv and ymomv (deep). 534 535 xmomv[k,:] = (1-alpha)*xmomc[k] + alpha*xmomv[k,:]; 536 537 537 # zvi + hc + alpha*(hvi - hc) 538 if alpha < 1: 539 for i in range(3): 540 wv[k,i] = zv[k,i] + hc[k] + alpha*(hv[k,i]-hc[k]) 541 542 543 #Momentums at centroids 544 xmomc = domain.quantities['xmomentum'].centroid_values 545 ymomc = domain.quantities['ymomentum'].centroid_values 546 547 #Momentums at vertices 548 xmomv = domain.quantities['xmomentum'].vertex_values 549 ymomv = domain.quantities['ymomentum'].vertex_values 550 551 # Update momentum as a linear combination of 552 # xmomc and ymomc (shallow) and momentum 553 # from extrapolator xmomv and ymomv (deep). 554 555 xmomv[k,:] = (1-alpha)*xmomc[k] + alpha*xmomv[k,:]; 556 ymomv[k,:] = (1-alpha)*ymomc[k] + alpha*ymomv[k,:]; 557 558 #print 'y1', Q.vertex_values[1,:] #OK 559 538 560 #Finally, protect against infinitesimal heights and high speeds 539 561 #Water depths at vertices
Note: See TracChangeset
for help on using the changeset viewer.