Find answers, ask questions, and connect with our <br>community around the world.

Home Forums CFD foundation course: Forum doubt in Matlab coding: 1D, SS, Heat conduction with convective BC

• # doubt in Matlab coding: 1D, SS, Heat conduction with convective BC

Posted by on July 31, 2022 at 7:35 am

clc
close all
clear all

L = 10/100;
N = 20;
dx = L/(N-1);

T = zeros(N,1);
Tb = 200;
Tamb = 20;
h = 50; %W/m2K
k = 250; %W/mK

X = h*dx/k;

z = 5000;

for j=1:1:z

T(1,1) = Tb;

for i=2:1:N-1

T(i,1) = ( T(i+1,1) + T(i-1,1) )/2;

end

T(N,1) = ( X*Tamb + T(N-1,1) )/(X+1);
plot(T);
%hold on;
end

2 Members · 2 Replies
• 2 Replies
• ### Sandeep

August 2, 2022 at 10:24 pm

what is the doubt Manoj? If you need someone to explain the code please raise a ticket with the zoom meeting. An Engineer from flowthermolab will clarify it.
Regards
Sandeep

• ### manojpanthalingal

Member
August 3, 2022 at 1:24 pm

its clarified… the numerical solution and the analytical solution was not matching… got it corrected… thanks