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.

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

 Accepted Answer

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

3 Comments

Thank you for the answer, the code gives me another problem with the surf plot.
Warning: Failure at t=9.073675e-02. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (2.220446e-16) at time t.
> In ode15s (line 653)
In pdepe (line 289)
In main (line 25)
Warning: Time integration has failed. Solution is available at requested time points up to t=0.000000e+00.
> In pdepe (line 303)
In main (line 25)
Error using surf (line 71)
Z must be a matrix, not a scalar or vector.
Error in main (line 29)
surf(etamesh,tspan,sol,'edgecolor','none')
How can I change the integration tolerance? Thank you.
I reproduced an example from the Bhatia and Perlmutter 1981 paper using pdepe.
My MATLAB code is here.
Good evening,
I used your example to solve the system and the next step is to perform a parameter estimation using lsqnonlin (PDE system,datas and code are attached) and I have the error "Unable to perform assignment because the size of the left side is 2-by-1 and the size of the right side is 2-by-10''
Do you have an idea of how I can fix the problem?
Thanks in advance for your kind help.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!