.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01-simple/I_shape_beam_bending.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_I_shape_beam_bending.py: 3 points bending of an I-Shape beam ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 5-9 .. code-block:: Python import fedoo as fd import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 10-16 Geometry and Mesh ~~~~~~~~~~~~~~~~~~ In this example, a mesh is created with an I-shaped cross-section. First, an I-shape profil is built using linear triangle elements 'tri3'. The 'extrude' function is then used to create the 3d geometry based on wedge elements 'wed6'. .. GENERATED FROM PYTHON SOURCE LINES 16-33 .. code-block:: Python # Build a I shaped beam profil profil = fd.mesh.structured_mesh.I_shape_mesh(10, 10, 2, 2, 1, "tri3") mesh = fd.mesh.extrude( profil, 100, # extrusion length, 11, ) # n_nodes mesh.nodes = mesh.nodes[ :, [2, 1, 0] ] # switch axis to put the extrusion direction along the X axis # Uncomment the following line to use quadratic elements # mesh = fd.mesh.functions.change_elm_type(mesh, 'wed15') #or 'wed18' print(f"element type: '{mesh.elm_type}'") .. rst-class:: sphx-glr-script-out .. code-block:: none element type: 'wed6' .. GENERATED FROM PYTHON SOURCE LINES 34-37 Problem définition ~~~~~~~~~~~~~~~~~~~~~ Define a 3d linear static problem with a linear elastc constitutive law .. GENERATED FROM PYTHON SOURCE LINES 37-50 .. code-block:: Python fd.ModelingSpace("3D") # Material definition material = fd.constitutivelaw.ElasticIsotrop(200e3, 0.3) wf = fd.weakform.StressEquilibrium(material) # Assembly assembly = fd.Assembly.create(wf, mesh) # Type of problem pb = fd.problem.Linear(assembly) .. GENERATED FROM PYTHON SOURCE LINES 51-58 Boundary conditions ~~~~~~~~~~~~~~~~~~~~~ Create set of nodes to apply boundary conditions (ie numpy array of node indices) and apply boundary conditions on the sets: - Ux = Uy = 0 on the left bottom edge - Uy = 0 on the right bottom edge - Uy = -10 on the edge at the center top .. GENERATED FROM PYTHON SOURCE LINES 58-70 .. code-block:: Python bottom = mesh.find_nodes("Y", mesh.bounding_box.ymin) top = mesh.find_nodes("Y", mesh.bounding_box.ymax) left_bottom = np.intersect1d(mesh.find_nodes("X", mesh.bounding_box.xmin), bottom) right_bottom = np.intersect1d(mesh.find_nodes("X", mesh.bounding_box.xmax), bottom) center_top = np.intersect1d(mesh.find_nodes("X", mesh.bounding_box.center[0]), top) pb.bc.add("Dirichlet", left_bottom, "Disp", 0) pb.bc.add("Dirichlet", right_bottom, "DispY", 0) pb.bc.add("Dirichlet", center_top, "DispY", -10) .. rst-class:: sphx-glr-script-out .. code-block:: none Dirichlet boundary condition: var = 'DispY' n_nodes = 8 value = -10 .. GENERATED FROM PYTHON SOURCE LINES 71-75 Solve and plot results ~~~~~~~~~~~~~~~~~~~~~~~~ Solve and extract, stress and displacement field and plot \sigma_{xx} .. GENERATED FROM PYTHON SOURCE LINES 75-80 .. code-block:: Python pb.solve() res = pb.get_results(assembly, ["Stress", "Disp"]) res.plot("Stress", "XX", "Node", show_edges=False) .. image-sg:: /examples/01-simple/images/sphx_glr_I_shape_beam_bending_001.png :alt: I shape beam bending :srcset: /examples/01-simple/images/sphx_glr_I_shape_beam_bending_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.235 seconds) .. _sphx_glr_download_examples_01-simple_I_shape_beam_bending.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: I_shape_beam_bending.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: I_shape_beam_bending.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: I_shape_beam_bending.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_