# ME200 HW#2 - Fall 2015

## ME200 - Thermodynamics.¶

### Homework #2¶

#### Given:¶

A damaged 1200 kg car being towed by a truck

#### Find:¶

1. Power (kW) required for towing on level surface at constant velocity.
2. Power (kW) required for towing on inclined surface at constant velocity.
3. Power (kw) required for towing on level surface with acceleration

#### Assumptions:¶

• Negligible friction on the surface
• Ignore air drag and rolling resistance

#### Solution / Graphs / Final Answers:¶

Total power required for towing the car will be equal to the rate of change in potential energy and kinetic energy:

$$\dot{W}_t=\dot{W}_{PE}+\dot{W}_{KE}=\frac{mg\big(z_2-z_1\big)+\frac{1}{2}\big(\forall_2^2-\forall_1^2\big)}{\Delta t}$$

(a) When the car is being towed on a level surface, there is no change in potential energy. Since the car is being towed at constant velocity, the change in kinetic energy is zero. Hence, no additional power is required for towing the car at constant velocity on a level surface.

$\dot{W}_T=0$

There is no change in kinetic energy. However, the change in inclination results in change in potential energy. The rate of change of potential energy is given as:

\begin{align} \dot{W}_{PE} &= \frac{mg\delta z}{\delta t} \\ &= mgV_z \\ &= mgVsin30^o \end{align}
In [1]:
import pint, math
from IPython.display import Latex
u=pint.UnitRegistry()

In [2]:
m=1200*u.kilogram
g=u.gravity
V=50*u.kilometer/u.hour
theta=30
Latex("The power required for towing the car on the inclined surface is: $\dot{W}_t=$"+"{:.2f}".format(Wdot_pe))

Out[2]:
The power required for towing the car on the inclined surface is: $\dot{W}_t=$81.72 kilowatt

There is no change in potential energy. However, acceleration results in change in kinetic energy. The rate of change of kinetic energy is given as:

\begin{align} \dot{W}_{KE}&=\frac{\frac{1}{2} m \big(\forall_2^2-\forall_1^2\big)}{\Delta t} \\ &=\frac{m \big(\forall_2^2-\forall_1^2\big)}{2\Delta t} \end{align}
In [3]:
V2=(90*u.km/u.hour)
V1=0*u.km/u.hour
dt=12*u.second
Wdot_ke=m*(V2 ** 2 - V1 **2)/(2*dt)
Latex("Hence, the power required for towing the car on a level surface when accelerating from rest $\dot{W}_t=$"+"{:.2f}".format(Wdot_ke.to(u.kilowatt)))

Out[3]:
Hence, the power required for towing the car on a level surface when accelerating from rest $\dot{W}_t=$31.25 kilowatt

#### Problem 2¶

##### Given¶

Heating of gas inside a cylinder with piston motion contrained by stopes

##### Find:¶
1. Work (kJ) from State 1 to State 3
2. Work (kJ) from State 2 to State 3
3. P-V diagram
In [4]:
kPa=u.kilopascal
L=u.liter
kg=u.kilogram
m=u.meter
kJ=u.kilojoule

P_atm=101*kPa
P1=70*kPa
V1=1.25*L
Ap=0.005*m**2
mp=25*kg

$$\begin{array} PP_2 &> P_1 \\ V_2 &= V_1 \end{array}$$
In [5]:
V2=V1
V3=1.75*L

##### Assumptions¶
• Quasi-equilibrium process
• Negligible friction
##### Basic Equations¶

$W_b=\int PdV$

##### Solution¶

(a) Gas inside the cylinder must be heated to a pressure such that it can overcome the weight of the piston and the surrounding pressure. Therefore, volume remains constant from State 1 to State 2 i.e. dV = 0. Work during the process from State 1 to State 2: $W_{12} \int_1^2 P dV \Rightarrow W_{12}=0$ b) Considering force balance on the piston, we can write the pressure required to move the piston from the bottom stops (State 2): $$P_2=P_{atm} + \frac{W_{piston}}{A_{piston}} = P_{atm} + \frac{m_pg}{A_p}$$

In [6]:
P2=P_atm+mp*g/Ap
print("P2={}".format(P2))

P2=150.03324999999998 kilopascal


