How to solve coupled partial differential equations with method of lines?
이전 댓글 표시
I am getting problem in solving the partial differential equations used for modelling of packed bed adsorption column. I have attached the equations which I need to solve.
I solved it using method of lines approach with the help of some code which I got on mathworks ask community. But the graph which I am getting is different from which I need to get.
Can anyone help me in solving these equations?
I am also providing the code which I used to solve.
% parameters
eps = 0.41; % bed porosity
volflow = 5e-7; % volumetric flow rate in m3/sec
dia = 0.022; % bed internal dia in m
bedarea = pi*dia^2/4;
u = volflow/bedarea; % superficial velocity in m/s
Dl = 0.08e-4; % axial dipsersion coefficient in m2/sec
rhop = 1228.5; % particle density
Kl = 0.226; % overall mass transfer coeff in sec-1
P = 102000; % total pressure in pascals
R = 8.314; % gas constant in jol/mol-k
T = 500; % gas temp in K
yco2 = 0.2; % co2 mole fraction
cfeed = yco2*P/(R*T); % feed conc in mol/m3
K0 = 4.31e-9; % in pascal-1
delh = -29380; % heat of adsorption in j/mol
Keq = K0*exp(-delh/(R*T)); % equilibrium constant in pascal-1
% using method of lines
tf = 300; % End time
nz = 400; % Number of gateways
np = nz + 1; % Number of gateposts
% Initial Concentrations
C = zeros(np,1);
q = zeros(np,1);
c0 = [C; q];
dt = tf/300;
tspan = 0:dt:tf;
[t, c] = ode15s(@rates, tspan, c0);
% Plot results
plot(t,c(:,np-4)/cfeed),grid
xlabel('time'), ylabel('C/Cfeed')
function dcdt = rates(~,c)
eps = 0.41; % bed porosity
volflow = 5e-7; % volumetric flow rate in m3/sec
dia = 0.022; % bed internal dia in m
bedarea = pi*dia^2/4;
u = volflow/bedarea; % superficial velocity in m/s
Dl = 0.08e-4; % axial dipsersion coefficient in m2/sec
rhop = 1228.5; % particle density
Kl = 0.226; % overall mass transfer coeff in sec-1
P = 102000; % total pressure in pascals
R = 8.314; % gas constant in jol/mol-k
T = 500; % gas temp in K
yco2 = 0.2; % co2 mole fraction
cfeed = yco2*P/(R*T); % feed conc in mol/m3
K0 = 4.31e-9; % in pascal-1
delh = -29380; % heat of adsorption in j/mol
Keq = K0*exp(-delh/(R*T)); % equilibrium constant in pascal-1
qm = 5.09; % max adsrobed conc in mol/kg
n = 0.429; % toth isotherm parameter
L = 0.171;
nz = 400;
np = nz + 1;
dz = L/nz;
C = c(1:np);
q = c(np+1:2*np);
dCdt = zeros(np,1);
dqdt = zeros(np,1);
% boundary condition at z=0
C(1) = (1/(eps*Dl+u*dz))*((eps*Dl*C(2)+u*cfeed*dz));
for i = 2:np-1
dCdt(i) = (Dl/dz^2)*(C(i+1)-2*C(i)+C(i-1)) - (u/(2*eps*dz))*(C(i+1)-C(i-1)) - (((1-eps)*rhop)/eps)*dqdt(i);
dqdt(i) = Kl*((qm*Keq*C(i)*R*T/(1+(Keq*C(i)*R*T)^n)^(1/n)) - q(i));
end
% boundary conditions at z=L
dCdt(np) = dCdt(np-1);
% Combine rates for the function to return to the calling routine
dcdt = [real(dCdt); real(dqdt)];
end
Here I used time interms of seconds. So when I plot the graph the x-axis is also in seconds and my breakthrough time which I am getting is around 35 seconds. But in the experimental values for showed that the breakthrough time for the graph is around 300 minutes.
so please someone help whether there is any mistake which I am doing in my code.
댓글 수: 4
Davide Masiello
2022년 5월 30일
I can see several problems with your code. For instance:
1) you are not actually imposing a boundary condition at z = 0, because what the functions really sees is that dCdt is zero at that point (from the pre-allocation of the dCdt vector). If you need to impose an algebraic boundary condition then your problem becomes a DAE system and you need to specify that to MatLab.
2) Why do you write
dcdt = [real(dCdt); real(dqdt)];
?
There should not be the need to use the real function.
Some help could be devised if you could post the governing equations and b.c.
Ari Dillep Sai
2022년 5월 30일
Davide Masiello
2022년 5월 31일
What are z+ and z- in the flux boundary condition?
Ari Dillep Sai
2022년 5월 31일
채택된 답변
추가 답변 (1개)
The sink term
- (((1-eps)*rhop)/eps)*dqdt(i);
for the concentration of your gaseous species is always 0 because you specify dqdt(i) after dCdt(i) in the for-loop.
Thus the breakthrough is at the time instant
t_break = L/(u/eps)
댓글 수: 4
Ari Dillep Sai
2022년 5월 30일
Ari Dillep Sai
2022년 5월 30일
Ari Dillep Sai
2022년 5월 31일
편집: Ari Dillep Sai
2022년 5월 31일
카테고리
도움말 센터 및 File Exchange에서 Programming에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

