Solving Partial Differential Equation for heat convection equation.

7 views (last 30 days)
clc;
clear all;
m = 2;
x = linspace(0,0.025,20);
t = linspace(0,28800,30);
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
% Extract the first solution component as u. This is not necessary
% for a single equation, but makes a point about the form of the output.
u = sol(:,:,1);
% A surface plot is often a good way to study a solution.
figure;
surf(x,t,u);
xlabel('Distance x');
ylabel('Time t');
% A solution profile can also be illuminating.
figure;
plot(x,u(end,:),'o');
legend('Temprature Profile');
xlabel('Distance x');
ylabel('temp');
% --------------------------------------------------------------------------
function [c,f,s] = pdex1pde(x,t,u,DuDx)
c = 1;
f = DuDx;
s = 0;
end
% --------------------------------------------------------------------------
function u0 = pdex1ic(x)
u0 = 3;
end
% --------------------------------------------------------------------------
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
h=1400;
t0=4;
tinf=100;
A=0.0019265;
pl = 0;
ql = 1;
pr = h*(t0-tinf)*A;
qr = 1;
end
  8 Comments
Bill Greene
Bill Greene on 11 Dec 2017
There is nothing particularly wrong with having a constant value of heat flux at the outer end of the region. The reason the temperature is high is that you are solving for a very long time (28800 seconds) and your value for alpha is unrealistically low. You should calculate alpha for a "real" material.
Torsten
Torsten on 11 Dec 2017
Why should the OP use a temperature of the environment Tinf if he wants to set a constant heat flux ?

Sign in to comment.

Answers (1)

Torsten
Torsten on 11 Dec 2017
If Tinf is the temperature of the environment and h is the heat transfer coefficient [W/(m^2*K)],
pr = h*(ur(1)-Tinf);
qr = 1.0;
T0 is superfluous.
Here, a value of 1 W/(m*K) for the thermal conductivity of the material of the sphere is assumed.
Best wishes
Torsten.
  1 Comment
Anirudh Mehta
Anirudh Mehta on 11 Dec 2017
Sorry I am still not able to get the correct temperature profile.! Here the temperature increases at t=0 and remains constant to a value of 100 until time T. Temperature should be constantly rising with distance and time.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!