PDEPE and BCFUN
28 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I would like to use pdepe for solving Heat equation in 1D with a non linear coefficient. I know it is possible. But I remain stuck with the boundary condition and pl,pr,ql,qr.
Let us consider a classic Heat equation : pi^2 dUdt = d2U/dx2 with, U(0,x)= sin(pi x) and as boundary condition : u(t,0)=0=u(t,1) for t>=0 and 0<=x<=1
How do you translate this boundary condition into BCfun and pl,pr,qr,ql ??
Thanks. Alex.
0 件のコメント
回答 (1 件)
Grzegorz Knor
2011 年 11 月 25 日
Below is the full code:
function heat1D
m = 0;
xmesh = linspace(0,1,20);
tspan = linspace(0,3,60);
sol = pdepe(m,@pdefunH,@icfunH,@bcfunH,xmesh,tspan);
u = sol(:,:,1);
surf(xmesh,tspan,u)
function [c,f,s] = pdefunH(x,t,u,dudx)
c = pi^2;
f = dudx;
s = 0;
function u = icfunH(x)
u = sin(pi*x);
function [pl,ql,pr,qr] = bcfunH(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = ur;
qr = 0;
2 件のコメント
HARRISON WANDERA
2021 年 2 月 2 日
@Grzegorz Knor how will the boundary conditions look like for the same equation but in two dimension case?
HARRISON WANDERA
2021 年 2 月 2 日
@Grzegorz Knor i wrote them this way:
pl = [ul(1);ul(2)];
ql = [0;0];
pr = [ur(1);ur(2)];
qr = [0;0];
but i think am not correct because my code is not running as i expected. I will appreciate your intervention.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!