Changeset 244
- Timestamp:
- Aug 30, 2004, 5:38:16 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/run_profile.py
r239 r244 31 31 #domain.visualise = True 32 32 domain.newstyle = False #For comparison 33 33 34 34 35 print 'Field values' -
inundation/ga/storm_surge/pyvolution/shallow_water.py
r243 r244 410 410 if not domain.newstyle: 411 411 #Protect against infinitesimal heights and high speeds at_centroid 412 #FIXME: T ry without when using the second balance function412 #FIXME: To be phased out 413 413 414 414 for k in range(domain.number_of_elements): … … 468 468 Q.limit() 469 469 470 471 470 balance_deep_and_shallow(domain) 472 471 473 472 474 473 def balance_deep_and_shallow(domain): 475 #FIXME: Grap math comments from old_first_order_balance....(below) 474 """Compute linear combination between stage as computed by gradient-limiters and 475 stage computed as constant height above bed. 476 The former takes precedence when heights are large compared to the bed slope while the latter 477 takes precedence when heights are relatively small. 478 Anything in between is computed as a balanced linear combination in order to avoid numerical 479 disturbances which would otherwise appear as a result of hard switching between modes. 480 """ 476 481 477 482 #Shortcuts … … 484 489 hv = wv-zv 485 490 491 486 492 #Computed linear combination between constant levels and and 487 493 #levels parallel to the bed elevation. 488 for k in range(domain.number_of_elements): 489 494 for k in range(domain.number_of_elements): 490 495 #Compute maximal variation in bed elevation 491 496 # This quantitiy is … … 494 499 # In the 1d case zc = (z0+z1)/2 495 500 # In the 2d case zc = (z0+z1+z2)/3 496 # 497 498 z_range = max(abs(zv[k,0]-zc[k]), 499 abs(zv[k,1]-zc[k]), 500 abs(zv[k,2]-zc[k])) 501 502 503 hmin = min( hv[k, :] ) 501 502 dz = max(abs(zv[k,0]-zc[k]), 503 abs(zv[k,1]-zc[k]), 504 abs(zv[k,2]-zc[k])) 505 506 507 hmin = min( hv[k,:] ) 504 508 505 509 #Create alpha in [0,1], where alpha==0 means using shallow 506 #first order scheme and alpha==1 means using the limited 507 #second order scheme for the stage w 508 #If hmin < 0 then alpha=0 reverting to first order. 510 #first order scheme and alpha==1 means using the stage w as 511 #computed by the gradient limiter (1st or 2nd order) 512 # 513 #If hmin > dz/2 then alpha = 1 and the bed will have no effect 514 #If hmin < 0 then alpha = 0 reverting to constant height above bed. 509 515 510 if z_range > 0.0: 511 alpha = max( min( 2*hmin/z_range, 1.0), 0.0) 512 else: 516 if dz > 0.0: 517 alpha = max( min( 2*hmin/dz, 1.0), 0.0 ) 518 else: 519 #Flat bed 513 520 alpha = 1.0 514 515 #Update water levels 516 # (1-alpha)*(zvi+hc) + alpha*(zvi+hvi) = 517 # zvi + hc + alpha*(hvi - hc) 521 522 523 #Weighted balance between stage parallel to bed elevation 524 #(wvi = zvi + hc) and stage as computed by 1st or 2nd order gradient limiter 525 #(wvi = zvi + hvi) where i=0,1,2 denotes the vertex ids 526 # 527 #It follows that the updated wvi is 528 # wvi := (1-alpha)*(zvi+hc) + alpha*(zvi+hvi) = 529 # zvi + hc + alpha*(hvi - hc) 530 # 531 #Note that hvi = zc+hc-zvi in the first order case (constant). 532 518 533 if alpha < 1: 519 534 for i in range(3):
Note: See TracChangeset
for help on using the changeset viewer.