% Diffusion equation - 2D - Explicit Method % Convection boundary conditions clear clc clf % Inputs alpha = 1e-4; % Thermal diffusivity, m2/s (Heat Conduction - Ozisik & Hahn) kt = 386; % Thermal conductivity of the material, W/(m*deg.C), eg 386 h1 = 30; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 30 Tinf1 = 100; % Temperature of the convection medium at end 1, deg.C, eg 100 h2 = 40; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 40 Tinf2 = 200; % Temperature of the convection medium at end 1, deg.C, eg 200 h3 = 50; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 50 Tinf3 = 300; % Temperature of the convection medium at end 1, deg.C, eg 300 h4 = 60; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 60 Tinf4 = 400; % Temperature of the convection medium at end 1, deg.C, eg 400 t = 15; % total time, s eg. 200, 1600 nt = 300; % total no. of time steps eg. 2, 160 delta_t = t/nt; % timestep, s xlength = 1; % xlength = yheight, m nx = 4; % total no. of spatial grids eg. 4, 15 delta_x = xlength/nx; % delta_x = delta_y, m delta_y = delta_x; % delta_x = delta_y, m Tin = 0; % Initial temperature Tmax = max([Tinf1,Tinf2,Tinf3,Tinf4,Tin]); Bi1 = (h1*delta_x)/kt % Biot number Bi2 = (h2*delta_x)/kt % Biot number Bi3 = (h3*delta_x)/kt % Biot number Bi4 = (h4*delta_x)/kt % Biot number Fo = alpha*delta_t/delta_x^2 % Note: Fourier number, Fo = diffusion number, d % Solution n = ((xlength/delta_x) + 1)^2; % no. of interior points m = sqrt(n); % no. of points in a row / column r = (t/delta_t) + 1; % no. of time steps d = alpha*delta_t/delta_x^2; % diffusion number if d < 0.25 fprintf('solution stable d = %8.4f', d) else fprintf('solution unstable d = %8.4f', d) end % Creating initial and boundary conditions T = zeros(m,m,r); % Creating initial conditions for k = 1:1 for j = 1:m for i = 1:m T(i,j,k) = Tin; end end end T; %{ % Creating boundary conditions for k = 1:1 for j = 1:m for i = 1:m if (j == 1) && (i>1) && (i1) && (j1) && (i1) && (j1) && (i1) && (j1) && (i1) && (j
I am curious if one can still use fictitious nodes like Neumann BCs for Convection BCs, or do you have to do this heat balance? That being said, wouldn't you still need this heat balance for, say, the corner nodes for all Neumann BCs? Edit: I guess I am confusing the energy balance and the Taylor approaches to finite differences.
% Diffusion equation - 2D - Explicit Method
% Convection boundary conditions
clear
clc
clf
% Inputs
alpha = 1e-4; % Thermal diffusivity, m2/s (Heat Conduction - Ozisik & Hahn)
kt = 386; % Thermal conductivity of the material, W/(m*deg.C), eg 386
h1 = 30; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 30
Tinf1 = 100; % Temperature of the convection medium at end 1, deg.C, eg 100
h2 = 40; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 40
Tinf2 = 200; % Temperature of the convection medium at end 1, deg.C, eg 200
h3 = 50; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 50
Tinf3 = 300; % Temperature of the convection medium at end 1, deg.C, eg 300
h4 = 60; % Convection heat transfer coefficient at end 1, W/(m2*C), eg 60
Tinf4 = 400; % Temperature of the convection medium at end 1, deg.C, eg 400
t = 15; % total time, s eg. 200, 1600
nt = 300; % total no. of time steps eg. 2, 160
delta_t = t/nt; % timestep, s
xlength = 1; % xlength = yheight, m
nx = 4; % total no. of spatial grids eg. 4, 15
delta_x = xlength/nx; % delta_x = delta_y, m
delta_y = delta_x; % delta_x = delta_y, m
Tin = 0; % Initial temperature
Tmax = max([Tinf1,Tinf2,Tinf3,Tinf4,Tin]);
Bi1 = (h1*delta_x)/kt % Biot number
Bi2 = (h2*delta_x)/kt % Biot number
Bi3 = (h3*delta_x)/kt % Biot number
Bi4 = (h4*delta_x)/kt % Biot number
Fo = alpha*delta_t/delta_x^2 % Note: Fourier number, Fo = diffusion number, d
% Solution
n = ((xlength/delta_x) + 1)^2; % no. of interior points
m = sqrt(n); % no. of points in a row / column
r = (t/delta_t) + 1; % no. of time steps
d = alpha*delta_t/delta_x^2; % diffusion number
if d < 0.25
fprintf('solution stable
d = %8.4f', d)
else
fprintf('solution unstable
d = %8.4f', d)
end
% Creating initial and boundary conditions
T = zeros(m,m,r);
% Creating initial conditions
for k = 1:1
for j = 1:m
for i = 1:m
T(i,j,k) = Tin;
end
end
end
T;
%{
% Creating boundary conditions
for k = 1:1
for j = 1:m
for i = 1:m
if (j == 1) && (i>1) && (i1) && (j1) && (i1) && (j1) && (i1) && (j1) && (i1) && (j
I am curious if one can still use fictitious nodes like Neumann BCs for Convection BCs, or do you have to do this heat balance? That being said, wouldn't you still need this heat balance for, say, the corner nodes for all Neumann BCs?
Edit: I guess I am confusing the energy balance and the Taylor approaches to finite differences.
Thank you for sharing this video , appreciate you. I encountered with a problem, if top side will be insulated, what will we do ?
Consider insulated boundary conditions.
Detailed explanation.. Thank you for the video. :-) how will this case differ with convectioin BCs using BTCS method?
Should not ..significantly
Can anyone tell me what the errors would be compared to the analytical solitaire? Where would it be higher boundary or center?
Have you the functions of Gauss elimination, SOR method, vector to matrix?
Did you check in
engineering-stream.com ?
@@samseleven1 Yes, but i couldn't find it out
@@samseleven1 I found all, except gauss elimination, have you the code?
@@pabloANR gauss elimination should be there. Pls double check.
@@samseleven1 It's the only missing :c
Codes may be obtained from engineering-stream.com under Numerical Methods Section
I believe the unit for g is W/m3 so you may use the volume info to calculate g depending on how your model is set up
thank you sir please send me the programme 1D theat conduction please
Pls check engineering-stream.com for the codes under Numerical methods
can I get the ppt for this one
Check into
engineering-stream.com