Please help! pdepe does not stop!!

2 views (last 30 days)
Hüseyin Cagdas Yatkin
Hüseyin Cagdas Yatkin on 17 Dec 2019
Answered: Guru Mohanty on 23 Jan 2020
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

Answers (1)

Guru Mohanty
Guru Mohanty on 23 Jan 2020
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

Categories

Find more on Partial Differential Equation Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!