Ignore:
Timestamp:
Aug 26, 2004, 10:14:19 PM (20 years ago)
Author:
ole
Message:

Finally quashed bug where ymomentum wasn't updated in
second order limiter

File:
1 edited

Legend:

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

    r221 r229  
    273273def distribute_to_vertices_and_edges(domain):
    274274
    275     #print 'Calling distrib within SW'
     275    ##print 'Calling distrib within SW'
    276276    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)       
    277280        protect_against_infinitesimal_heights_centroid(domain)       
    278281        extrapolate_first_order(domain)
    279282    elif domain.order == 2:
    280         protect_against_negative_heights_centroid(domain)       
     283        #protect_against_negative_heights_centroid(domain)       
    281284        extrapolate_second_order(domain)       
    282285    else:
     
    323326    """
    324327
    325     #FIXME: USed only in second order
     328   
    326329    #Water levels at centroids
    327330    wc = domain.quantities['level'].centroid_values
     
    428431        #Update water levels
    429432        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           
    434439       
    435440def extrapolate_second_order(domain):
     
    462467        Q = domain.quantities[name]
    463468        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]     
    464479        Q.limit()
    465480
    466481 
     482    #print 'y1', Q.vertex_values[1,:]   #OK   
     483     
    467484    #Water levels at centroids
    468485    wc = domain.quantities['level'].centroid_values
     
    507524        #first order scheme and alpha==1 means using the limited
    508525        #second order scheme for the stage w
    509         #If hmin < 0 then alpha=0 reverrting to first order.
     526        #If hmin < 0 then alpha=0 reverting to first order.
    510527     
    511528        if z_range > 0.0:
     
    513530        else:
    514531            alpha = 1.0
    515 
     532   
     533        ##if k==1: print 'alpha', alpha #OK
     534       
    516535        #Update water levels
    517536        #  (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           
    538560    #Finally, protect against infinitesimal heights and high speeds
    539561    #Water depths at vertices
Note: See TracChangeset for help on using the changeset viewer.