Foam drainage problem using pdepe

2 views (last 30 days)
Elena Amy
Elena Amy on 11 Dec 2023
Answered: SOUMNATH PAUL on 22 Dec 2023
The foam drainage equation ๐œ•๐œ™๐‘™ ๐œ•๐‘ก = โˆ’ ๐œ• ๐œ•๐‘ง ๐‘˜1๐‘… 2 ๐œ‚ ๐œŒ๐‘”๐œ™๐‘™ 2 โˆ’ ๐‘˜2 ๐›พ 2๐‘… ๐œ™๐‘™ 0.5 ๐œ• ๐œ•๐‘ง ๐œ™๐‘™ describes the spatio-temporal evolution of liquid in a foam due to gravitation and capillary forces. Herein, ๐œ™๐‘™(๐‘ฅ,๐‘ก) is the local liquid content, ๐‘ก is time, ๐‘ง is the spatial coordinate in the direction of the gravitational acceleration ๐‘”, ๐œ‚ is the dynamic liquid viscosity, ๐›พ is the interfacial tension, ๐œŒ is the liquid density and ๐‘˜1 = 0.0066, ๐‘˜2 = 0.1610.5 are constants. In this task, the effect of bubble size ๐‘… on the drainage of liquid out of the foam shall be studied. You can assume the following conditions: โ€ข The height ๐ป of the foam is constant โ€ข The bubble size of constant in the whole foam โ€ข At the foamโ€™s bottom edge (๐‘ง = ๐ป), the liquid fraction is constant ๐œ™๐‘™ ๐‘ก, ๐ป = 0.36 โ€ข At the foamโ€™s top edge (๐‘ง = 0), the liquid flux is zero โ€ข At ๐‘ก = 0, assume ๐œ™๐‘™(0, ๐‘ง) = 0.36 Multiscale Process Modelling and Process Analysis 2 ๐‘ง = 0 ๐‘ง = ๐ป ๐‘” Deliverable Task 02โ€”Foam drainage โ€ข Implement the foam drainage equation in MATLAB using the pdepe command with the respective initial and boundary conditions. Use the following parameter values โ€“ ๐œ‚ = 0.001 ๐‘ƒ๐‘Ž โ‹… ๐‘ , ๐›พ = 0.04 ๐‘/๐‘š, ๐œŒ = 1000 ๐‘˜๐‘”/๐‘š3 , ๐‘” = 9.81 ๐‘š ๐‘  2 โ€“ ๐ป = 0.1 ๐‘š, ฮ”โ„Ž = 0.0001 ๐‘š, ฮ”๐‘ก = 0.01 ๐‘ , ๐‘‡ = 100 ๐‘  โ€ข Solve the model for ๐‘… = 0.0005 ๐‘š, ๐‘… = 0.001 ๐‘š, ๐‘… = 0.005 ๐‘š and generate a chart for each solution showing the spatial profile of the liquid fraction at times between ๐‘ก = 0 and ๐‘ก = ๐‘‡ in steps of ฮ”๐œ = 0.05๐‘‡ โ€ข Compute the cumulated liquid flux out of the foam and compare the time-evolution with respect for each bubble size. โ€“ Use the fact that the drained liquid ๐‘‰๐‘™,๐ท can be computed at any time as the difference of the liquid being initially present in the foam and the liquid in the foam at time ๐‘ก, thus, ๐‘‰๐‘™,๐ท(๐‘ก) = ๐‘‰๐‘™,๐น ๐‘ก0 โˆ’ ๐‘‰๐‘™,๐น(๐‘ก) โ€“ Use the relation ๐‘‰๐‘™,๐น = ๐ด๐ป (integral lower border z=0 upper border z=H) ๐œ™๐ฟ ๐‘‘๐‘ง, where ๐ด๐น is the foamโ€™s cross-section. The trapz command can be used to calculate the integral (compare to add-on of exercise 6). Assume ๐ด๐น = 0.002 m2

Answers (1)

SOUMNATH PAUL
SOUMNATH PAUL on 22 Dec 2023
To my understanding of this problem, we need to define the partial differential equation, set the initial and the boundary conditions. In the second step I have solved the equation for the specified bubble sizes and plotted the spatial profile of the liquid fraction over time. Finally, I have computed the cumulated liquid flux out of the foam.
function foam_drainage
% Given parameters
eta = 0.001; % Pa.s
gamma_tension = 0.04; % N/m
rho = 1000; % kg/m^3
g = 9.81; % m/s^2
H = 0.1; % m
A_f = 0.002; % m^2 (cross-section of the foam)
k1 = 0.0066;
k2 = 0.161^0.5;
% Discretization parameters
dz = 0.0001; % m
dt = 0.01; % s
T = 100; % s
dTau = 0.05 * T; % s
% Bubble sizes to study
R_values = [0.0005, 0.001, 0.005]; % m
% Spatial mesh
zmesh = 0:dz:H;
% Time vector
tspan = 0:dt:T;
% Loop over the bubble sizes
for R = R_values
% Solve PDE
sol = pdepe(0, @(z,t,u,dudz) pdefun(z,t,u,dudz,k1,k2,R,eta,rho,g,gamma_tension), ...
@icfun, ...
@bcfun, ...
zmesh, tspan);
% Extract the solution for phi_l
phi_l = sol(:,:,1);
% Plot the spatial profile of the liquid fraction at specified times
figure;
hold on;
for t = 0:dTau:T
[~, tIdx] = min(abs(tspan - t)); % Find the closest time index
plot(zmesh, phi_l(tIdx,:), 'DisplayName', sprintf('t = %.2f s', t));
end
hold off;
title(sprintf('Spatial profile of liquid fraction over time (R = %.4f m)', R));
xlabel('Height z (m)');
ylabel('Liquid fraction \phi_l');
legend('show');
% Compute the cumulated liquid flux out of the foam
V_l_F_initial = A_f * H * trapz(zmesh, phi_l(1,:)); % Initial liquid volume in the foam
V_l_F = A_f * H * trapz(zmesh, phi_l, 2); % Liquid volume in the foam over time
V_l_D = V_l_F_initial - V_l_F; % Drained liquid volume over time
% Plot the time-evolution of the cumulated liquid flux for each bubble size
figure;
plot(tspan, V_l_D, 'DisplayName', sprintf('R = %.4f m', R));
title('Cumulated liquid flux out of the foam over time');
xlabel('Time t (s)');
ylabel('Drained liquid volume V_l_D (m^3)');
legend('show');
end
end
% Define the PDE function
function [c,f,s] = pdefun(z,t,u,dudz,k1,k2,R,eta,rho,g,gamma_tension)
c = 1;
f = -k1*R^2/(eta*rho*g) * u^2 - k2*gamma_tension^2/(2*R) * sqrt(u) * dudz;
s = 0;
end
% Define the initial condition function
function u0 = icfun(z)
u0 = 0.36; % Initial liquid fraction
end
% Define the boundary condition function
function [pl,ql,pr,qr] = bcfun(zl,ul,zr,ur,t)
pl = ul - 0.36; % At the bottom edge (z = H), the liquid fraction is constant
ql = 0;
pr = 0; % At the top edge (z = 0), the liquid flux is zero
qr = 1;
end
You can also see the examples section in below link for further reference:
Hope it helps!
Regards,
Soumnath

Categories

Find more on Fluid Dynamics 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!