Changeset 2380
- Timestamp:
- Feb 13, 2006, 12:35:15 PM (19 years ago)
- Location:
- inundation/pyvolution
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/domain.py
r2319 r2380 60 60 #FIXME: Maybe have separate orders for h-limiter and w-limiter? 61 61 #Or maybe get rid of order altogether and use beta_w and beta_h 62 self.default_order = 1 63 self.order = self.default_order 62 self.set_default_order(1) 63 #self.default_order = 1 64 #self.order = self.default_order 65 64 66 self.smallsteps = 0 65 67 self.max_smallsteps = max_smallsteps … … 92 94 N=self.number_of_elements 93 95 self.already_computed_flux = zeros((N, 3), Int) 96 97 98 def set_default_order(self, n): 99 """Set default (spatial) order to either 1 or 2 100 """ 101 102 msg = 'Default order must be either 1 or 2. I got %s' %n 103 assert n in [1,2], msg 104 105 self.default_order = n 106 self.order = self.default_order 107 94 108 95 109 #Public interface to Domain … … 197 211 198 212 return self.quantities[name].get_values( location, indices = indices) 213 214 def get_quantity_object(self, name): 215 """Get object for named quantity 216 217 name: Name of quantity 218 """ 219 220 return self.quantities[name] 199 221 200 222 -
inundation/pyvolution/run_profile.py
r1629 r2380 1 1 """Example of shallow water wave equation. 2 2 3 This version is for profiling 4 (The original) 3 This version is for profiling of timestepping 5 4 """ 6 5 7 6 ###################### 8 7 # Module imports 9 # 10 from shallow_water import Domain, Reflective_boundary, Dirichlet_boundary,\ 11 Transmissive_boundary, Time_boundary,\ 12 Weir_simple as Weir, Constant_height 13 8 from shallow_water import Domain, Reflective_boundary 14 9 from mesh_factory import rectangular 15 10 from Numeric import array … … 18 13 ###################### 19 14 # Domain 20 #21 15 22 N = 128 16 #N = 16 #Should take less than 0.1 s 17 #N = 64 #Should take less than 3s 18 N = 128 #Should take less than 20s 19 23 20 24 21 print 'Creating domain' … … 28 25 #Create shallow water domain 29 26 domain = Domain(points, vertices, boundary) 30 domain. default_order = 231 #domain.visualise = True 27 domain.set_default_order(2) 28 domain.set_quantities_to_be_stored(None) 32 29 33 30 34 print 'Field values' 31 print 'Setting initial conditions' 32 35 33 def slope(x, y): 36 34 return -x 37 35 38 36 domain.set_quantity('elevation', slope) 39 domain.set_quantity('friction', 0.3) 37 domain.set_quantity('friction', 0.03) 38 domain.set_quantity('stage', expression = 'elevation + 0.5') 40 39 41 40 42 # Boundary conditions 43 # 41 42 print 'Setting boundary conditions' 44 43 Br = Reflective_boundary(domain) 45 44 domain.set_boundary({'left': Br, 'right': Br, 'bottom': Br, 'top': Br}) 46 45 47 46 48 ###################### 49 #Initial condition 50 domain.set_quantity('stage', Constant_height(slope, 0.3)) 51 47 print 'Checking integrity' 52 48 domain.check_integrity() 53 49 … … 60 56 61 57 s = 'for t in domain.evolve(yieldstep = 0.02, finaltime = 0.2): domain.write_time()' 62 63 58 64 59 -
inundation/pyvolution/run_profile2.py
r1592 r2380 3 3 This version is for profiling 4 4 (The original) 5 6 7 FIXME: This should really measure something else, such as profiling the set up of domains. 5 8 """ 6 9 … … 29 32 domain = Domain(points, vertices, boundary) 30 33 domain.default_order = 2 34 domain.set_quantities_to_be_stored(None) 31 35 #domain.visualise = True 32 36
Note: See TracChangeset
for help on using the changeset viewer.