Ignore:
Timestamp:
Aug 24, 2004, 4:11:25 PM (21 years ago)
Author:
ole
Message:

Testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/shallow_water.py

    r209 r212  
    3333        self.minimum_allowed_height = minimum_allowed_height
    3434
    35        
     35        self.forcing_terms.append(gravity)
     36        self.forcing_terms.append(manning_friction)
    3637
    3738
     
    280281        raise 'Unknown order'
    281282
     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
    282289def protect_against_infinitesimal_heights_centroid(domain):
    283290    """Adjust height and momentum at centroid if height is less than
     
    333340        Q = domain.quantities[name]
    334341        Q.extrapolate_first_order()
    335         Q.interpolate_from_vertices_to_edges()       
     342
    336343     
    337344 
     
    419426    """
    420427   
    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
    425430    #Update conserved quantities using straight second order
    426431    for name in domain.conserved_quantities:
    427432        Q = domain.quantities[name]
    428 
    429433        Q.extrapolate_second_order()
    430         Q.limiter()
    431         Q.interpolate_from_vertices_to_edges()               
     434        Q.limit()
    432435
    433436 
     
    469472
    470473
    471         hmin = minimum( hv[k, :] )
     474        hmin = min( hv[k, :] )
    472475
    473476        #Create alpha in [0,1], where alpha==0 means using shallow
     
    500503        # from extrapolator xmomv and ymomv (deep).
    501504       
    502 
    503         ##f##or i in range(3):
    504         #####    xmomv[k,i] = (1-alpha)*xmomc[k] + alpha*xmomv[k,i];
    505            
    506505        xmomv[k,:] = (1-alpha)*xmomc[k] + alpha*xmomv[k,:];           
    507506           
     
    512511    hc = wc-zc   
    513512    for k in range(domain.number_of_elements):
    514         hmax = maximum(hv[k,:])
    515        
    516         if hmax < minimum_allowed_height:       
     513        hmax = max(hv[k,:])
     514       
     515        if hmax < domain.minimum_allowed_height:       
    517516            #Reset negative heights to bed elevation       
    518517            if hc[k] < 0.0:
    519518                wc[k] = zc[k]
    520                 ###hc[k] = 0.0
    521519            for i in range(3):   
    522520                if hv[k,i] < 0.0:
    523521                    wv[k,i] = zv[k,i]
    524                     ##hv0 = 0.0;}         
    525522
    526523   
     
    569566#########################
    570567#Standard forcing terms:
    571 
     568#
    572569def gravity(domain):
    573570    """Implement forcing function for bed slope working with
     
    629626           
    630627
     628###########################
     629class 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
    631649##############################################
    632650#Initialise module
Note: See TracChangeset for help on using the changeset viewer.