# How to Bend Beams in 3D

Most structural frame models are analyzed in two dimensions (2D), for a variety of legitimate reasons.

But sometimes, you have to go to three dimensions (3D). And the most confusing thing about making that jump in OpenSees is the geometric transformation and its “vector in the x-z plane”.

Instead of going into the details of the geometric transformation in 3D, which is explained in a previous post, this post shows how to bend a simple beam about its strong and weak axes in 3D, like this post did for simple 2D beams.

Consider the simple span shown below. There is a concentrated moment at one end and the section is bent about its strong axis (section z-axis).

To bend the beam about its strong axis, we define the vector in the x-z plane as `[0,0,1]`.

```import openseespy.opensees as ops

L = 240.0
E = 29000.0
v = 0.3
G = 0.5*E/(1+v)
A = 20.0
Iz = 1400.0
Iy = 600.0
J = 2000.0
M = 3000.0

ops.wipe()
ops.model('basic','-ndm',3,'-ndf',6)

ops.node(1,0,0,0); ops.fix(1,1,1,1,1,0,0)
ops.node(2,L,0,0); ops.fix(2,1,1,1,0,0,0)

ops.geomTransf('Linear',12, 0,1,0)
ops.element('elasticBeamColumn',1,1,2,A,E,G,J,Iy,Iz,12)

ops.timeSeries('Constant',23)
ops.pattern('Plain',1,23)

ops.analysis('Static')

ops.analyze(1)
ops.reactions()
```

Note that the rotation about the global X-axis is fixed in order to prevent rigid body spinning. This boundary condition is necessary for this simple span, but generally not necessary for larger frame models.

At any rate, compare the vertical reactions (global Y-direction) to the equilibrium solution M/L. Also compare the nodal rotations (about global Z-axis) to the known solutions ML/(3EIz) and ML/(6EIz).

Using `[1,0,1]` as the vector in the x-z plane will work too. Try it out.

Now, suppose we want to keep the loading the same (moment about the global Z-axis), but bend the beam about its weak axis (section y-axis), i.e., lay the beam down and employ the “flat use” factor in wood design.

The wrong way to modify the script is to swap `Iz` and `Iy` in the element definition–you’re changing the element.

The right way is to use the geometric transformation to “rotate” or “spin” the element about its local x-axis.

To this end, you can define the vector in the x-z plane as `[0,-1,0]`.

```ops.geomTransf('Linear',12, 0,-1,0)
```

That’s the only part of the model definition you need to change. You should get the same reactions, M/L, in the global Y-direction and the rotations about the global Z-axis should now be ML/(3EIy) and ML/(6EIy).

You can get the same result using `[1,-1,0]` as the vector in the x-z plane.

This site uses Akismet to reduce spam. Learn how your comment data is processed.