Path: blob/main/latex-templates/templates/mechanical-engineering/thermodynamics_cycle.tex
51 views
unlisted
\documentclass[11pt,a4paper]{article}12% Document Setup3\usepackage[utf8]{inputenc}4\usepackage[T1]{fontenc}5\usepackage{lmodern}6\usepackage[margin=1in]{geometry}7\usepackage{amsmath,amssymb}8\usepackage{siunitx}9\usepackage{booktabs}10\usepackage{float}11\usepackage{caption}12\usepackage{hyperref}1314% PythonTeX Setup15\usepackage[makestderr]{pythontex}1617\title{Thermodynamic Cycles: Efficiency Analysis}18\author{Mechanical Engineering Laboratory}19\date{\today}2021\begin{document}22\maketitle2324\begin{abstract}25This 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.26\end{abstract}2728\tableofcontents29\newpage3031\section{Introduction to Thermodynamic Cycles}3233Thermodynamic cycles convert heat into work. The four cycles analyzed here are:34\begin{itemize}35\item Carnot cycle: Maximum possible efficiency (theoretical ideal)36\item Otto cycle: Spark-ignition internal combustion engines37\item Diesel cycle: Compression-ignition engines38\item Rankine cycle: Steam power plants39\end{itemize}4041% Initialize Python environment42\begin{pycode}43import numpy as np44import matplotlib.pyplot as plt45from scipy.optimize import fsolve4647plt.rcParams['figure.figsize'] = (8, 5)48plt.rcParams['font.size'] = 1049plt.rcParams['text.usetex'] = True5051# Air properties (ideal gas)52gamma = 1.453cp = 1005 # J/kgK54cv = cp / gamma55R = cp - cv5657def save_fig(filename):58plt.savefig(filename, dpi=150, bbox_inches='tight')59plt.close()60\end{pycode}6162\section{Carnot Cycle}6364The Carnot efficiency sets the maximum limit:65\begin{equation}66\eta_{Carnot} = 1 - \frac{T_L}{T_H}67\end{equation}6869\begin{pycode}70# Carnot cycle analysis71T_L = 300 # K (cold reservoir)72T_H_range = np.linspace(400, 1500, 100)73eta_carnot = 1 - T_L / T_H_range7475# T-s diagram for Carnot cycle76T_H = 1000 # K77s1, s2 = 0, 1 # kJ/kgK7879fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))8081# Efficiency vs temperature82ax1.plot(T_H_range, eta_carnot * 100, 'b-', linewidth=2)83ax1.axhline(50, color='r', linestyle='--', alpha=0.5, label='50\\% efficiency')84ax1.set_xlabel('Hot Reservoir Temperature $T_H$ (K)')85ax1.set_ylabel('Carnot Efficiency (\\%)')86ax1.set_title(f'Carnot Efficiency ($T_L$ = {T_L} K)')87ax1.legend()88ax1.grid(True, alpha=0.3)8990# T-s diagram91s_cycle = [s1, s2, s2, s1, s1]92T_cycle = [T_L, T_L, T_H, T_H, T_L]93ax2.plot(s_cycle, T_cycle, 'b-', linewidth=2)94ax2.fill(s_cycle, T_cycle, alpha=0.3)95ax2.set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')96ax2.set_ylabel('Temperature $T$ (K)')97ax2.set_title('Carnot Cycle T-s Diagram')98ax2.grid(True, alpha=0.3)99100# Label processes101ax2.annotate('1-2: Isothermal expansion', xy=(0.5, T_H), xytext=(0.6, T_H+100),102arrowprops=dict(arrowstyle='->', color='black'), fontsize=9)103ax2.annotate('3-4: Isothermal compression', xy=(0.5, T_L), xytext=(0.6, T_L-100),104arrowprops=dict(arrowstyle='->', color='black'), fontsize=9)105106plt.tight_layout()107save_fig('carnot_cycle.pdf')108109eta_carnot_design = 1 - T_L / T_H110\end{pycode}111112\begin{figure}[H]113\centering114\includegraphics[width=\textwidth]{carnot_cycle.pdf}115\caption{Carnot cycle: efficiency dependence on temperature and T-s diagram.}116\end{figure}117118Carnot efficiency at $T_H = 1000$ K: $\eta = \py{f"{eta_carnot_design*100:.1f}"}$\%119120\section{Otto Cycle}121122The Otto cycle efficiency depends on compression ratio:123\begin{equation}124\eta_{Otto} = 1 - \frac{1}{r^{\gamma-1}}125\end{equation}126127\begin{pycode}128# Otto cycle analysis129r_range = np.linspace(4, 14, 100) # Compression ratio130eta_otto = 1 - 1/r_range**(gamma-1)131132# P-v diagram for specific compression ratio133r = 10134P1 = 100e3 # Pa135T1 = 300 # K136V1 = 1 # m^3 (normalized)137V2 = V1/r138139# State points140T2 = T1 * r**(gamma-1)141P2 = P1 * r**gamma142143# Heat addition (constant volume)144q_in = 1000e3 # J/kg145T3 = T2 + q_in/cv146P3 = P2 * T3/T2147148# Expansion149T4 = T3 / r**(gamma-1)150P4 = P3 / r**gamma151152fig, axes = plt.subplots(2, 2, figsize=(12, 10))153154# Efficiency vs compression ratio155axes[0, 0].plot(r_range, eta_otto * 100, 'b-', linewidth=2)156axes[0, 0].axvline(r, color='r', linestyle='--', alpha=0.5, label=f'r = {r}')157axes[0, 0].set_xlabel('Compression Ratio $r$')158axes[0, 0].set_ylabel('Thermal Efficiency (\\%)')159axes[0, 0].set_title('Otto Cycle Efficiency')160axes[0, 0].legend()161axes[0, 0].grid(True, alpha=0.3)162163# P-v diagram164V = np.linspace(V2, V1, 100)165P_12 = P1 * (V1/V)**gamma # Compression (1-2)166P_34 = P3 * (V2/V)**gamma # Expansion (3-4)167168axes[0, 1].plot(V, P_12/1e6, 'b-', linewidth=2)169axes[0, 1].plot(V, P_34/1e6, 'r-', linewidth=2)170axes[0, 1].plot([V2, V2], [P2/1e6, P3/1e6], 'g-', linewidth=2) # 2-3171axes[0, 1].plot([V1, V1], [P4/1e6, P1/1e6], 'g-', linewidth=2) # 4-1172axes[0, 1].set_xlabel('Volume $V/V_1$')173axes[0, 1].set_ylabel('Pressure (MPa)')174axes[0, 1].set_title('Otto Cycle P-v Diagram')175axes[0, 1].grid(True, alpha=0.3)176177# T-s diagram (approximate)178s = np.array([0, 0, 0.7, 0.7, 0])179T = np.array([T1, T2, T3, T4, T1])180axes[1, 0].plot(s, T, 'b-o', linewidth=2, markersize=8)181axes[1, 0].set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')182axes[1, 0].set_ylabel('Temperature (K)')183axes[1, 0].set_title('Otto Cycle T-s Diagram')184axes[1, 0].grid(True, alpha=0.3)185for i, txt in enumerate(['1', '2', '3', '4']):186axes[1, 0].annotate(txt, (s[i], T[i]), xytext=(5, 5), textcoords='offset points')187188# Effect of gamma189gamma_range = [1.2, 1.3, 1.4, 1.5]190for g in gamma_range:191eta = 1 - 1/r_range**(g-1)192axes[1, 1].plot(r_range, eta * 100, linewidth=1.5, label=f'$\\gamma$ = {g}')193194axes[1, 1].set_xlabel('Compression Ratio $r$')195axes[1, 1].set_ylabel('Thermal Efficiency (\\%)')196axes[1, 1].set_title('Effect of Specific Heat Ratio')197axes[1, 1].legend()198axes[1, 1].grid(True, alpha=0.3)199200plt.tight_layout()201save_fig('otto_cycle.pdf')202203eta_otto_design = 1 - 1/r**(gamma-1)204W_net = q_in * eta_otto_design205\end{pycode}206207\begin{figure}[H]208\centering209\includegraphics[width=\textwidth]{otto_cycle.pdf}210\caption{Otto cycle analysis: efficiency, P-v diagram, T-s diagram, and gamma effect.}211\end{figure}212213Otto efficiency at $r = 10$: $\eta = \py{f"{eta_otto_design*100:.1f}"}$\%, Net work = \py{f"{W_net/1000:.0f}"} kJ/kg214215\section{Diesel Cycle}216217The Diesel cycle efficiency includes the cutoff ratio:218\begin{equation}219\eta_{Diesel} = 1 - \frac{1}{r^{\gamma-1}} \cdot \frac{r_c^{\gamma} - 1}{\gamma(r_c - 1)}220\end{equation}221222\begin{pycode}223# Diesel cycle analysis224r = 20 # Compression ratio (higher than Otto)225r_c_range = np.linspace(1.5, 4, 100) # Cutoff ratio226227eta_diesel = 1 - (1/r**(gamma-1)) * (r_c_range**gamma - 1)/(gamma*(r_c_range - 1))228229# Compare with Otto at same compression ratio230eta_otto_r20 = 1 - 1/r**(gamma-1)231232fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))233234# Efficiency vs cutoff ratio235ax1.plot(r_c_range, eta_diesel * 100, 'b-', linewidth=2, label='Diesel')236ax1.axhline(eta_otto_r20 * 100, color='r', linestyle='--', linewidth=2, label=f'Otto (r={r})')237ax1.set_xlabel('Cutoff Ratio $r_c$')238ax1.set_ylabel('Thermal Efficiency (\\%)')239ax1.set_title(f'Diesel Cycle Efficiency (r = {r})')240ax1.legend()241ax1.grid(True, alpha=0.3)242243# Comparison of Otto and Diesel244r_comp = np.linspace(8, 24, 100)245eta_otto_comp = 1 - 1/r_comp**(gamma-1)246r_c = 2.5 # Fixed cutoff ratio247eta_diesel_comp = 1 - (1/r_comp**(gamma-1)) * (r_c**gamma - 1)/(gamma*(r_c - 1))248249ax2.plot(r_comp, eta_otto_comp * 100, 'b-', linewidth=2, label='Otto')250ax2.plot(r_comp, eta_diesel_comp * 100, 'r-', linewidth=2, label=f'Diesel ($r_c$={r_c})')251ax2.set_xlabel('Compression Ratio $r$')252ax2.set_ylabel('Thermal Efficiency (\\%)')253ax2.set_title('Otto vs Diesel Cycle Comparison')254ax2.legend()255ax2.grid(True, alpha=0.3)256257plt.tight_layout()258save_fig('diesel_cycle.pdf')259260r_c_design = 2.5261eta_diesel_design = 1 - (1/r**(gamma-1)) * (r_c_design**gamma - 1)/(gamma*(r_c_design - 1))262\end{pycode}263264\begin{figure}[H]265\centering266\includegraphics[width=\textwidth]{diesel_cycle.pdf}267\caption{Diesel cycle: efficiency dependence on cutoff ratio and comparison with Otto.}268\end{figure}269270Diesel efficiency at $r = 20$, $r_c = 2.5$: $\eta = \py{f"{eta_diesel_design*100:.1f}"}$\%271272\section{Rankine Cycle}273274The Rankine cycle uses phase change for higher efficiency:275276\begin{pycode}277# Simplified Rankine cycle analysis278# Using approximate steam properties279280# Operating conditions281P_boiler = 10e6 # Pa (10 MPa)282P_condenser = 10e3 # Pa (10 kPa)283T_boiler = 500 + 273 # K284285# Simplified enthalpy calculations (kJ/kg)286h1 = 191.8 # Saturated liquid at condenser pressure287h2 = h1 + 0.00101 * (P_boiler - P_condenser)/1000 # Pump work (approximate)288h3 = 3373.6 # Superheated steam at boiler conditions289h4s = 2345 # Isentropic expansion to condenser pressure290291# Actual expansion with turbine efficiency292eta_turbine = 0.85293h4 = h3 - eta_turbine * (h3 - h4s)294295# Cycle efficiency296W_turbine = h3 - h4297W_pump = h2 - h1298Q_in = h3 - h2299eta_rankine = (W_turbine - W_pump) / Q_in300301# Effect of boiler pressure302P_boiler_range = np.linspace(1, 20, 50) # MPa303eta_range = []304305for P in P_boiler_range:306# Simplified model: efficiency increases with pressure307h3_approx = 2800 + 50*P # Approximate308h4s_approx = 2400 - 5*P309h4_approx = h3_approx - 0.85 * (h3_approx - h4s_approx)310Q_approx = h3_approx - 200311W_approx = h3_approx - h4_approx312eta_range.append(W_approx / Q_approx * 100)313314fig, axes = plt.subplots(2, 2, figsize=(12, 10))315316# T-s diagram317s = [0.6, 0.7, 6.5, 7.0] # Approximate entropy values318T = [319, 584, 773, 319] # Temperature in K319320axes[0, 0].plot(s, T, 'b-o', linewidth=2, markersize=8)321axes[0, 0].fill(s, T, alpha=0.3)322axes[0, 0].set_xlabel('Entropy $s$ (kJ/kg$\\cdot$K)')323axes[0, 0].set_ylabel('Temperature $T$ (K)')324axes[0, 0].set_title('Rankine Cycle T-s Diagram')325axes[0, 0].grid(True, alpha=0.3)326for i, txt in enumerate(['1', '2', '3', '4']):327axes[0, 0].annotate(txt, (s[i], T[i]), xytext=(5, 5), textcoords='offset points')328329# Efficiency vs boiler pressure330axes[0, 1].plot(P_boiler_range, eta_range, 'b-', linewidth=2)331axes[0, 1].set_xlabel('Boiler Pressure (MPa)')332axes[0, 1].set_ylabel('Thermal Efficiency (\\%)')333axes[0, 1].set_title('Rankine Efficiency vs Boiler Pressure')334axes[0, 1].grid(True, alpha=0.3)335336# Energy flow diagram337components = ['Turbine Work', 'Pump Work', 'Net Work']338values = [W_turbine, W_pump, W_turbine - W_pump]339colors = ['green', 'red', 'blue']340341axes[1, 0].bar(components, values, color=colors, alpha=0.7)342axes[1, 0].set_ylabel('Energy (kJ/kg)')343axes[1, 0].set_title('Rankine Cycle Energy Balance')344axes[1, 0].grid(True, alpha=0.3, axis='y')345346# Effect of reheat347# Simplified: reheat increases efficiency by ~3-5%348base_eta = np.array(eta_range)349reheat_eta = base_eta * 1.04350351axes[1, 1].plot(P_boiler_range, base_eta, 'b-', linewidth=2, label='Simple')352axes[1, 1].plot(P_boiler_range, reheat_eta, 'r--', linewidth=2, label='With Reheat')353axes[1, 1].set_xlabel('Boiler Pressure (MPa)')354axes[1, 1].set_ylabel('Thermal Efficiency (\\%)')355axes[1, 1].set_title('Effect of Reheat on Efficiency')356axes[1, 1].legend()357axes[1, 1].grid(True, alpha=0.3)358359plt.tight_layout()360save_fig('rankine_cycle.pdf')361\end{pycode}362363\begin{figure}[H]364\centering365\includegraphics[width=\textwidth]{rankine_cycle.pdf}366\caption{Rankine cycle: T-s diagram, pressure effect, energy balance, and reheat improvement.}367\end{figure}368369Rankine efficiency: $\eta = \py{f"{eta_rankine*100:.1f}"}$\%, Net work = \py{f"{W_turbine - W_pump:.0f}"} kJ/kg370371\section{Cycle Comparison}372373\begin{pycode}374# Compare all cycles375cycles = ['Carnot', 'Otto (r=10)', 'Diesel (r=20)', 'Rankine']376efficiencies = [377(1 - 300/1000) * 100,378(1 - 1/10**(gamma-1)) * 100,379(1 - (1/20**(gamma-1)) * (2.5**gamma - 1)/(gamma*(2.5 - 1))) * 100,380eta_rankine * 100381]382383fig, ax = plt.subplots(figsize=(10, 6))384385colors = ['gold', 'blue', 'green', 'red']386bars = ax.bar(cycles, efficiencies, color=colors, alpha=0.7)387388ax.set_ylabel('Thermal Efficiency (\\%)')389ax.set_title('Comparison of Thermodynamic Cycles')390ax.grid(True, alpha=0.3, axis='y')391392for bar, eff in zip(bars, efficiencies):393ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 1,394f'{eff:.1f}\\%', ha='center', fontsize=10)395396save_fig('cycle_comparison.pdf')397\end{pycode}398399\begin{figure}[H]400\centering401\includegraphics[width=0.8\textwidth]{cycle_comparison.pdf}402\caption{Comparison of thermal efficiencies for different thermodynamic cycles.}403\end{figure}404405\section{Summary Table}406407\begin{table}[H]408\centering409\caption{Thermodynamic Cycle Parameters}410\begin{tabular}{lcccc}411\toprule412Cycle & Key Parameter & Efficiency Formula & Typical $\eta$ & Application \\413\midrule414Carnot & $T_H/T_L$ & $1 - T_L/T_H$ & 70\% & Theoretical \\415Otto & $r$ & $1 - r^{1-\gamma}$ & 60\% & Gasoline engines \\416Diesel & $r$, $r_c$ & Complex & 55\% & Diesel engines \\417Rankine & $P_{boiler}$ & Energy balance & 35\% & Power plants \\418\bottomrule419\end{tabular}420\end{table}421422\section{Conclusions}423424This analysis demonstrates key aspects of thermodynamic cycles:425\begin{enumerate}426\item Carnot efficiency sets the theoretical maximum for any heat engine427\item Otto efficiency increases with compression ratio but is limited by knock428\item Diesel cycles achieve higher compression ratios but lower peak efficiency429\item Rankine cycles use phase change for effective heat addition430\item Reheat and regeneration improve Rankine cycle efficiency431\item Actual efficiencies are lower due to irreversibilities432\end{enumerate}433434\end{document}435436437