.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01-simple/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_01-simple_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-47 .. code-block:: Python fd.ModelingSpace("2D") length = 1.0 young_modulus = 210e9 radius = 0.02 material = fd.constitutivelaw.ElasticIsotrop(young_modulus, 0.3) properties = fd.constitutivelaw.BeamCircular(material, radius, k=0.5) 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 48-57 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 57-67 .. 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 68-74 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 74-89 .. 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("buckling_modes.fdh5", assembly, ["Disp"]) buckling.solve(n_modes=3) print("Critical load factors:", buckling.load_factors) # For comparison, Euler's analytical load for a pinned-pinned beam is # pi**2 E I / L**2. second_moment = np.pi * radius**4 / 4.0 euler_load = np.pi**2 * young_modulus * second_moment / length**2 print(f"Euler critical load: {euler_load:.6g} N") .. rst-class:: sphx-glr-script-out .. code-block:: none Critical load factors: [ 259125.77314178 1021031.95765562 2242455.06016186] Euler critical load: 260453 N .. GENERATED FROM PYTHON SOURCE LINES 90-95 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 95-108 .. 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/01-simple/images/sphx_glr_linear_buckling_001.png :alt: linear buckling :srcset: /examples/01-simple/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.278 seconds) .. _sphx_glr_download_examples_01-simple_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 `_