Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
Show older comments
I get this error in writing the code.... The code I wrote is as follows
function pdeop global A void G L Usg Usl Rhog Rhol Kos Kot aeff Ugeff Uleff hl a; m = 0; x = linspace(0,1.5,31); t = linspace(0,3600,3601); sol = pdepe(m,@pdeoppde,@pdeopic,@pdeopbc,x,t); u1 = sol(:,:,1); u2 = sol(:,:,2); u3=sol(:,:,3); u4=sol(:,:,4);
% -------------------------------------------------------------- function [c,f,s] = pdeoppde(x,t,u,DuDx) c = [A*void*(1-hl)*Rhog;A*void*hl*Rhol;A*void*(1-hl)*Rhog;A*void*hl*Rhol]; f = [-G;L;-G;L] .*u; Cs=Rhog*Kos*aeff*A*sqrt(Rhog/(Rhol-Rhog))*(Ugeff/Uleff); Ct=Rhog*Kot*aeff*A*sqrt(Rhog/(Rhol-Rhog))*(Ugeff/Uleff); ysstar=-4.2913*u(2)^4+11.791*u(2)^3-12.01*u(2)^2+5.508*u(2); ytstar=0.0023*exp(6.0058*u(4)); M=Cs*(ysstar-u(1)); N=Ct*(ytstar-u(3)); s = [M;-M;N;-N]; end % -------------------------------------------------------------- function u0 = pdeopic(x) u0 = [0;0.5;0;0.5]; end % -------------------------------------------------------------- function[pl,ql,pr,qr] = pdeopbc(xl,ul,xr,ur,t) pl = [ul(1);0;ul(3);0]; ql = [0;0;0;0]; pr = [ur(1)-0.5;0;ur(3)-0.5;0]; qr = [0;0;0;0]; end end
Can anyone please suggest me a solution?
3 Comments
Alan Weiss
on 18 Feb 2016
Please edit this and use the {} Code button so we might be able to read it.
Alan Weiss
MATLAB mathematical toolbox documentation
Torsten
on 19 Feb 2016
... and best include the PDE system with boundary and initial conditions in mathematical notation as pdf document such that we are able to compare it to your code.
Best wishes
Torsten.
Widitha Samrakoon
on 19 Feb 2016
Edited: Widitha Samrakoon
on 19 Feb 2016
Accepted Answer
More Answers (1)
Torsten
on 22 Feb 2016
0 votes
As Bill already pointed out, pdepe is not designed to solve PDEs without 2nd derivative terms.
You will have to discretize the spatial first derivatives (e.g. by a first-order upwind scheme) and solve the resulting system of ordinary differential equations using ODE15S, e.g. . Look up "method of lines" for more details.
Best wishes
Torsten.
2 Comments
Widitha Samrakoon
on 22 Feb 2016
Torsten
on 22 Feb 2016
If you have the NAG Toolbox, use
Best wishes
Torsten.
Categories
Find more on Eigenvalue Problems 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!