Solving multiple PDE with using PDEPE
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sait Mutlu Karahan
el 2 de Jun. de 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1019540/image.jpeg)
Acoording to this physical setup here is the my boundary conditions.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1019545/image.jpeg)
Here is the my initial condition.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1019550/image.jpeg)
And my pdes are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1019555/image.jpeg)
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 :)
0 comentarios
Respuesta aceptada
Torsten
el 2 de Jun. de 2022
Editada: Torsten
el 4 de Jun. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Eigenvalue Problems en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!