Please help! pdepe does not stop!!

조회 수: 2 (최근 30일)
Hüseyin Cagdas Yatkin
Hüseyin Cagdas Yatkin 2019년 12월 17일
답변: Guru Mohanty 2020년 1월 23일
Hello guys, I trying solve below question with pdepe and whe I run the code as mantioned in the below code, it never stop working.
v = 49 680 m/day
kd = 0.24 1/day
ks = 58,8 m/day
h = 5 m
C(t = 0,x) = 13.75 mg/L initial condition
C(t, x = 0) = 13.75 mg/L
C(t, x = 1000m) = 10.05 mg/L
clc
clear
x = linspace(0,1000,1000);
t = linspace(0, 7, 28);
m = 0;
sol = pdepe(m, @pde,@pdeic,@pdebc,x,t);
u = sol(:,:,1);
sol(1000,:);
plot(x, sol(1000,:))
function [c, f, s] = pde(x, t, C, dCdx)
c = 1/(0.575*24*3600);
f = C;
s = (0.24+2.45*24/5)/(0.575*24*3600)*C;
end
function u0 = pdeic(x)
u0 = 13.75;
end
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = ul - 13.75;
ql = 0;
pr = ur - 10.05;
qr = 0;
end

답변 (1개)

Guru Mohanty
Guru Mohanty 2020년 1월 23일
Hi, I understand you are trying to solve this partial differential equation. You can do this by using pdepe. Here is a sample code.
clc
clear all;
x = linspace(0,1000,1001);
t = linspace(0, 7, 28);
m = 0;
sol = pdepe(m, @pde,@pdeic,@pdebc,x,t);
val=sol(28,:);
figure
surf(t,x,sol');
figure
plot(x,val);
function [u, f, s] = pde(x,t,u,dudx)
u = 1/(0.575*24*3600);
f = u;
s = (0.24+2.45*24/5)/(0.575*24*3600)*u;
end
function u0 = pdeic(x)
u0 = 13.75;
end
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = ul - 13.75;
ql = 0;
pr = ur - 10.05;
qr = 0;
end
pdepe.PNG

카테고리

Help CenterFile Exchange에서 Partial Differential Equation Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by