# Beams - structural beams¶

This notebook shows how to use Beam elements model cantilever beams, how to get the results and how those results compare to theory.

A “Beam” in DAVE consists of a number of discrete segments and has a different formulation than the beams typically found in FEM packages.

```
from DAVE import *
s = Scene();
```

```
Equilibrium-core version = 1.07
default resource folders:
/home/ruben/miniconda3/lib/python3.8/site-packages/DAVE/resources
/home/ruben/DAVE_models
/home/ruben/DAVE_book/DAVE-notebooks
```

Beams are elastic nodes that can be created between axis systems.

```
left = s.new_axis("left")
right = s.new_axis("right")
beam = s.new_beam("beam", nodeA=left, nodeB = right,
EA = 1000,
EIy = 1e5, EIz = 1e5, GIp = 1e3,
L=10,
mass = 0,
n_segments=20)
right.set_free()
s.solve_statics()
```

```
Solved to 1.0658141036401503e-11.
```

```
True
```

```
from DAVE.jupyter import *;
```

```
embedWindow(verbose=True): could not load k3d module, try:
> pip install k3d # and if necessary:
> conda install nodejs
```

```
show(s, camera_pos=(5,-10,6), lookat = (5,0,2), sea=False, width=1000, height = 200)
```

A Beam node is rigidly fixed to the axis systems at its ends. It is fixed in the positive X-direction, so it departs from node A along the X-axis and arrives at ndoe B from the negative X-direction.

At the momement we have a massless beam with its left side fixed (axis system “left” is fixed) and its right size free (the right end of the beam is fixed to axis system “right”, but “right” is not connected to anything and is free to move).

This is one of those cases that frequently occur in textbooks and for which we can easily check the results.

First place a point on the right side so that we can apply a force:

```
s.new_point("point", parent = right)
force = s.new_force("force", parent = "point")
```

## Cantilever beam with a force¶

```
force.force = (0,0,-100)
```

```
s.solve_statics()
```

```
Solved to 2.8971669507882325e-10.
```

```
True
```

```
show(s, camera_pos=(5,-10,0), lookat = (5,0,0), sea=False, width=1000, height = 300)
```

Theory tells us that the deflection and rotation of the right end should be:

\(\delta = -PL^3 / 3EI\)

and

\(\Theta = PL^2 / 2EI\)

Get the values from the model:

```
L = beam.L
EI = beam.EIy
P = -force.force[2]
```

And calculate their values

The deflection is the vertical displacement of the axis system on the right side of the beam:

```
right.z
```

```
-0.3360465308510179
```

```
-P*L**3 / (3*EI)
```

```
-0.3333333333333333
```

Theta is the slope. The slope can be calculated from the rotation of the axis system, but it is also available as “tilt”, which is a percentage.

```
right.tilt_y / 100
```

```
0.05014161613257607
```

```
P*L**2 / (2*EI)
```

```
0.05
```

It is also possible to obtain the forces in the beam.

The moments are available at the nodes.

```
import matplotlib.pyplot as plt
```

```
plt.plot(beam.X_nodes, beam.bending[:,1])
plt.xlabel('Distance along the beam [m]')
plt.ylabel('Moment about y-axis [kN*m]');
```

## Cantilever with moment¶

We can do the same with a moment

```
force.force = (0,0,0)
force.moment = (0,1000,0)
```

```
s.solve_statics()
```

```
Solved to 3.0920071709726403e-10.
```

```
True
```

```
show(s, camera_pos=(5,-10,3), lookat = (5,0,-1), sea=False, width=1000, height = 300)
```

Theory tells us that the deflection and rotation of the right end should be:

\(\delta = ML^2 / 2EI\)

and

\(\Theta = ML / EI\)

Get the values from the model:

```
M = force.moment[1] # moment about Y-axis
```

```
M*L**2 / (2*EI)
```

```
0.5
```

```
-right.z
```

```
0.499583992597253
```

```
M*L / EI
```

```
0.1
```

```
right.tilt_y / 100
```

```
0.09983341664682813
```

## Tension and torsion¶

Beam can also take tension and torsion.

```
force.force = (100,0,0)
force.moment = (100,0,0)
```

```
s.solve_statics()
```

```
Solved to 0.0007999983761348021.
```

```
True
```

```
show(s, camera_pos=(5,-10,3), lookat = (5,0,-1), sea=False, width=1000, height = 300)
```

Tension and torsion forces in the beam are available not at the nodes but at the centers for the beam segments.

```
plt.plot(beam.X_midpoints, beam.torsion);
```

