Solving heat equation with source term using pdepe

18 vues (au cours des 30 derniers jours)
Nishant Gupta
Nishant Gupta le 9 Août 2020
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.

Réponse acceptée

Uday Pradhan
Uday Pradhan le 12 Août 2020
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.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by