MATLAB: Gas-Solid Reaction Modeling with Random Pore Model. Pdepe: Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.

bhatiaperlmuttercao carbonation reactionchemicalengineeringdiffusion-reaction modelgas solid reactionkineticsMATLABpde

Hello everyone,
I am studying the reaction's kinetics of calcium oxide with carbon dioxide through the Random Pore Model of Bhatia and Perlmutter. You can find the equations and code attached that I am trying to solve with the pdepe but it appears the error "Error using pdepe (line 293) Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative".
Is there anyone who could tell me why I have this kind of error in the code and how to fix it?
Thanks in advance for your help.
clc,clear
%% RPM
% Properties
global phi zeta beta psi eps0 cb ceq s0 ks Sh
R=41e-6; %[m]
cb=1.95e-5; %[kmol m^-3]

ks=0.559e-5; %[m^4 kmol^-1 s^-1]
ceq=1.93e-3; %[kmol m^-3]
s0=42e6; %[m^-1]
psi=1.52; %[-]





zeta=2.10; %[-]
eps0=0.47; %[-]
beta=8120; %[-]
phi=45.46; %[-]
Sh=4.48; %[-]
%Axes
rmesh=linspace(0,R,100);
etamesh=rmesh/R; %eta
tspan=linspace(-1523,0,100);%tetac
%% Solver
m=2;
sol=pdepe(m,@pdefun,@icfun,@bcfun,etamesh,tspan);
cstar=sol(:,:,1);
xcao=sol(:,:,2);
%% Plots
surf(etamesh,tspan,sol,'edgecolor','none')
xlabel('xcao [-]')
ylabel('deltatetac [-]')
zlabel('c* [-]')
% Pdefun
function [c,f,s] = pdefun(x,t,u,dudx)
global phi zeta beta psi eps0 cb ceq s0 ks Sh
cs=u(1);
xcao=u(2);
c=[-phi^2 1]';
f=[1-((zeta-1)*(1-eps0)/eps0)*xcao 0]'.*dudx;
s=[0 -(cs*(1-xcao)*(1-psi*log(1-xcao)^(0.5)))/(1+((beta*zeta)/(psi)*(1-psi*log(1-xcao))^(0.5)-1))]';
end
% Bcfun
function [pl,ql,pr,qr] = bcfun(xl,ul,xr,ur,t)
global phi zeta beta psi eps0 cb ceq s0 ks Sh
pl = [0 0]';
ql = [1 1]';
pr=[0 0]';
qr =[0 0]' ;
end
% Icfun
function u0 = icfun(x)
global phi zeta beta psi eps0 cb ceq s0 ks Sh
u0 =[-ceq/(cb-ceq) 0]';
end

Best Answer

Your right-end boundary conditions are invalid.
Possibly you want:
pr=[ur(1)-1 0]';
qr =[0 1]' ;