Hi I have tried to create a minimal, complete, and verifiable example sample code below to emphasize the one error message I am getting. The error is "Type Mismatch in argument 'func0' at (1); passed REAL(4) to COMPLEX(4).
I indicated in the code where the error message from (1) is. It occurs when I try to call a subroutine within another subroutine.
I originally tried to add implicit none into Sub2, however then I get an error message saying func0,func1 do not have implicit types.
I tried to follow the logic of this post : How to call and use a subroutine inside another subroutine in fortran?
Module Sample
integer :: n,m
contains
subroutine Sub1(func0,func1)
implicit none
complex, dimension(-10:10, -10:10), intent(inout) :: func0,func1
complex, dimension(-10:10, -10:10) :: Deriv0,Deriv1
do while (100 > 0.000001)
Deriv0 = Deriv(func0)
Deriv1 = Deriv(func1)
end do
end subroutine Sub1
subroutine Sub2(func3)
!implicit none : if this line is not commented out, I still get error messages saying func0,func1 do not have implicit types
real,dimension(0:20), intent(inout) :: Func3
call Sub1(func0,func1) !error message from here, this is line (1)
end subroutine Sub2
function Deriv(func)
implicit none
complex, dimension(-10:10, -10:10) :: func, Deriv
do n=-9,9
do m=-9,9
Deriv(n,m) = func(n+1,m)-2*func(n,m)
end do
end do
end function Deriv
End Module Sample
How can I fix this error? Thanks.