# Solving partial differential equations using pdesolver

3 views (last 30 days)
인범 황 on 4 May 2022
Commented: Torsten on 5 May 2022
Hello, I am a college student learning MATLAB. I have a problem while studying, so I ask a question.
I want to solve this partial differential equation.
𝜕𝐶/𝜕𝑡=𝐷 (𝜕^2 C)/(𝜕z^2 ) − 𝑢/((1+𝐹𝐻)) 𝜕𝐶/𝜕𝑧
%% fuction script
function [j,f,s] = pde1(z,t,c,dcdz)
D =0.01;
e=0.6;
F=(1-e)/e;
H=1.88;
u=0.05;
j = 1;
f = (D/(1+(F*H)))*dcdz;
s = -(u/(1+(F*H)))*dcdz;
%p= F*dQdt;
end
%% boundary condition script
function [pl,ql,pr,qr]=pde1BC(zl, cl,zr,cr,t)
pl=zl;
ql=0.2;
pr=zr;
qr=0;
end
%% initial condition script
function c0=pde1ic(z,t)
c0=0.2;
end
%% main script (for 'run')
z=linspace(0,10,100)
t=linspace(0,200,2000)
m=0;
%eqn= @ (z,t,c,q,dcdz,dqdt)
sol=pdepe(m,@pde1, @pde1ic, @pde1BC,t,z)
When I 'run', the following error appears.
An error occurred while using: Failed to discretize pdepe space. Discretization supports only parabolic and elliptic equations with spatial derivative related flux terms.
An error occurred: pde1_main (line 6)
sol=pdepe(m,@pde1, @pde1ic, @pde1BC,t,z)
how can i solve this error
Thanks for reading this long post.

Bill Greene on 4 May 2022
Edited: Bill Greene on 5 May 2022
First, in your call to pdepe, you have the t and z arguments switched. It should be
sol=pdepe(m,@pde1, @pde1ic, @pde1BC,z,t);
Second, your boundary condition at the right end of the region(z=10) is incorrect. What is the boundary condition you want to impose at this point? If, for example, it is the Dirichlet condition c(10)=0, you should replace
pr=zr;
with
pr=cr;
Torsten on 5 May 2022
There is no mass sink in your equation. So the boundary condition c=0 at x=Inf seems inadequate to me. Better use dc/dx = 0.

### Categories

Find more on Eigenvalue Problems in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!