Need an explanation of setting Boundary Condition in pdepe (PDE Solver)

1 回表示 (過去 30 日間)
Raj001
Raj001 2018 年 7 月 16 日
編集済み: Raj001 2018 年 7 月 16 日
I am trying to solve Advection Diffusion equation using pdepe (PDE solver) in Matlab. I am not clear why we are writing pl=cl-1.0 in boundary condition. At left boundary, I am setting C(0,t)=1 and C(L,t)=0.1.
I need an explanation of it.
clear
close all
%P(1)=1;
P(2)=1;
L=0.01;
maxt=40;
m=0;
t=linspace(0,maxt,100);
x=linspace(0,L,50);
sol=pdepe(m,@PDEfun,@ICfun,@BCfun,x,t,[],P);
c=sol;
figure(1)
surf(x,t,c);
xlabel('distance x')
ylabel('time t')
zlabel('species c')
figure(2)
hold all
for n=linspace(1,length(t),10)
plot(x/L,(c(n,:)))
end
%legend([t = 1], ['t'=length(t)]);
xlabel('x/L')
ylabel('C(x,t)/C0')
grid on;
%.........................................
function [g,f,s]=PDEfun(x,t,c,dcdx,P)
D=0.000001;
k=0;%-0.0167;
U=0;%.001;
g=1;
f=D.*dcdx;
s=-(U*dcdx)+(k*c);
end
%..................................
function c0=ICfun(x,P)
c0=1.0;
end
%................................
function [p1,q1,pr,qr]=BCfun(x1,c1,xr,cr,t,P)
%c0=P(2);
p1=c1-1.0; q1=0; pr=cr-0.1; qr=0;
end

回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by