program Propagation

integer, parameter::N=500,Nt=100
real, parameter::DX=0.01,DT=0.01
real, dimension(2,0:N+1)::Ua,Un ! (N+1)==> Condition Limite
real ,dimension(2,2)::F
real, dimension(N)::X
real, dimension(Nt)::T

Ua = 0      !Condition limite absorbante
Un = 0      !Condition limite absorbante
v = 0.5       !Vitesse
x0 = N/2*DX
F(1,1) = 0
F(1,2) = -v
F(2,1) = -v
F(2,2) = 0

Do I = 1,N 
  
   X(I) = (I-1)*DX
   Ua(1,I) = exp( - ((X(I)-x0) * (X(I)-x0)) / (v*v))
   Ua(2,I) = Ua(1,I) 

enddo

Un = Ua

Do It = 1,Nt
   
   T(It) = (It-1)*DT
   Do I = 1,N
         
      Un(:,I) = 1.0/2 * (Ua(:,I+1) + Ua(:,I-1)) - Matmul(F,(DT / (2*DX) * (Ua(:,I+1) - Ua(:,I-1)) ))
     
      write(6,*)T(It),X(I),Un(1,I),Un(2,I)
      
   enddo
   
   write(6,*)
   write(6,*)
   
   Ua = Un
  

enddo



endprogram Propagation
