Ignore:
Timestamp:
Sep 1, 2004, 6:31:42 PM (20 years ago)
Author:
ole
Message:
 
File:
1 edited

Legend:

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

    r263 r266  
    474474
    475475def balance_deep_and_shallow(domain):
    476     """Compute linear combination between stage as computed by gradient-limiters and
    477     stage computed as constant height above bed.
    478     The former takes precedence when heights are large compared to the bed slope while the latter
    479     takes precedence when heights are relatively small.
    480     Anything in between is computed as a balanced linear combination in order to avoid numerical
    481     disturbances which would otherwise appear as a result of hard switching between modes.
     476    """Compute linear combination between stage as computed by
     477    gradient-limiters and stage computed as constant height above bed.
     478    The former takes precedence when heights are large compared to the
     479    bed slope while the latter takes precedence when heights are
     480    relatively small.  Anything in between is computed as a balanced
     481    linear combination in order to avoid numerical disturbances which
     482    would otherwise appear as a result of hard switching between
     483    modes.
    482484    """
    483485   
     
    553555            ymomv[k,:] = (1-alpha)*ymomc[k] + alpha*ymomv[k,:];                     
    554556           
     557
     558def balance_deep_and_shallow_c(domain):
     559    """Wrapper for C implementation
     560    """
     561   
     562    #Shortcuts
     563    wc = domain.quantities['level'].centroid_values
     564    zc = domain.quantities['elevation'].centroid_values
     565    hc = wc - zc
     566   
     567    wv = domain.quantities['level'].vertex_values
     568    zv = domain.quantities['elevation'].vertex_values
     569    hv = wv-zv
     570
     571    #Momentums at centroids
     572    xmomc = domain.quantities['xmomentum'].centroid_values
     573    ymomc = domain.quantities['ymomentum'].centroid_values       
     574
     575    #Momentums at vertices
     576    xmomv = domain.quantities['xmomentum'].vertex_values
     577    ymomv = domain.quantities['ymomentum'].vertex_values         
     578
     579   
     580
     581    from shallow_water_ext import balance_deep_and_shallow
     582    balance_deep_and_shallow(domain.number_of_elements,
     583                             wc, zc, wv, zv, hv,
     584                             xmomc, ymomc, xmomv, ymomv)
     585
    555586   
    556587
     
    954985    gravity = gravity_c
    955986    manning_friction = manning_friction_c
    956    
     987    #balance_deep_and_shallow = balance_deep_and_shallow_c
    957988   
    958989    #distribute_to_vertices_and_edges = distribute_to_vertices_and_edges_c
Note: See TracChangeset for help on using the changeset viewer.