Filter löschen
Filter löschen

1D advection diffusion with pdepe

4 Ansichten (letzte 30 Tage)
Kevin
Kevin am 17 Mai 2024
Kommentiert: Kevin am 17 Mai 2024
Hello guys, i want to solve the 1D advection diffusion PDE in dimensionless form. The equation is the following:
​dC/dW=(1/Pe)*d^2C/dX^2-dC/dX
I want to simlulate the dimensionless concentration for an finite element in x-Direction. Because the variables are dimensionless, my inital condition is C=1 for all X at W=0. Then, for W>0, the concentration must decrease, because of an Flow with an liquid with a concentration of zero. I want to plot the dimensinlos concentration C vs. W and X.
I think, my mistake are the boundary conditions, but I can´t find the solution.
I would be happy about a solution, to solve my problem.
This is my code so far:
function [c, f, s] = pdefun(X, W, C, dCdX)
Pe = 10;
c = 1;
f = (1/Pe)*dCdX;
s = -dCdX;
end
function C0 = ic(X)
C0 = 1;
end
function [pl, ql, pr, qr] = bc(Xl, Cl, Xr, Cr, W)
Pe=10;
pl =Cl;
ql = -1/Pe;
pr = Cr-1;
qr = 0;
end
X = linspace(0, 1, 10);
W = linspace(0, 10, 100);
m = 0;
sol = pdepe(m, @pdefun, @ic, @bc, X, W);
u = sol(:,:,1);
surf(X,W,u)
xlabel('X')
ylabel('W')
zlabel('u(W,X)')
view([150 25])

Akzeptierte Antwort

Torsten
Torsten am 17 Mai 2024
You mean something like this ?
X = linspace(0, 1, 100);
W = linspace(0, 2, 30);
m = 0;
sol = pdepe(m, @pdefun, @ic, @bc, X, W);
u = sol(:,:,1);
plot(X,u(1:20,:))
function [c, f, s] = pdefun(X, W, C, dCdX)
Pe = 10;
c = 1;
f = (1/Pe)*dCdX;
s = -dCdX;
end
function C0 = ic(X)
C0 = 1;
end
function [pl, ql, pr, qr] = bc(Xl, Cl, Xr, Cr, W)
pl = -Cl;
ql = 1; % Sets 1/Pe*dC/dx = C
pr = 0;
qr = 1; % Sets dC/dx = 0
end
  1 Kommentar
Kevin
Kevin am 17 Mai 2024
Hi, thank you very much Torsten. The trend of the curves are very good, also for higher Peclét-Numbers, so that the concentration profile is typical for a plug flow. I had chosen the wrong boundary conditions :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by