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!