"""Create mesh for Jon Hinwoods wave flume """ from anuga.pmesh.mesh import * from anuga.coordinate_transforms.geo_reference import Geo_reference xslope = 5.0 # Distance between the boundary and the start of the slope def generate(mesh_filename, slope, maximum_triangle_area=0.01): """ Generate mesh for Monash University wave generation flume. Origin of x coordinate is the toe of the beach, x measured positive shorewards. """ #Basic geometry global xslope xleft = slope['xleft'][0] xtoe = slope['xtoe'][0] xbeach = slope['xbeach'][0] xright = slope['xright'][0] ybottom = 0 ytop = 1.00 ###xslope = slope #Outline point_sw = [xleft, ybottom] point_se = [xright, ybottom] point_nw = [xleft, ytop] point_ne = [xright, ytop] # 1st slope seperation (middle) point_toe_top = [xtoe, ytop] point_toe_bottom = [xtoe, ybottom] # 2nd slope seperation (middle) point_beach_top = [xbeach, ytop] point_beach_bottom = [xbeach, ybottom] m = Mesh() #Boundary points = [point_sw, #se point_nw, point_toe_top, # 2 point_beach_top, # 3 point_ne, point_se, point_beach_bottom, # 6 point_toe_bottom # 7 ] segments = [ [0,1], [1,2], [2,3], [3,4], [4,5], [5,6], [6,7], [7,0], #The outer border [2,7], # toe separator [3,6] # _beach separator ] segment_tags = {'wall':[1,2,3,4,5,6,7], 'wave':[0]} # '':[6] m.add_points_and_segments(points, segments, segment_tags) # dam = m.add_region(xslope - 0.0000001,(ytop - ybottom)/2) # # this is the location of the reservoir region. # dam.setTag("flat") # slope = m.add_region(xslope + 0.0000001,(ytop - ybottom)/2) # # this is the location of the slope region. # slope.setTag("slope") m.generate_mesh(maximum_triangle_area=maximum_triangle_area) m.export_mesh_file(mesh_filename) print "mesh created" #------------------------------------------------------------- if __name__ == "__main__": generate("aa.tsh")