# ## Energy: Single Degree of Freedom

#### Learning Outcomes

• Describe the concept of the energy in a single degree of freedom system for linear and nonlinear systems.
• Differentiate between the “Strain Energy in a Spring” and the “Potential Energy of a System” for linear and nonlinear systems.
• Identify that the “Potential Energy of a System” when differentiated, gives the equilibrium equation for linear and nonlinear systems.
• Identify that the potential energy is minimum at stable equilibrium for linear and nonlinear systems.
• Describe how the potential energy can be used to differentiate between stable and unstable equilibria.
• Define “non-elastic springs” and explain how energy is dissipated in such springs.
• Dynamics of linear elastic springs: Differentiate between the static equilibrium equation vs. the dynamic equilibrium equation for a linear elastic spring.
• Compare the difference in the expressions of the “potential energy of the system” and the “kinetic energy of the system”

In this section we will investigate the static and dynamic equilibria of a single degree of freedom mass-spring system. Under static static equilibrium of such system, loading of the system gives rise to an energy of deformation (termed potential energy) that is stored in the spring. This energy is released upon removal of loading. In the case of dynamic equilibrium of such system, the energy of the system is composed of two terms whose sum is constant, the kinetic energy due to the velocity of the mass and the potential energy (energy of deformation) stored in the spring. The presentation of the single degree of freedom, while elementary, enables the extension of the same principles to the deformation of continuum objects.

### Static Equilibrium of a Mass-Spring System:

The equilibrium of a mass-spring system is achieved when the weight of the mass is equal to the force applied in the spring. In other words equilibrium is achieved when: where is the displacement (extension/contraction) of the spring, is the force in the spring which is function of the displacement, is the mass of the spring, and is the gravity body force per unit mass (The ground acceleration). The displacement at which equilibrium is achieved is going to be termed . In the following, we will investigate three forms for the force function ; linear elastic, nonlinear elastic, and non-elastic.

#### Linear Elastic Spring:

A linear elastic spring has a linear relationship between the spring force and the displacement such that where has units of force/unit length. When a weight of value is gradually hung the spring is gradually stretched until equilibrium is achieved when . At this stage, the spring force is equal to the applied weight and thus: The work done by the external forces during the process of loading is stored as an elastic potential energy inside the spring and can be recovered once the load is removed (Figure 1). The spring force acts to reduce the potential energy of the spring by always acting to reduce the spring length to its original unstretched length. At an arbitrary distance x, the potential energy stored in the spring is equal to In the process of moving a distance downward, the weight lost some of its gravitational potential energy that is equal to the value . We call this term the work done by the external load. If we consider the combined system of the spring and the mass, then the potential energy of the system is equal to:

(1) The potential energy of the system can be viewed also as the resulting expression when integrating the equilibrium equation from 0 to : Therefore, differentiating the potential energy function leads to the equilibrium equation: The potential energy is a function of the displacement of the spring. When the displacement , the rate of change of the potential energy is equal to zero: Therefore, at equilibrium, the potential energy function is either a maximum, minimum, or an inflection point. To identify which of the three, we can take the second derivative of the potential energy: Therefore, the stiffness of the spring is what determines whether the potential energy is minimum, maximum, or an inflection point. When is positive, the potential energy of the system is minimum at equilibrium!

#### Nonlinear Elastic Spring:

