Below is an engineering mechanics problem that can be solved with Python. Follow along to see how to solve the problem with code.
Two aluminum strips and a strip of steel are securely bonded together to form a a lamellar composite part. The width of the part is $b=60 \ mm$ and the thickness of the part $h = 40 \ mm$. The modulus of elasticity for the steel in the composite is $200 \ GPa$ and the modulus of elasticity of the aluminum is $75 GPa$. The bending moment $M$ of the part is $1500 N m$
(a) If the thickness of the aluminum top and bottom plates is varied from $ a = 0 \ mm$ to $a = 20 \ mm$ in $2 \ mm$ increments (the composite part keeps the same thickness), what is the stress in the steel and what is the stress in the aluminum?
(b) What is the largest stress that can occur in steel if aluminum thickness is varied from $a=0 \ mm$ to $a = 40/2 \ mm$ and how thick is the aluminum when this maximum steel stress occurs?
We are going to use Python to code the solution to this problem. If you don't already have Python installed on your computer, I recommend installing the Anaconda distribution of Python. See this post to learn how to install Anaconda on your computer.
I am coding this solution in a Jupyter Notebook. Once you install Anaconda, you can open a Jupyter notebook from the Windows Start Menu or the Anaconda Prompt. See this post to learn about 3 ways to open a Jupyter notebook.
Alternatively, instead of using a Jupyter notebook, you could code your solution in a .py
file.
Alright. Let's get coding....
Based on parameters given in the problem, we can define the following variables in Python.
$h = 40 \ mm$ part thickness (height)
$b = 60 \ mm$ part width
$h_a = 2 \ mm$ thickness (height) of aluminum that we'll start the problem with
$h_s = h - 2h_a $ thickness of the steel
$E_a = 75 \ GPa$ elastic modulus of the aluminum
$E_s = 200 \ GPa$ elastic modulus of the steel
$M = 1500 \ N \ m$ applied moment
In [1]:
h = 40
b = 60
ha = 2
hs = h - 2*ha
Ea = 75*10**3 #Elastic modulus in MPa
Es = 200*10**3 #Elastic modulus in MPa
M = 1500*10**3 # N mm
In [2]:
n = Es/Ea
ha = 2
I = (1/12)*b*h**3 + (1/12)*(2*(1/2)*(n*b-b))*(h-2*ha)**3
print(f"The moment of inertia I = {I} mm4")
The maximum stress in the aluminum, $\sigma$ is dependent on the bending moment $M$, the distance from the neutral axis $c$ and the moment of inertia I according to the following equation:
$$ \sigma = \frac{Mc}{I} $$In case of the aluminum, $c$ the distance from the neutral axis that we are calculating the stress for is $c = h/2$, so the equation above becomes:
$$ \sigma_a = \frac{M(h/2)}{I} $$We can code this into Python pretty easily.
In [3]:
sa = M*(h/2)/I
print(f"The stress in the aluminum sigma a = {sa} MPa")
Maximum stress in the steel, $\sigma$ is dependent on the bending moment $M$, the distance from the neutral axis $c$ and the moment of inertia I according to the the same equation we used to calculate the stress in the aluminum.
$$ \sigma = n\frac{Mc}{I} $$In case of the c, $c$ the distance from the neutral axis that we are calculating the stress for is $c = h/2-h_a$, so the equation above becomes:
$$ \sigma_a = n\frac{M(h/2-a}{I} $$Like before, we can code this into Python.
In [4]:
ss = n*M*(h/2-ha)/I
print(f"The stress in the steel sigma s = {ss} MPa")
In [5]:
for ha in range(0,22,2):
print(f"For aluminum thickness h_a = {ha} mm")
I = (1/12)*b*h**3 + (1/12)*(2*(1/2)*(n*b-b))*(h-2*ha)**3
sa = M*(h/2)/I
print(f"The stress in the aluminum sigma a = {sa} MPa")
ss = n*M*(h/2-ha)/I
print(f"The stress in the steel sigma s = {ss} MPa")
In [6]:
import numpy as np
SS = []
for ha in np.arange(0,22,0.1):
I = (1/12)*b*h**3 + (1/12)*(2*(1/2)*(n*b-b))*(h-2*ha)**3
ss = n*M*(h/2-ha)/I
SS.append([ss,ha])
maxs = max(SS)
print(f"The maximum stress in the steel is {maxs[0]} MPa at an aluminum thickness of {maxs[1]} mm")
In [ ]: