Lower Dirichlet boundary condition for heat equation PDE
5 次查看（过去 30 天）
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);
title('Temperature over length')
xlabel('Tank Length (m)')
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;
f = [0;
s = [-(m/(A*e*crho_l))*dudx(1) - (h*(u(1)-u(2))/(crho_l*e));
function u0 = heatic(x)
u0 = [500;
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);
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
for both liquid and solid because of the different heat capacities and densities of the two substances.