.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01-simple/simple_cantilever_beam_3D_model.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_simple_cantilever_beam_3D_model.py: Canteleaver Beam using 3D hexahedral elements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 5-8 .. code-block:: Python import fedoo as fd .. GENERATED FROM PYTHON SOURCE LINES 9-10 Pre-treatment: Mesh and problem definition .. GENERATED FROM PYTHON SOURCE LINES 10-47 .. code-block:: Python # Units: N, mm, MPa mesh = fd.mesh.box_mesh( nx=51, ny=7, nz=7, x_min=0, x_max=1000, y_min=0, y_max=100, z_min=0, z_max=100, elm_type="hex8", name="Domain", ) fd.ModelingSpace("3D") # Material definition fd.constitutivelaw.ElasticIsotrop(200e3, 0.3, name="ElasticLaw") wf = fd.weakform.StressEquilibrium("ElasticLaw") # Assembly assembly = fd.Assembly.create(wf, mesh, "hex8") # Type of problem pb = fd.problem.Linear(assembly) # Boundary conditions nodes_left = mesh.node_sets["left"] nodes_right = mesh.node_sets["right"] nodes_top = mesh.node_sets["top"] nodes_bottom = mesh.node_sets["bottom"] pb.bc.add("Dirichlet", nodes_left, "Disp", 0) pb.bc.add("Dirichlet", nodes_right, "DispY", -50) .. rst-class:: sphx-glr-script-out .. code-block:: none Dirichlet boundary condition: var = 'DispY' n_nodes = 49 value = -50 .. GENERATED FROM PYTHON SOURCE LINES 48-49 Solver: use conjugate gradient method .. GENERATED FROM PYTHON SOURCE LINES 49-53 .. code-block:: Python # pb.set_solver('cg') #uncomment for conjugate gradient solver pb.solve() .. GENERATED FROM PYTHON SOURCE LINES 54-55 Post-treatment: Get and plot results .. GENERATED FROM PYTHON SOURCE LINES 55-66 .. code-block:: Python # Get the displacement vector U = pb.get_disp() # Get the stress and strain tensor at nodes res = pb.get_results(assembly, ["Stress", "Strain", "Disp"], "Node") stress = res["Stress"] strain = res["Strain"] # plot the stress (xx component) res.plot("Stress", "XX") .. image-sg:: /examples/01-simple/images/sphx_glr_simple_cantilever_beam_3D_model_001.png :alt: simple cantilever beam 3D model :srcset: /examples/01-simple/images/sphx_glr_simple_cantilever_beam_3D_model_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.470 seconds) .. _sphx_glr_download_examples_01-simple_simple_cantilever_beam_3D_model.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: simple_cantilever_beam_3D_model.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: simple_cantilever_beam_3D_model.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: simple_cantilever_beam_3D_model.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_