Solving heat equation with source term using pdepe

19 ビュー (過去 30 日間)
Nishant Gupta
Nishant Gupta 2020 年 8 月 9 日
回答済み: Uday Pradhan 2020 年 8 月 12 日
I was able to write the equations in the form that is expected by the pdepe command. Here is the code I have so far-
clc
clear all
global rho Cp MW dH k
tspan = 60*(1:500:30000);
x = 0:0.25:5;
m = 0;
sol = pdepe(m, @pdefun, @pdeic, @pdebc, x, tspan);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
surf(x,tspan,u1)
title('u_1(x,t)')
xlabel('Distance x')
ylabel('Time t')
function [c,f,s] = pdefun(x,t,u,dudx)
rho = 906;
Cp = 0.4365;
MW = 104.15;
dH = -17800;
k = 0.03;
y2 = 1-u(2);
A0 = 1.964*(10^5)*exp(-10040/u(1));
A1 = 2.57-5.05*u(1)*(10^(-3));
A2 = 9.56-1.76*u(1)*(10^(-2));
A3 = -3.03+7.85*u(1)*(10^(-3));
A = A0*exp(A1*(y2) + A2*(y2^2) + A3*(y2^3));
F = -A*((rho/MW)^(3/2))*((u(2))^(5/2));
c = [1; 1];
f = [k*rho/Cp; 0].*dudx;
s = [(dH/(MW*Cp))*F; F];
end
function u0 = pdeic(x)
u0 = [313.5; 1];
end
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = [0; 0];
ql = [1; 1];
pr = [0; 0];
qr = [1; 1];
end
The problem is that on making the surface plot of the temperature u1, I don't see any variation along the length. This is what the surface plot of u1 looks like-
Another funny thing is that even if I change the function 'f' in pdefun to garbage values like f = [65675; 767].*dudx (these numbers are meaningless, I just typed out something randomly), I get the same plot regardless of the function f. I even cleared all variables before running the code but the same thing happens. I don't understand what's going on here. Any help is appreciated.

採用された回答

Uday Pradhan
Uday Pradhan 2020 年 8 月 12 日
Hi Nishant,
I reckon you have already found the answer here. Sharing the link here so that it comes handy for anyone who has a similar doubt in this topic.

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by