QuickerSim CFD Toolbox for MATLAB allows simulation of a wide range of problems in heat transfer. It solves problems described by both steady-state and transient heat transfer equations. Variants of this Matlab heat transfer code can handle:
- 2-D,
- 3-D
problems. Heat conduction and heat convection with laminar and turbulent flows can be solved. Below, we present an example code for simulation of heat transfer in MATLAB. Simulation shows heat conduction in a box with nonlinear thermal diffusivity. Heat condution is temperature dependent. Other examples involve heat exchanger simulation in MATLAB and/or convective heat transfer from a flat plate (see validation in pictures below). More materials can be found among tutorials.
Laminar heat convection from a flat plate. Example of a simulation and validation in MATLAB:
Example code for 3-D heat transfer simulation in a box governed by heat conduction equation:
clc; clear; % Import mesh [p,e,t] = importMeshGmsh('grids/box.msh'); % Define convergence criteria maxiter = 10; maxres = 1e-3; % Init solution with T = 20 [T,convergence] = initScalarSolution(p,20); % Start iteration loop to iterate nonlinearity for iter = 1:maxiter % Compute thermal conductivity lambda = 20+0.4*T; % W/(mK) % Assemble problem matrix [D,F] = assembleDiffusionMatrix(p,t,lambda); % Apply boundary conditions [D,F] = imposeScalarBoundaryCondition(p,e,D,F,28,'value',20); [D,F] = imposeScalarBoundaryCondition(p,e,D,F,29,'flux',100); % Compute and plot residuals [stop, convergence] = computeScalarResiduals(D,F,T,convergence,maxres); plotScalarResiduals(convergence,2); % Break if solution converged if(stop) break; end % Solve linearized equations T = D\F; end figure(4); displaySolution(p,t,T,'Temperature [deg C]');
Go here to download the toolbox.