| 1 | = Buildings, Bridges and Dams = |
| 2 | |
| 3 | A new feature in ANUGA 1.2 lets you create create arbitrary geometry to represent solid structures. These take the form of holes within the mesh, and can be given arbitrary boundary properties, just like the edges of the domain. |
| 4 | |
| 5 | The demo code can be found within demos/buildings.py, part of which is reproduced here: |
| 6 | |
| 7 | {{{ |
| 8 | length = 50 |
| 9 | width = 10 |
| 10 | resolution = 0.15 # make this number smaller to make the simulation more accurate |
| 11 | |
| 12 | # Create the "world" as a long, skinny channel |
| 13 | boundary_poly = poly_from_box(0, length, 0, width) |
| 14 | |
| 15 | # Place 3 buildings downstream |
| 16 | building_polys = [ poly_from_box(10, 15, 2.5, 7.5), # upstream box |
| 17 | poly_from_box(22.5, 27.5, 1.5, 6.5), # middle box |
| 18 | poly_from_box(35, 40, 3.5, 8.5)] # downstream box |
| 19 | |
| 20 | # create a domain mesh, with 3 building holes in it |
| 21 | domain = anuga.create_domain_from_regions(boundary_poly, |
| 22 | boundary_tags={'left': [0], |
| 23 | 'bottom': [1], |
| 24 | 'right': [2], |
| 25 | 'top': [3]}, |
| 26 | maximum_triangle_area = resolution, |
| 27 | mesh_filename = 'building.msh', |
| 28 | interior_holes = building_polys, |
| 29 | use_cache=True, # to speed it up |
| 30 | verbose=True) # log output on |
| 31 | }}} |
| 32 | |
| 33 | Note the new parameter to create_domain_from_regions: |
| 34 | {{{ |
| 35 | interior_holes = building_polys |
| 36 | }}} |
| 37 | This lets you specify a list of polygons to be cut out of the mesh. |
| 38 | |
| 39 | The internal boundaries have their own boundary tag: |
| 40 | {{{exterior}}} |
| 41 | which can be set just like any other boundary. |
| 42 | |