.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/LinearizedElasticity/Elas3.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_Elas3.py: Elas3 ===== Hydraulic dam subjected to water pressure and its own weight. .. GENERATED FROM PYTHON SOURCE LINES 12-87 .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas3_001.png :alt: TRI6: Ne = 133, Nn = 302 :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas3_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas3_002.png :alt: Boundary conditions :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas3_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/LinearizedElasticity/images/sphx_glr_Elas3_003.png :alt: $\sigma_{vm}$ :srcset: /examples/LinearizedElasticity/images/sphx_glr_Elas3_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none err area = 0.000e+00 ==================== Mesh ==================== Element type: TRI6 Ne = 133, Nn = 302 ==================== Model ==================== Isotropic: E = 1.50e+10, v = 0.25 planeStress = False thickness = 3.60e+02 solver:scipy ============= Boundary Conditions ============= Unspecified. =================== Results =================== W def = 620258634.76 Svm max = 2788891.49 Evm max = 0.02 % Ux max = 2.06e-02 Ux min = 0.00e+00 Uy max = 4.64e-04 Uy min = -9.77e-03 =================== TicTac =================== Mesh: 10.648 ms Boundary Conditions: 21.696 µs Matrix: 4.702 ms Solver: 2.907 ms PostProcessing: 591.755 µs | .. code-block:: Python :lineno-start: 13 import matplotlib.pyplot as plt import numpy as np from EasyFEA import Display, Models, ElemType, Simulations from EasyFEA.Geoms import Points if __name__ == "__main__": Display.Clear() # ---------------------------------------------- # Configuration # ---------------------------------------------- # geom dim = 2 h = 180 # m (thickness) thickness = 2 * h # model coef = 1e6 E = 15000 * coef # Pa (Young's modulus) v = 0.25 # Poisson's ratio # load g = 9.81 # m/s^2 (acceleration due to gravity) ro = 2400 # kg/m^3 (density) w = 1000 # kg/m^3 (density) # ---------------------------------------------- # Mesh # ---------------------------------------------- contour = Points([(0, 0), (h, 0), (0, h)], h / 10) if dim == 2: mesh = contour.Mesh_2D([], ElemType.TRI6) print(f"err area = {np.abs(mesh.area - h**2 / 2) / mesh.area:.3e}") elif dim == 3: mesh = contour.Mesh_Extrude([], [0, 0, -thickness], [3], ElemType.PRISM15) print( f"error volume = {np.abs(mesh.volume - h**2 / 2 * thickness) / mesh.volume:.3e}" ) nodes_x0 = mesh.Nodes_Conditions(lambda x, y, z: x == 0) nodes_y0 = mesh.Nodes_Conditions(lambda x, y, z: y == 0) # ---------------------------------------------- # Simulation # ---------------------------------------------- material = Models.Elastic.Isotropic( dim, E, v, planeStress=False, thickness=thickness ) simu = Simulations.Elastic(mesh, material) simu.add_dirichlet(nodes_y0, [0] * dim, simu.Get_unknowns()) simu.add_surfLoad( nodes_x0, [lambda x, y, z: w * g * (h - y)], ["x"], description="[w*g*(h-y)]" ) simu.add_volumeLoad(mesh.nodes, [-ro * g], ["y"], description="[-ro*g]") sol = simu.Solve() simu.Save_Iter() # ---------------------------------------------- # Results # ---------------------------------------------- print(simu) Display.Plot_Mesh(simu, h / 10 / np.abs(sol.max())) Display.Plot_BoundaryConditions(simu) Display.Plot_Result(simu, "Svm", nodeValues=True, coef=1 / coef, ncolors=20) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.277 seconds) .. _sphx_glr_download_examples_LinearizedElasticity_Elas3.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: Elas3.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: Elas3.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: Elas3.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_