I'm trying to solve the following 1D PDE of an advection-diffusion equation:
for , and
I used the pdepe function, here's the code:
function c = lfaF2para.Ao = 10^-5; % Ao
para.DA = 10^-6; % D
para.L = 40;para.T = 180;para.dx = 0.1; % x discretization step
para.dt = 0.1; % t discretization step
c.x = 0:para.dx:para.L;c.t = 0:para.dt:para.T;m = 0;fun = @(x,t,u,dudx) lfapde(x,t,u,dudx,para);bc = @(xl,ul,xr,ur,t) lfabc(xl,ul,xr,ur,t,para);c.A = pdepe(m,fun,@lfaic,bc,c.x,c.t);c.surf = surf(c.x,c.t,c.A,'LineStyle','none');title('Flow')xlabel('Distance (mm)')ylabel('Time (s)')bar = colorbar;bar.Label.String = 'Concentration (M)';endfunction [c,f,s] = lfapde(x,t,u,dudx,para)c = 1;f = para.DA*dudx;v = para.L/para.T;s = -v*dudx;endfunction u0 = lfaic(x)u0 = 0;endfunction [pl,ql,pr,qr] = lfabc(xl,ul,xr,ur,t,para)pl = ul-para.Ao;ql = 0;pr = 0;qr = 1;end
The code works fine for or but when and , I get spurious oscillatory behaviors:
This is usually seen when numerically solving advection-diffusion equations when the Peclet number, (advection dominant). I have two questions:
1) Why does affect the stability of the solution when it is not in the Peclet number formula?
2) How can I solve such a problem in Matlab without reducing the distance step size?
Best Answer