PDEPE solver failure (spatial discretization) ; partial differential/derivative temperature modelling
1 view (last 30 days)
Show older comments
Attempting to model temperature profile of an adsorption column based on concentration profile since this determines the heat of adsorption.
This is the function:
function[c,f,s] = pdefunEB(x,t,u,dudx)
global qmax_phenol K_L_phenol kf De u_s Rep Dp epsilon rho_liq cp_AC cp_feed H_ads h alpha
C = u(1) ;
q = u(2) ;
Tf = u(3) ;
dCdx = dudx(1) ;
dqdx = dudx(2) ;
dTdx = dudx(3) ;
Ts = 298.15 ; % adsorbent temp Kelvin
qstar = ((qmax_phenol)*(K_L_phenol)*C)/(1+(K_L_phenol)*C) ;
dqdt = kf*(qstar-q) ;
c = ones(3,1) ;
f = [De*dCdx;
0;
0];
s = [-u_s*dCdx-(1-epsilon)/epsilon*rho_liq*dqdt;
dqdt;
-u_s*dTdx+(((h*alpha*(Tf-Ts)-(H_ads/cp_AC))+(H_ads/cp_feed))*(dqdt*((1-epsilon)/epsilon)))] ;
end
%% initial condition
function u0 = icfunEB(x)
u0 = [0;
0;
298.15] ;
end
%% boundary condition
function [p1,q1,pr,qr] = bcfunEB(x1,u1,xr,ur,t)
global C_phenol
C0 = C_phenol ;
p1 = [u1(1)-C0;0;-298.15] ;
q1 = [0;1;0] ;
pr = [0;0;0] ;
qr = [1;1;1] ;
end
this is where the error appears (Error using pdepe Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative)
mEB = 0 ;
sol1 = pdepe(mEB,@pdefunEB,@icfunEB,@bcfunEB,x,t) ;
CEB = sol1(:,:,1) ;
qEB = sol1(:,:,2) ;
TEB = sol1(:,:,3) ;
figure(2)
T0 = 298.15 ;
Cp1 = C1(:,end)./C01 ;
plot(t,TEB,'b-','LineWidth',2)
grid on
title('Column Temperature')
xlabel('time in minutes')
ylabel('temp in kelvin')
Heres a picture of my mathematical working before input into matlab:
0 Comments
Accepted Answer
Torsten
on 20 Apr 2024
Edited: Torsten
on 20 Apr 2024
Please include the constants defined as globals so that we can test your code.
One obvious error is the boundary condition for T in the left boundary point. Use
p1 = [u1(1)-C0;0;u1(3)-298.15] ;
instead of
p1 = [u1(1)-C0;0;-298.15] ;
Another problem can be that f = 0 for equations (2) and (3). "pdepe" - as the name indicates - is designed for parabolic-elliptic partial differential equations (thus for equations with second-order spatial derivatives present). Your second equation is a simple ODE, your third equation is hyperbolic in nature.
4 Comments
Torsten
on 20 Apr 2024
Edited: Torsten
on 20 Apr 2024
As you can see above, the temperature explodes at the right endpoint (see above). Check the possible reasons (especially your sourceterm -u_s*dTdx+(((h*alpha*(Tf-Ts)-(H_ads/cp_AC))+(H_ads/cp_feed))*(dqdt*((1-epsilon)/epsilon))) )
h*alpha = 1.5e9 !!!
More Answers (0)
See Also
Categories
Find more on Oil, Gas & Petrochemical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!