function sol = advectionmol(a, nu, n)
%
% Advection-diffusion equation by the method of lines
% u_t = a u_x + nu u_xx
D = gallery('chebspec',n+2);
x = cos( pi*(0:n+1)/(n+1) );
function dy = mol(t,y)
    my = [0; y; 0];
    tmp = -a*D*my + nu*D*D*my;
    dy = tmp(2:end-1);
end
inits = cos(pi*x/2).^2.*exp(-(0.0e-2).*x.^2./(1-x.^2));
% inits = exp(-100*x.^2);
tf = 2.5;
opts = odeset('RelTol',1.0e-3,'AbsTol',1.0e-6);
sol = ode15s( @mol, [0,tf], inits(2:end-1)', opts );
figure(1)
mesh( x, sol.x, [zeros(size(sol.x));sol.y;zeros(size(sol.x))]' ), ...
    view(160,50),colormap([0,0,0]), axis([-1,1,0,tf,0,1]);
set(gca,'fontsize',16);
xlabel('x','fontsize',16);
ylabel('t','fontsize',16);
zlabel('u','fontsize',16);
end