A nonlinear elastic spring has a nonlinear relationship between the spring force and the displacement . When a weight of value is gradually hung the spring is gradually stretched until equilibrium is achieved when . At this stage, the spring force is equal to the applied weight and thus: Similar to the linear case, the work done by the external forces during the process of loading is stored as an elastic potential energy inside the spring and can be recovered once the load is removed. The spring force acts to reduce the potential energy of the spring by always acting to reduce the spring length to its original unstretched length. At an arbitrary distance x, the potential energy stored in the spring is equal to Similar to the linear case, the potential energy of the system is equal to: The potential energy of the system can be viewed also as the resulting expression when integrating the equilibrium equation from 0 to : Therefore, differentiating the potential energy function leads to the equilibrium equation: The potential energy is a function of the displacement x of the spring. When the displacement , the rate of change of the potential energy is equal to zero: Therefore, at equilibrium, the potential energy function is either a maximum, minimum, or an inflection point. To identify which of the three, we can take the second derivative of the potential energy: Therefore, the slope of the force displacement curve of the spring is what determines whether the potential energy is minimum, maximum, or an inflection point. When is positive, the potential energy of the system is minimum at equilibrium while when is negative, the potential energy is maximum! In addition, when the slope of the spring force is negative with respect to the displacement , the equilibrium position is deemed unstable. In this case, under the effect of an external force , any small perturbation in the displacement would lead to instabilities in the system. To understand this, let there be an equilibrium position where the slope is negative (Figure 2c & d). At this instance, the external force is in equilibrium with the internal spring force . Imagine then, that a small perturbation in the displacement increases the position to corresponding to an internal force . Since the slope is negative, . This, in turn, will lead to further extension in the direction of the higher force . Thus, the system will become unstable with the external force acting to increase the extension x in an unstable fashion.

Note that if the extension of the spring is applied using a displacement-controlling mechanism, this unstable mechanism will not be observed.

On the other hand, a spring whose force is always increasing with respect to the displacement (Figures 2a and 2b), and if the external load is not a function of the displacement then this spring is always stable and the mathematical expression for that is: A continuously smooth function whose second derivative is always higher than zero belongs to the family of “convex” functions. If the elastic strain energy density of continuum bodies is convex in its variables, this implies that the material is stable. Figure 2. Force versus extension in nonlinear elastic springs. (a) and (b) Slope is always positive, and the potential energy is minimum at the equilibrium position. (c) and (d) have negative slopes in some portions, and thus, at those locations, any perturbation in the displacement would lead to instabilities and loss of equilibrium.

#### Non-Elastic Spring:

The term nonelastic spring implies that the force in the spring is not simply a function of the position only but of the history of loading as well. For example, during a cycle of loading, the energy supplied by external sources dissipates in the system or turns into a form that is not useful. Figure 3 shows an elasto-plastic spring during a cycle of gradual loading and unloading. When the mass is gradually removed, the spring does not return back to its original position, but has a residual extension . The energy required to reach from state A to state B is the area under the curve shown in Figure 3b. During unloading, the load displacement curve follows a different path and some energy is lost. As can be seen in state C shown in Figure 3, the energy lost during the loading cycle is manifested in some change in the internal structure of the spring, which now has a longer length than that before loading. In such springs, a potential energy function cannot be easily defined, and the behaviour of the spring is history (path) dependent. Figure 3. A cycle of loading and unloading in an elasto-plastic spring. (a) The process of loading and unloading produces a residual plastic extension, (b) energy supplied to the spring during the loading process, (c) part of the energy supplied is recovered and another part is lost in the damaging or plastification effect.

### Dynamic Equilibrium of a Mass-Spring System:

In the previous section, we were concerned with finding a position at which the system is stable. At this position, the velocity and acceleration of the mass is equal to zero. That position was termed the “static equilibrium” position of the system. A static equilibrium position is not always available. On the other hand, Newton’s equations of motion can be applied to any system to find the velocity and the acceleration due to the applied external loads. Any system, at any point in time, is in a state of dynamic equilibrium with the external loads. In a simple dynamic situation, there are two forms for energy in the system, the potential energy which was defined in the previous section and the kinetic energy due to the movement of the mass. To illustrate these concepts, we will investigate the dynamic equilibrium of a mass-spring system. We will restrict our example to a linear elastic spring where and to a system where the initial conditions are such that at and the velocity . The equation of dynamic equilibrium is:

(2) Unlike the previous section, the above equation is applicable at any displacement . I.e., : We can now integrate the above equation from 0 to an arbitrary as follows: The following equality can be used to simplify the second integral in the above equation: Therefore: Therefore: The first term is called the kinetic energy ( ) of the system while the sum of the last two terms on the left hand side are equal to the potential energy of the system (see Equation 1). The total energy ( ) is the sum of both and therefore throughout the dynamic equilibrium (at any point in time or at any position ): Going back to the differential equation (Equation 2), and utilizing the initial and boundary conditions, we can use Mathematica to find the solution for the position of the mass as a function of time : View Mathematica Code

