%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%EQ Chaleur 2-d
%
%ADI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all
global S1 S2 N1 N2 f dt Npdt X Y;

        %Données numériques en temps et en espace

n=50;h=1/(n+1);x=h:h:1-h;y=x;
[X,Y]=meshgrid(x,y);

dt=0.01;Npdt=1000;
        % matrices
        Ax=gallery('tridiag',n)/h^2;
        Id=speye(n,n);
        K1=kron(Id,Ax);
        K2=kron(Ax,Id);
        nt=n*n;
        M1=speye(nt,nt)+0.5*dt*K1;
        M2=speye(nt,nt)+0.5*dt*K2;
        N1=speye(nt,nt)-0.5*dt*K2;
        N2=speye(nt,nt)-0.5*dt*K1;
        
        %factorisation de cholesky
        S1=chol(M1);
        S2=chol(M2);
        %initialisation
        f=ones(n*n,1);
        U=rand(n*n,1);;
        %$$$$$$$$$$$$$$$$$$$$$$$$$$$
        %Resolution par theta-schema
        %$$$$$$$$$$$$$$$$$$$$$$$$$$$
        adi(U,f,n)
        
