pdepe boundary condition help!!

조회 수: 3 (최근 30일)
KANCHETI
KANCHETI 2025년 3월 10일
댓글: KANCHETI 2025년 3월 11일
H0 = 1;
% Spatial and time mesh
y = linspace(0, H0, 20);
t = linspace(0, 1, 200);
% Solve the PDE
sol = pdepe(0, @pdefun, @icfun, @bcfun, y, t);
% Extract the solution
lambda = sol(:,:,1).';
function [c, f, s] = pdefun(y, t, lambda, DlambdaDx)
nu = 1.7e-28;
X = 0.1;
G0 =1e7;
kB = 1.3806488e-23;
theta = 298;
m_d = 0.5/(kB*nu*theta);
% Define the PDE coefficients
c = 1 / nu;
f = m_d/lambda * (G0*nu*(1+1/lambda^2))*DlambdaDx + kB*theta*(1/(lambda*(lambda-0.99))-1/lambda^2-2*X/lambda^3)*DlambdaDx;
s = 0;
end
function lambda0 = icfun(y)
% Initial condition
if y < 1 %H0
lambda0 = 1;
else
lambda0 = 1.498;
end
end
function [pl, ql, pr, qr] = bcfun(yl, lambda_l, yr, lambda_r, t)
% Boundary conditions
pl = 0;
ql = 1;
pr = lambda_r-1.498 ;
qr = 0;
end
I am trying to solve this problem and confused about the boundary condition where dLambda/dX = 0 at x = 0. I am not getting the results. Can someone explain how to apply initial and boundary condtions? Thank you very much.

채택된 답변

Torsten
Torsten 2025년 3월 10일
편집: Torsten 2025년 3월 10일
Note that the f you define in "pdefun" doesn't fit the formula from the paper. You forgot to multiply both terms with m_d/lambda, not only the first term.
H0 = 1;
% Spatial and time mesh
y = linspace(0, H0, 40);
t = linspace(0, 1, 20);
% Solve the PDE
sol = pdepe(0, @pdefun, @icfun, @bcfun, y, t);
% Extract the solution
lambda = sol(:,:,1);
plot(y,[lambda(1,:);lambda(5,:);lambda(10,:);lambda(15,:);lambda(end,:)])
function [c, f, s] = pdefun(y, t, lambda, DlambdaDx)
nu = 1.7e-28;
X = 0.1;
G0 =1e7;
kB = 1.3806488e-23;
theta = 298;
m_d = 0.5/(kB*nu*theta);
% Define the PDE coefficients
c = 1 / nu;
f = m_d/lambda * (G0*nu*(1+1/lambda^2) + kB*theta*(1/(lambda*(lambda-0.99))-1/lambda^2-2*X/lambda^3))*DlambdaDx;
s = 0;
end
function lambda0 = icfun(y)
% Initial condition
if y < 1 %H0
lambda0 = 1;
else
lambda0 = 1.498;
end
end
function [pl, ql, pr, qr] = bcfun(yl, lambda_l, yr, lambda_r, t)
% Boundary conditions
pl = 0;
ql = 1;
pr = lambda_r-1.498 ;
qr = 0;
end
  댓글 수: 3
Torsten
Torsten 2025년 3월 11일
편집: Torsten 2025년 3월 11일
Also could you tell me how can i calculate μ from equation 44 for every value of λ.
μ = nu*(G0*λ-G0/λ+ kB*theta/nu*(log(1-1/λ)+1/λ+X/λ^2))
Also if λ = 1, i need to replace log(1-1/λ) by log(1-0.999/λ)
I don't know about the physical background of your problem. So I can't give advice how the case λ = 1 is to be handled in the equations.
KANCHETI
KANCHETI 2025년 3월 11일
Thank you for your time.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by