Changeset 4713
- Timestamp:
- Sep 10, 2007, 4:09:23 PM (18 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r4712 r4713 208 208 self.min_timestep = self.max_timestep = 0.0 209 209 self.starttime = 0 #Physical starttime if any (0 is 1 Jan 1970 00:00:00) 210 self.timestep = 0.0 211 self.flux_timestep = 0.0 210 212 211 213 # Monitoring … … 242 244 243 245 244 def set_default_order(self, n): 245 """Set default (spatial) order to either 1 or 2 246 """ 247 248 msg = 'Default order must be either 1 or 2. I got %s' %n 249 assert n in [1,2], msg 250 251 self.default_order = n 252 self._order_ = self.default_order 246 253 247 254 248 … … 295 289 296 290 return self.time 291 292 def set_default_order(self, n): 293 """Set default (spatial) order to either 1 or 2 294 """ 295 296 msg = 'Default order must be either 1 or 2. I got %s' %n 297 assert n in [1,2], msg 298 299 self.default_order = n 300 self._order_ = self.default_order 301 297 302 298 303 def set_quantity_vertices_dict(self, quantity_dict): … … 964 969 def set_timestepping_method(self,timestepping_method): 965 970 966 if timestepping_method in ['euler', 'rk2' ]:971 if timestepping_method in ['euler', 'rk2', 'rk3']: 967 972 self.timestepping_method = timestepping_method 968 973 return … … 1113 1118 1114 1119 elif self.get_timestepping_method() == 'rk2': 1115 self.evolve_one_rk2_step(yieldstep,finaltime) 1116 1120 self.evolve_one_rk2_step(yieldstep,finaltime) 1121 1122 elif self.get_timestepping_method() == 'rk3': 1123 self.evolve_one_rk3_step(yieldstep,finaltime) 1124 1117 1125 # Update extrema if necessary (for reporting) 1118 1126 self.update_extrema() … … 1183 1191 1184 1192 1185 def evolve_one_rk2_step(self, yieldstep, finaltime):1193 def evolve_one_rk2_step(self, yieldstep, finaltime): 1186 1194 """One 2nd order RK timestep""" 1187 1195 … … 1226 1234 #------------------------------------ 1227 1235 #Combine initial and final values 1228 #of conserved quantities 1236 #of conserved quantities and cleanup 1229 1237 #------------------------------------ 1230 1238 #combine steps 1231 1239 self.saxpy_conserved_quantities(0.5, 0.5) 1240 1241 #update ghosts 1242 self.update_ghosts() 1243 1244 #Update vertex and edge values 1245 self.distribute_to_vertices_and_edges() 1246 1247 #Update boundary values 1248 self.update_boundary() 1249 1250 1251 1252 def evolve_one_rk3_step(self, yieldstep, finaltime): 1253 """One 2nd order RK timestep""" 1254 1255 1256 1257 #Save initial initial conserved quantities values 1258 self.backup_conserved_quantities() 1259 1260 initial_time = self.time 1261 1262 #-------------------------------------- 1263 #First euler step 1264 #-------------------------------------- 1265 1266 #Compute fluxes across each element edge 1267 self.compute_fluxes() 1268 1269 #Update timestep to fit yieldstep and finaltime 1270 self.update_timestep(yieldstep, finaltime) 1271 1272 #Update conserved quantities 1273 self.update_conserved_quantities() 1274 1275 #update ghosts 1276 self.update_ghosts() 1277 1278 #Update vertex and edge values 1279 self.distribute_to_vertices_and_edges() 1280 1281 #Update boundary values 1282 self.update_boundary() 1283 1284 #Update time 1285 self.time += self.timestep 1232 1286 1233 1287 #------------------------------------ 1234 # Clean up rkstep1288 #Second Euler step 1235 1289 #------------------------------------ 1236 1290 1291 #Compute fluxes across each element edge 1292 self.compute_fluxes() 1293 1294 #Update conserved quantities 1295 self.update_conserved_quantities() 1296 1297 #------------------------------------ 1298 #Combine final and initial values 1299 #of conserved quantities and cleanup 1300 #------------------------------------ 1301 #combine steps 1302 self.saxpy_conserved_quantities(0.25, 0.75) 1303 1237 1304 #update ghosts 1238 1305 self.update_ghosts() … … 1243 1310 #Update boundary values 1244 1311 self.update_boundary() 1312 1313 #set substep time 1314 self.time = initial_time + self.timestep*0.5 1315 1316 #------------------------------------ 1317 #Third Euler step 1318 #------------------------------------ 1319 1320 #Compute fluxes across each element edge 1321 self.compute_fluxes() 1322 1323 #Update conserved quantities 1324 self.update_conserved_quantities() 1325 1326 #------------------------------------ 1327 #Combine final and initial values 1328 #of conserved quantities and cleanup 1329 #------------------------------------ 1330 #combine steps 1331 self.saxpy_conserved_quantities(2.0/3.0, 1.0/3.0) 1332 1333 #update ghosts 1334 self.update_ghosts() 1335 1336 #Update vertex and edge values 1337 self.distribute_to_vertices_and_edges() 1338 1339 #Update boundary values 1340 self.update_boundary() 1341 1342 #set substep time 1343 self.time = initial_time + self.timestep 1344 1345 1245 1346 1246 1347 … … 1344 1445 # self.timestep is calculated from speed of characteristics 1345 1446 # Apply CFL condition here 1346 timestep = min(self.CFL*self. timestep, max_timestep)1447 timestep = min(self.CFL*self.flux_timestep, max_timestep) 1347 1448 1348 1449 #Record maximal and minimal values of timestep for reporting -
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r4712 r4713 824 824 825 825 826 domain. timestep = timestep826 domain.flux_timestep = timestep 827 827 828 828 #MH090605 The following method belongs to the shallow_water domain class … … 875 875 compute_fluxes_ext_central as compute_fluxes_ext 876 876 877 domain. timestep = compute_fluxes_ext(timestep, domain.epsilon,877 domain.flux_timestep = compute_fluxes_ext(timestep, domain.epsilon, 878 878 domain.H0, 879 879 domain.g, -
anuga_work/development/demos/netherlands.py
r4539 r4713 83 83 N = 130 #size = 33800 84 84 N = 600 #Size = 720000 85 N = 5085 N = 100 86 86 87 87 … … 97 97 domain.check_integrity() 98 98 99 domain.set_timestepping_method('rk3') 100 domain.set_default_order(2) 101 99 102 #Setup order and all the beta's for the limiters (these should become defaults 100 domain.default_order = 2101 domain.beta_w = 1.0102 domain.beta_w_dry = 0.2103 domain.beta_uh = 1.0104 domain.beta_uh_dry = 0.2105 domain.beta_vh = 1.0106 domain.beta_vh_dry = 0.2107 103 108 domain.alpha_balance = 100.0 104 ## domain.beta_w = 1.0 105 ## domain.beta_w_dry = 0.2 106 ## domain.beta_uh = 1.0 107 ## domain.beta_uh_dry = 0.2 108 ## domain.beta_vh = 1.0 109 ## domain.beta_vh_dry = 0.2 110 111 ## domain.alpha_balance = 100.0 109 112 110 113 #Output params … … 117 120 #Set bed-slope and friction 118 121 inflow_stage = 0.5 119 manning = 0.0 3122 manning = 0.0 120 123 Z = Weir(inflow_stage) 121 124 … … 186 189 187 190 188 v .join()191 vis.join()
Note: See TracChangeset
for help on using the changeset viewer.