Solving Partial Differential Equation for heat convection equation.
Mostra commenti meno recenti
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 Commenti
John D'Errico
il 11 Dic 2017
Modificato: John D'Errico
il 11 Dic 2017
Um, nobody can know how your code should be modified to solve a PDE, because you never chose to tell us what PDE you are trying to solve, and what are the boundary conditions. As it is so far, the code is perfect, because it solves the PDE it was told to solve. Computers are very literal that way. :)
So if you want help, you need to tell people what problem you really needed to solve. Showing the code you used is a good start, but only half of the necessary information.
Jan
il 11 Dic 2017
@Anirudh Mehta: "There seems to be a problem" is not useful for the readers in the forum. Obviously you have some reasons to assume, that there is a problem. So why don't you tell, what they are?
Torsten
il 11 Dic 2017
The boundary condition
pr = h*(t0-tinf)*A;
qr = 1;
seems to be wrong.
Best wishes
Torsten.
Anirudh Mehta
il 11 Dic 2017
Torsten
il 11 Dic 2017
You prescribe a constant heat flux at the outer side of the sphere.
This will make the temperature arbitrarily high.
In a correct setting, the heat flux will depend on T (i.e. ur(1)).
Best wishes
Torsten.
Anirudh Mehta
il 11 Dic 2017
Modificato: Anirudh Mehta
il 11 Dic 2017
Bill Greene
il 11 Dic 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
il 11 Dic 2017
Why should the OP use a temperature of the environment Tinf if he wants to set a constant heat flux ?
Risposte (1)
Torsten
il 11 Dic 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 Commento
Anirudh Mehta
il 11 Dic 2017
Categorie
Scopri di più su Boundary Conditions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

