advection.f90 640 Bytes
subroutine advection

use parameters

implicit none

	double precision, allocatable :: beta_1(:),beta_2(:),beta_3(:)


	allocate(beta_1(nfreq))
	allocate(beta_2(nfreq))
	allocate(beta_3(nfreq))

	beta_1=CN/2*(CN+1)
	beta_2=1-CN**2
	beta_3=CN/2*(CN-1)

	
	E(n,1,1:nfreq)=beta_2*E(n-1,1,1:nfreq)+beta_3*E(n-1,2,1:nfreq)

	if (i.le.nbin) then
	E(n,i,1:nfreq)=beta_1*E(n-1,i-1,1:nfreq)+beta_2*E(n-1,i,1:nfreq)+beta_3*E(n-1,i+1,1:nfreq)
	else
		
	E(n,i,1:nfreq)=beta_1*E(n-1,i-1,1:nfreq)!+beta_2*E(n-1,i,1:nfreq)
	end if
	
	
	do j=1,nbin
	do ii=1,nfreq
	if (E(n,j,ii).lt.0) then
		E(n,j,ii)=0
	end if
	end do
	end do
	

end subroutine advection