How to set a time-dependent variable in PDE system equation?
2 次查看(过去 30 天)
显示 更早的评论
I am working with heat exchange problems. I have cermic exchanger with slots for air inlet (ceramic is being heated from warmer inside air) and after period of time the direction is changing and air from the outside remove heat from the ceramic. I am modelling one tiny slot heating (square, 3mmx3mm). I have one PDE equation for solid (here: ceramic, Ts is a modeled temperature):
ro*cp*(dTs/dt)-k*((d^2Ts)/dx^2)=h*(Tg-Ts)
And other equation for the air heating (Tg is an air temperature, modeled now):
ro*cp*(dTg/dt)+u*ro*cp*(dTg/dx)=h*(Ts-Tg)
Annotations:
t - time;
x - length,m;
ro - density, kg/m^3;
cp - specific heat,J/(kgK);
h - convection coefficient,W/(m^2K);
k - thermal conductivity of copper, W/(mK);
u - fluid velocity, m/s;
My current Matlab code is:
function pdex2
m = 1;
x = linspace(0,0.002,20);
t = linspace(0,140,10);
sol = pdepe(m,@pdex2pde,@pdex2ic,@pdex2bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure
surf(x,t,u1)
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
figure
surf(x,t,u2)
title('u2(x,t)')
xlabel('Distance x')
ylabel('Time t')
% --------------------------------------------------------------
function [c,f,s] = pdex2pde(x,t,u,DuDx)
c = [980.8; 1.2110e+03];
f = [3; 0] .*DuDx;
y = u(1) - u(2);
F = 32*y;
s = [-F; -0.31*1.2110e+03*DuDx(2)+F];
% --------------------------------------------------------------
function u0 = pdex2ic(x);
u0 = [10; 20];
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex2bc(xl,ul,xr,ur,t)
pl = [1; 1];
ql = [1; 1];
pr = [(32/3)*(ur(1)-ur(2)); ?];
qr = [1; 1];
I want to insert real value of air temperature from my measurements. I have error with typing it like in that example: https://au.mathworks.com/matlabcentral/answers/124817-how-to-implement-irregular-time-dependent-boundary-condition-in-pdepe-function
Should I put the temperature vector as a boundary condition? I stuck with that problem and do not know how to go further.
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!