MATLAB: Solving 1D heat equation with constant heat flux (boundary condition)

boundary conditionheat equationheat fluxpdepe

Hello everyone, i am trying to solve the 1-dimensional heat equation under the boundary condition of a constant heat flux (unequal zero). The heat flux is on the left and on the right bound and is representing the heat input into the material through convective heat transfer. I am using pdepe to solve the heat equation and with dirichlet boundary conditions it is working. To represent the heat flux i was thinking of a Neumann boundary condition, but i can't figure out how to contribute the value of the heat flux into the boundary condition. For a heat flux of zero (isolation) the code would look like this (leaving out the declaration of the parameters):
function u0=IC(x)
u0=T_0;
end
function [pl,ql,pr,qr]=BC(xl,ul,xr,ur,t)
ql=1;
pl=0;
qr=1;
pr=0;
end
function [c,f,s]=DGL(x,t,u,DuDx)
c=1;
f=a*DuDx;
s=0;
end
% solution
x=linspace(0,L,10);
t=linspace(0,t_End,10);
sol=pdepe(m,@PDE,@IC,@BC,x,t);
u=sol(:,:,1);
uu=sol(end,:,1);
end
Now the heat flux being unequal zero, my idea was to modify pl and pr in dependence of the heat flux density, but i can't find a connection. Has anyone an idea?
Regards, Malte

Best Answer

What is the boundary condition you are trying to implement ?
lambda*dT/dn = alpha*(T-T_ext) (n: outer normal) ?
Best wishes
Torsten.