PEER logo
  • Examples 
  •  

Plane bending

2 min read • 330 words

A plane cantilever is subjected to a transverse load at the tip.

Python
  • cantilever.ipynb
  • cantilever.py

Various isoparametric quadrilaterals are used to perform a static analysis of a simple cantilever subjected to a parabolically distributed load at the tip.

Consistent nodal loads are computed automatically using the SurfaceLoad class.

  
import xara
import veux
from xara.load import SurfaceLoad, Line
from xara.helpers import find_nodes, find_node
from xara.post import NodalStress
  

def f(x):
    return [0, 12 * ((1/2)**2 - (x-1/2)**2)]

def create_beam(nxy,          # Number of elements in the x and y directions
                length,       # Beam length
                depth, width, # Shape dimensions
                order=1,      # Element interpolation order
                element = "quad",
                section = "PlaneStress"
    ):

    nx, ny = nxy

    E = 10000.0
    nu = 0.25


    #
    # Create model
    #
    # create model in two dimensions with 2 DOFs per node
    model = xara.Model(ndm=2, ndf=2)

    # Define the material
    # -------------------

    # Create a material with tag=1
    model.material("ElasticIsotropic", 1, E, nu)
    # Create a section with tag=1 using material with tag=1
    model.section(section, 1, 1, width)


    # Define geometry
    # ---------------
    # now create the nodes and elements using the surface method
    L = length
    d = depth
    mesh = model.surface((nx, ny),
                  element=element,
                  args={"section": 1},
                  order=order,
                  points={
                    1: [  0.0,   -d/2],
                    2: [   L,    -d/2],
                    3: [   L,     d/2 ],
                    4: [  0.0,    d/2 ]
            })

    # Fix nodes
    for node in find_nodes(model, x=0):
        if abs(model.nodeCoord(node)[1]) == 0:
            model.fix(node, (1, 1))
        else:
            model.fix(node, (1, 0))

    #
    # Define loads
    #
    tip_nodes = sorted(find_nodes(model, x=L), key=lambda n: model.nodeCoord(n)[1])

    tip_load = SurfaceLoad(Line(model, tip_nodes), f, scale=-1)

    root_nodes = sorted(find_nodes(model, x=0), key=lambda n: model.nodeCoord(n)[1])
    root_load = SurfaceLoad(Line(model, root_nodes), f)



    #
    # Run Analysis
    #
    xara.solve(model, [tip_load, root_load])
    return model
  
length= 50.0
depth = 10.0
width =  1.0

model = create_beam((12,4),
                    length = length,
                    depth = depth,
                    width = width,
                    element="quad",
                    order=1
        )
  
utip = model.nodeDisp(find_node(model, x=length, y=0))
print(utip)

9-Node Quad  

Setting order=2 will generate quadratic elements (9-node quadrilaterals).
  

model = create_beam((6,2),
                    length=length,
                    depth=depth,
                    width=width,
                    element="quad",
                    order=2
        )


artist = veux.create_artist(model, canvas="gltf")


artist.draw_nodes()
artist.draw_outlines()
artist.draw_surfaces(state=model.nodeDisp, scale=1, field=NodalStress(model, "sxx"))
artist.draw_outlines(state=model.nodeDisp, scale=1)
artist
  
utip = model.nodeDisp(find_node(model, x=length, y=0))
print(utip)
 Orienting frames in 3D
Linear Dynamic analysis of ground shaking 
Plane bending
Plane bending
A gallery of technical examples using OpenSees.
Code licensed BSD, docs CC BY-NC 4.0
 
Links
Home 
Examples
Working with solids 
Nonlinear dynamics 
Basic Statics 
Community
Issues   
Discussions   
Contribute 
PEER
Code copied to clipboard