Mesh9#

Meshing of a perforated plate with a structured mesh.

Mesh9
Mesh9
============= Init GMSH interface =============
/home/docs/checkouts/readthedocs.org/user_builds/easyfea/envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:946: PyVistaDeprecationWarning:
../../../../envs/v1.5.5/lib/python3.11/site-packages/EasyFEA/utilities/PyVista.py:946: Arguments 'pointa', 'pointb', 'center' must be passed as keyword arguments to function 'CircularArc'.
From version 0.50, passing these as positional arguments will result in a TypeError.
  return pv.CircularArc(
Meshing with gmsh (1.869 ms)
Construct mesh object (24.426 ms)

Element type: QUAD4
Ne = 200, Nn = 240, dof = 480

 12 from EasyFEA import Display, np, Mesher, ElemType, PyVista
 13 from EasyFEA.Geoms import Point, Circle, Points, Line, CircleArc, Contour
 14
 15 if __name__ == "__main__":
 16     dim = 2
 17
 18     if dim == 2:
 19         elemType = ElemType.QUAD4
 20     else:
 21         elemType = ElemType.HEXA8
 22
 23     Display.Clear()
 24
 25     # ----------------------------------------------
 26     # Geom
 27     # ----------------------------------------------
 28     H = 90
 29     L = 45
 30     D = 10
 31     e = 20
 32
 33     N = 5
 34     mS = (np.pi / 4 * D / 2) / N
 35
 36     # PI for Points
 37     # pi for gmsh points
 38     PC = Point(L / 2, H / 2, 0)
 39     circle = Circle(PC, D, mS)
 40
 41     P1 = Point()
 42     P2 = Point(L, 0)
 43     P3 = Point(L, H)
 44     P4 = Point(0, H)
 45     contour1 = Points(
 46         [
 47             (P3 + P2) / 2,
 48             P3,
 49             (P3 + P4) / 2,
 50             P4,
 51             (P4 + P1) / 2,
 52             P1,
 53             (P1 + P2) / 2,
 54             P2,
 55             (P3 + P2) / 2,
 56         ],
 57         mS,
 58     )
 59
 60     # ----------------------------------------------
 61     # Mesh
 62     # ----------------------------------------------
 63     mesher = Mesher(False, True, True)
 64     factory = mesher._factory
 65
 66     contours1: list[Contour] = []
 67
 68     for c in range(4):
 69         pc = circle.center
 70         contour = circle.Get_Contour()
 71         pc1 = contour.geoms[c].pt1
 72         pc2 = contour.geoms[c].pt2
 73         pc3 = contour.geoms[c].pt3
 74
 75         p1, p2, p3 = contour1.points[c * 2 : c * 2 + 3]
 76
 77         cont1 = Contour(
 78             [Line(pc1, p1), Line(p1, p2), Line(p2, pc3), CircleArc(pc3, pc1, pc)]
 79         )
 80         loop1, lines1, points1 = mesher._Loop_From_Geom(cont1)
 81
 82         cont2 = Contour(
 83             [Line(pc3, p2), Line(p2, p3), Line(p3, pc2), CircleArc(pc2, pc3, pc)]
 84         )
 85         loop2, lines2, points2 = mesher._Loop_From_Geom(cont2)
 86
 87         surf1 = factory.addSurfaceFilling(loop1)
 88         surf2 = factory.addSurfaceFilling(loop2)
 89
 90         mesher._Surfaces_Organize([surf1, surf2], elemType, True, [N] * 4)
 91
 92         contours1.extend([cont1, cont2])
 93
 94     PyVista.Plot_Geoms(contours1).show()
 95
 96     if dim == 3:
 97         for cont1 in contours1:
 98             cont2 = cont1.copy()
 99             cont2.Translate(dz=e)
100             # cont2.rotate(np.pi/8, PC.coordo)
101             mesher._Link_Contours(cont1, cont2, elemType, 3, [N] * 4)
102
103     mesher._Set_PhysicalGroups()
104
105     mesher._Mesh_Generate(dim, elemType)
106
107     mesh = mesher._Mesh_Get_Mesh()
108
109     if len(mesh.orphanNodes) > 0:
110         plotter = PyVista.Plot_Nodes(mesh, mesh.orphanNodes)
111         plotter.add_title("Orphan nodes detected")
112         plotter.show()
113
114     PyVista.Plot_Mesh(mesh).show()

Total running time of the script: (0 minutes 0.905 seconds)

Gallery generated by Sphinx-Gallery