Ignore:
Timestamp:
Mar 31, 2006, 6:21:26 PM (18 years ago)
Author:
steve
Message:

Looking at island.py example. I changed the order of the implicit and explicit update (in quantity_ext.c) which I think improved the situation a little. But this has left a few fails in the test_all suite which we need to fix up. Mainly small differences in results.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/shallow_water.py

    r2620 r2648  
    8383        from config import minimum_allowed_height, maximum_allowed_speed, g
    8484        self.minimum_allowed_height = minimum_allowed_height
    85         self.maximum_allowed_speed = maximum_allowed_speed     
     85        self.maximum_allowed_speed = maximum_allowed_speed
    8686        self.g = g
    8787
     88
     89        self.forcing_terms.append(manning_friction)
    8890        self.forcing_terms.append(gravity)
    89         self.forcing_terms.append(manning_friction)
    9091
    9192        #Realtime visualisation
     
    108109        self.quantities_to_be_stored = ['stage','xmomentum','ymomentum']
    109110
    110        
     111
    111112    def set_quantities_to_be_stored(self, q):
    112113        """Specify which quantities will be stored in the sww file.
     
    118119
    119120        In the two first cases, the named quantities will be stored at each yieldstep
    120         (This is in addition to the quantities elevation and friction) 
     121        (This is in addition to the quantities elevation and friction)
    121122        If q is None, storage will be switched off altogether.
    122123        """
     
    124125
    125126        if q is None:
    126             self.quantities_to_be_stored = []           
     127            self.quantities_to_be_stored = []
    127128            self.store = False
    128129            return
     
    131132            q = [q] # Turn argument into a list
    132133
    133         #Check correcness   
     134        #Check correcness
    134135        for quantity_name in q:
    135136            msg = 'Quantity %s is not a valid conserved quantity' %quantity_name
    136             assert quantity_name in self.conserved_quantities, msg 
    137        
     137            assert quantity_name in self.conserved_quantities, msg
     138
    138139        self.quantities_to_be_stored = q
    139        
     140
    140141
    141142    def initialise_visualiser(self,scale_z=1.0,rect=None):
     
    224225               yieldstep = None,
    225226               finaltime = None,
    226                duration = None,               
     227               duration = None,
    227228               skip_initial_step = False):
    228229        """Specialisation of basic evolve method from parent class
     
    670671    hc = wc - zc  #Water depths at centroids
    671672
    672     #Update 
     673    #Update
    673674    #FIXME: Modify accroditg to c-version - or discard altogether.
    674675    for k in range(domain.number_of_elements):
     
    695696    from shallow_water_ext import protect
    696697
    697     protect(domain.minimum_allowed_height, domain.maximum_allowed_speed, 
     698    protect(domain.minimum_allowed_height, domain.maximum_allowed_speed,
    698699            domain.epsilon, wc, zc, xmomc, ymomc)
    699700
     
    11831184
    11841185
    1185 def manning_friction_c(domain):
     1186def manning_friction_implicit_c(domain):
    11861187    """Wrapper for c version
    11871188    """
     
    12001201    xmom_update = xmom.semi_implicit_update
    12011202    ymom_update = ymom.semi_implicit_update
     1203
     1204    N = domain.number_of_elements
     1205    eps = domain.minimum_allowed_height
     1206    g = domain.g
     1207
     1208    from shallow_water_ext import manning_friction
     1209    manning_friction(g, eps, w, z, uh, vh, eta, xmom_update, ymom_update)
     1210
     1211
     1212def manning_friction_explicit_c(domain):
     1213    """Wrapper for c version
     1214    """
     1215
     1216    xmom = domain.quantities['xmomentum']
     1217    ymom = domain.quantities['ymomentum']
     1218
     1219    w = domain.quantities['stage'].centroid_values
     1220    z = domain.quantities['elevation'].centroid_values
     1221
     1222    uh = xmom.centroid_values
     1223    vh = ymom.centroid_values
     1224    eta = domain.quantities['friction'].centroid_values
     1225
     1226    xmom_update = xmom.explicit_update
     1227    ymom_update = ymom.explicit_update
    12021228
    12031229    N = domain.number_of_elements
     
    17911817    extrapolate_second_order_sw=extrapolate_second_order_sw_c
    17921818    gravity = gravity_c
    1793     manning_friction = manning_friction_c
     1819    manning_friction = manning_friction_implicit_c
    17941820    h_limiter = h_limiter_c
    17951821    balance_deep_and_shallow = balance_deep_and_shallow_c
Note: See TracChangeset for help on using the changeset viewer.