anuga.size_field_from_regions
- anuga.size_field_from_regions(bounding_polygon, regions, maximum_triangle_area, grade=0.5, cellsize=None, poly_geo_reference=None, max_cells=20000000)[source]
Build a graded
Size_fieldfrom polygons and resolutions.Takes the same
(polygon, maximum area)list asinterior_regions, but the polygons only say where the mesh should be fine: none of their segments enter the mesh. They may therefore touch, overlap, have sharp corners or reach outside the bounding polygon. Where they overlap, the finest one wins.The target edge length
h_kof each region holds inside it and grows away from it atgrademetres per metre,h(x) = min( h_max, min over regions k of h_k + grade*dist(x, k) )
with
h_maxthe edge length ofmaximum_triangle_area. Edge lengths are those of the equilateral triangle of the given area.- Parameters:
bounding_polygon (list of points) – Outline of the domain; the raster covers its bounding box.
regions (list of (polygon, maximum area) tuples) – Regions to refine, as for
interior_regions.maximum_triangle_area (float) – Target area away from all regions.
grade (float, optional) – Growth of the target edge length per unit distance from a region. Smaller is smoother and costs more triangles. 0 gives an ungraded field, stepping at the region outlines, which is not recommended (see
Size_field). Default 0.5.cellsize (float, optional) – Raster cell size. Defaults to the smallest target edge length, enlarged if needed to keep the raster under
max_cellscells.poly_geo_reference (Geo_reference, optional) – Geo reference of the polygons. If None they are absolute.
max_cells (int, optional) – Limit on the raster size when
cellsizeis not given.
- Return type: