Changeset 212 for inundation/ga/storm_surge/pyvolution/shallow_water.py
- Timestamp:
- Aug 24, 2004, 4:11:25 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/shallow_water.py
r209 r212 33 33 self.minimum_allowed_height = minimum_allowed_height 34 34 35 35 self.forcing_terms.append(gravity) 36 self.forcing_terms.append(manning_friction) 36 37 37 38 … … 280 281 raise 'Unknown order' 281 282 283 #Compute edge values 284 for name in domain.conserved_quantities: 285 Q = domain.quantities[name] 286 Q.interpolate_from_vertices_to_edges() 287 288 282 289 def protect_against_infinitesimal_heights_centroid(domain): 283 290 """Adjust height and momentum at centroid if height is less than … … 333 340 Q = domain.quantities[name] 334 341 Q.extrapolate_first_order() 335 Q.interpolate_from_vertices_to_edges() 342 336 343 337 344 … … 419 426 """ 420 427 421 #FIXME: first and second order migh merge 422 423 from Numeric import minimum, maximum 424 428 #FIXME: first and second order might merge 429 425 430 #Update conserved quantities using straight second order 426 431 for name in domain.conserved_quantities: 427 432 Q = domain.quantities[name] 428 429 433 Q.extrapolate_second_order() 430 Q.limiter() 431 Q.interpolate_from_vertices_to_edges() 434 Q.limit() 432 435 433 436 … … 469 472 470 473 471 hmin = min imum( hv[k, :] )474 hmin = min( hv[k, :] ) 472 475 473 476 #Create alpha in [0,1], where alpha==0 means using shallow … … 500 503 # from extrapolator xmomv and ymomv (deep). 501 504 502 503 ##f##or i in range(3):504 ##### xmomv[k,i] = (1-alpha)*xmomc[k] + alpha*xmomv[k,i];505 506 505 xmomv[k,:] = (1-alpha)*xmomc[k] + alpha*xmomv[k,:]; 507 506 … … 512 511 hc = wc-zc 513 512 for k in range(domain.number_of_elements): 514 hmax = max imum(hv[k,:])515 516 if hmax < minimum_allowed_height:513 hmax = max(hv[k,:]) 514 515 if hmax < domain.minimum_allowed_height: 517 516 #Reset negative heights to bed elevation 518 517 if hc[k] < 0.0: 519 518 wc[k] = zc[k] 520 ###hc[k] = 0.0521 519 for i in range(3): 522 520 if hv[k,i] < 0.0: 523 521 wv[k,i] = zv[k,i] 524 ##hv0 = 0.0;}525 522 526 523 … … 569 566 ######################### 570 567 #Standard forcing terms: 571 568 # 572 569 def gravity(domain): 573 570 """Implement forcing function for bed slope working with … … 629 626 630 627 628 ########################### 629 class Constant_height: 630 """Set an initial condition with constant water height, e.g 631 stage s = z+h 632 """ 633 634 #FIXME: Rethink this way of creating values. 635 636 def __init__(self, W, h): 637 self.W = W 638 self.h = h 639 640 def __call__(self, x, y): 641 if self.W is None: 642 from Numeric import ones, Float 643 return self.h*ones(len(x), Float) 644 else: 645 return self.W(x,y) + self.h 646 647 648 631 649 ############################################## 632 650 #Initialise module
Note: See TracChangeset
for help on using the changeset viewer.