I am trying to solve a system of 3 PDEs using pdepe in MATLAB. But I am getting an error

3 次查看(过去 30 天)
Here is the code
%
function pdex51
m = 0;
x = 0:0.005:1;
t = 0:0.01:1;
options=odeset('Reltol',1e-10,'Abstol',1e-8);
sol = pdepe(m,@pdex5pde,@pdex5ic,@pdex5bc,x,t,options);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
u3 = sol(:,:,3);
% --------------------------------------------------------------
function [c,f,s] = pdex5pde(x,t,u,DuDx)
A=1; Re=1; strainrate=1;
c = [1; 1; Re];
n=1.2;
alpha= [0; 1; strainrate].*DuDx ;
f=alpha;
f(1)=0;
f(2)= alpha(3);
f(3)= alpha(2);
s = [A; (-u(2)/(1+u(1)^n)); 0 ] + [ - strainrate*u(1) ;0 ; 0].*flipud(DuDx);
% --------------------------------------------------------------
function u0 = pdex5ic(x)
u0 = [0; 0;0];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex5bc(xl,ul,xr,ur,t)
pl = [0; 0; ul(3)];
ql = [1; 0;0];
pr = [0;0;ur(3)-1*heaviside(t-1e-15)];
qr = [1; 0;0];
Now I am getting the error "Error using daeic12 (line 77) This DAE appears to be of index greater than 1.
Error in ode15s (line 311) [y,yp,f0,dfdy,nFE,nPD,Jfac] = daeic12(odeFcn,odeArgs,t,ICtype,Mt,y,yp0,f0,...
Error in pdepe (line 317) [t,y] = ode15s(@pdeodes,t,y0,opts);
Error in pdex51 (line 6) sol = pdepe(m,@pdex5pde,@pdex5ic,@pdex5bc,x,t,options); " Please help me in this regard Thanks

采纳的回答

Torsten
Torsten 2016-6-15
You don't supply boundary conditions for u(2).
This gives a singular matrix and is not allowed within pdepe.
Best wishes
Torsten.
  6 个评论
Torsten
Torsten 2016-6-15
E.g.
Schiesser: The numerical method of lines
or, if you have access to the NAG Toolbox, you can use
http://www.nag.co.uk/numeric/MB/manual64_24_1/html/D03/d03plf.html
Best wishes
Torsten.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by