def CurvedPlate(ncirc=2, nlong=20, show_plot=False): """Creates custom mesh for plate with curved edges ncirc discretisation around circular fillets nlong discretisation along the length - X """ mesh_arc = Mesh() mesh_arc.Arc(element_type="quad", nrad=ncirc, ncirc=ncirc, radius=5) mesh_arc1 = deepcopy(mesh_arc) mesh_arc1.points[:, 1] += 15 mesh_arc1.points[:, 0] += 95 mesh_arc2 = deepcopy(mesh_arc) mesh_arc2.points[:, 1] += 15 mesh_arc2.points[:, 0] *= -1. mesh_arc2.points[:, 0] += 5. mesh_plate1 = Mesh() mesh_plate1.Rectangle(element_type="quad", lower_left_point=(5, 15), upper_right_point=(95, 20), ny=ncirc, nx=nlong) mesh_plate2 = deepcopy(mesh_plate1) mesh_plate2.points[:, 1] -= 5. mesh_square1 = Mesh() mesh_square1.Square(element_type="quad", lower_left_point=(0, 10), side_length=5, nx=ncirc, ny=ncirc) mesh_square2 = deepcopy(mesh_square1) mesh_square2.points[:, 0] += 95 mesh = mesh_plate1 + mesh_plate2 + mesh_arc1 + mesh_arc2 + mesh_square1 + mesh_square2 mesh.Extrude(length=0.5, nlong=1) mesh2 = deepcopy(mesh) mesh2.points[:, 2] += 0.5 mesh += mesh2 if show_plot: mesh.SimplePlot() return mesh
def HarvesterPatch(ndisc=20, nradial=4, show_plot=False): """Creates a custom mesh for an energy harvester patch. [Not to be modified] ndisc: [int] number of discretisation in c ndradial: [int] number of discretisation in radial directions for different components of harevester """ center = np.array([30.6979, 20.5]) p1 = np.array([30., 20.]) p2 = np.array([30., 21.]) p1line = p1 - center p2line = p2 - center radius = np.linalg.norm(p1line) pp = np.array([center[0], center[1] + radius]) y_line = pp - center start_angle = -np.pi / 2. - np.arccos( np.linalg.norm(y_line * p1line) / np.linalg.norm(y_line) / np.linalg.norm(p1line)) end_angle = np.pi / 2. + np.arccos( np.linalg.norm(y_line * p1line) / np.linalg.norm(y_line) / np.linalg.norm(p1line)) points = np.array([p1, p2, center]) # nradial = 4 mesh = Mesh() mesh.Arc(element_type="quad", radius=radius, start_angle=start_angle, end_angle=end_angle, nrad=nradial, ncirc=ndisc, center=(center[0], center[1]), refinement=True) mesh1 = Mesh() mesh1.Triangle(element_type="quad", npoints=nradial, c1=totuple(center), c2=totuple(p1), c3=totuple(p2)) mesh += mesh1 mesh_patch = Mesh() mesh_patch.HollowArc(ncirc=ndisc, nrad=nradial, center=(-7.818181, 44.22727272), start_angle=np.arctan(44.22727272 / -7.818181), end_angle=np.arctan(-24.22727272 / 37.818181), element_type="quad", inner_radius=43.9129782, outer_radius=44.9129782) mesh3 = Mesh() mesh3.Triangle(element_type="quad", npoints=nradial, c2=totuple(p1), c3=totuple(p2), c1=(mesh_patch.points[0, 0], mesh_patch.points[0, 1])) mesh += mesh3 mesh += mesh_patch mesh.Extrude(nlong=ndisc, length=40) if show_plot: mesh.SimplePlot() return mesh