Partial Differential Equation Solver with Dynamic Boundary conditions
Show older comments
P0 = 101325; % Atmospheric pressure (Pa)
C1 = 10;
C2 = 62.29;
C3 = 62.29;
C4 = 0.557;
C5 = 2391.3;
C6 = 0.609;
omega_i = 0.008; % Inlet humidity ratio (kg/kg dry air)
Tg_i = 303.15; % Inlet air temperature (K)
% Initial conditions
Ts_init = Tg_i;
omega_s_init = 0.008; % solid humidity ratio
omega_o_init = omega_i;
Tg_o_init = Tg_i;
% Sim parameters
N = 180; % Angular resolution
theta = linspace(0, 180, N); % Angular positions in degrees
dt = 1 / (15.5 * 60) / N; % Time step for rotation
tspan = [0, dt * N]; % Simulation time
% ODE system to access constants
function dYdt = desiccant_wheel_ode(t, Y)
% Unpack variables
omega_o = Y(1);
Ts = Y(2);
Tg_o = Y(3);
omega_s = Y(4);
% Saturation pressure and relative humidity
Ps = exp(5294 / Ts - 6); % Saturation pressure (Pa)
phi = (omega_s / 0.622) * P0 / ((0.622 + omega_s) * Ps);
% Empirical functions
s1 = (0.24 / 1.5) * (phi^0.333) * (0.622 * P0) / ((0.622 + omega_s)^2 * Ps);
s2 = (0.24 / 1.5) * (phi^0.333) * (5294 * phi) / (Ts^2);
% Differential equations
d_omega_dt = C1 * (omega_i - omega_o) + C2 * (omega_s - omega_o);
d_Ts_dt = C4 * C5 * (omega_o - omega_s) + C6 * (Tg_o - Ts);
d_Tg_dt = C1 * (Tg_i - Tg_o) + C3 * (Ts - Tg_o);
d_omega_s_dt = (s2 / s1) * d_Ts_dt + (C4 / s1) * (omega_o - omega_s);
% Output derivatives
dYdt = [d_omega_dt; d_Ts_dt; d_Tg_dt; d_omega_s_dt];
end
% ODE ode45
Y0 = [omega_o_init, Ts_init, Tg_o_init, omega_s_init]; % Initial conditions
[t, Y] = ode45(@desiccant_wheel_ode, tspan, Y0);
% Extract results
omega_o = Y(:, 1) * 1000; % Convert to g/kg dry air
Ts = Y(:, 2) - 273.15; % temp to °C
% Plot data
figure;
plot(theta, omega_o, 'k', 'LineWidth', 2);
xlabel('Degree');
ylabel('Humidity [g/kg dry air]');
title('Adsorption-side Outlet Humidity Ratio');
grid on;
28 Comments
Torsten
on 4 Jan 2025
Can you include the mathematical description of your model ? I don't like to extract it from your code and I don't want to join ResearchGate.
Emmanuel
on 4 Jan 2025
Emmanuel
on 4 Jan 2025
Emmanuel
on 4 Jan 2025
As far as I understand the article, the four equations given are representative for a single cell within the entire tube. Thus you will have to repeat the equations n times (with exchange terms between neighbouring cells) to reproduce the PDE model.
The equations given in the article are already a discretized version of the underlying partial differential equations.
Emmanuel
on 5 Jan 2025
I think the main problem are the 4*n equations themselves, not their implementation in MATLAB. Or could you derive the system you have to solve from the article ? I was not even able to understand the underlying physical system. What is the spatial variable in the direction of which the system is discretized ?
Emmanuel
on 5 Jan 2025
Emmanuel
on 5 Jan 2025
Torsten
on 5 Jan 2025
So 180 degrees does not always correspond to axial position L ? Since if rotational speed is higher/lower, angular position of 180 degrees should be reached before/after length L.
Emmanuel
on 5 Jan 2025
Emmanuel
on 5 Jan 2025
Torsten
on 5 Jan 2025
But at L, the air leaves the apparatus - thus rotational speeds that give 180° after L is reached wouldn't make sense. Further, I don't think that graphs for different contact times can be compared.
I'm in doubt that this is really the correct interpretation of the results.
Emmanuel
on 5 Jan 2025
Torsten
on 5 Jan 2025
But then, why simulations are necessary ? If L is given, rotational speed can immediately be adjusted such that at 180°, the outlet L is reached.
Emmanuel
on 5 Jan 2025
Torsten
on 5 Jan 2025
If you neglect the diffusive/conductive terms in Table 1 listed in this document
you get the relevant equations before discretization in axial direction. These are the basis for a solution outside SIMULINK.
Emmanuel
on 5 Jan 2025
Look up "method-of-lines" as a method to solve partial differential equations.
The method aims at replacing the spatial derivative (d/dx) in the equations by finite difference quotients and leaving the temporal derivatives in their continuous form. The resulting system of ordinary differential equations in the grid points can then be solved by ode45, e.g..
In principle, in the original article, this discretization is done. The equations written therein are the equations in a single grid point in x-direction.
I found the new article could clarify many open questions (at least for me) - especially the question of how the apparatus works.
Since the results from the first article are plotted over the angle, I suspect that the spatial coordinate according to which the discretization is done there is the angle theta, not the axial length x. But I'm not going to dive into it more deeply.
Emmanuel
on 7 Jan 2025
Here is a publication where both spatial directions (length and angles) are taken into account.
Emmanuel
on 7 Jan 2025
Torsten
on 7 Jan 2025
Use
% Air equations
dTg_dt = -ua/(rho_g*cp_g) * (T_g(z,t) - T_g(z-1,t))/(dz) + ...
(PHI_T + PHI_TM)/(rho_g*cp_g);
dYg_dt = -ua/rho_g * (Y_g(z,t) - Y_g(z-1,t))/(dz) + ...
PHI_M/rho_g;
instead of
% Air equations
dTg_dt = -ua/(rho_g*cp_g) * (T_g(z+1,t) - T_g(z-1,t))/(2*dz) + ...
(PHI_T + PHI_TM)/(rho_g*cp_g);
dYg_dt = -ua/rho_g * (Y_g(z+1,t) - Y_g(z-1,t))/(2*dz) + ...
PHI_M/rho_g;
and
dt = 0.001; % Time step (s)
instead of
dt = 0.01; % Time step (s)
Emmanuel
on 8 Jan 2025
Emmanuel
on 8 Jan 2025
Answers (0)
Categories
Find more on Programming 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!