PDEPE and BCFUN
Afficher commentaires plus anciens
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.
Réponses (1)
Grzegorz Knor
le 25 Nov 2011
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 commentaires
HARRISON WANDERA
le 2 Fév 2021
@Grzegorz Knor how will the boundary conditions look like for the same equation but in two dimension case?
HARRISON WANDERA
le 2 Fév 2021
@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.
Catégories
En savoir plus sur Historical Contests dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!