After leaving the bottom stops, if the heat is added slowly, forces on the piston remain unchanged until the gas expands and reaches the top stops. Therefore, pressure remains constant from State 2 to State 3. Work during the process from State 2 to State 3:

$$W_{23}=\int_2^3PdV=(P_2=P_3)(V_3-V_2)$$
In [7]:
P3=P2
W23=P3*(V3-V2)
print("W23={:.3f}".format(W23.to(kJ)))

W23=0.075 kilojoule

In [8]:
# Remove dimensions for plotting
V1=V1.to(u.L).magnitude
V2=V2.to(u.L).magnitude
P1=P1.to(u.kPa).magnitude
P2=P2.to(u.kPa).magnitude
V3=V3.to(u.cm ** 3).magnitude
P3=P3.to(u.kPa).magnitude

In [9]:
%pylab inline

Populating the interactive namespace from numpy and matplotlib

In [10]:
plt.xkcd()  # (Yes, this is going to happen)
ax = plt.axes()
ax.axis([0,2,0,200])
axvline(x=V1,color='k',ls='dashed')
axvline(x=V3,color='k',ls='dashed')
axhline(y=P1,color='k',ls='dashed')
axhline(y=P2,color='k',ls='dashed')
plt.plot([V1,V2],[P1,P2])
plt.plot([V2,V3],[P2,P3])
plt.xlabel("Volume ($cm^3$)")
plt.ylabel("Pressure (kPa)")
plt.title('PV Diagram')

Out[10]:
<matplotlib.text.Text at 0x811cf23c8>
/usr/local/lib/python3.4/site-packages/matplotlib/font_manager.py:1282: UserWarning: findfont: Font family ['Humor Sans', 'Comic Sans MS'] not found. Falling back to Bitstream Vera Sans
(prop.get_family(), self.defaultFamily[fontext]))


#### Problem #3¶

##### Given¶

Heating of hydrogen gas inside a cylinder fitted with piston attached to a linear spring.

##### Find¶
1. Atmospheric pressure (psia)
2. P-V diagram
3. Final pressure (psia) of hydrogen gas
4. Total work (Btu) during the expansion process
5. Fraction of work done against the spring
In [11]:
psia=u.pound_force/u.inch ** 2
ft3=u.ft ** 3
lbm=u.pound

P1=14.7*psia
V1=15*ft3
ks=15000*u.pound_force/u.feet
mp=1000*lbm
Ap=3*ft3
V2=30*ft3

##### Basic Equations¶

$W = \int PdV$

##### Solution¶

(a). Consider force balance on the piston:

$P_1=P_{atm}+\frac{W_{piston}}{A_{piston}}=P_{atm}+\frac{m_pg}{A_p}$

In [12]:
P_atm=P1-mp*g/Ap

---------------------------------------------------------------------------
DimensionalityError                       Traceback (most recent call last)
<ipython-input-12-d997f808ed44> in <module>()
----> 1 P_atm=P1-mp*g/Ap

/usr/local/lib/python3.4/site-packages/pint/quantity.py in __sub__(self, other)
502
503     def __sub__(self, other):
505
506     def __rsub__(self, other):

413             raise DimensionalityError(self.units, other.units,
414                                       self.dimensionality,
--> 415                                       other.dimensionality)
416
417         # Next we define some variables to make if-clauses more readable.

DimensionalityError: Cannot convert from 'force_pound / inch ** 2' ([mass] / [length] / [time] ** 2) to 'pound * standard_gravity / foot ** 3' ([mass] / [length] ** 2 / [time] ** 2)

I don't care enough about this to figure out why the units don't work other than to say stop using English units. Just stop. For the love of all of industies stop.

(c) For a linear spring, the force is linearly proportional to the displacement from the equilibrium position. Force exerted by the spring can be written as:

$$F_{spring}=k_{spring}*x_{spring}=k_{spring}\frac{V_2-V_1}{A_{piston}}$$

In [13]:
F_spring=ks*(V2-V1)/Ap
print("Sprig Force = {:f}".format(F_spring))
print("Sprig Force = {:f}".format(F_spring.to_base_units()))

Sprig Force = 75000.000000 force_pound / foot
Sprig Force = 1094542720.290477 gram / second ** 2