```
plt.plot(beam.X_midpoints, beam.tension);
```

**Now this looks horrible!**

Fortunately this is just the way matplotlib displays data which is almost constant.

Looking at the data directly it appears to be comfortingly constant:

```
beam.torsion
```

```
[99.99999999994328,
99.99999999994392,
99.99999999994418,
99.9999999999124,
99.99999999997411,
99.99999999993838,
99.99999999993328,
99.9999999999635,
99.99999999995251,
99.99999999991043,
99.99999999990685,
100.00000000007931,
99.99999999991343,
99.99999999990095,
100.00000000017306,
99.99999999973171,
100.00000000021214,
99.99999999992586,
99.99999999987122,
100.00000000014418]
```

```
import matplotlib
matplotlib.rcParams['axes.formatter.useoffset'] = False
```

```
plt.plot(beam.X_midpoints, beam.torsion);
plt.ylim((99.9, 100.1));
```

```
plt.plot(beam.X_midpoints, beam.tension);
plt.ylim((99.9, 100.1));
```

## Distributed load¶

Modelling a distributed load is not possible in this way. Loads can only be added at points.

To model a distributed load we would have to manually discretise the model and add discrete loads at each node.

But these is a shortcut that we can take: The beams can have a mass. We can use the mass to model a distributed load as gravity.

```
s.delete('force')
```

```
Deleting force [Force]
```

```
q = 10 # kN/m
```

```
beam.mass = beam.L * q / 9.81
```

```
s.solve_statics()
```

```
Solved to 1.0395062588486326e-10.
```

```
True
```

```
show(s, camera_pos=(5,-10,0), lookat = (5,0,0), sea=False, width=1000, height = 300)
```

Theory tells us that the deflection and rotation of the right end should be:

\(\delta = qL^4 / 8EI\)

and

\(\Theta = qL^3 / 6EI\)

```
-q*L**4 / (8*EI)
```

```
-0.125
```

```
right.z
```

```
-0.12543632662912632
```

```
q*L**3 / (6*EI)
```

```
0.016666666666666666
```

```
right.tilt_y / 100
```

```
0.016695081219443974
```

## Large deflections¶

All the tests done so far were performed on small deflections. That is for a good reason. The Euler/Bernouilli beam theory is only applicable to small displacements. This is because in this theory the moment is derived from the deflection:

\(d^2/dx^2(EI d^2w / dx^2) = q\)

so the moment in the beam is proprtional to the change in slope. This is only valid for small changes.

The implementation in DAVE **is valid for large deflections**, it is just that the analytical formula used above are not.

## Number of segments¶

Beams use a discrete model (see theory https://davedocs.online/beams.html).

When a higher number of segments is used:

The model become more accurate

The solver becomes slower

(The numerical errors build up)

So the number of nodes should be selected with some caution. In general 20 seems to be a good number for beams although in some cases (for example pure tension or torsion) a single segment is just as good.

It is easy to use the “plot_effect” function in scene to check the effect of the number of segments.

Here we calculate the effect of the number of segments on the vertical position of the second end of the beam:

```
s.plot_effect(evaluate="s['point'].gz",
change_property="n_segments",
change_node="beam",
start=1,
to=25.0,
steps=25);
```

```
setting 1.0 results in -0.2505213025684722
setting 2.0 results in -0.15644445038870636
setting 3.0 results in -0.13903861948406035
setting 4.0 results in -0.13294953638252988
setting 5.0 results in -0.1301317531654582
setting 6.0 results in -0.12860125832356478
setting 7.0 results in -0.12767850811020817
setting 8.0 results in -0.12707960002618518
setting 9.0 results in -0.12666902521282053
setting 10.0 results in -0.12637533593191538
setting 11.0 results in -0.1261581286772298
setting 12.0 results in -0.1259928305168724
```

```
setting 13.0 results in -0.12586419134589738
setting 14.0 results in -0.12576214275091344
setting 15.0 results in -0.12567992474755918
setting 16.0 results in -0.12561238407718095
```

```
setting 17.0 results in -0.1255565409935068
setting 18.0 results in -0.12550974407435136
setting 19.0 results in -0.12547013993486988
```

```
setting 20.0 results in -0.1254363266291249
setting 21.0 results in -0.12540722785030317
setting 22.0 results in -0.12538200620805579
```

```
setting 23.0 results in -0.1253600023016723
setting 24.0 results in -0.1253406911786322
```

```
setting 25.0 results in -0.1253236507315631
```

– end –