.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/basic/linear_buckling.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_basic_linear_buckling.py: Linear buckling of a pinned beam ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example predicts the critical compressive loads and buckling modes of a straight elastic beam. Linear buckling is a perturbation analysis performed about a preloaded reference state. Fedoo solves .. math:: (\mathbf{K}_M + \lambda\mathbf{K}_G)\boldsymbol{\phi}=0, where :math:`\mathbf{K}_M` is the material stiffness, :math:`\mathbf{K}_G` is the geometric stiffness generated by the reference stress, and :math:`\lambda` is a critical load factor. .. GENERATED FROM PYTHON SOURCE LINES 17-22 .. code-block:: Python import numpy as np import fedoo as fd .. GENERATED FROM PYTHON SOURCE LINES 23-28 Geometry and beam properties ---------------------------- A one-metre-long circular beam is discretized with 20 linear beam elements. Both ends are pinned for transverse motion, while the left end also prevents rigid-body translation along the beam axis. .. GENERATED FROM PYTHON SOURCE LINES 28-51 .. code-block:: Python fd.ModelingSpace("2D") length = 1.0 young_modulus = 210e9 radius = 0.02 poisson_ratio = 0.3 material = fd.constitutivelaw.ElasticIsotrop(young_modulus, poisson_ratio) # Timoshenko shear coefficient of a solid circular section (k = 0 would # give an Euler-Bernoulli beam) shear_coef = 6 * (1 + poisson_ratio) / (7 + 6 * poisson_ratio) # ~0.886 properties = fd.constitutivelaw.BeamCircular(material, radius, k=shear_coef) mesh = fd.mesh.line_mesh( n_nodes=21, x_min=0.0, x_max=length, elm_type="lin2", ndim=2, ) weakform = fd.weakform.BeamEquilibrium(properties, nlgeom=False) assembly = fd.Assembly.create(weakform, mesh) .. GENERATED FROM PYTHON SOURCE LINES 52-61 Reference preload ----------------- The geometric stiffness depends on the current stress state, so a preload problem must be solved first. A linear static problem is sufficient here because the reference response is linear. A nonlinear problem could instead supply the preload when the reference equilibrium requires it. The reference compressive force is one newton. Consequently, the buckling load factors obtained below also equal the critical forces in newtons. .. GENERATED FROM PYTHON SOURCE LINES 61-71 .. code-block:: Python left = [0] right = [mesh.n_nodes - 1] preload = fd.problem.Linear(assembly) preload.bc.add("Dirichlet", left, ["DispX", "DispY"], 0.0) preload.bc.add("Dirichlet", right, "DispY", 0.0) preload.bc.add("Neumann", right, "DispX", -1.0) preload.solve() .. GENERATED FROM PYTHON SOURCE LINES 72-78 Linear buckling problem ----------------------- ``LinearBuckling`` uses the assembly and state variables of the preload problem. Its boundary conditions describe perturbations about that state and must therefore be homogeneous. As for modal analysis, the registered output contains one frame per buckling mode. .. GENERATED FROM PYTHON SOURCE LINES 78-87 .. code-block:: Python buckling = fd.problem.LinearBuckling(preload) buckling.bc.add("Dirichlet", left, ["DispX", "DispY"], 0.0) buckling.bc.add("Dirichlet", right, "DispY", 0.0) results = buckling.add_output("results/buckling_modes.fdh5", assembly, ["Disp"]) buckling.solve(n_modes=3) print("Critical load factors:", buckling.load_factors) .. rst-class:: sphx-glr-script-out .. code-block:: none Critical load factors: [ 259702.62244211 1029993.45931084 2285732.06568466] .. GENERATED FROM PYTHON SOURCE LINES 88-99 Comparison with the analytical solution --------------------------------------- Euler's critical load of a pinned-pinned beam is :math:`P_E = \pi^2 E I / L^2`. The shear flexibility of the Timoshenko beam slightly lowers it: .. math:: P_{cr} = \frac{P_E}{1 + P_E / (k G A)}, here a reduction of about 0.3 %. .. GENERATED FROM PYTHON SOURCE LINES 99-108 .. code-block:: Python second_moment = np.pi * radius**4 / 4.0 area = np.pi * radius**2 euler_load = np.pi**2 * young_modulus * second_moment / length**2 shear_stiffness = shear_coef * material.G * area timoshenko_load = euler_load / (1 + euler_load / shear_stiffness) print(f"Euler critical load: {euler_load:.6g} N") print(f"Timoshenko critical load: {timoshenko_load:.6g} N") .. rst-class:: sphx-glr-script-out .. code-block:: none Euler critical load: 260453 N Timoshenko critical load: 259701 N .. GENERATED FROM PYTHON SOURCE LINES 109-114 Plot the first buckling mode ---------------------------- Eigenvectors have an arbitrary amplitude. We scale the first one to display a maximum deflection equal to 15% of the beam length, then use the standard :class:`fedoo.DataSet` plotting interface to draw the deformed beam. .. GENERATED FROM PYTHON SOURCE LINES 114-127 .. code-block:: Python results.load(0) max_displacement = np.max(np.linalg.norm(results["Disp"], axis=0)) display_scale = 0.15 * length / max_displacement results.plot( "Disp", component="norm", iteration=0, scale=display_scale, show_edges=True, show_nodes=True, title=f"First buckling mode - load factor {buckling.load_factors[0]:.3g}", ) .. image-sg:: /examples/basic/images/sphx_glr_linear_buckling_001.png :alt: linear buckling :srcset: /examples/basic/images/sphx_glr_linear_buckling_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.226 seconds) .. _sphx_glr_download_examples_basic_linear_buckling.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: linear_buckling.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: linear_buckling.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: linear_buckling.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_