Solving partial differential equations using pdepe solver
Mostrar comentarios más antiguos
I have to solve two coupled partial differential equations which I have attached below. I used pdepe solver for those equations but I am getting error. I would like to know whether I can solve such equations with pdepe solver.

I have written the following code for the above equations.
% paramters
global P R T L epsf pel tc epstar beta Keq cref yin sh gamma p
% paramters
L = 6e-2; % in m
epsf = 0.43;
beta = 46.65;
Keq = 75;
epstar = epsf + Keq*beta;
pel = 21.73;
tc = 140e-3; % in sec
P = 1e5; % in pascals
R = 8.314; % in j/mol-k
T = 323; % in K
cref = P/(R*T); % in mol/m3
yin = 2420;
sh = 4.51;
gamma = 0.111;
p = 0.0326;
% defining mesh
xmesh = linspace(0,1,300);
tmesh = linspace(0,1500,500);
% using pdepe solver
m = 0;
sol = pdepe(m,@adsorp,@adsorpic,@adsorpbc,xmesh,tmesh);
% % plotting results
% plot(tmesh,sol(:,end)*1e6*R*T/P)
% xlabel('time (sec)')
% ylabel('concentration (ppm)')
function [c,f,s] = adsorp(x,t,u,dudx)
global epsf beta pel sh p gamma Keq
c = [epsf; beta];
f = [((1/pel)*dudx(1));0 ];
s = [-dudx(1)-(sh/p)*(u(1)-(gamma*u(1)+beta*u(2)/Keq)/(gamma+beta*(1-u(2)))); (sh/p)*(u(1)-(gamma*u(1)+beta*u(2)/Keq)/(gamma+beta*(1-u(2))))];
end
function u0 = adsorpic(x)
u0 = [0;0];
end
function [pl,ql,pr,qr] = adsorpbc(xl,ul,xr,ur,t)
global yin
pl = [ul(1)-yin;0];
ql = [1;0];
pr = [0;0];
qr = [1;0];
end
when I am running above code I am getting error as follows:
Error using pdepe (line 293)
Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term
involving spatial derivative.
Error in systemofpdesusingpdepe (line 27)
sol = pdepe(m,@adsorp,@adsorpic,@adsorpbc,xmesh,tmesh);
Can someone please tell whether the pdepe solver can be used for these type of problems? Also suggestions on the method to solve above equations is very much appreciated.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
