Version 3 (modified by hudson, 7 years ago)


Screenshot of internal boundary demo.

Buildings, Bridges and Dams

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.

The demo code can be found within demos/, part of which is reproduced here:

length = 50
width = 10
resolution = 0.15 # make this number smaller to make the simulation more accurate

# Create the "world" as a long, skinny channel
boundary_poly = poly_from_box(0, length, 0, width)

# Place 3 buildings downstream
building_polys = [  poly_from_box(10, 15, 2.5, 7.5),        # upstream box
                    poly_from_box(22.5, 27.5, 1.5, 6.5),    # middle box
                    poly_from_box(35, 40, 3.5, 8.5)]        # downstream box

# create a domain mesh, with 3 building holes in it
domain = anuga.create_domain_from_regions(boundary_poly,
                                            boundary_tags={'left': [0],
                                                   'bottom': [1],
                                                   'right': [2],
                                                   'top': [3]},
                                            maximum_triangle_area = resolution,
                                            mesh_filename = 'building.msh',
                                            interior_holes = building_polys,
                                            use_cache=True, # to speed it up
                                            verbose=True)   # log output on

Note the new parameter to create_domain_from_regions:

interior_holes = building_polys

This lets you specify a list of polygons to be cut out of the mesh.

The internal boundaries have their own boundary tag: exterior which can be set just like any other boundary.