Please help! pdepe does not stop!!

1 Ansicht (letzte 30 Tage)
Hüseyin Cagdas Yatkin
Hüseyin Cagdas Yatkin am 17 Dez. 2019
Beantwortet: Guru Mohanty am 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

Antworten (1)

Guru Mohanty
Guru Mohanty am 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

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by