Professional Documents
Culture Documents
V.Vuorinen
Aalto University School of Engineering
Heat and Mass Transfer Course, Autumn 2016
Δ T ni , j=T ni ,+1j −T ni , j
Visualization of 2d Cartesian Grid
x=0 x=Lx This corner
cell would be
Ghost cells “idle”/useless
where
y=Ly
boundary
conditions Ghost cells
given. For example: T ni , j +1 where
Zero gradient:
boundary
n n n n n n conditions
T ghost =Ti−1, j T ghost T i−1, j T i,j T i+1, j given
Fixed temperature:
T nghost =2 T target −T ni−1, j T ni , j −1
y=0
Δy
Cell face center Cell center
Δx
Summary of the Numerical Solution
Scheme for 2d Heat Equation
(Known and
1) Set boundary conditions (BC's) to the ghost cells T ni , j hence BC
using T from step n. update possible)
T n+1
i,j
3) Update time according to t = t + dt
t n+1 =t n +Δ t
4) Go back to 1)
Also This Scheme is Extremely Short
to Program in Matlab
Program: /Examples2d/HeatDiffusion2d.m
Execution: >> HeatDiffusion2d
What it does: Solves 2d heat equation in Cartesian grid, various BC's possible.
It is also possible to simulate materials with variable heat diffusivity to simulate
conduction in e.g. “layered” materials.
The “heart” of this 2d code is the computation of dT in the .m file computedT.m
dT=dt*DivDiv(T,nu,east,west,north,south,inx,iny,dx,dy);
Tright =
293K
Bottom and top walls are zero gradient Bottom wall is zero gradient i.e. isolated
keeping solution 1d
Tleft =500K Tright=293K
Top & Bottom zero gradient
Conducting
Isolated area
In the Non-
domain conducting
Thank you for your attention!