pdepe boundary condition help!!
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Boundary Conditions 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!