%% MATLAB-Based CFD Simulation for Heat Sink Optimization
clc; clear; close all;
% Design Parameters (Baseline)
L_base = 100e-3; % Base Length (m)
W_base = 100e-3; % Base Width (m)
th_base = 5e-3; % Base Thickness (m)
H_fins = 20e-3; % Fin Height (m)
D_fins = 4e-3; % Fin Diameter (m)
S_fins = 6e-3; % Fin Spacing (m, edge-to-edge)
% Material Properties
k_al = 237; % Thermal Conductivity of Aluminum (W/m.K)
% Fluid Properties (Air at 25C)
rho_air = 1.184; % Density (kg/m^3)
Cp_air = 1005; % Specific Heat Capacity (J/kg.K)
mu_air = 1.85e-5; % Dynamic Viscosity (Pa.s)
k_air = 0.0262; % Thermal Conductivity (W/m.K)
Pr_air = Cp_air * mu_air / k_air; % Prandtl Number
% Heat Load
Q = 100; % Total Heat Input (W)
V_air = 2; % Air Velocity (m/s)
% CFD Grid
Nx = 50; % Grid points in X
Ny = 50; % Grid points in Y
Nz = 50; % Grid points in Z
% Computational Mesh
x = linspace(0, L_base, Nx);
y = linspace(0, W_base, Ny);
z = linspace(0, H_fins, Nz);
% Heat Transfer Coefficient Estimation
Re = (rho_air * V_air * D_fins) / mu_air; % Reynolds Number
Nu = 0.023 * Re^(0.8) * Pr_air^(0.3); % Nusselt Number
h = (Nu * k_air) / D_fins; % Convective Heat Transfer Coefficient
% Efficiency and Overall Heat Transfer Calculation
Afins = pi * D_fins * H_fins * 100; % Total Fin Surface Area
Abase = L_base * W_base;
Atotal = Abase + Afins;
Ts = (Q / (h * Atotal)) + 25; % Surface Temperature (Assuming Ta,i = 25C)
% Thermal Resistance Calculation
Rth = (Ts - 25) / Q;
% Display Results
fprintf('Reynolds Number: %.2f\n', Re);
fprintf('Nusselt Number: %.2f\n', Nu);
fprintf('Convective Heat Transfer Coefficient: %.2f W/m^2.K\n', h);
fprintf('Surface Temperature: %.2f C\n', Ts);
fprintf('Thermal Resistance: %.5f K/W\n', Rth);