Changeset 5450 for anuga_core
- Timestamp:
- Jun 30, 2008, 10:41:27 AM (17 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/shallow_water_domain.py
r5442 r5450 1491 1491 verbose=False): 1492 1492 1493 1493 if center is None: 1494 msg = 'I got radius but no center.' 1495 assert radius is None, msg 1496 1497 if radius is None: 1498 msg += 'I got center but no radius.' 1499 assert center is None, msg 1500 1501 1502 1494 1503 from math import pi 1495 1504 … … 1529 1538 # Inlet is circular 1530 1539 1540 inlet_region = 'center=%s, radius=%s' %(self.center, self.radius) 1541 1531 1542 self.exchange_indices = [] 1532 1543 for k in range(N): … … 1537 1548 if self.polygon is not None: 1538 1549 # Inlet is polygon 1550 1551 inlet_region = 'polygon=%s' %(self.polygon) 1552 1539 1553 self.exchange_indices = inside_polygon(points, self.polygon) 1540 1554 1541 1542 1555 1556 if self.exchange_indices is not None: 1557 #print inlet_region 1558 1559 if len(self.exchange_indices) == 0: 1560 msg = 'No triangles have been identified in specified region: %s' %inlet_region 1561 raise Exception, msg 1543 1562 1544 1563 -
anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py
r5442 r5450 2321 2321 2322 2322 2323 2324 2325 def test_inflow_catch_too_few_triangles(self): 2326 """test_inflow_catch_too_few_triangles 2327 2328 Test that exception is thrown if no triangles are covered by the inflow area 2329 """ 2330 from math import pi, cos, sin 2331 2332 a = [0.0, 0.0] 2333 b = [0.0, 2.0] 2334 c = [2.0, 0.0] 2335 d = [0.0, 4.0] 2336 e = [2.0, 2.0] 2337 f = [4.0, 0.0] 2338 2339 points = [a, b, c, d, e, f] 2340 #bac, bce, ecf, dbe 2341 vertices = [ [1,0,2], [1,2,4], [4,2,5], [3,1,4]] 2342 2343 2344 domain = Domain(points, vertices) 2345 2346 # Flat surface with 1m of water 2347 domain.set_quantity('elevation', 0) 2348 domain.set_quantity('stage', 1.0) 2349 domain.set_quantity('friction', 0) 2350 2351 Br = Reflective_boundary(domain) 2352 domain.set_boundary({'exterior': Br}) 2353 2354 # Setup only one forcing term, constant inflow of 2 m^3/s on a circle affecting triangles #0 and #1 (bac and bce) 2355 2356 try: 2357 Inflow(domain, rate=2.0, center=(1,1.1), radius=0.01) 2358 except: 2359 pass 2360 else: 2361 msg = 'Should have raised exception' 2362 raise Exception, msg 2363 2364 2365 2366 2367 2323 2368 2324 2369 #####################################################
Note: See TracChangeset
for help on using the changeset viewer.