Changeset 554


Ignore:
Timestamp:
Nov 16, 2004, 2:43:04 PM (20 years ago)
Author:
ole
Message:

Added linear friction term

File:
1 edited

Legend:

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

    r535 r554  
    861861    from shallow_water_ext import manning_friction
    862862    manning_friction(g, eps, w, z, uh, vh, eta, xmom_update, ymom_update)
     863
     864
     865def linear_friction(domain):
     866    """Apply linear friction to water momentum
     867    """
     868
     869    from math import sqrt
     870
     871    w = domain.quantities['level'].centroid_values
     872    z = domain.quantities['elevation'].centroid_values
     873    h = w-z
     874
     875    uh = domain.quantities['xmomentum'].centroid_values
     876    vh = domain.quantities['ymomentum'].centroid_values
     877    eta = domain.quantities['friction'].centroid_values   
     878   
     879    xmom_update = domain.quantities['xmomentum'].semi_implicit_update
     880    ymom_update = domain.quantities['ymomentum'].semi_implicit_update   
     881   
     882    N = domain.number_of_elements
     883    eps = domain.minimum_allowed_height
     884   
     885    for k in range(N):
     886        if eta[k] >= eps:
     887            if h[k] >= eps:
     888                S = -eta[k]/h[k]
     889
     890                #Update momentum
     891                xmom_update[k] += S*uh[k]
     892                ymom_update[k] += S*vh[k]
     893           
     894       
    863895       
    864896
Note: See TracChangeset for help on using the changeset viewer.