Mixed boundary condition in pdepe solver

4 ビュー (過去 30 日間)
Deepa Maheshvare
Deepa Maheshvare 2019 年 10 月 29 日
編集済み: Deepa Maheshvare 2019 年 10 月 30 日
I'm solving the following 1D convection diffusion system in pdepe solver.
I've to impose no-flux boundary condition at both left and rigth boundary.
function sol=main(Input)
format short
global D v
m = 0;
D = Input.D;
v = Input.v;
x = Input.xmesh;
t = Input.tspan;
sol = pdepe(m,@pdefun,@icfun,@bcfun,x,t)
function [g,f,s] = pdefun(x,t,c,DcDx)
g = 1;
f = D*DcDx;
s = -v*DcDx;
end
function c0 = icfun(x)
c0 = Input.c0;
end
I'm not sure how to implement the no-flux boundary condition according to the general form given here
Is it correct to re-write the BC: - vC + DdC/dx = 0
as
C -( D/v) dC/dx = 0
where p = C
q = -(1/v)
f = DdC/dx
Is the following correct?
function [pl,ql,pr,qr] = bcfun(xl,cl,xr,cr,t)
pl = cl;
ql = -1/v;
pr = cr;
qr = -1/v;
end
or
function [pl,ql,pr,qr] = bcfun(xl,cl,xr,cr,t)
pl = -cl;
ql = 1/v;
pr = -cr;
qr = 1/v;
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics and Optimization についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by