Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
Advanced Structural Analysis and Dynamics 5 – ENG5274
import numpy as np
import matplotlib.pyplot as plt
import math
In this report, you will develop and validate a nite element code written in Python for solving
Euler–Bernoulli beam theory. The code will extend the one you developed for a linear elastic bar
in 1D.
The report is to be uploaded to Moodle by 8 March 2020 (by 15:00).
Overview
Report
The main report document should clearly and logically address all the tasks. Marks will be
deducted for poor presentation. The report is to be submitted on-line via Moodle - hard-copies
will not be marked.
You are to write the report in the Jupyter Notebook format (IPython) using Markdown for the
written report. You can use Google Colab, Jupyter Notebook or your favourite IPython le editor.
the main_EB.ipynb containing the write up and code. No other documents will be accepted.
Code
Your code needs to be commented and documented.
You must include the validation examples in your submission.
Submission requirements
Primary functions
Primary functions to compute the element stiffness matrix , the element force vector due to
distributed loading and the local to global degree of freedom map.
Ω
def get_Ke(le, EIe):
'''Return element stiffness matrix
Parameters
----------
le : double
Length of element
EIe : double
Product of Young's modulus and moment of inertia
'''
return
def get_fe_omega(le, fe):
'''Return force vector due to distributed loading
Parameters
----------
le : double
Length of element
fe : double
Average distributed load on element
'''
return
def get_dof_index(e):
'''Return the global dof associated with an element
Parameters
----------
e : int
Element ID
'''
return
Consider a 12 m beam with Nm. Ensure that your code is indeed producing the
correct results by comparing the computed deection and possibly rotation with the analytical
solution for the following loading conditions:
1. An end-loaded cantilever beam with point load of N acting at m. The
beam is fully xed at . Compare the computed tip deection and rotation with the
analytical solution.
2. A cantilever beam with a distributed load of N/m acting over the length of the
beam. The beam is fully xed at . Compare the computed tip deection and rotation
with the analytical solution.
3. An off-center-loaded simple beam with a point load of N acting at m.
Deections are 0 at and . Ensure that the load acts at a node. You only need
Validation problems
= 14
= −10 = 12
= 0
= −1
= 0
= −10 = 3
= 0 =
to compare your solution to the analytical solution for the position of, and deection at, the
point of maximum displacement.
4. A uniformly-loaded simple beam with a distributed load of N/m acting over the
length of the beam. Deections are 0 at and . You only need to compare the
deection along the length of the beam to the analytical solution.
Where possible, you should test your code for one element and for multiple elements.
Consult https://en.wikipedia.org/wiki/Deection_(engineering) for analytical solutions and
descriptions of the loading.
= −1
= 0 =
Validation - Cantilever with point load
# properties of EB theory
dof_per_node = 2
# domain data
L = 12.
# material and load data
P = -10.
P_x = L
f_e = 0.
EI = 1e4
# mesh data
n_el = 1
n_np = n_el + 1
n_dof = n_np * dof_per_node
x = np.linspace(0, L, n_np)
le = L / n_el
K = np.zeros((n_dof, n_dof))
f = np.zeros((n_dof, 1))
for ee in range(n_el):
dof_index = get_dof_index(ee)
K[np.ix_(dof_index, dof_index)] += get_Ke(le, EI)
f[np.ix_(dof_index)] += get_fe_omega(le, f_e)
node_P = np.where(x == P_x)[0][0]
f[2*node_P] += P
free_dof = np.arange(2,n_dof)
K_free = K[np.ix_(free_dof, free_dof)]
f_free = f[np.ix_(free_dof)]
# solve the linear system
w_free = np.linalg.solve(K_free,f_free)
w = np.zeros((n_dof, 1))
w[2:] = w free
[ ] _
# reaction force
rw = K[0,:].dot(w) - f[0]
rtheta = K[1,:].dot(w) - f[1]
# analytical solution
w_analytical = (P * L**3) / (3*EI)
theta_analytical = (P * L**2) / (2*EI)