In [14]:
P2=P1+F_spring/Ap

---------------------------------------------------------------------------
DimensionalityError                       Traceback (most recent call last)
<ipython-input-14-705eae9324ce> in <module>()
----> 1 P2=P1+F_spring/Ap

491
494

413             raise DimensionalityError(self.units, other.units,
414                                       self.dimensionality,
--> 415                                       other.dimensionality)
416
417         # Next we define some variables to make if-clauses more readable.

DimensionalityError: Cannot convert from 'force_pound / inch ** 2' ([mass] / [length] / [time] ** 2) to 'force_pound / foot ** 4' ([mass] / [length] ** 3 / [time] ** 2)

Again. Stop using English units. The rest of this problem is English units.

#### Problem 4¶

##### Given¶

Compression of gas inside a piston-cylinder device in three different processes

##### Find¶
• Work (kJ) during the process:
• P = constant
• PV = constant
• PV^2 = constant
• Process to minimize required work input
In [15]:
kg=u.kg
kJ=u.kJ
bar=u.bar
m3=u.m **3

In [16]:
m=.2*kg
P1=1*bar
V1=0.02*m3
V2=0.01*m3

##### Basic Equations¶

$W = \int PdV$

##### Solution¶

(a). For constant pressure process, work during compression

$W_{12}=\int_1^2PdV=(P_1=P_2)(V_2-V_1)$

In [17]:
W12_1=(P1*(V2-V1)).to(kJ)
print("For constant pressure process, work during compression: {:3f}".format(W12_1))

For constant pressure process, work during compression: -1.000000 kilojoule


For a process during which PV=constant, work during compression $W_{12}=\int_1^2PdV =$ constant $\int_1^2\frac{dV}{V}=(P_1V_1=P_2V_2)ln\frac{V2}{V1}$

In [18]:
W12_2=(P1*V1*math.log(V2/V1)).to(kJ)
print("For constant pressure process, work during compression: {:3f}".format(W12_2))

For constant pressure process, work during compression: -1.386294 kilojoule


For a process during which $PV^2$=constant, work during compression $W_{12}=\int_1^2PdV =$ constant $\int_1^2\frac{dV}{V^2}=-P_1V_1^2\big(\frac{1}{V_2}-\frac{1}{V_1}\big)$

In [19]:
W12_3=(-P1*(V1 ** 2)*(1/V2-1/V1)).to(kJ)
print("For a process during which PV^2=constant, work during compression: {:3f}".format(W12_3))

For a process during which PV^2=constant, work during compression: -2.000000 kilojoule


(b) Since work input is required for compression process, the process with minimum work input i.e. constant pressure process should be recommended

#### Problem 5¶

##### Given¶

Mass accelerated vertically upwards

##### Find¶

Total change in energy (kJ)

##### System¶
In [20]:
s=u.s
V2=10*u.m/s
V1=0*u.m/s
mass=10*kg
z2=100*u.m
z1=0*u.m
du=100*u.J/kg

##### Assumptions¶
• Ignore air drag
##### Basic Equations¶

$\Delta E = \Delta U + \Delta$KE$\Delta$PE

##### Solution¶

Total change in energy of the mass: $\Delta E = \Delta U + \Delta$KE$\Delta$PE

Change in internal energy: $\Delta U=m\Delta u$

In [21]:
dU=mass*du
print("Change in internal energy: {}".format(dU.to(kJ)))

Change in internal energy: 1.0 kilojoule


Change in kinetic energy: $\Delta KE=\frac{1}{2}m\big(\forall_2^2-\forall_1^2\big)$

In [22]:
dKE=1/2*mass*(V2**2)
print("Change in kinetic energy: {}".format(dKE.to(kJ)))

Change in kinetic energy: 0.5 kilojoule


Change in potential energy: $\Delta PE=mg(z_2-z_1)$

In [23]:
dPE=m*g*(z2-z1)
print("Change in potential energy: {}".format(dPE.to(kJ)))
dE=dU+dKE+dPE
print("Change in total energy: {}".format(dE.to(kJ)))

Change in potential energy: 0.19613299999999997 kilojoule
Change in total energy: 1.6961330000000001 kilojoule


#### Problem 6¶

Is in English units. I learned my lesson.