フィルターのクリア

1D advection diffusion with pdepe

7 ビュー (過去 30 日間)
Kevin
Kevin 2024 年 5 月 17 日
コメント済み: Kevin 2024 年 5 月 17 日
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])

採用された回答

Torsten
Torsten 2024 年 5 月 17 日
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 件のコメント
Kevin
Kevin 2024 年 5 月 17 日
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 :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics and Optimization についてさらに検索

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by