coding a PDE using PDEPE

조회 수: 16 (최근 30일)
Isaac Bt
Isaac Bt 2016년 5월 16일
편집: Isaac Bt 2016년 5월 16일
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개)

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by