.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/springs/plot_spring_system01.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_springs_plot_spring_system01.py: ========================================================== A first 1D spring system ========================================================== .. code:: o---/\/\/\---o---/\/\/\---o x---/\/\/\---o o---> o-------/\/\/\/\/\--------o x ... fixed node o ... free node (moving in x-direction) .. note:: **This example uses** * :ref:`System class` * :ref:`Spring class` * :ref:`Node class` .. GENERATED FROM PYTHON SOURCE LINES 27-30 Initialization ---------------- .. GENERATED FROM PYTHON SOURCE LINES 30-34 .. code-block:: Python from femedu.domain import * from femedu.elements.linear import Spring .. GENERATED FROM PYTHON SOURCE LINES 35-38 Building the model ------------------- 1. Initializing a model .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python model = System() .. GENERATED FROM PYTHON SOURCE LINES 42-43 2. Defining nodes .. GENERATED FROM PYTHON SOURCE LINES 43-50 .. code-block:: Python nd1 = Node(0.0, 0.0) nd2 = Node(2.0, 0.0) nd3 = Node(4.0, 0.0) nd4 = Node(6.0, 0.0) model.addNode(nd1, nd2, nd3, nd4) .. GENERATED FROM PYTHON SOURCE LINES 51-52 3. Creating the springs .. GENERATED FROM PYTHON SOURCE LINES 52-59 .. code-block:: Python springA = Spring(nd1, nd2, 15) springB = Spring(nd2, nd3, 10) springC = Spring(nd3, nd4, 10) springD = Spring(nd2, nd4, 10) model.addElement(springA,springB,springC,springD) .. GENERATED FROM PYTHON SOURCE LINES 60-61 4. Applying the essential boundary conditions .. GENERATED FROM PYTHON SOURCE LINES 61-63 .. code-block:: Python nd1.fixDOF('ux') .. GENERATED FROM PYTHON SOURCE LINES 64-65 5. Applying loads .. GENERATED FROM PYTHON SOURCE LINES 65-67 .. code-block:: Python nd4.setLoad([2.0],['ux']) .. GENERATED FROM PYTHON SOURCE LINES 68-69 You may check your model any time by executing .. GENERATED FROM PYTHON SOURCE LINES 69-71 .. code-block:: Python model.report() .. rst-class:: sphx-glr-script-out .. code-block:: none System Analysis Report ======================= Nodes: --------------------- Node_0: x: [0.000 0.000] fix: ['ux'] u: None Node_1: x: [2.000 0.000] u: None Node_2: x: [4.000 0.000] u: None Node_3: x: [6.000 0.000] P: [2.000] u: None Elements: --------------------- Spring Elem_0: Node_0 to Node_1 with c=15 length change: delta = 0.0 internal force: force = 0.0 Spring Elem_1: Node_1 to Node_2 with c=10 length change: delta = 0.0 internal force: force = 0.0 Spring Elem_2: Node_2 to Node_3 with c=10 length change: delta = 0.0 internal force: force = 0.0 Spring Elem_3: Node_1 to Node_3 with c=10 length change: delta = 0.0 internal force: force = 0.0 .. GENERATED FROM PYTHON SOURCE LINES 72-75 Performing the analysis ----------------------- 6. Assembly and solve .. GENERATED FROM PYTHON SOURCE LINES 75-77 .. code-block:: Python model.solve() .. GENERATED FROM PYTHON SOURCE LINES 78-79 7. Check out displacements and internal forces .. GENERATED FROM PYTHON SOURCE LINES 79-81 .. code-block:: Python model.report() .. rst-class:: sphx-glr-script-out .. code-block:: none System Analysis Report ======================= Nodes: --------------------- Node_0: x: [0.000 0.000] fix: ['ux'] u: [0.000] Node_1: x: [2.000 0.000] u: [0.133] Node_2: x: [4.000 0.000] u: [0.200] Node_3: x: [6.000 0.000] P: [2.000] u: [0.267] Elements: --------------------- Spring Elem_0: Node_0 to Node_1 with c=15 length change: delta = 0.13333333333333333 internal force: force = 2.0 Spring Elem_1: Node_1 to Node_2 with c=10 length change: delta = 0.06666666666666668 internal force: force = 0.6666666666666667 Spring Elem_2: Node_2 to Node_3 with c=10 length change: delta = 0.06666666666666665 internal force: force = 0.6666666666666665 Spring Elem_3: Node_1 to Node_3 with c=10 length change: delta = 0.13333333333333333 internal force: force = 1.3333333333333333 .. GENERATED FROM PYTHON SOURCE LINES 82-83 We can also create a force plot, though it doesn't look all that nice in 1D .. GENERATED FROM PYTHON SOURCE LINES 83-85 .. code-block:: Python model.beamValuePlot('f') .. image-sg:: /auto_examples/springs/images/sphx_glr_plot_spring_system01_001.png :alt: Axial Forces :srcset: /auto_examples/springs/images/sphx_glr_plot_spring_system01_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.149 seconds) .. _sphx_glr_download_auto_examples_springs_plot_spring_system01.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_spring_system01.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_spring_system01.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_spring_system01.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_