"""Create mesh for lwru2 validation of the Oshiri island tsunami """ from anuga.pmesh.mesh import * from anuga.coordinate_transforms.geo_reference import Geo_reference def generate(mesh_filename, gate_position, is_course = False): #Basic geometry xright = gate_position ybottom = 0 ytop = 0.4 xdam = 0.0 xleft = gate_position - 3.0 #Outline point_sw = [xleft, ybottom] point_se = [xright, ybottom] point_nw = [xleft, ytop] point_ne = [xright, ytop] # Dam seperation (left) point_dam_top = [xdam, ytop] point_dam_bottom = [xdam, ybottom] m = Mesh() #Boundary points = [point_sw, #se point_nw, point_dam_top, point_ne, point_se, point_dam_bottom ] segments = [[0,1], [1,2], [2,3], [3,4 ],[4,5], [5,0], #The outer border [2,5]] #dam Separator segment_tags = {'wall':[0,1,2,4,5],'edge':[3]} # '':[6] m.add_points_and_segments(points, segments, segment_tags) dam = m.add_region(-0.0000001,(ytop - ybottom)/2) # this is the location of the region. dam.setTag("dam") if is_course: m.generate_mesh(maximum_triangle_area=0.01) else: m.generate_mesh(maximum_triangle_area=0.001) m.export_mesh_file(mesh_filename) print "mesh created" #------------------------------------------------------------- if __name__ == "__main__": generate("aa.tsh", 0.75, 3.0, is_course = True)