Creating a Domain
The first step in running an ANUGA model is to create a domain. This is done by creating a mesh and then creating a domain from that mesh.
rectangular_cross_domain
The domain (mesh) can be created in a number of ways. The simplest way is to
create a simple rectangular
domain using the rectangular_cross_domain() function.
For instance the following code creates a 1m by 1m rectangular domain, with a 10 by 10 mesh, with the bottom left corner at (0,0).
domain = anuga.rectangular_cross_domain(10, 10)
See the rectangular_cross_domain() API for the full argument list, and the
Simple Script Example or
Simple Notebook Example for worked examples.
create_domain_from_regions
The usual method for creating a domain for practical problems is to create a
domain by defining a boundary polygon and then a set of regions within the domain to
define area of different refinement levels and holes in the domain.
This is done using the create_domain_from_regions()
function.
The regions are defined by a list of polygons. Each polygon is defined by a list of points. The most important polygon is the boundary polygon. This is the outer polygon that defines the boundary of the domain. The segments of the boundary need to be tagged with boundary tags which will allow different boundary conditions to be applied to different segments.
Other polygons are the interior polygons that define the regions within the domain. These other polygons can be used to define regions with different refinement levels and holes in the domain.
The following example creates a domain with a rectangular boundary 20m by 10m with boundary tags on the 4 sides of the rectangle, and the mesh having a maximum triangle area of 0.2 m^2.
import anuga
bounding_polygon = [[0.0, 0.0],
[20.0, 0.0],
[20.0, 10.0],
[0.0, 10.0]]
boundary_tags={'bottom': [0],
'right': [1],
'top': [2],
'left': [3]}
domain = anuga.create_domain_from_regions(bounding_polygon,
boundary_tags,
maximum_triangle_area = 0.2,
)
See the create_domain_from_regions() API for the full argument list, and the
Simple Example using Create from Regions for a worked example.
See also
- Choosing a Flow Algorithm
How to choose between DE0, DE1, DE_ader2, and DE2 — trade-offs between cost, accuracy, and robustness.
- Coordinate Reference Systems
How to attach a coordinate reference system (UTM zone, national grid, or arbitrary local CRS) to a domain via
Geo_reference.- ANUGA User Manual — Chapter 7: The Domain
Covers domain construction in depth, including mesh generation from polygon regions, geo-referencing, flow algorithm choices, and domain attributes.
See also
Domain — full API of the domain-creation functions
(rectangular_cross_domain, create_domain_from_regions) and the
Domain methods.