Solving advection diffusion pde

조회 수: 26 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2018년 12월 25일
댓글: Deepa Maheshvare 2019년 1월 2일
I want to solve the above pde with the given boundary and initial conditions. I came across the pdepe function in MATLAB.
I had a chance to look at the example given here . I couldn't understand how pdex1pde function has to be defined for my case.
Could someone help?
  댓글 수: 1
Deepa Maheshvare
Deepa Maheshvare 2018년 12월 27일
Hi All,
Is the following implementation correct?
function DiffusionConvection
m = 0;
x = linspace(0,62,10);
t = linspace(0,10,100);
sol = pdepe(m,@pdefun,@icfun,@bcfun,x,t)
function [g,f,s] = pdefun(x,t,c,DcDx)
D = 900;
v = 10;
g = 1;
f = D*DcDx;
s = -v*DcDx;
end
function c0 = icfun(x)
c0 = 80;
end
function [pl,ql,pr,qr] = bcfun(xl,cl,xr,cr,t)
pl = cl -10;
ql = 1;
pr = cr;
qr = 1;
end
end

댓글을 달려면 로그인하십시오.

답변 (1개)

Bill Greene
Bill Greene 2018년 12월 27일
The only problem I see with your code is in the boundary conditions. I corrected your bcfun function and have attached my version of your code below.
function DiffusionConvection
m = 0;
x = linspace(0,62,10);
t = linspace(0,10,100);
D = 900;
sol = pdepe(m,@pdefun,@icfun,@bcfun,x,t);
function [g,f,s] = pdefun(x,t,c,DcDx)
v = 10;
g = 1;
f = D*DcDx;
s = -v*DcDx;
end
function c0 = icfun(x)
c0 = 80;
end
function [pl,ql,pr,qr] = bcfun(xl,cl,xr,cr,t)
pl = -10*D;
ql = 1;
pr = 0;
qr = 1;
end
end
  댓글 수: 5
Torsten
Torsten 2019년 1월 2일
편집: Torsten 2019년 1월 2일
pl = -10*D;
ql = 1;
If you insert in the form used by pdepe (p+q*f=0), you get
-10*D + 1*D*Dcdx = 0,
thus
DcDx = 10.
Deepa Maheshvare
Deepa Maheshvare 2019년 1월 2일
Thanks a lot for the clarification

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics and Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by