Clear[m,g,x,k]
DSolve[{m*g-k*x[t]==m*x''[t],x==0,x'==0},x,t]


View Python Code

from sympy import dsolve,Eq,trigsimp
import sympy as sp
m,g,k,t = sp.symbols("m g k t")
x = sp.Function("x")
dx = x(t).diff(t)
ddx = x(t).diff(t,2)
x1 = x(t).subs(t,0)
dx1 = dx.subs(t,0)
s = trigsimp(dsolve(m*g-k*x(t)-m*ddx,x(t),ics ={x1:0,dx1:0}))
display(s)
display(s.rewrite(sp.cos).simplify())
display("Note that for t,k and m > 0 the following two expressions are equal")
gg = Eq(sp.cosh(t*sp.sqrt((-k/m))),sp.cos(t*sp.sqrt((k/m))))
display(gg)


Two important observations to note about this solution. The first observation is that the solution predicts that the mass will vibrate around the static equilibrium position: The second observation is that the maximum position for the spring is obtained when the cosine function is equal to –1 and thus, The corresponding force in the spring is equal to I.e., the force in the spring is doubled compared to the case of static equilibrium! In the process of designing a structure susceptible to vibrations, a dynamic effect factor is usually considered and this dynamic factor is usually between 1 and 2. This dynamic factor accounts for the increase in the internal forces induced by the vibrations. If the loads are expected to be applied in a sudden manner, similar to the initial conditions used in the differential equation, then the dynamic factor is closer to 2. In the other cases, when the load is expected to be applied in a gradual manner then the dynamic factor would be closer to 1.

The following code can help you visualize the effect of changing the mass and the stiffness on the vibration of the system. Copy and paste the code in your Mathematica program. Comment on the effect of increasing the stiffness and or the mass on the vibrations.

View Mathematica Code

Manipulate[g = 1;
Graphics3D[{GrayLevel[0.3],
Cuboid[{-1, -1, -5}, {0, 0, (g*m - g*m*Cos[Sqrt[k/m]*t])/k}]},
Axes -> True, Lighting ->" Neutral",
PlotRange -> {{-1, 0}, {-1, 0}, {-5, 2*5/1}},
BaseStyle -> Directive[Bold, 12], AxesOrigin -> {0, 0, 0},
ViewVertical -> {0, 0, -1}], {t, 0, 4*Pi*Sqrt}, {m, 1, 5}, {k, 1, 5}]


View Python Code

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
from mpl_toolkits.mplot3d import Axes3D
%matplotlib notebook
class plot3dCube(object):
def __init__(self, origin, length, color):
# origin[x,y,z], length[Lx,Ly,Lz],
self.g = 1
self.origin = origin
self.length = length
#initial plot
self.updateCube(origin,length)
self.height = length
# create plot figure
self.fig = plt.figure(figsize=(6,7))
self.ax = self.fig.add_subplot(111, projection='3d')
self.ax.set_xlim3d(-1, 0)
self.ax.set_ylim3d(-1, 0)
self.ax.set_zlim3d(-5, 10)
self.ax.set_xlabel('X')
self.ax.set_ylabel('Y')
self.ax.set_zlabel('Z')
# set color
self.color = color
# dictionary of surfaces and edges
self.dFrm = {}
# surface variable name
surface = "self.surface"
# edge variable name
edge = "self.edge"
# generate frame and edge plots
for i in range(len(self.sqrP)):
# number
n = str(i)
self.dFrm[surface+n], self.dFrm[edge+n] = self.initFrame(self.sqrP[i][:])
# slider plot
plt.subplots_adjust(left = 0.1, bottom = 0.45)
# input the position of sliders
xSlider = plt.axes([0.2,0.2,0.5,0.03])
ySlider = plt.axes([0.2,0.15,0.5,0.03])
zSlider = plt.axes([0.2,0.1,0.5,0.03])
xSlider.set_xticks(np.array([90,180,270]), minor = True)
ySlider.set_xticks(np.array([1,2,3,4]), minor = True)
zSlider.set_xticks(np.array([1,2,3,4]), minor = True)
# input values and update graph
self.slider1 = Slider(xSlider, 't', 0, 4*np.pi*np.sqrt(5), valinit = 0, valstep = 0.1)
self.slider2 = Slider(ySlider, 'm', 1, 5, valinit = 1, valstep = 0.1)
self.slider3 = Slider(zSlider, 'k', 1, 5, valinit = 1, valstep = 0.1)
# updates the graph when input is changes
self.slider1.on_changed(self.updateGraph)
self.slider2.on_changed(self.updateGraph)
self.slider3.on_changed(self.updateGraph)
def updateCube(self,origin, length):
Lx,Ly,Lz = length
x1,y1,z1 = origin
x2,y2,z2 = [length[i]+origin[i] for i in range(3)]
# for A as X,Y,Z
# A_1212 uses [[x1, x2][x1,x2]]
# A_1122 is just X_1.T
# A_1111 all x1
# A_2222 all x2
r = [x1, x2]
X_1212 = np.array([r,r])
X_1111 = np.ones(4).reshape(2, 2)*x1
X_2222 = np.ones(4).reshape(2, 2)*x2
r = [y1, y2]
Y_1212, Y_1122 = np.meshgrid(r, r)
Y_1111 = np.ones(4).reshape(2, 2)*y1
Y_2222 = np.ones(4).reshape(2, 2)*y2
r = [z1, z2]
Z_1122 = np.array([r,r]).transpose()
Z_1111 = np.ones(4).reshape(2, 2)*z1
Z_2222 = np.ones(4).reshape(2, 2)*z2
# points of the cube
self.points = np.array([[x1, y1, z1],
[x2, y1, z1],
[x2, y2, z1],
[x1, y2, z1],
[x1, y1, z2],
[x2, y1, z2],
[x2, y2, z2],
[x1, y2, z2]])
# square points for surface, edges
self.sqrP = [[X_1212,Y_1122,Z_1111],[X_1212,Y_1122,Z_2222],
[X_1212,Y_1111,Z_1122],[X_1212,Y_2222,Z_1122],
[X_1111,Y_1212,Z_1122],[X_2222,Y_1212,Z_1122]]
def initFrame(self, sqrP):
surface = self.ax.plot_surface(sqrP,sqrP,sqrP,alpha=0.5,color=self.color)
edge = self.ax.plot_wireframe(sqrP,sqrP,sqrP,alpha=0.5,color=self.color)
return surface, edge
def updateGraph(self, event):
t, m, k = self.slider1.val, self.slider2.val, self.slider3.val
g = self.g
z = (g*m-g*m*np.cos(np.sqrt(k/m)*t))/k
self.origin = z
self.length = self.height - z
self.updateCube(self.origin, self.length)
self.updateFrames()
def updateFrame(self, surface, edge, X, Y, Z):
#destory previous surfaces and edges
surface.remove()
edge.remove()
# plot surfaces and edges
surface = self.ax.plot_surface(X,Y,Z, alpha = 0.5, color = self.color)
edge = self.ax.plot_wireframe(X,Y,Z, alpha = 0.5, color = self.color)
return surface, edge
def updateFrames(self):
surface = "self.surface"
edge = "self.edge"
# destroy current surface and edge, new surface and edge
for j in range(6):
n = str(j)
self.dFrm[surface+n], self.dFrm[edge+n]= self.updateFrame(self.dFrm[surface+n],self.dFrm[edge+n],
self.sqrP[j],self.sqrP[j],self.sqrP[j])
plt.draw()
plt.pause(.01)
# main function
p = plot3dCube([0,0,0], [-1,-1,-5],["grey","black"])


### Examples and Problems

#### Example 1

The force versus displacement of a nonlinear elastic spring follows the following relationship: where the force and the displacement are given in N and mm, respectively. If the range of applicability of this formula is when , then:

• Draw the relationship between the force versus displacement in the full range of applicability of this relationship.
• Find the strain energy stored inside the sprint at full extension and at full contraction.
• Find the displacement in the spring that corresponds to a force of 3kN and a force of -1kN.
• comment on the behaviour of the spring at and .
##### SOLUTION
The required plot is shown here:

The strain energy stored inside the spring at full extension and full contraction can be obtained by integration: The displacements corresponding to 3kN and -1kN can be obtained using the Newton Raphson method, which is implemented in Mathematica using the function “FindRoot” and they are: The graph of the force versus the displacement of the spring predicts an unstable behaviour at full extension and at . The forces that can be carried by the spring at those two displacement values are equal to 3.75 kN and -2.037 kN, respectively. At both displacements or at both spring forces values, the slope of the spring force versus extension is equal to zero, indicating that a small increase in the external force applied on the spring will lead to an unstable behaviour for the spring. Notice that the slope of the spring force versus extension is equal to the second derivative of the strain energy function: Thus, for the sake of stability of the spring, it should be used at force values that are sufficiently less than 3.75 kN in tension and -2.037 kN in compression.

View Mathematica Code

Clear[x];
f = 1000 x + 50 x^2 - 20 x^3;
Plot[f, {x, -5, 5}, AxesLabel -> {"x (mm)", "f (N)"},
PlotStyle -> Black]
Integrate[f, {x, 0., 5}]
Integrate[f, {x, 0., -5}]
FindRoot[f == 3000, {x, 0}]
FindRoot[f == -1000, {x, 0}]
a = D[f, x];
sol = Solve[a == 0., x]
f /. sol[[1, 1]]
f /. sol[[2, 1]]


View Python Code

import sympy as sp
import numpy as np
from sympy import integrate, lambdify, solve
from matplotlib import pyplot as plt
from mpmath import findroot, mp
mp.pretty = True
x = sp.symbols("x")
f = 1000*x+50*x**2-20*x**3
F = lambdify(x,f)
xL = np.arange(-5,5,0.1)
y = F(xL)
fig, ax = plt.subplots()
plt.xlabel("f(N)")
plt.ylabel("(mm)")
ax.plot(xL, y)
ax.grid(True, which='both')
ax.axhline(y = 0, color = 'k')
ax.axvline(x = 0, color = 'k')
display("E_{full extension}",integrate(f,(x, 0, 5)).evalf())
display("E_{full contraction}",integrate(f,(x, 0, -5)).evalf())
f1 = 1000*x+50*x**2-20*x**3-3000
display("Raphson method")
func = lambdify(x, f1)
sol = findroot(func,0)
display("@3kN, x =",sol)
f2 = 1000*x+50*x**2-20*x**3+1000
func = lambdify(x, f2)
sol = findroot(func,0)
display("@-1kN, x =",sol)
display("Unstable behaviour of the spring")
a = f.diff(x)
sol = solve(a,x)
display("x =",[i.evalf() for i in sol])
display("Tension limits")
display("f(-3.33) = ",f.subs({x:sol}).evalf())
display("f(5) =",f.subs({x:sol}))


#### Problems

1. A spring manufacturer supplies three different elastic springs with the following three force-displacement relationships: with the units of and being N and mm, respectively. The manufacturer warns that the above relationships are only valid when the spring is stretched or contracted with a distance of 0.5mm. Draw the relationship between the force and the displacement in the specified range.
• Find the strain energy stored in each spring at full extension and at full contraction. (Answer: 12.5, 16.67, 28.125, 12.5, 8.33, 28.125 N.mm).
• If a spring is required to carry a force of 45N (tension), find the displacement exhibited by each spring, and comment on which spring you would choose for this application.
• If a spring is required to carry a force of –45N (compression), find the displacement exhibited by each spring, and comment on which spring you would choose for this application.
• Comment on the stability of the second spring at full contraction.