Hello,
I am trying to call a function to my program. The function name is poisson and it has 3 variables. I put together a shorter version of my code(bellow) using the same setup and it still won't work. What am I doing wrong?
Thanks so much!
module f_module
implicit none
contains
function poisson(rho,dx,n_x) result(X)
implicit none
integer :: i
real, intent(in) :: dx,n_x
real, dimension(n_x) , intent(in) :: rho
real, dimension(n_x) :: X
X(1)=-0.5*rho(1)*dx
do i=2,n_x
X(i)=X(i-1)-0.5*(rho(i-1)+rho(i))*dx
end do
end function poisson
end module f_module
program test
implicit none
real :: dx,n_x, pi,L, i, beta
real, dimension(n_x,1) :: rho
real, dimension(1,n_x) :: x,E
pi=3.14
beta=0.01
n_x=20
L=sqrt(3*pi**2/beta)
dx= L/n_x
do i=1,n_x
rho(I,1)=i
end do
E= poisson(rho,dx,n_x)
print*, "The field is", E
end program test