.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/LinearizedElasticity/Elas7.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_LinearizedElasticity_Elas7.py: Elas7 ===== Control lever for a molding machine used to blow plastic bottles. References ---------- This example comes from: * A French research article: `MMC et RDM comparées sur un cas de dimensionnement de levier `_ * The book: `Mécanique des systèmes et des milieux déformables `_ (3rd edition) .. GENERATED FROM PYTHON SOURCE LINES 20-158 .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas7_001.png :alt: Elas7 :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas7_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.9.1/docs/examples/LinearizedElasticity/images/sphx_glr_Elas7_001.vtksz .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas7_002.png :alt: Elas7 :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas7_002.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/docs/checkouts/readthedocs.org/user_builds/easyfea/checkouts/v1.9.1/docs/examples/LinearizedElasticity/images/sphx_glr_Elas7_002.vtksz .. rst-class:: sphx-glr-script-out .. code-block:: none ==================== Mesh ==================== Element type: PRISM6 Ne = 6108, Nn = 4315 ==================== Model ==================== Isotropic: E = 2.10e+05, v = 0.25 solver:scipy ============= Boundary Conditions ============= Unspecified. =================== Results =================== W def = 615.59 Svm max = 43.45 Evm max = 0.03 % Ux max = 2.07e-02 Ux min = -2.05e-02 Uy max = 1.98e-03 Uy min = -1.13e-01 Uz max = 4.60e-04 Uz min = -4.60e-04 =================== TicTac =================== Mesh: 179.866 ms Boundary Conditions: 96.321 µs Matrix: 257.163 ms Solver: 1.723 s PostProcessing: 5.475 ms Generate paraview 1/5 (20.00 %) 91.40 ms Generate paraview 2/5 (40.00 %) 68.57 ms Generate paraview 3/5 (60.00 %) 45.38 ms Generate paraview 4/5 (80.00 %) 22.71 ms Generate paraview 5/5 (100.00 %) 0.00 µs | .. code-block:: Python :lineno-start: 21 import numpy as np from EasyFEA import Display, Folder, Models, ElemType, Simulations, PyVista, Paraview from EasyFEA.Geoms import Points, Point, Circle if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # outputs folder = Folder.Results_Dir() makeMovie = False makeParaview = True # geom dim = 3 thickness = 25 # sinusoidal load F = 13000 # N area = np.pi * 25 / 2 * thickness coefs = np.linspace(0, 1, 5) loads = F * np.sin(np.pi / 2 * coefs) # ---------------------------------------------- # Mesh # ---------------------------------------------- meshSize = 42 / 5 # get the contour pt1 = Point(0, 80) pt2 = Point(-245, 21) pt3 = Point(-245, -21) pt4 = Point(0, -80) pt5 = Point(114, -80) pt6 = Point(114 + 13, -80 + 13) pt7 = Point(114 + 13, -67 / 2) pt8 = Point(114 + 13 + 25, -67 / 2) pt9 = Point(114 + 13 + 25, -34 / 2) pt10 = Point(114 + 13, -34 / 2, r=10) pt11 = Point(114 + 13, 34 / 2, r=10) pt12 = Point(114 + 13 + 25, 34 / 2) pt13 = Point(114 + 13 + 25, 67 / 2) pt14 = Point(114 + 13, 67 / 2) pt15 = Point(114 + 13, 80 - 13) pt16 = Point(114, 80) # fmt: off contour = Points([ pt1, pt2, pt3, pt4, pt5, pt6, pt7, pt8, pt9, pt10, pt11, pt12, pt13, pt14, pt15, pt16, ], meshSize, ) # fmt: on # get circles circle1 = Circle(Point(-220), 25, meshSize) circle2 = Circle(Point(), 25, meshSize) circle3 = Circle(Point(114 + 13 - 25, 80 - 25), 25, meshSize) circle4 = Circle(Point(114 + 13 - 25, -80 + 25), 25, meshSize) circle5 = Circle(Point(67), 84, meshSize) inclusions = [circle1, circle2, circle3, circle4, circle5] # get the mesh if dim == 2: mesh = contour.Mesh_2D(inclusions, ElemType.TRI3) else: mesh = contour.Mesh_Extrude(inclusions, [0, 0, thickness], [4], ElemType.PRISM6) # get loading nodes nodesLoad = mesh.Nodes_Cylinder(circle1) nodesLoad = nodesLoad[mesh.coord[nodesLoad, 1] <= 0] # get fixed nodes nodesCircle2 = mesh.Nodes_Cylinder(circle2) nodesCircle3 = mesh.Nodes_Cylinder(circle3) nodesCircle4 = mesh.Nodes_Cylinder(circle4) fixedNodes = np.concat((nodesCircle2, nodesCircle3, nodesCircle4)) # PyVista.Plot_Mesh(mesh).show() # ---------------------------------------------- # Simulation # ---------------------------------------------- material = Models.Elastic.Isotropic( dim, E=210000, v=0.25, planeStress=True, thickness=thickness ) simu = Simulations.Elastic(mesh, material) fixed = [0] * dim unknowns = simu.Get_unknowns() # loop over the load for load in loads: # Apply boundary conditions simu.Bc_Init() simu.add_dirichlet(fixedNodes, fixed, unknowns) simu.add_surfLoad(nodesLoad, [-load / area], ["y"]) # Solve the simulation simu.Solve() # Save the iteration results simu.Save_Iter() # ---------------------------------------------- # Results # ---------------------------------------------- print(simu) PyVista.Plot_BoundaryConditions(simu).show() PyVista.Plot(simu, "Svm", deformFactor=200, plotMesh=True, nodeValues=False).show() if makeMovie: PyVista.Movie_simu( simu, "Svm", folder, "Svm.gif", deformFactor=200, nodeValues=False, plotMesh=True, ) if makeParaview: Paraview.Save_simu( simu, folder, elementFields=["Svm", "Stress", "Strain", "Wdef_e"] ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.684 seconds) .. _sphx_glr_download_examples_LinearizedElasticity_Elas7.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Elas7.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Elas7.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Elas7.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_