Solving partial differential equations using pdesolver

์กฐํšŒ ์ˆ˜: 6 (์ตœ๊ทผ 30์ผ)
์ธ๋ฒ” ํ™ฉ
์ธ๋ฒ” ํ™ฉ 2022๋…„ 5์›” 4์ผ
๋Œ“๊ธ€: Torsten 2022๋…„ 5์›” 5์ผ
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.

๋‹ต๋ณ€ (1๊ฐœ)

Bill Greene
Bill Greene 2022๋…„ 5์›” 4์ผ
ํŽธ์ง‘: Bill Greene 2022๋…„ 5์›” 5์ผ
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;
  ๋Œ“๊ธ€ ์ˆ˜: 4
Bill Greene
Bill Greene 2022๋…„ 5์›” 5์ผ
I modified my answer to reflect your actual outlet boundary conditon. The code for the inlet boundary condition is simply
ql=0;
pl=cl-ci0;
I am assuming you have determined that your domain length of ten is sufficiently large that it approximates infiniity for this particular problem.
Apparently you found the pdepe documentation for defining boundary conditions confusing. Can you say more about what confused you? I have written a document describing pdepe boundary condition definitions in a more tutorial fashion. Can you please look at this document and let me know if you find it more or less confusing? Thanks.
Torsten
Torsten 2022๋…„ 5์›” 5์ผ
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.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Eigenvalue Problems์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

์ œํ’ˆ


๋ฆด๋ฆฌ์Šค

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by