coding a PDE using PDEPE
18 次查看(过去 30 天)
显示 更早的评论
Hi,
I was wondering if my code for the below equations is right, particularly the f for the first part (highlighted). I have a hard time coding in the du1/dz term so I put it in s but not sure if it's right.

================================
sol = pdepe(m,@Dimless1PDEfun,@Dimless1ICfun,@Dimless1BCfun,x,t,[],P);
%sol:xmesh x tspan x variable
u1=sol(:,:,1);
u2=sol(:,:,2);
function [c,f,s]=Dimless1PDEfun(x,t,u,dudx,P)
%Extract parameters
Pe=P(1); %Peclet as a variable
St=P(2); %Stanton as a variable
alfa=P(3); %Degredation yield
%PDEs
c=[1;1];
f=[1/Pe.*dudx;0];
s=[-dudx-St*u(1)*; -alfa*St*u(1)];
======================
function u0=Dimless1ICfun(x,P);
u0=[0;1];
function [pl,ql,pr,qr]=Dimless1BCfun(xl,ul,xr,ur,t,P)
pl=[ur;1]; %set on right side s=0,u=1
ql=[0;0];
pr=[0;0];
qr=[P(1);1]; %sets right side at x=1, du/dt=0
Thanks!
(St, Pe, and Alfa are constants previously defined and not shown here)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 PDE Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!