Changeset 5666
- Timestamp:
- Aug 18, 2008, 5:43:46 PM (16 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/domain.py
r5631 r5666 1194 1194 """ 1195 1195 1196 # Compute fluxes across each element edge1196 # Compute fluxes across each element edge 1197 1197 self.compute_fluxes() 1198 1198 1199 # Update timestep to fit yieldstep and finaltime1199 # Update timestep to fit yieldstep and finaltime 1200 1200 self.update_timestep(yieldstep, finaltime) 1201 1201 1202 # Update conserved quantities1202 # Update conserved quantities 1203 1203 self.update_conserved_quantities() 1204 1204 1205 # update ghosts1205 # Update ghosts 1206 1206 self.update_ghosts() 1207 1207 1208 # Update vertex and edge values1208 # Update vertex and edge values 1209 1209 self.distribute_to_vertices_and_edges() 1210 1210 1211 # Update boundary values1211 # Update boundary values 1212 1212 self.update_boundary() 1213 1213 1214 # Update time1214 # Update time 1215 1215 self.time += self.timestep 1216 1216 … … 1224 1224 """ 1225 1225 1226 # Save initial initial conserved quantities values1226 # Save initial initial conserved quantities values 1227 1227 self.backup_conserved_quantities() 1228 1228 1229 1229 #-------------------------------------- 1230 # First euler step1230 # First euler step 1231 1231 #-------------------------------------- 1232 1232 1233 # Compute fluxes across each element edge1233 # Compute fluxes across each element edge 1234 1234 self.compute_fluxes() 1235 1235 1236 # Update timestep to fit yieldstep and finaltime1236 # Update timestep to fit yieldstep and finaltime 1237 1237 self.update_timestep(yieldstep, finaltime) 1238 1238 1239 # Update conserved quantities1239 # Update conserved quantities 1240 1240 self.update_conserved_quantities() 1241 1241 1242 # update ghosts1242 # Update ghosts 1243 1243 self.update_ghosts() 1244 1244 1245 # Update vertex and edge values1245 # Update vertex and edge values 1246 1246 self.distribute_to_vertices_and_edges() 1247 1247 1248 # Update boundary values1248 # Update boundary values 1249 1249 self.update_boundary() 1250 1250 1251 # Update time1251 # Update time 1252 1252 self.time += self.timestep 1253 1253 1254 1254 #------------------------------------ 1255 # Second Euler step1255 # Second Euler step 1256 1256 #------------------------------------ 1257 1257 1258 # Compute fluxes across each element edge1258 # Compute fluxes across each element edge 1259 1259 self.compute_fluxes() 1260 1260 1261 # Update conserved quantities1261 # Update conserved quantities 1262 1262 self.update_conserved_quantities() 1263 1263 1264 1264 #------------------------------------ 1265 # Combine initial and final values1266 # of conserved quantities and cleanup1265 # Combine initial and final values 1266 # of conserved quantities and cleanup 1267 1267 #------------------------------------ 1268 #combine steps 1268 1269 # Combine steps 1269 1270 self.saxpy_conserved_quantities(0.5, 0.5) 1270 1271 1271 # update ghosts1272 # Update ghosts 1272 1273 self.update_ghosts() 1273 1274 1274 # Update vertex and edge values1275 # Update vertex and edge values 1275 1276 self.distribute_to_vertices_and_edges() 1276 1277 1277 # Update boundary values1278 # Update boundary values 1278 1279 self.update_boundary() 1279 1280 … … 1287 1288 """ 1288 1289 1289 # Save initial initial conserved quantities values1290 # Save initial initial conserved quantities values 1290 1291 self.backup_conserved_quantities() 1291 1292 … … 1293 1294 1294 1295 #-------------------------------------- 1295 # First euler step1296 # First euler step 1296 1297 #-------------------------------------- 1297 1298 1298 # Compute fluxes across each element edge1299 # Compute fluxes across each element edge 1299 1300 self.compute_fluxes() 1300 1301 1301 # Update timestep to fit yieldstep and finaltime1302 # Update timestep to fit yieldstep and finaltime 1302 1303 self.update_timestep(yieldstep, finaltime) 1303 1304 1304 # Update conserved quantities1305 # Update conserved quantities 1305 1306 self.update_conserved_quantities() 1306 1307 1307 # update ghosts1308 # Update ghosts 1308 1309 self.update_ghosts() 1309 1310 1310 # Update vertex and edge values1311 # Update vertex and edge values 1311 1312 self.distribute_to_vertices_and_edges() 1312 1313 1313 # Update boundary values1314 # Update boundary values 1314 1315 self.update_boundary() 1315 1316 1316 # Update time1317 # Update time 1317 1318 self.time += self.timestep 1318 1319 1319 1320 #------------------------------------ 1320 # Second Euler step1321 # Second Euler step 1321 1322 #------------------------------------ 1322 1323 1323 # Compute fluxes across each element edge1324 # Compute fluxes across each element edge 1324 1325 self.compute_fluxes() 1325 1326 1326 # Update conserved quantities1327 # Update conserved quantities 1327 1328 self.update_conserved_quantities() 1328 1329 … … 1332 1333 #------------------------------------ 1333 1334 1334 # combine steps1335 # Combine steps 1335 1336 self.saxpy_conserved_quantities(0.25, 0.75) 1336 1337 1337 # update ghosts1338 # Update ghosts 1338 1339 self.update_ghosts() 1339 1340 1340 # Update vertex and edge values1341 # Update vertex and edge values 1341 1342 self.distribute_to_vertices_and_edges() 1342 1343 1343 # Update boundary values1344 # Update boundary values 1344 1345 self.update_boundary() 1345 1346 1346 # set substep time1347 # Set substep time 1347 1348 self.time = initial_time + self.timestep*0.5 1348 1349 1349 1350 #------------------------------------ 1350 # Third Euler step1351 # Third Euler step 1351 1352 #------------------------------------ 1352 1353 1353 # Compute fluxes across each element edge1354 # Compute fluxes across each element edge 1354 1355 self.compute_fluxes() 1355 1356 1356 # Update conserved quantities1357 # Update conserved quantities 1357 1358 self.update_conserved_quantities() 1358 1359 1359 1360 #------------------------------------ 1360 # Combine final and initial values1361 # and cleanup1361 # Combine final and initial values 1362 # and cleanup 1362 1363 #------------------------------------ 1363 #combine steps 1364 1365 # Combine steps 1364 1366 self.saxpy_conserved_quantities(2.0/3.0, 1.0/3.0) 1365 1367 1366 # update ghosts1368 # Update ghosts 1367 1369 self.update_ghosts() 1368 1370 1369 # Update vertex and edge values1371 # Update vertex and edge values 1370 1372 self.distribute_to_vertices_and_edges() 1371 1373 1372 # Update boundary values1374 # Update boundary values 1373 1375 self.update_boundary() 1374 1376 1375 # set new time1377 # Set new time 1376 1378 self.time = initial_time + self.timestep 1377 1379 -
anuga_core/source/anuga/abstract_2d_finite_volumes/generic_boundary_conditions.py
r5657 r5666 269 269 msg = 'Keyword argument default_boundary must be either None ' 270 270 msg += 'or a boundary object.\n I got %s' %(str(default_boundary)) 271 assert default_boundary is None or isinstance(default_boundary, Boundary), msg 271 assert default_boundary is None or\ 272 isinstance(default_boundary, Boundary), msg 272 273 self.default_boundary = default_boundary 273 274 self.default_boundary_invoked = False # Flag … … 321 322 i = self.boundary_indices[ vol_id, edge_id ] 322 323 323 324 #res = self.F(t, point_id = i)325 324 try: 326 res = self.F(t, point_id = i) 327 except (Modeltime_too_late, Modeltime_too_early), e: 325 res = self.F(t, point_id=i) 326 except Modeltime_too_early, e: 327 raise Modeltime_too_early, e 328 except Modeltime_too_late, e: 328 329 if self.default_boundary is None: 329 330 raise Exception, e # Reraise exception 330 331 else: 332 # Pass control to default boundary 333 res = self.default_boundary.evaluate(vol_id, edge_id) 334 331 335 if self.default_boundary_invoked is False: 332 336 # Issue warning the first time 333 337 msg = '%s' %str(e) 334 msg += 'Instead I will us ingthe default boundary: %s\n'\338 msg += 'Instead I will use the default boundary: %s\n'\ 335 339 %str(self.default_boundary) 336 340 msg += 'Note: Further warnings will be supressed' … … 342 346 self.default_boundary_invoked = True 343 347 344 # Pass control to default boundary 345 res = self.default_boundary.evaluate(vol_id, edge_id) 348 346 349 347 350 … … 371 374 return res 372 375 else: 373 # raise 'Boundary call without point_id not implemented' 376 msg = 'Boundary call without point_id not implemented.\n' 377 msg += 'vol_id=%s, edge_id=%s' %(str(vol_id), str(edge_id)) 378 raise Exception, msg 374 379 # FIXME: What should the semantics be? 375 return self.F(t)380 #return self.F(t) 376 381 377 382 -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_generic_boundary_conditions.py
r5657 r5666 101 101 102 102 103 def test_fileboundary_time_only(self):103 def NOtest_fileboundary_time_only(self): 104 104 """Test that boundary values can be read from file and interpolated 105 105 This is using the .tms file format … … 109 109 file_function using the sts format 110 110 """ 111 111 #FIXME (Ole): This test was disabled 18 August 2008 as no 112 # need for this was found. Rather I implemented an Exception 113 # to catch possible errors in the model setup 114 112 115 from domain import Domain 113 116 from quantity import Quantity
Note: See TracChangeset
for help on using the changeset viewer.