Pdepe: Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
3 views (last 30 days)
Show older comments
Mallikarjuna M
on 8 Feb 2022
Commented: Mallikarjuna M
on 9 Feb 2022
i am trying to solve the diffusion reaction using pdepe but it is showing an error like
Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
any problem with the boundary. x(0)=1,x'(1)=0, y(1)=1,x'(0)=0
function steady
m = 0;
x = linspace(0,1);
t = linspace(0,1000);
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
%u2= sol(:,:,2);
%figure
plot(x, u1(end,:),'b')
hold on
%title('u1(x, t)')
%xlabel('Distance x')
%ylabel('u1(x,t)')
%figure
%plot(x, u2(end,:),'b')
%title('u2(x, t)')
%figure
% --------------------------------------------------------------
function [c,f,s] = pdex4pde(~,~,u,DuDx)
al=0.1;phi=0.0009;
c = [1;1];
f = [1;1].* DuDx;
F1=-9.*phi.^2.*(u(1)./1+u(1)+u(2));
F2=-9.*al.^2.*(u(2)./1+u(1)+u(2));
s = [F1;F2];
% --------------------------------------------------------------
function u0 = pdex4ic(~)
u0 = [0; 1];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(~,~,ul,ur,~)
%bi=10.0;
pl = [ul(1)-1;0];
ql = [0;1];
pr = [0;ur(2)-1];
qr = [1;0];
%qr = [0; bi*(1-ur(2))];
0 Comments
Accepted Answer
Bill Greene
on 8 Feb 2022
Your definition of the input arguments for the boundary condition function is incorrect.
Replace,
function [pl,ql,pr,qr] = pdex4bc(~,~,ul,ur,~)
with
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
or
function [pl,ql,pr,qr] = pdex4bc(~,ul,~,ur,~)
More Answers (0)
See Also
Categories
Find more on PDE Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!