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

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

commiting most recent dir

File size: 2.0 KB
RevLine 
[5093]1"""Create mesh for near shore PMD
2"""
3
4from anuga.pmesh.mesh_interface import create_mesh_from_regions
[5154]5from anuga.coordinate_transforms.geo_reference import Geo_reference
[5093]6
7xslope = 5.0 # Distance between the boundary ande the start of the slope
8
9
[5095]10def 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#-------------------------------------------------------------
69if __name__ == "__main__":
[5095]70    generate("aa.tsh", thinner=True)
Note: See TracBrowser for help on using the repository browser.