Path: blob/main/latex-templates/templates/mechanical-engineering/heat_transfer.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{Heat Transfer Analysis: Conduction, Convection, and Fins}18\author{Mechanical Engineering Laboratory}19\date{\today}2021\begin{document}22\maketitle2324\begin{abstract}25This report presents computational analysis of heat transfer mechanisms including conduction through composite walls, convection correlations, fin analysis, and heat exchanger design. Python-based computations provide quantitative analysis with dynamic visualization of temperature distributions and heat flux.26\end{abstract}2728\tableofcontents29\newpage3031\section{Introduction to Heat Transfer}3233Heat transfer is the thermal energy in transit due to a temperature difference. The three modes are:34\begin{itemize}35\item Conduction: Energy transfer through molecular interactions36\item Convection: Energy transfer by fluid motion37\item Radiation: Energy transfer by electromagnetic waves38\end{itemize}3940% Initialize Python environment41\begin{pycode}42import numpy as np43import matplotlib.pyplot as plt44from scipy.optimize import fsolve4546plt.rcParams['figure.figsize'] = (8, 5)47plt.rcParams['font.size'] = 1048plt.rcParams['text.usetex'] = True4950def save_fig(filename):51plt.savefig(filename, dpi=150, bbox_inches='tight')52plt.close()53\end{pycode}5455\section{Conduction Heat Transfer}5657\subsection{Fourier's Law}5859The rate of heat conduction is proportional to the temperature gradient:60\begin{equation}61q = -k \frac{dT}{dx}62\end{equation}63where $k$ is thermal conductivity (\si{\watt\per\meter\per\kelvin}).6465\subsection{Composite Wall Analysis}6667For a composite wall with convection on both sides:68\begin{equation}69q = \frac{T_{i} - T_{o}}{R_{total}} = \frac{T_{i} - T_{o}}{\frac{1}{h_i A} + \sum\frac{L_j}{k_j A} + \frac{1}{h_o A}}70\end{equation}7172\begin{pycode}73# Composite wall analysis74# Three-layer wall: brick + insulation + plaster75materials = [76{'name': 'Brick', 'k': 0.72, 'L': 0.23}, # W/mK, m77{'name': 'Insulation', 'k': 0.038, 'L': 0.08},78{'name': 'Plaster', 'k': 0.48, 'L': 0.02}79]8081h_i = 10 # W/m2K (inside convection)82h_o = 25 # W/m2K (outside convection)83T_i = 22 # C (inside temperature)84T_o = -5 # C (outside temperature)8586# Calculate thermal resistances (per unit area)87R_i = 1/h_i88R_o = 1/h_o89R_total = R_i + R_o9091x_positions = [0]92T_positions = [T_i]9394# Calculate temperature at each interface95q = 0 # Will be calculated96current_T = T_i - (T_i - T_o) * R_i # Temperature at inner surface9798R_materials = []99for mat in materials:100R = mat['L'] / mat['k']101R_materials.append(R)102R_total += R103104# Heat flux105q = (T_i - T_o) / R_total106107# Temperature profile108T_positions = [T_i]109x_positions = [0]110111# Inner convection boundary112T_s1 = T_i - q * R_i113T_positions.append(T_s1)114x = 0115x_positions.append(x)116117# Through each material layer118for mat, R in zip(materials, R_materials):119x += mat['L']120T_next = T_positions[-1] - q * R121x_positions.append(x)122T_positions.append(T_next)123124# Outer surface125T_positions.append(T_o)126x_positions.append(x_positions[-1])127128fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(14, 5))129130# Temperature profile131ax1.plot(np.array(x_positions)*100, T_positions, 'b-o', linewidth=2, markersize=8)132ax1.axhline(0, color='k', linestyle='--', alpha=0.3)133134# Shade regions135colors = ['#FFB6C1', '#90EE90', '#ADD8E6']136x_start = 0137for i, (mat, color) in enumerate(zip(materials, colors)):138ax1.axvspan(x_start*100, (x_start + mat['L'])*100, alpha=0.3, color=color, label=mat['name'])139x_start += mat['L']140141ax1.set_xlabel('Position (cm)')142ax1.set_ylabel('Temperature ($^\\circ$C)')143ax1.set_title('Temperature Profile Through Composite Wall')144ax1.legend(loc='upper right')145ax1.grid(True, alpha=0.3)146147# Thermal resistance breakdown148resistances = [R_i] + R_materials + [R_o]149labels = ['Conv (in)'] + [m['name'] for m in materials] + ['Conv (out)']150colors_bar = ['yellow'] + colors + ['yellow']151152ax2.bar(labels, resistances, color=colors_bar, alpha=0.7)153ax2.set_ylabel('Thermal Resistance (m$^2$K/W)')154ax2.set_title(f'Resistance Breakdown (Total = {R_total:.3f} m$^2$K/W)')155ax2.grid(True, alpha=0.3, axis='y')156157plt.tight_layout()158save_fig('composite_wall.pdf')159\end{pycode}160161\begin{figure}[H]162\centering163\includegraphics[width=\textwidth]{composite_wall.pdf}164\caption{Composite wall analysis: temperature profile and thermal resistance breakdown.}165\end{figure}166167Heat flux through wall: $q = \py{f"{q:.1f}"}$ \si{\watt\per\square\meter}168169\section{Convection Heat Transfer}170171\subsection{Convection Correlations}172173The heat transfer coefficient depends on the Nusselt number:174\begin{equation}175h = \frac{Nu \cdot k}{L_c}176\end{equation}177178\begin{pycode}179# Convection correlations for different geometries180def Nu_flat_plate_laminar(Re, Pr):181"""Laminar flow over flat plate"""182return 0.664 * Re**0.5 * Pr**(1/3)183184def Nu_flat_plate_turbulent(Re, Pr):185"""Turbulent flow over flat plate"""186return 0.037 * Re**0.8 * Pr**(1/3)187188def Nu_cylinder_crossflow(Re, Pr):189"""Cross-flow over cylinder (Churchill-Bernstein)"""190return 0.3 + (0.62 * Re**0.5 * Pr**(1/3)) / (1 + (0.4/Pr)**(2/3))**0.25 * \191(1 + (Re/282000)**(5/8))**(4/5)192193def Nu_pipe_turbulent(Re, Pr):194"""Fully developed turbulent flow in pipe (Dittus-Boelter)"""195return 0.023 * Re**0.8 * Pr**0.4196197# Calculate for air flow198Pr = 0.71 # Prandtl number for air199Re_range = np.logspace(3, 6, 100)200201fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))202203# External flow correlations204Nu_plate_lam = [Nu_flat_plate_laminar(Re, Pr) for Re in Re_range if Re < 5e5]205Nu_plate_turb = [Nu_flat_plate_turbulent(Re, Pr) for Re in Re_range if Re >= 5e5]206Nu_cyl = [Nu_cylinder_crossflow(Re, Pr) for Re in Re_range]207208ax1.loglog(Re_range[Re_range < 5e5], Nu_plate_lam, 'b-', linewidth=2, label='Flat plate (laminar)')209ax1.loglog(Re_range[Re_range >= 5e5], Nu_plate_turb, 'b--', linewidth=2, label='Flat plate (turbulent)')210ax1.loglog(Re_range, Nu_cyl, 'r-', linewidth=2, label='Cylinder cross-flow')211ax1.axvline(5e5, color='k', linestyle=':', alpha=0.5)212ax1.set_xlabel('Reynolds Number')213ax1.set_ylabel('Nusselt Number')214ax1.set_title('External Flow Correlations')215ax1.legend()216ax1.grid(True, which='both', alpha=0.3)217218# Internal flow correlation219Re_pipe = np.logspace(4, 6, 50)220Nu_pipe = [Nu_pipe_turbulent(Re, Pr) for Re in Re_pipe]221222ax2.loglog(Re_pipe, Nu_pipe, 'g-', linewidth=2, label='Dittus-Boelter (heating)')223ax2.set_xlabel('Reynolds Number')224ax2.set_ylabel('Nusselt Number')225ax2.set_title('Internal Flow Correlation (Turbulent Pipe)')226ax2.legend()227ax2.grid(True, which='both', alpha=0.3)228229plt.tight_layout()230save_fig('convection_correlations.pdf')231\end{pycode}232233\begin{figure}[H]234\centering235\includegraphics[width=\textwidth]{convection_correlations.pdf}236\caption{Convection heat transfer correlations for external and internal flows.}237\end{figure}238239\section{Extended Surfaces (Fins)}240241\subsection{Fin Temperature Distribution}242243For a fin with adiabatic tip:244\begin{equation}245\frac{\theta}{\theta_b} = \frac{\cosh[m(L-x)]}{\cosh(mL)}246\end{equation}247where $m = \sqrt{\frac{hP}{kA_c}}$ and $\theta = T - T_{\infty}$.248249\begin{pycode}250# Fin analysis251k_fin = 200 # W/mK (aluminum)252h_fin = 50 # W/m2K253L_fin = 0.1 # m (fin length)254t_fin = 0.005 # m (fin thickness)255w_fin = 0.05 # m (fin width)256257# Cross-section parameters258P = 2 * (t_fin + w_fin) # perimeter259A_c = t_fin * w_fin # cross-sectional area260m = np.sqrt(h_fin * P / (k_fin * A_c))261262T_b = 100 # C (base temperature)263T_inf = 25 # C (ambient temperature)264theta_b = T_b - T_inf265266# Temperature distribution267x = np.linspace(0, L_fin, 100)268theta = theta_b * np.cosh(m * (L_fin - x)) / np.cosh(m * L_fin)269T_fin = theta + T_inf270271# Heat transfer rate272q_fin = np.sqrt(h_fin * P * k_fin * A_c) * theta_b * np.tanh(m * L_fin)273274# Maximum possible heat transfer (if entire fin at base temperature)275A_fin = P * L_fin # fin surface area276q_max = h_fin * A_fin * theta_b277278# Fin efficiency279eta_fin = q_fin / q_max280281fig, axes = plt.subplots(2, 2, figsize=(12, 10))282283# Temperature distribution284axes[0, 0].plot(x*100, T_fin, 'b-', linewidth=2)285axes[0, 0].axhline(T_inf, color='r', linestyle='--', label=f'$T_\\infty$ = {T_inf}$^\\circ$C')286axes[0, 0].set_xlabel('Distance from Base (cm)')287axes[0, 0].set_ylabel('Temperature ($^\\circ$C)')288axes[0, 0].set_title('Fin Temperature Distribution')289axes[0, 0].legend()290axes[0, 0].grid(True, alpha=0.3)291292# Temperature ratio293axes[0, 1].plot(x*100, theta/theta_b * 100, 'g-', linewidth=2)294axes[0, 1].set_xlabel('Distance from Base (cm)')295axes[0, 1].set_ylabel('Temperature Ratio $\\theta/\\theta_b$ (\\%)')296axes[0, 1].set_title('Normalized Temperature Distribution')297axes[0, 1].grid(True, alpha=0.3)298299# Effect of fin length300L_range = np.linspace(0.01, 0.2, 50)301eta_range = []302q_range = []303for L in L_range:304mL = m * L305q = np.sqrt(h_fin * P * k_fin * A_c) * theta_b * np.tanh(mL)306A_s = P * L307q_max_L = h_fin * A_s * theta_b308eta = q / q_max_L309eta_range.append(eta * 100)310q_range.append(q)311312axes[1, 0].plot(L_range*100, eta_range, 'r-', linewidth=2)313axes[1, 0].axvline(L_fin*100, color='k', linestyle='--', alpha=0.5)314axes[1, 0].set_xlabel('Fin Length (cm)')315axes[1, 0].set_ylabel('Fin Efficiency (\\%)')316axes[1, 0].set_title('Fin Efficiency vs Length')317axes[1, 0].grid(True, alpha=0.3)318319# Heat transfer rate320axes[1, 1].plot(L_range*100, q_range, 'm-', linewidth=2)321axes[1, 1].axvline(L_fin*100, color='k', linestyle='--', alpha=0.5)322axes[1, 1].set_xlabel('Fin Length (cm)')323axes[1, 1].set_ylabel('Heat Transfer Rate (W)')324axes[1, 1].set_title('Fin Heat Transfer vs Length')325axes[1, 1].grid(True, alpha=0.3)326327plt.tight_layout()328save_fig('fin_analysis.pdf')329\end{pycode}330331\begin{figure}[H]332\centering333\includegraphics[width=\textwidth]{fin_analysis.pdf}334\caption{Fin analysis: temperature distribution, efficiency, and heat transfer rate.}335\end{figure}336337\begin{table}[H]338\centering339\caption{Fin Performance Parameters}340\begin{tabular}{lcc}341\toprule342Parameter & Value & Units \\343\midrule344Fin parameter $m$ & \py{f"{m:.2f}"} & 1/m \\345Product $mL$ & \py{f"{m*L_fin:.2f}"} & -- \\346Fin efficiency & \py{f"{eta_fin*100:.1f}"} & \% \\347Heat transfer rate & \py{f"{q_fin:.1f}"} & W \\348\bottomrule349\end{tabular}350\end{table}351352\section{Heat Exchanger Analysis}353354\subsection{LMTD Method}355356For counter-flow heat exchangers:357\begin{equation}358\Delta T_{lm} = \frac{\Delta T_1 - \Delta T_2}{\ln(\Delta T_1/\Delta T_2)}359\end{equation}360361\begin{pycode}362# Counter-flow heat exchanger analysis363# Hot fluid (oil): inlet 150C, outlet 90C364# Cold fluid (water): inlet 20C, outlet 70C365366T_h_in = 150 # C367T_h_out = 90 # C368T_c_in = 20 # C369T_c_out = 70 # C370371# Temperature differences372dT_1 = T_h_in - T_c_out # at hot inlet373dT_2 = T_h_out - T_c_in # at hot outlet374375# LMTD376if dT_1 != dT_2:377LMTD = (dT_1 - dT_2) / np.log(dT_1/dT_2)378else:379LMTD = dT_1380381# Assume heat transfer and calculate UA382m_dot_h = 0.5 # kg/s383c_p_h = 2000 # J/kgK (oil)384Q = m_dot_h * c_p_h * (T_h_in - T_h_out)385UA = Q / LMTD386387# Temperature profiles along heat exchanger388x = np.linspace(0, 1, 100)389390# Counter-flow391T_h_counter = T_h_in - (T_h_in - T_h_out) * x392T_c_counter = T_c_out - (T_c_out - T_c_in) * x393394# Parallel flow (for comparison)395# Need to recalculate outlet temps for same UA396dT_1_parallel = T_h_in - T_c_in397C_h = m_dot_h * c_p_h398m_dot_c = Q / (4186 * (T_c_out - T_c_in))399C_c = m_dot_c * 4186400C_min = min(C_h, C_c)401NTU = UA / C_min402C_r = C_min / max(C_h, C_c)403eps_counter = (1 - np.exp(-NTU * (1 - C_r))) / (1 - C_r * np.exp(-NTU * (1 - C_r)))404eps_parallel = (1 - np.exp(-NTU * (1 + C_r))) / (1 + C_r)405406fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))407408# Counter-flow temperature profiles409ax1.plot(x*100, T_h_counter, 'r-', linewidth=2, label='Hot fluid')410ax1.plot(x*100, T_c_counter, 'b-', linewidth=2, label='Cold fluid')411ax1.fill_between(x*100, T_h_counter, T_c_counter, alpha=0.2, color='green')412ax1.set_xlabel('Position (\\% of length)')413ax1.set_ylabel('Temperature ($^\\circ$C)')414ax1.set_title(f'Counter-Flow HX (LMTD = {LMTD:.1f}$^\\circ$C)')415ax1.legend()416ax1.grid(True, alpha=0.3)417418# Effectiveness-NTU curves419NTU_range = np.linspace(0.1, 5, 100)420C_r_values = [0, 0.25, 0.5, 0.75, 1.0]421422for C_r in C_r_values:423if C_r == 1:424eps = NTU_range / (1 + NTU_range)425else:426eps = (1 - np.exp(-NTU_range * (1 - C_r))) / (1 - C_r * np.exp(-NTU_range * (1 - C_r)))427ax2.plot(NTU_range, eps, linewidth=1.5, label=f'$C_r$ = {C_r}')428429ax2.set_xlabel('NTU')430ax2.set_ylabel('Effectiveness $\\varepsilon$')431ax2.set_title('Counter-Flow HX Effectiveness')432ax2.legend()433ax2.grid(True, alpha=0.3)434435plt.tight_layout()436save_fig('heat_exchanger.pdf')437\end{pycode}438439\begin{figure}[H]440\centering441\includegraphics[width=\textwidth]{heat_exchanger.pdf}442\caption{Heat exchanger analysis: temperature profiles and effectiveness-NTU curves.}443\end{figure}444445Heat duty: $Q = \py{f"{Q/1000:.1f}"}$ kW, $UA = \py{f"{UA:.0f}"}$ W/K446447\section{Transient Conduction}448449\subsection{Lumped Capacitance Method}450451When $Bi = hL_c/k < 0.1$:452\begin{equation}453\frac{T - T_{\infty}}{T_i - T_{\infty}} = \exp\left(-\frac{hA_s}{\rho V c_p}t\right) = \exp\left(-\frac{t}{\tau}\right)454\end{equation}455456\begin{pycode}457# Transient cooling of a sphere458D = 0.05 # m diameter459rho = 2700 # kg/m3 (aluminum)460c_p = 900 # J/kgK461k = 200 # W/mK462h = 100 # W/m2K463464V = (4/3) * np.pi * (D/2)**3465A_s = 4 * np.pi * (D/2)**2466L_c = V / A_s467468# Biot number469Bi = h * L_c / k470471# Time constant472tau = rho * V * c_p / (h * A_s)473474T_i = 200 # C initial475T_inf = 25 # C ambient476477# Temperature history478t = np.linspace(0, 600, 200)479theta_ratio = np.exp(-t/tau)480T = T_inf + (T_i - T_inf) * theta_ratio481482# Heat transfer rate483q_t = h * A_s * (T - T_inf)484Q_total = rho * V * c_p * (T_i - T_inf) # total energy485Q_transferred = Q_total * (1 - theta_ratio)486487fig, axes = plt.subplots(2, 2, figsize=(12, 10))488489# Temperature history490axes[0, 0].plot(t, T, 'b-', linewidth=2)491axes[0, 0].axhline(T_inf, color='r', linestyle='--', label=f'$T_\\infty$ = {T_inf}$^\\circ$C')492axes[0, 0].axvline(tau, color='k', linestyle=':', alpha=0.5, label=f'$\\tau$ = {tau:.0f} s')493axes[0, 0].set_xlabel('Time (s)')494axes[0, 0].set_ylabel('Temperature ($^\\circ$C)')495axes[0, 0].set_title('Temperature History (Lumped Capacitance)')496axes[0, 0].legend()497axes[0, 0].grid(True, alpha=0.3)498499# Temperature ratio (semi-log)500axes[0, 1].semilogy(t, theta_ratio, 'g-', linewidth=2)501axes[0, 1].axhline(0.368, color='k', linestyle='--', alpha=0.5, label='$e^{-1}$')502axes[0, 1].axvline(tau, color='k', linestyle=':', alpha=0.5)503axes[0, 1].set_xlabel('Time (s)')504axes[0, 1].set_ylabel('$(T - T_\\infty)/(T_i - T_\\infty)$')505axes[0, 1].set_title('Normalized Temperature')506axes[0, 1].legend()507axes[0, 1].grid(True, which='both', alpha=0.3)508509# Instantaneous heat transfer rate510axes[1, 0].plot(t, q_t, 'r-', linewidth=2)511axes[1, 0].set_xlabel('Time (s)')512axes[1, 0].set_ylabel('Heat Transfer Rate (W)')513axes[1, 0].set_title('Instantaneous Heat Transfer')514axes[1, 0].grid(True, alpha=0.3)515516# Cumulative energy transferred517axes[1, 1].plot(t, Q_transferred/1000, 'm-', linewidth=2)518axes[1, 1].axhline(Q_total/1000, color='k', linestyle='--', alpha=0.5, label=f'Total = {Q_total/1000:.2f} kJ')519axes[1, 1].set_xlabel('Time (s)')520axes[1, 1].set_ylabel('Energy Transferred (kJ)')521axes[1, 1].set_title('Cumulative Energy Transfer')522axes[1, 1].legend()523axes[1, 1].grid(True, alpha=0.3)524525plt.tight_layout()526save_fig('transient_conduction.pdf')527\end{pycode}528529\begin{figure}[H]530\centering531\includegraphics[width=\textwidth]{transient_conduction.pdf}532\caption{Transient conduction analysis using lumped capacitance method.}533\end{figure}534535Biot number: $Bi = \py{f"{Bi:.3f}"}$ (lumped model valid since $Bi < 0.1$)536537\section{Radiation Heat Transfer}538539\begin{pycode}540# Radiation between surfaces541sigma = 5.67e-8 # Stefan-Boltzmann constant542543# Enclosure with two surfaces544T1 = 500 + 273 # K (hot surface)545T2 = 300 + 273 # K (cold surface)546eps1 = 0.8547eps2 = 0.6548A1 = 2 # m2549F12 = 0.5 # view factor550551# Net radiation heat transfer552q_rad = sigma * A1 * F12 * (T1**4 - T2**4) / (1/eps1 + A1/(A1*F12) * (1/eps2 - 1))553554# Blackbody radiation555T_range = np.linspace(300, 1500, 100)556E_b = sigma * T_range**4557558fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))559560# Blackbody emissive power561ax1.plot(T_range - 273, E_b/1000, 'r-', linewidth=2)562ax1.set_xlabel('Temperature ($^\\circ$C)')563ax1.set_ylabel('Emissive Power (kW/m$^2$)')564ax1.set_title('Blackbody Emissive Power')565ax1.grid(True, alpha=0.3)566567# Effect of emissivity on net radiation568eps_range = np.linspace(0.1, 1.0, 50)569q_eps = []570for eps in eps_range:571q = sigma * A1 * F12 * (T1**4 - T2**4) * eps # simplified572q_eps.append(q/1000)573574ax2.plot(eps_range, q_eps, 'b-', linewidth=2)575ax2.set_xlabel('Emissivity')576ax2.set_ylabel('Heat Transfer (kW)')577ax2.set_title('Effect of Emissivity on Radiation')578ax2.grid(True, alpha=0.3)579580plt.tight_layout()581save_fig('radiation.pdf')582\end{pycode}583584\begin{figure}[H]585\centering586\includegraphics[width=\textwidth]{radiation.pdf}587\caption{Radiation heat transfer: blackbody emission and emissivity effects.}588\end{figure}589590\section{Conclusions}591592This analysis demonstrates key aspects of heat transfer:593\begin{enumerate}594\item Composite walls require thermal resistance network analysis595\item Convection correlations depend on flow geometry and regime596\item Fin efficiency decreases with length but total heat transfer increases597\item Heat exchanger design uses LMTD or effectiveness-NTU methods598\item Lumped capacitance applies when $Bi < 0.1$599\item Radiation becomes dominant at high temperatures600\end{enumerate}601602\end{document}603604605