Solving Heat Transfer problem using Finite Difference

5 views (last 30 days)
I was working on modelling this question
Modelled it liket this:
I used this formula for finite difference
I wrote the code but how do i obtain equations ..for example solving by hand i got these:
Heres my code: There is an issue if i use syms T1 ....T5
Any help would be appreciated.
clear all
clc
close all
L=0.05; %thickness
n=5; % no of nodes
edot=6e5; % heat generation
k=34; % conductivity
g=edot/k;
dx=L/n; %distance between 2 nodes
alp=1/(dx)^2;
h=60; % heat transfer coefficient
syms T5
T_inf=30; % T on the right hand side
T0=ones(1,n);
T1=ones(1,n);
%T0(5)=T5;
for i=1:n-1
T1(i)=(alp)*(T0(i+1)-2*T0(i)+T0(i-1))+g; % node 1= insulation
end
T0(end)=h*(T_inf-T(5))*k*1/dx+edot*dx/2; % node 5 has heat convection too
  4 Comments
SALAH ALRABEEI
SALAH ALRABEEI on 16 Jun 2021
In this case, you boundary conditon in Neumann not Dirichlet, meaning that the derivate of the temperature at the end is zero not the temperature itself is zero.
amena zainab
amena zainab on 16 Jun 2021
Edited: amena zainab on 16 Jun 2021
Hi, Thanks for the reply, I am supposed to get equations and solve then as as system. But editing as you said got me
1.0e+11 *
0 0.0000 0.0008 7.6478 0.0001
Im confused as this is the solution by hand and we get different values
Loop 1 only gives the value of (g *alp) how can I involve the T0 nad T1??
T =
1.0e+04 *
1.7647 0 0 0 0
Loop 2 same for here..
T =
1.0e+08 *
0.0002 1.7649 0 0 0
for i=1:n-1
T(i)=(alp)*(T(i+1)-2*T(i)+T(i-1))+g;
end
T(n)=h*(T_inf-T(5))*k*((T(4)-T(5)*1/dx)+edot*dx/2;
disp(T)
T= 1.0e+11 *
0 0.0000 0.0008 7.6478 0.0001

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!