Changeset 2648 for inundation/pyvolution/shallow_water.py
- Timestamp:
- Mar 31, 2006, 6:21:26 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/shallow_water.py
r2620 r2648 83 83 from config import minimum_allowed_height, maximum_allowed_speed, g 84 84 self.minimum_allowed_height = minimum_allowed_height 85 self.maximum_allowed_speed = maximum_allowed_speed 85 self.maximum_allowed_speed = maximum_allowed_speed 86 86 self.g = g 87 87 88 89 self.forcing_terms.append(manning_friction) 88 90 self.forcing_terms.append(gravity) 89 self.forcing_terms.append(manning_friction)90 91 91 92 #Realtime visualisation … … 108 109 self.quantities_to_be_stored = ['stage','xmomentum','ymomentum'] 109 110 110 111 111 112 def set_quantities_to_be_stored(self, q): 112 113 """Specify which quantities will be stored in the sww file. … … 118 119 119 120 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) 121 122 If q is None, storage will be switched off altogether. 122 123 """ … … 124 125 125 126 if q is None: 126 self.quantities_to_be_stored = [] 127 self.quantities_to_be_stored = [] 127 128 self.store = False 128 129 return … … 131 132 q = [q] # Turn argument into a list 132 133 133 #Check correcness 134 #Check correcness 134 135 for quantity_name in q: 135 136 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 138 139 self.quantities_to_be_stored = q 139 140 140 141 141 142 def initialise_visualiser(self,scale_z=1.0,rect=None): … … 224 225 yieldstep = None, 225 226 finaltime = None, 226 duration = None, 227 duration = None, 227 228 skip_initial_step = False): 228 229 """Specialisation of basic evolve method from parent class … … 670 671 hc = wc - zc #Water depths at centroids 671 672 672 #Update 673 #Update 673 674 #FIXME: Modify accroditg to c-version - or discard altogether. 674 675 for k in range(domain.number_of_elements): … … 695 696 from shallow_water_ext import protect 696 697 697 protect(domain.minimum_allowed_height, domain.maximum_allowed_speed, 698 protect(domain.minimum_allowed_height, domain.maximum_allowed_speed, 698 699 domain.epsilon, wc, zc, xmomc, ymomc) 699 700 … … 1183 1184 1184 1185 1185 def manning_friction_ c(domain):1186 def manning_friction_implicit_c(domain): 1186 1187 """Wrapper for c version 1187 1188 """ … … 1200 1201 xmom_update = xmom.semi_implicit_update 1201 1202 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 1212 def 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 1202 1228 1203 1229 N = domain.number_of_elements … … 1791 1817 extrapolate_second_order_sw=extrapolate_second_order_sw_c 1792 1818 gravity = gravity_c 1793 manning_friction = manning_friction_ c1819 manning_friction = manning_friction_implicit_c 1794 1820 h_limiter = h_limiter_c 1795 1821 balance_deep_and_shallow = balance_deep_and_shallow_c
Note: See TracChangeset
for help on using the changeset viewer.