function A = diff_advec(N)
% Creates some advection diffusion matrices (2d) and stores A in
% two-dimensional cell of matrices 
% uses finite differences on 2d N x N grid, N number of interior d´grid
% points

x = linspace(0,1,N+2); x = x(2:end-1);
y = x;
[X,Y] = meshgrid(x,y);

a = cell(1,4);
sigma = 100;
% Constant flow in diagonal direction /
a{1} = @(x,y) sigma*[1+0*x;1+0*y];

% Constant flow in y-direction
a{2} = @(x,y) sigma*[0+0*x;1+0*y];

% Constant flow in x-direction
a{3} = @(x,y) sigma*[1+0*x;0+0*y];

% Recirculating flow
a{4} = @(x,y) sigma*[4*x.*(x-1).*(1-2*y);-4*y.*(y-1).*(1-2*x)];


d = cell(1,2);

%unit diffusion coefficient
d{1} = @(x,y) [1+0*x; 1+ 0*y];

%diffusion coefficient increases linearly and diagonally
mu = 50;
d{2} = @(x,y) [1+mu*(x+y); 1+ mu*(x+y)];



K = length(a);
L = length(d);

A = cell(L,K);

for l = 1:2
   for k = 1:4
     A{l}{k} = advecdiff2(N,a{k},d{l});
   end
end
