[5093] | 1 | """Create mesh for near shore PMD |
---|
| 2 | """ |
---|
| 3 | |
---|
| 4 | from anuga.pmesh.mesh_interface import create_mesh_from_regions |
---|
[5154] | 5 | from anuga.coordinate_transforms.geo_reference import Geo_reference |
---|
[5093] | 6 | |
---|
| 7 | xslope = 5.0 # Distance between the boundary ande the start of the slope |
---|
| 8 | |
---|
| 9 | |
---|
[5095] | 10 | def generate(mesh_filename, maximum_triangle_area=300000, thinner=False): |
---|
[5093] | 11 | """ |
---|
| 12 | """ |
---|
| 13 | # Basic geometry and bounding polygon |
---|
| 14 | xleft = -100 # Beach |
---|
[5154] | 15 | xleft = 8000 # looking at the first 2 km of wave travel |
---|
[5093] | 16 | xright = 10000 # wave generated here |
---|
[5095] | 17 | if thinner: |
---|
[5154] | 18 | ytop = 500 |
---|
| 19 | ybottom = -500 |
---|
[5095] | 20 | else: |
---|
| 21 | ytop = 2000 |
---|
| 22 | ybottom = -2000 |
---|
| 23 | |
---|
[5093] | 24 | |
---|
| 25 | point_sw = [xleft, ybottom] |
---|
| 26 | point_se = [xright, ybottom] |
---|
| 27 | point_nw = [xleft, ytop] |
---|
| 28 | point_ne = [xright, ytop] |
---|
| 29 | |
---|
| 30 | bounding_polygon = [point_se, |
---|
| 31 | point_ne, |
---|
| 32 | point_nw, |
---|
| 33 | point_sw] |
---|
| 34 | |
---|
| 35 | # local refinement |
---|
| 36 | xleft = -80 |
---|
[5095] | 37 | xright = 2000 |
---|
| 38 | if thinner: |
---|
[5154] | 39 | ytop = 450 |
---|
| 40 | ybottom = -450 |
---|
[5095] | 41 | else: |
---|
| 42 | ytop = 1000 |
---|
| 43 | ybottom = -1000 |
---|
[5093] | 44 | |
---|
| 45 | point_sw = [xleft, ybottom] |
---|
| 46 | point_se = [xright, ybottom] |
---|
| 47 | point_nw = [xleft, ytop] |
---|
| 48 | point_ne = [xright, ytop] |
---|
| 49 | |
---|
| 50 | polygon_2 = [point_se, |
---|
| 51 | point_ne, |
---|
| 52 | point_nw, |
---|
| 53 | point_sw] |
---|
| 54 | |
---|
[5095] | 55 | interior_regions = [[polygon_2, maximum_triangle_area/2.]] |
---|
[5093] | 56 | |
---|
| 57 | m = create_mesh_from_regions(bounding_polygon, |
---|
| 58 | boundary_tags={'wall': [1, 2, 3], |
---|
| 59 | 'wave': [0]}, |
---|
| 60 | maximum_triangle_area=maximum_triangle_area, |
---|
[5154] | 61 | #interior_regions=interior_regions, |
---|
| 62 | mesh_geo_reference=Geo_reference(), |
---|
[5093] | 63 | filename=mesh_filename, |
---|
| 64 | verbose=True) |
---|
| 65 | print "mesh created" |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | #------------------------------------------------------------- |
---|
| 69 | if __name__ == "__main__": |
---|
[5095] | 70 | generate("aa.tsh", thinner=True) |
---|