Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ok-landscape
GitHub Repository: Ok-landscape/computational-pipeline
Path: blob/main/latex-templates/templates/mechanical-engineering/thermodynamics_cycle.tex
51 views
unlisted
1
\documentclass[11pt,a4paper]{article}
2
3
% Document Setup
4
\usepackage[utf8]{inputenc}
5
\usepackage[T1]{fontenc}
6
\usepackage{lmodern}
7
\usepackage[margin=1in]{geometry}
8
\usepackage{amsmath,amssymb}
9
\usepackage{siunitx}
10
\usepackage{booktabs}
11
\usepackage{float}
12
\usepackage{caption}
13
\usepackage{hyperref}
14
15
% PythonTeX Setup
16
\usepackage[makestderr]{pythontex}
17
18
\title{Thermodynamic Cycles: Efficiency Analysis}
19
\author{Mechanical Engineering Laboratory}
20
\date{\today}
21
22
\begin{document}
23
\maketitle
24
25
\begin{abstract}
26
This report presents computational analysis of thermodynamic power cycles including Carnot, Otto, Diesel, and Rankine cycles. We examine ideal and actual cycle efficiencies, P-v and T-s diagrams, and parametric studies. Python-based computations provide quantitative analysis with dynamic visualization.
27
\end{abstract}
28
29
\tableofcontents
30
\newpage
31
32
\section{Introduction to Thermodynamic Cycles}
33
34
Thermodynamic cycles convert heat into work. The four cycles analyzed here are:
35
\begin{itemize}
36
\item Carnot cycle: Maximum possible efficiency (theoretical ideal)
37
\item Otto cycle: Spark-ignition internal combustion engines
38
\item Diesel cycle: Compression-ignition engines
39
\item Rankine cycle: Steam power plants
40
\end{itemize}
41
42
% Initialize Python environment
43
\begin{pycode}
44
import numpy as np
45
import matplotlib.pyplot as plt
46
from scipy.optimize import fsolve
47
48
plt.rcParams['figure.figsize'] = (8, 5)
49
plt.rcParams['font.size'] = 10
50
plt.rcParams['text.usetex'] = True
51
52
# Air properties (ideal gas)
53
gamma = 1.4
54
cp = 1005 # J/kgK
55
cv = cp / gamma
56
R = cp - cv
57
58
def save_fig(filename):
59
plt.savefig(filename, dpi=150, bbox_inches='tight')
60
plt.close()
61
\end{pycode}
62
63
\section{Carnot Cycle}
64
65
The Carnot efficiency sets the maximum limit:
66
\begin{equation}
67
\eta_{Carnot} = 1 - \frac{T_L}{T_H}
68
\end{equation}
69
70
\begin{pycode}
71
# Carnot cycle analysis
72
T_L = 300 # K (cold reservoir)
73
T_H_range = np.linspace(400, 1500, 100)
74
eta_carnot = 1 - T_L / T_H_range
75
76
# T-s diagram for Carnot cycle
77
T_H = 1000 # K
78
s1, s2 = 0, 1 # kJ/kgK
79
80
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
81
82
# Efficiency vs temperature
83
ax1.plot(T_H_range, eta_carnot * 100, 'b-', linewidth=2)
84
ax1.axhline(50, color='r', linestyle='--', alpha=0.5, label='50\\% efficiency')
85
ax1.set_xlabel('Hot Reservoir Temperature $T_H$ (K)')
86
ax1.set_ylabel('Carnot Efficiency (\\%)')
87
ax1.set_title(f'Carnot Efficiency ($T_L$ = {T_L} K)')
88
ax1.legend()
89
ax1.grid(True, alpha=0.3)
90
91
# T-s diagram
92
s_cycle = [s1, s2, s2, s1, s1]
93
T_cycle = [T_L, T_L, T_H, T_H, T_L]
94
ax2.plot(s_cycle, T_cycle, 'b-', linewidth=2)
95
ax2.fill(s_cycle, T_cycle, alpha=0.3)
96
ax2.set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')
97
ax2.set_ylabel('Temperature $T$ (K)')
98
ax2.set_title('Carnot Cycle T-s Diagram')
99
ax2.grid(True, alpha=0.3)
100
101
# Label processes
102
ax2.annotate('1-2: Isothermal expansion', xy=(0.5, T_H), xytext=(0.6, T_H+100),
103
arrowprops=dict(arrowstyle='->', color='black'), fontsize=9)
104
ax2.annotate('3-4: Isothermal compression', xy=(0.5, T_L), xytext=(0.6, T_L-100),
105
arrowprops=dict(arrowstyle='->', color='black'), fontsize=9)
106
107
plt.tight_layout()
108
save_fig('carnot_cycle.pdf')
109
110
eta_carnot_design = 1 - T_L / T_H
111
\end{pycode}
112
113
\begin{figure}[H]
114
\centering
115
\includegraphics[width=\textwidth]{carnot_cycle.pdf}
116
\caption{Carnot cycle: efficiency dependence on temperature and T-s diagram.}
117
\end{figure}
118
119
Carnot efficiency at $T_H = 1000$ K: $\eta = \py{f"{eta_carnot_design*100:.1f}"}$\%
120
121
\section{Otto Cycle}
122
123
The Otto cycle efficiency depends on compression ratio:
124
\begin{equation}
125
\eta_{Otto} = 1 - \frac{1}{r^{\gamma-1}}
126
\end{equation}
127
128
\begin{pycode}
129
# Otto cycle analysis
130
r_range = np.linspace(4, 14, 100) # Compression ratio
131
eta_otto = 1 - 1/r_range**(gamma-1)
132
133
# P-v diagram for specific compression ratio
134
r = 10
135
P1 = 100e3 # Pa
136
T1 = 300 # K
137
V1 = 1 # m^3 (normalized)
138
V2 = V1/r
139
140
# State points
141
T2 = T1 * r**(gamma-1)
142
P2 = P1 * r**gamma
143
144
# Heat addition (constant volume)
145
q_in = 1000e3 # J/kg
146
T3 = T2 + q_in/cv
147
P3 = P2 * T3/T2
148
149
# Expansion
150
T4 = T3 / r**(gamma-1)
151
P4 = P3 / r**gamma
152
153
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
154
155
# Efficiency vs compression ratio
156
axes[0, 0].plot(r_range, eta_otto * 100, 'b-', linewidth=2)
157
axes[0, 0].axvline(r, color='r', linestyle='--', alpha=0.5, label=f'r = {r}')
158
axes[0, 0].set_xlabel('Compression Ratio $r$')
159
axes[0, 0].set_ylabel('Thermal Efficiency (\\%)')
160
axes[0, 0].set_title('Otto Cycle Efficiency')
161
axes[0, 0].legend()
162
axes[0, 0].grid(True, alpha=0.3)
163
164
# P-v diagram
165
V = np.linspace(V2, V1, 100)
166
P_12 = P1 * (V1/V)**gamma # Compression (1-2)
167
P_34 = P3 * (V2/V)**gamma # Expansion (3-4)
168
169
axes[0, 1].plot(V, P_12/1e6, 'b-', linewidth=2)
170
axes[0, 1].plot(V, P_34/1e6, 'r-', linewidth=2)
171
axes[0, 1].plot([V2, V2], [P2/1e6, P3/1e6], 'g-', linewidth=2) # 2-3
172
axes[0, 1].plot([V1, V1], [P4/1e6, P1/1e6], 'g-', linewidth=2) # 4-1
173
axes[0, 1].set_xlabel('Volume $V/V_1$')
174
axes[0, 1].set_ylabel('Pressure (MPa)')
175
axes[0, 1].set_title('Otto Cycle P-v Diagram')
176
axes[0, 1].grid(True, alpha=0.3)
177
178
# T-s diagram (approximate)
179
s = np.array([0, 0, 0.7, 0.7, 0])
180
T = np.array([T1, T2, T3, T4, T1])
181
axes[1, 0].plot(s, T, 'b-o', linewidth=2, markersize=8)
182
axes[1, 0].set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')
183
axes[1, 0].set_ylabel('Temperature (K)')
184
axes[1, 0].set_title('Otto Cycle T-s Diagram')
185
axes[1, 0].grid(True, alpha=0.3)
186
for i, txt in enumerate(['1', '2', '3', '4']):
187
axes[1, 0].annotate(txt, (s[i], T[i]), xytext=(5, 5), textcoords='offset points')
188
189
# Effect of gamma
190
gamma_range = [1.2, 1.3, 1.4, 1.5]
191
for g in gamma_range:
192
eta = 1 - 1/r_range**(g-1)
193
axes[1, 1].plot(r_range, eta * 100, linewidth=1.5, label=f'$\\gamma$ = {g}')
194
195
axes[1, 1].set_xlabel('Compression Ratio $r$')
196
axes[1, 1].set_ylabel('Thermal Efficiency (\\%)')
197
axes[1, 1].set_title('Effect of Specific Heat Ratio')
198
axes[1, 1].legend()
199
axes[1, 1].grid(True, alpha=0.3)
200
201
plt.tight_layout()
202
save_fig('otto_cycle.pdf')
203
204
eta_otto_design = 1 - 1/r**(gamma-1)
205
W_net = q_in * eta_otto_design
206
\end{pycode}
207
208
\begin{figure}[H]
209
\centering
210
\includegraphics[width=\textwidth]{otto_cycle.pdf}
211
\caption{Otto cycle analysis: efficiency, P-v diagram, T-s diagram, and gamma effect.}
212
\end{figure}
213
214
Otto efficiency at $r = 10$: $\eta = \py{f"{eta_otto_design*100:.1f}"}$\%, Net work = \py{f"{W_net/1000:.0f}"} kJ/kg
215
216
\section{Diesel Cycle}
217
218
The Diesel cycle efficiency includes the cutoff ratio:
219
\begin{equation}
220
\eta_{Diesel} = 1 - \frac{1}{r^{\gamma-1}} \cdot \frac{r_c^{\gamma} - 1}{\gamma(r_c - 1)}
221
\end{equation}
222
223
\begin{pycode}
224
# Diesel cycle analysis
225
r = 20 # Compression ratio (higher than Otto)
226
r_c_range = np.linspace(1.5, 4, 100) # Cutoff ratio
227
228
eta_diesel = 1 - (1/r**(gamma-1)) * (r_c_range**gamma - 1)/(gamma*(r_c_range - 1))
229
230
# Compare with Otto at same compression ratio
231
eta_otto_r20 = 1 - 1/r**(gamma-1)
232
233
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
234
235
# Efficiency vs cutoff ratio
236
ax1.plot(r_c_range, eta_diesel * 100, 'b-', linewidth=2, label='Diesel')
237
ax1.axhline(eta_otto_r20 * 100, color='r', linestyle='--', linewidth=2, label=f'Otto (r={r})')
238
ax1.set_xlabel('Cutoff Ratio $r_c$')
239
ax1.set_ylabel('Thermal Efficiency (\\%)')
240
ax1.set_title(f'Diesel Cycle Efficiency (r = {r})')
241
ax1.legend()
242
ax1.grid(True, alpha=0.3)
243
244
# Comparison of Otto and Diesel
245
r_comp = np.linspace(8, 24, 100)
246
eta_otto_comp = 1 - 1/r_comp**(gamma-1)
247
r_c = 2.5 # Fixed cutoff ratio
248
eta_diesel_comp = 1 - (1/r_comp**(gamma-1)) * (r_c**gamma - 1)/(gamma*(r_c - 1))
249
250
ax2.plot(r_comp, eta_otto_comp * 100, 'b-', linewidth=2, label='Otto')
251
ax2.plot(r_comp, eta_diesel_comp * 100, 'r-', linewidth=2, label=f'Diesel ($r_c$={r_c})')
252
ax2.set_xlabel('Compression Ratio $r$')
253
ax2.set_ylabel('Thermal Efficiency (\\%)')
254
ax2.set_title('Otto vs Diesel Cycle Comparison')
255
ax2.legend()
256
ax2.grid(True, alpha=0.3)
257
258
plt.tight_layout()
259
save_fig('diesel_cycle.pdf')
260
261
r_c_design = 2.5
262
eta_diesel_design = 1 - (1/r**(gamma-1)) * (r_c_design**gamma - 1)/(gamma*(r_c_design - 1))
263
\end{pycode}
264
265
\begin{figure}[H]
266
\centering
267
\includegraphics[width=\textwidth]{diesel_cycle.pdf}
268
\caption{Diesel cycle: efficiency dependence on cutoff ratio and comparison with Otto.}
269
\end{figure}
270
271
Diesel efficiency at $r = 20$, $r_c = 2.5$: $\eta = \py{f"{eta_diesel_design*100:.1f}"}$\%
272
273
\section{Rankine Cycle}
274
275
The Rankine cycle uses phase change for higher efficiency:
276
277
\begin{pycode}
278
# Simplified Rankine cycle analysis
279
# Using approximate steam properties
280
281
# Operating conditions
282
P_boiler = 10e6 # Pa (10 MPa)
283
P_condenser = 10e3 # Pa (10 kPa)
284
T_boiler = 500 + 273 # K
285
286
# Simplified enthalpy calculations (kJ/kg)
287
h1 = 191.8 # Saturated liquid at condenser pressure
288
h2 = h1 + 0.00101 * (P_boiler - P_condenser)/1000 # Pump work (approximate)
289
h3 = 3373.6 # Superheated steam at boiler conditions
290
h4s = 2345 # Isentropic expansion to condenser pressure
291
292
# Actual expansion with turbine efficiency
293
eta_turbine = 0.85
294
h4 = h3 - eta_turbine * (h3 - h4s)
295
296
# Cycle efficiency
297
W_turbine = h3 - h4
298
W_pump = h2 - h1
299
Q_in = h3 - h2
300
eta_rankine = (W_turbine - W_pump) / Q_in
301
302
# Effect of boiler pressure
303
P_boiler_range = np.linspace(1, 20, 50) # MPa
304
eta_range = []
305
306
for P in P_boiler_range:
307
# Simplified model: efficiency increases with pressure
308
h3_approx = 2800 + 50*P # Approximate
309
h4s_approx = 2400 - 5*P
310
h4_approx = h3_approx - 0.85 * (h3_approx - h4s_approx)
311
Q_approx = h3_approx - 200
312
W_approx = h3_approx - h4_approx
313
eta_range.append(W_approx / Q_approx * 100)
314
315
fig, axes = plt.subplots(2, 2, figsize=(12, 10))
316
317
# T-s diagram
318
s = [0.6, 0.7, 6.5, 7.0] # Approximate entropy values
319
T = [319, 584, 773, 319] # Temperature in K
320
321
axes[0, 0].plot(s, T, 'b-o', linewidth=2, markersize=8)
322
axes[0, 0].fill(s, T, alpha=0.3)
323
axes[0, 0].set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')
324
axes[0, 0].set_ylabel('Temperature $T$ (K)')
325
axes[0, 0].set_title('Rankine Cycle T-s Diagram')
326
axes[0, 0].grid(True, alpha=0.3)
327
for i, txt in enumerate(['1', '2', '3', '4']):
328
axes[0, 0].annotate(txt, (s[i], T[i]), xytext=(5, 5), textcoords='offset points')
329
330
# Efficiency vs boiler pressure
331
axes[0, 1].plot(P_boiler_range, eta_range, 'b-', linewidth=2)
332
axes[0, 1].set_xlabel('Boiler Pressure (MPa)')
333
axes[0, 1].set_ylabel('Thermal Efficiency (\\%)')
334
axes[0, 1].set_title('Rankine Efficiency vs Boiler Pressure')
335
axes[0, 1].grid(True, alpha=0.3)
336
337
# Energy flow diagram
338
components = ['Turbine Work', 'Pump Work', 'Net Work']
339
values = [W_turbine, W_pump, W_turbine - W_pump]
340
colors = ['green', 'red', 'blue']
341
342
axes[1, 0].bar(components, values, color=colors, alpha=0.7)
343
axes[1, 0].set_ylabel('Energy (kJ/kg)')
344
axes[1, 0].set_title('Rankine Cycle Energy Balance')
345
axes[1, 0].grid(True, alpha=0.3, axis='y')
346
347
# Effect of reheat
348
# Simplified: reheat increases efficiency by ~3-5%
349
base_eta = np.array(eta_range)
350
reheat_eta = base_eta * 1.04
351
352
axes[1, 1].plot(P_boiler_range, base_eta, 'b-', linewidth=2, label='Simple')
353
axes[1, 1].plot(P_boiler_range, reheat_eta, 'r--', linewidth=2, label='With Reheat')
354
axes[1, 1].set_xlabel('Boiler Pressure (MPa)')
355
axes[1, 1].set_ylabel('Thermal Efficiency (\\%)')
356
axes[1, 1].set_title('Effect of Reheat on Efficiency')
357
axes[1, 1].legend()
358
axes[1, 1].grid(True, alpha=0.3)
359
360
plt.tight_layout()
361
save_fig('rankine_cycle.pdf')
362
\end{pycode}
363
364
\begin{figure}[H]
365
\centering
366
\includegraphics[width=\textwidth]{rankine_cycle.pdf}
367
\caption{Rankine cycle: T-s diagram, pressure effect, energy balance, and reheat improvement.}
368
\end{figure}
369
370
Rankine efficiency: $\eta = \py{f"{eta_rankine*100:.1f}"}$\%, Net work = \py{f"{W_turbine - W_pump:.0f}"} kJ/kg
371
372
\section{Cycle Comparison}
373
374
\begin{pycode}
375
# Compare all cycles
376
cycles = ['Carnot', 'Otto (r=10)', 'Diesel (r=20)', 'Rankine']
377
efficiencies = [
378
(1 - 300/1000) * 100,
379
(1 - 1/10**(gamma-1)) * 100,
380
(1 - (1/20**(gamma-1)) * (2.5**gamma - 1)/(gamma*(2.5 - 1))) * 100,
381
eta_rankine * 100
382
]
383
384
fig, ax = plt.subplots(figsize=(10, 6))
385
386
colors = ['gold', 'blue', 'green', 'red']
387
bars = ax.bar(cycles, efficiencies, color=colors, alpha=0.7)
388
389
ax.set_ylabel('Thermal Efficiency (\\%)')
390
ax.set_title('Comparison of Thermodynamic Cycles')
391
ax.grid(True, alpha=0.3, axis='y')
392
393
for bar, eff in zip(bars, efficiencies):
394
ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 1,
395
f'{eff:.1f}\\%', ha='center', fontsize=10)
396
397
save_fig('cycle_comparison.pdf')
398
\end{pycode}
399
400
\begin{figure}[H]
401
\centering
402
\includegraphics[width=0.8\textwidth]{cycle_comparison.pdf}
403
\caption{Comparison of thermal efficiencies for different thermodynamic cycles.}
404
\end{figure}
405
406
\section{Summary Table}
407
408
\begin{table}[H]
409
\centering
410
\caption{Thermodynamic Cycle Parameters}
411
\begin{tabular}{lcccc}
412
\toprule
413
Cycle & Key Parameter & Efficiency Formula & Typical $\eta$ & Application \\
414
\midrule
415
Carnot & $T_H/T_L$ & $1 - T_L/T_H$ & 70\% & Theoretical \\
416
Otto & $r$ & $1 - r^{1-\gamma}$ & 60\% & Gasoline engines \\
417
Diesel & $r$, $r_c$ & Complex & 55\% & Diesel engines \\
418
Rankine & $P_{boiler}$ & Energy balance & 35\% & Power plants \\
419
\bottomrule
420
\end{tabular}
421
\end{table}
422
423
\section{Conclusions}
424
425
This analysis demonstrates key aspects of thermodynamic cycles:
426
\begin{enumerate}
427
\item Carnot efficiency sets the theoretical maximum for any heat engine
428
\item Otto efficiency increases with compression ratio but is limited by knock
429
\item Diesel cycles achieve higher compression ratios but lower peak efficiency
430
\item Rankine cycles use phase change for effective heat addition
431
\item Reheat and regeneration improve Rankine cycle efficiency
432
\item Actual efficiencies are lower due to irreversibilities
433
\end{enumerate}
434
435
\end{document}
436
437