source: anuga_work/development/near_shore_PMD/create_mesh.py @ 7840

Last change on this file since 7840 was 5154, checked in by duncan, 16 years ago

commiting most recent dir

File size: 2.0 KB
Line 
1"""Create mesh for near shore PMD
2"""
3
4from anuga.pmesh.mesh_interface import create_mesh_from_regions
5from anuga.coordinate_transforms.geo_reference import Geo_reference
6
7xslope = 5.0 # Distance between the boundary ande the start of the slope
8
9
10def generate(mesh_filename, maximum_triangle_area=300000, thinner=False):
11    """
12    """
13    # Basic geometry and bounding polygon
14    xleft   = -100  # Beach
15    xleft   = 8000  # looking at the first 2 km of wave travel
16    xright  = 10000  # wave generated here
17    if thinner:
18        ytop    = 500
19        ybottom = -500
20    else:
21        ytop    = 2000
22        ybottom = -2000
23       
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
37    xright  = 2000
38    if thinner:
39        ytop    = 450
40        ybottom = -450
41    else:
42        ytop    = 1000
43        ybottom = -1000
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
55    interior_regions = [[polygon_2, maximum_triangle_area/2.]]
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,
61                                 #interior_regions=interior_regions,
62                                 mesh_geo_reference=Geo_reference(),
63                                 filename=mesh_filename,
64                                 verbose=True)
65    print "mesh created"
66
67   
68#-------------------------------------------------------------
69if __name__ == "__main__":
70    generate("aa.tsh", thinner=True)
Note: See TracBrowser for help on using the repository browser.