.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/trusses/plot_truss06.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_auto_examples_trusses_plot_truss06.py: ========================== Simple triangular truss. ========================== Study of snap-through behavior using finite deformation truss elements. We shall be using displacement control to trace the unstable portion of the static equilibrium path. Author: Peter Mackenzie-Helnwein .. GENERATED FROM PYTHON SOURCE LINES 12-14 .. code-block:: Python :dedent: 1 .. GENERATED FROM PYTHON SOURCE LINES 18-19 Setup .. GENERATED FROM PYTHON SOURCE LINES 19-29 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from femedu.examples import Example from femedu.domain import System, Node from femedu.elements.finite import Truss from femedu.materials import FiberMaterial from femedu.solver import NewtonRaphsonSolver .. GENERATED FROM PYTHON SOURCE LINES 30-31 Create the example by subclassing the :py:class:`Example` .. GENERATED FROM PYTHON SOURCE LINES 31-129 .. code-block:: Python class ExampleTruss06(Example): def problem(self): # initialize a system model model = System() model.setSolver(NewtonRaphsonSolver()) # create notes x1=Node(0.0,0.0) x2=Node(5.5,0.5) x3=Node(9.5,0.0) model.addNode(x1,x2,x3) params = dict( E = 2100., # MOE A = 1. # cross section area ) # create elements elemA = Truss(x1,x2, FiberMaterial(params)) elemB = Truss(x3,x2, FiberMaterial(params)) model += elemA model += elemB # apply boundary conditions x1.fixDOF(['ux','uy']) x3.fixDOF(['ux','uy']) # build reference load x2.addLoad([-1.],['uy']) # write out report model.report() # create plots model.plot(factor=1., filename="truss05_deformed.png") # # performing the analysis # model.resetDisp() # setting target displaement levels disps = np.linspace(0.0, 1.1, 24) # set up data collection load_list = [] # will hold load factors data_list = [] # will hold displacements # reset the analysis model.resetDisp() model.setLoadFactor(0.0) # apply all load steps for u_bar in disps: #model.setLoadFactor(lam) model.setDisplacementControl(x2, 'uy', -u_bar) model.solve() # collect data load_list.append(model.loadfactor) data_list.append(x2.getDisp()) # plot the deformed shape model.plot(factor=1.0, show_loads=False, show_reactions=False) load = np.array(load_list) data = np.array(data_list) plt.figure() plt.plot(data, load) plt.grid(True) plt.xlabel('displacements $ u_i $') plt.ylabel('load factor $ \\lambda $') plt.legend(['$ u_x $','$ u_x $']) plt.show() #plt.figure() fig, (ax0,ax1) = plt.subplots(1,2) ax0.plot(load, data[:,0]) ax0.grid(True) ax0.set_xlabel('load factor $ \\lambda $') ax0.set_ylabel('displacements $ u_i $') ax0.legend(['$ u_x $']) ax1.plot(load, data[:,1]) ax1.grid(True) ax1.set_xlabel('load factor $ \\lambda $') ax1.set_ylabel('displacements $ u_i $') ax1.legend(['$ u_y $']) plt.show() .. GENERATED FROM PYTHON SOURCE LINES 144-146 Run the example by creating an instance of the problem and executing it by calling :py:meth:`Example.run()` .. GENERATED FROM PYTHON SOURCE LINES 146-151 .. code-block:: Python if __name__ == "__main__": ex = ExampleTruss06() ex.run() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_001.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_001.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_002.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_002.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_003.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_003.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_004.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_004.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_005.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_005.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_006.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_006.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_007.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_007.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_008.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_008.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_009.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_009.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_010.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_010.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_011.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_011.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_012.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_012.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_013.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_013.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_014.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_014.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_015.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_015.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_016.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_016.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_017.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_017.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_018.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_018.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_019.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_019.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_020.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_020.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_021.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_021.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_022.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_022.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_023.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_023.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_024.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_024.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_025.png :alt: Deformed System (magnification=1.00) :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_025.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_026.png :alt: plot truss06 :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_026.png :class: sphx-glr-multi-img * .. image-sg:: /auto_examples/trusses/images/sphx_glr_plot_truss06_027.png :alt: plot truss06 :srcset: /auto_examples/trusses/images/sphx_glr_plot_truss06_027.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none System Analysis Report ======================= Nodes: --------------------- Node_48: x: [0.000 0.000] fix: ['ux', 'uy'] u: None Node_49: x: [5.500 0.500] P: [0.000 -1.000] u: None Node_50: x: [9.500 0.000] fix: ['ux', 'uy'] u: None Elements: --------------------- Truss: Node_48 to Node_49: material properties: FiberMaterial(Material)({'E': 2100.0, 'A': 1.0, 'nu': 0.0, 'fy': 1e+30}) strain:0.0 stress:{'xx': 0.0, 'yy': 0.0, 'zz': 0.0, 'xy': 0.0} internal force: 0.0 Truss: Node_50 to Node_49: material properties: FiberMaterial(Material)({'E': 2100.0, 'A': 1.0, 'nu': 0.0, 'fy': 1e+30}) strain:0.0 stress:{'xx': 0.0, 'yy': 0.0, 'zz': 0.0, 'xy': 0.0} internal force: 0.0 + + + + + + + + + + + + + + + + + + + + /Users/pmackenz/Development/Educational/FEM.edu/src/femedu/plotter/ElementPlotter.py:120: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`. fig, axs = plt.subplots() + + + + .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.245 seconds) .. _sphx_glr_download_auto_examples_trusses_plot_truss06.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_truss06.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_truss06.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_truss06.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_