A first 1D spring system

             o---/\/\/\---o---/\/\/\---o
x---/\/\/\---o                         o--->
             o-------/\/\/\/\/\--------o

x ... fixed node
o ... free node (moving in x-direction)

Note

This example uses

Initialization

from femedu.domain import *
from femedu.elements.linear import Spring

Building the model

  1. Initializing a model

model = System()
  1. Defining nodes

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)
  1. Creating the springs

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)
  1. Applying the essential boundary conditions

nd1.fixDOF('ux')
  1. Applying loads

nd4.setLoad([2.0],['ux'])

You may check your model any time by executing

model.report()
System Analysis Report
=======================

Nodes:
---------------------
  Node_0:
      x:    [0. 0.]
      fix:  ['ux']
      u:    None
  Node_1:
      x:    [2. 0.]
      u:    None
  Node_2:
      x:    [4. 0.]
      u:    None
  Node_3:
      x:    [6. 0.]
      P:    [2.]
      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

Performing the analysis

  1. Assembly and solve

model.solve()
  1. Check out displacements and internal forces

model.report()
System Analysis Report
=======================

Nodes:
---------------------
  Node_0:
      x:    [0. 0.]
      fix:  ['ux']
      u:    [0.]
  Node_1:
      x:    [2. 0.]
      u:    [0.13333333]
  Node_2:
      x:    [4. 0.]
      u:    [0.2]
  Node_3:
      x:    [6. 0.]
      P:    [2.]
      u:    [0.26666667]

Elements:
---------------------
  Spring Elem_0: Node_0 to Node_1 with c=15
      length change:  delta = 0.1333333333333333
      internal force: force = 1.9999999999999996
  Spring Elem_1: Node_1 to Node_2 with c=10
      length change:  delta = 0.06666666666666671
      internal force: force = 0.6666666666666671
  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.13333333333333336
      internal force: force = 1.3333333333333335

We can also create a force plot, though it doesn’t look all that nice in 1D

model.beamValuePlot('f')
Axial Forces

Total running time of the script: (0 minutes 1.075 seconds)

Gallery generated by Sphinx-Gallery