Spatial discretization Error PDE solver- Shouldn't the following PDE work?
1 view (last 30 days)
Show older comments
I am currently trying to solve a Mass Transfer modeling problem that models a system of two PDE's:
Here are the PDE's: (1) (du1/dt)+(du1/dx)-(1/Pe)*(d^2u1/dx^2)=c_1*(u2-u1)
and (2) (du2/dt)=c_2*(u1-u2)
Where u1 and u2 are my variables. Pe, c_1, and c_2 are all constants.
The initial conditions are as follows: (@t=0, u1=0) and (@t=0, u2=qo) - Where qo is initial concentration at a value of .263
The boundary conditions are as follows (there are no boundary conditions for the second PDE equation as it is only related to time: (x=0; Pe*u1=du1/dx) and (x=1; du1/dx=0)
My code below is throwing me this error: "Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative."
From my understanding, my PDE should be suited for this problem. Are there something wrong with my boundary conditions?
I would greatly appreciate any help on this. New to MATLAB and the world of PDE's. Thanks in advance!
My code for this is below:*
function pdex11
clc
clear all
m=1; %M=1 for cylindrical
x=[0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1]; %x is z direction (axial)
t=[0 100 200 300 400 500 600 700 800 900 1000 1100 1200]; %t is Dimensionless time Tau
sol=pdepe(m,@pdex11pde,@pdex11ic,@pdex11bc,x,t);
u1=sol(:,:,1); %U1 is Cf
u2=sol(:,:,2); %U2 is Cs
%plot(x,u1(:,end))
function [c,f,s]=pdex11pde(x,t,u,DuDx)
global Pe H L Rp voidfrac kf vs
Pe=1097.51
H=1
L=3
Rp=.0000315
voidfrac=.75
kf=5.097
vs=.1313
c_1=3*L*Pe/Rp *((1-voidfrac)/voidfrac)*(kf/vs)
c_2=-3*L/(Rp^(kf/vs))
c=[Pe;H];
f=[1;0].*DuDx;
s1=c_1*u(1)-c_1*u(2)-Pe*DuDx(1);
s2=c_2*u(2)-c_2*u(1);
s=[s1;s2];
function u0=pdex11ic(x);
q0=.263; %solute concentration solid phase (kmol/m^3)
u0=[0;q0];
function [pl,ql,pr,qr]=pdex11bc(xl,ul,xr,ur,t)
global Pe
pl=[Pe*ul(1);0];
ql=[-1;0];
pr=[0;0];
qr=[1;0];
5 Comments
Bill Greene
on 19 Apr 2017
Your equation for the solid phase contains C_f and you don't specify a specific point where C_f is evaluated. If that is the case, then that equation is a function of both tau and x because C_f is a function of x.
Haniyeh Mohammadi
on 16 May 2021
Hi Henry
I'm having this problem. Can you please share the solution with me?
Answers (0)
See Also
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!