Filter löschen
Filter löschen

Solving multiple PDE with using PDEPE

8 Ansichten (letzte 30 Tage)
Sait Mutlu Karahan
Sait Mutlu Karahan am 2 Jun. 2022
Bearbeitet: Torsten am 4 Jun. 2022
Hi guys,
I have a trouble to use pdepe. I want to solve 4 different partial differential equation and here is the my boundary conditions. Here is the my problem's physical setup.
Acoording to this physical setup here is the my boundary conditions.
Here is the my initial condition.
And my pdes are:
L = 1500; %lenght
x = linspace(0,L,1501); %x values from 0 to 1000 and dx=1 meter
t = linspace(0,10,11); %t values from 0 to 10 and dt=1 day
m = 0;
%coordinate and it is also explained in the form of pdepe
sol = pdepe(m,@headpde,@headic,@headbc,x,t);%solution of head partial dif. equ. with
colormap hot %
imagesc(x,t,sol) %
colorbar % Graph of the t<=0 to t<=20
hold on %
xlabel('Distance x','interpreter','latex') %
ylabel('Time t','interpreter','latex') %
title('Head Distribution for $0 \le x \le 1500$ and $0 \le t \le 10$','interpreter','latex')
function [c,f,s] = headpde(x,t,u,dudx)
c = [6.67*10^-4;5*10^-4;4*10^-4;3.33*10^-4];
f = [1;1;1;1].*dudx;
s = [0;2*10^-6;4*10^-6;0];
end
function u0 = headic(x) %initial condition of pde
u0 = (-2/150*x)+60; % equation of initial condition
end
function [pl,ql,pr,qr] = headbc(xl,ul,xr,ur,t) %Boundary condition of pde
pl = ul-60; %Left side boundary condition is fixed and %it is equal to 60 this line represents that
ql = 0;
pr = ur-40; %Right side boundary condition is fixed and %it is equal to 40
qr = 0; %qr shows that again in the right side of %the boundary condition
end
I wrote this code for only t is between 0 to 10 days. But it gives errors. For this reason I will be grateful if you could help me!
P.S. I'm a new learner that's why if you be kind to me I would be appreciate :)

Akzeptierte Antwort

Torsten
Torsten am 2 Jun. 2022
Bearbeitet: Torsten am 4 Jun. 2022
L = 1500; %lenght
x = linspace(0,L,1501); %x values from 0 to 1000 and dx=1 meter
t = linspace(0,20,21); %t values from 0 to 10 and dt=1 day
m = 0; %coordinate and it is also explained in the form of pdepe
sol = pdepe(m,@headpde,@headic,@headbc,x,t);%solution of head partial dif. equ. with
colormap hot %
imagesc(x,t,sol) %
colorbar % Graph of the t<=0 to t<=20
hold on %
xlabel('Distance x','interpreter','latex') %
ylabel('Time t','interpreter','latex') %
title('Head Distribution for $0 \le x \le 1500$ and $0 \le t \le 10$','interpreter','latex')
function [pl,ql,pr,qr] = headbc(xl,ul,xr,ur,t) %Boundary condition of pde
if t <= 10
pl = ul - 60;
ql = 0.0;
else
pl = ul - (60-(t-10));
ql = 0.0;
end
pr = ur - 40;
qr = 0;
end
function [c,f,s] = headpde(x,t,u,dudx)
if x <= 500
c = 6.67e-4;
f = dudx;
s = 0;
elseif x > 500 && x <=800
c = 5e-4;
f = dudx;
s = 2e-6;
elseif x > 800 && x <= 1100
c = 4e-4;
f = dudx;
s = 4e-6;
else
c = 3.33e-4;
f = dudx;
s = 0.0;
end
end
function ic = headic(x)
ic = -2/150*x + 60;
end
  1 Kommentar
Sait Mutlu Karahan
Sait Mutlu Karahan am 2 Jun. 2022
Hi Torsten! You are truly a life saver! Thanks for replying my two problems and thanks for your time! You really help me a lot! Thanks many times :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by