Solving Partial Differential Equation for heat convection equation.

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

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.
@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?
The boundary condition
pr = h*(t0-tinf)*A;
qr = 1;
seems to be wrong.
Best wishes
Torsten.
https://www.youtube.com/watch?v=ri_1nxwupb8&t=329s
I tried to solve the same problem as shown in video.! which defines how we can solve for pde using heat convection model.
! But when the graphs are plot, the temperature value range is way to high. I have attached the image of pde which I need to solve.!
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.
@Torsten
So how can I correct my code.?
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.
Why should the OP use a temperature of the environment Tinf if he wants to set a constant heat flux ?

Accedi per commentare.

Risposte (1)

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

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.

Accedi per commentare.

Richiesto:

il 11 Dic 2017

Commentato:

il 11 Dic 2017

Community Treasure Hunt

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

Start Hunting!

Translated by