Lower Dirichlet boundary condition for heat equation PDE
8 次查看(过去 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
0 个评论
采纳的回答
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 个评论
Torsten
2023-5-31
Is it even possible then to set a lower temperature limit with the PDE solver?
You can't set limits on the solution from pdepe. The solution results from the equation, the initial and the boundary conditions- no way to influence it.
Furthermore I was under the impression that the following line:
pl = [ul(1);ul(2)];
Sets the temperatures of both the fluid and solid at x=0 to 500 degrees, as defined in:
function u0 = heatic(x)
u0 = [500;
500];
end
Am I wrong in this as you said: ''this boundary condition setting sets both temperatures (especially the inflow temperature of the fluid) to 0.''?
The boundary values for u(1) and u(2) at x=0 result from pl(1)+ql(1)*f(1) = 0, pl(2)+ql(2)*f(2) = 0. If you set pl(1) = ul(1), pl(2) = ul(2), ql(1) = 0 and ql(2) = 0, you set ul(1) + 0*f(1) = ul(1) = 0, ul(2) + 0*f(2) = ul(2) = 0, thus both temperatures to 0.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!