Lower Dirichlet boundary condition for heat equation PDE

1 次查看(过去 30 天)
Dear community,
I am currently working on modeling a packed bed thermal storage system for a school project. To do this I am solving two PDE's which represent the fluid and solid temperature respectively. The problem I am encountering is that I want to limit the lower temperature to 100 degrees (currently 0 degrees as can be seen in the figure). I've been playing around with the boundary conditions function but I can't get it to work, does anyone have an idea on how to get this done? Any help is much appreciated.
clear all;close all;clc
L = 15;
t_max = 8000;
steps = 1000;
x = linspace(0,L,steps);
t = linspace(0,t_max,steps);
m = 0;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
Ta = sol(:,:,1);
Tb = sol(:,:,2);
figure(1)
plot(x,Ta(:,steps/10),'LineWidth',1.5)
hold on
plot(x,Tb(:,steps/10),'LineWidth',1.5)
plot(x,Ta(:,steps/2),'LineWidth',1.5)
plot(x,Tb(:,steps/2),'LineWidth',1.5)
plot(x,Ta(:,round(steps/1.01)),'LineWidth',1.5)
plot(x,Tb(:,round(steps/1.01)),'LineWidth',1.5)
title('Temperature over length')
xlabel('Tank Length (m)')
ylabel('Temperature (degrees)')
function [c,f,s] = heatpde(x,t,u,dudx)
crho_s = 2.1e6; crho_l = 600; m = 150; cp_s = 920; cp_l = 1046; A = 160; h = 4; e = 0.35; rho_l = 0.61;
c = [1;
1];
f = [0;
0];
s = [-(m/(A*e*crho_l))*dudx(1) - (h*(u(1)-u(2))/(crho_l*e));
(h*(u(1)-u(2)))/(crho_l*e)];
end
function u0 = heatic(x)
u0 = [500;
500];
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = [ul(1);ul(2)];
ql = [0;0];
pr = zeros(2,1);
qr = ones(2,1);
end

采纳的回答

Torsten
Torsten 2023-5-31
编辑:Torsten 2023-5-31
Your equations are not suited to be solved with pdepe.
Both contain no second derivatives in space which is necessary for an equation to be of type parabolic-elliptic (pdepe) - the type of equation that pdepe solves. The first one is a hyperbolic transport equation, the second is a simple ordinary differential equation that has no spatial derivatives at all.
For the first equation, you have to supply one boundary condition at x=0; setting a boundary condition at x=L is wrong for this type of equation. The second equation does not need boundary conditions at all.
If you neverthess want to try to use "pdepe", you will have to change pl. At the moment, your boundary condition setting
pl = [ul(1);ul(2)];
sets both temperatures (especially the inflow temperature of the fluid) to 0.
Further I doubt that the source term for the heat transfered between liquid and solid is
(h*(u(1)-u(2))/(crho_l*e)
for both liquid and solid because of the different heat capacities and densities of the two substances.
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by