1D Heat equation in Matlab with heat Flux at one side

7 ビュー (過去 30 日間)
Steffen B.
Steffen B. 2022 年 6 月 20 日
編集済み: Torsten 2022 年 6 月 21 日
I’m solving the 1D heat equation with Matlab pdepe function.
The geometry is a steel rod of 1m length, which has a constant temperature on the right side and a constant flux on the other side.
I’m struggeling a little bit with specifying the value of p and q.
Here is the code I use:
function [c,f,s] = heatequation(x,t,u,dudx)
rho=7850; % density
cp=420; % heat capacity
lambda=40;% conductivity
c = rho*cp;
f = lambda*dudx;
s = 0;
end
function u0 = ic(x)
Tini=300; % initial temperature at t= 0 s
u0 = Tini;
end
function [pl,ql,pr,qr] = bc(xl,ul,xr,ur,t)
pl = 0;
ql = 10; % Flux at the left end = 10 W/m2
pr = ur-300; % Temperature at the rigth end = 300 K
qr = 0
end
m = 0;
sol = pdepe(m,@heatequation,@ic,@bc,x,t);
I'm not sure if I wrote the BC's correct? The notation with p and q is still confusing
  3 件のコメント
Torsten
Torsten 2022 年 6 月 20 日
編集済み: Torsten 2022 年 6 月 21 日
If your boundary condition at the left end is
-lambda*dT/dx = 10
, then
pl = 10, ql = 1
Steffen B.
Steffen B. 2022 年 6 月 20 日
編集済み: Steffen B. 2022 年 6 月 20 日
@Torsten thanks for your fast answer. You are rigth, I mixed someting up in the BC function. Now it's working just fine
function [pl,ql,pr,qr] = bc(xl,ul,xr,ur,t)
pl = 10; % Flux at the left end = 10 W/m2
ql = 1;
pr = ur-300; % Temperature at the rigth end = 300 K
qr = 0
end

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeRobotics についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by