Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29280 Discussions

Error: There is no matching specific subroutine for this generic subroutine call

bthekid
Beginner
3,127 Views
Hi, im new in this forum
Just want to help me fix a fortran program compiler error concernin "Error: There is no matching specific subroutine for this generic subroutine call"


My program radiation.f90 USED total_fluxes and spectrum of fluxes.f90

Here his apart of radiation.f90:
--------------------------------------------------------------------------------------------

USE precision
USE rad_field_mod
USE fluxes
! USE total_flux
! USE spectrum

IMPLICIT NONE
PRIVATE
PUBLIC :: radiation
SAVE

INTEGER :: mupts
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:) :: cosines
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:,:,:) :: f
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:,:) :: fb
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:) :: r
.
.
.
.
.
.
.
CALL total_flux(f(:,:,:,1),cosines,waveln(1:nwav,1,1),(180.0-theta_f),&
(180.0), flx)
CALL total_flux(f(:,:,1,:), cosines, waveln(1:nwav,1,1), (180.0-theta_f), &
(180.0), flx)
CALL spectrum(f(:,:,1,:),cosines,(180.-theta_s),180.0,spec)
CALL spectrum(f(:,:,:,1),cosines,(180.-theta_s),180.0,spec)

------------------------------------------------------------------------------
total_flux and spectrum are define in fluxes.f90like dat:


---------------------------------------------------------------
USE precision
USE integrate_mod
IMPLICIT NONE
SAVE
PRIVATE
PUBLIC :: total_flux, spectrum

REAL(KIND=real_opt), PARAMETER :: &
degrees_to_radians=1.745329238474369D-2, &
two_pi=6.283185307179586D0

INTERFACE total_flux
MODULE PROCEDURE total_flux
END INTERFACE

INTERFACE spectrum
MODULE PROCEDURE spectrum
END INTERFACE

CONTAINS
SUBROUTINE total_flux(f, mu, lambda, t1, t2, flux)

REAL(KIND=real_opt), DIMENSION(:,:,:), INTENT(IN) :: f
REAL(KIND=real_opt), DIMENSION(SIZE(f,2)), INTENT(IN) :: mu
REAL(KIND=real_opt), DIMENSION(SIZE(f,1)), INTENT(IN) :: lambda
REAL(KIND=real_opt), INTENT(IN) :: t1, t2
REAL(KIND=real_opt), DIMENSION(SIZE(f,3)), INTENT(OUT) :: flux
INTEGER :: stat

REAL(KIND=real_opt) :: mu1, mu2
REAL(KIND=real_opt), DIMENSION(SIZE(f,2),SIZE(f,3)) :: integrand
INTEGER :: nwav, nmu, nx, i, j

mu1 = COS(degrees_to_radians * t2)
mu2 = COS(degrees_to_radians * t1)

flux = 0.
IF( mu1>=MAXVAL(mu) .OR. mu2<=MINVAL(mu) ) THEN
PRINT '(A)', 'TOTAL_FLUX : Integration limits lie outside the range &
&of ''mu''.'
PRINT '(2(A,F8.4))', &
'mu1 = ', mu1, ' MAXVAL(mu) = ', MAXVAL(mu), &
'mu2 = ', mu2, ' MINVAL(mu) = ', MINVAL(mu)
RETURN
ENDIF

nwav=SIZE(f,1)
nmu=SIZE(f,2)
nx=SIZE(f,3)

! Integrate over the wavelengths
DO i=1, nmu
DO j=1, nx
! integrand(i,j) = integrate(f(:,i,j),lambda,lambda(1),lambda(nwav))
integrand(i,j) = trapezium(f(:,i,j),lambda,lambda(1),lambda(nwav),stat)
ENDDO
ENDDO

! Integrate over z-direction cosines
DO i=1, nx
! Need to multiply the integrand by mu to account for the fact that
! photons incident at a larger angle are spread over a larger area
!flux(i) = integrate(integrand(:,i) * ABS(mu),mu,mu1,mu2)
flux(i) = trapezium(integrand(:,i) * ABS(mu),mu,mu1,mu2,stat)
ENDDO

! Integrate over the azimuthal angle
flux = two_pi * flux

END SUBROUTINE total_flux

SUBROUTINE spectrum(f, mu, t1, t2, spec)
IMPLICIT NONE

REAL(KIND=real_opt), DIMENSION(:,:,:), INTENT(IN) :: f
REAL(KIND=real_opt), DIMENSION(SIZE(f,2)), INTENT(IN) :: mu
REAL(KIND=real_opt), INTENT(IN) :: t1, t2
REAL(KIND=real_opt), DIMENSION(SIZE(f,1),SIZE(f,3)) :: spec
INTEGER :: stat

INTEGER :: nwav, nx, i, j
REAL(KIND=real_opt) :: mu1, mu2

nwav = SIZE(f,1)
nx = SIZE(f,3)

mu1 = COS(degrees_to_radians * t2)
mu2 = COS(degrees_to_radians * t1)

! Integrate over the z-direction cosines
DO i=1, nwav
DO j=1, nx
! Need to multiply the integrand by mu to account for the fact that
! photons incident at a larger angle are spread over a larger area
!spec(i,j) = integrate(f(i,:,j) * ABS(mu),mu,mu1,mu2)
spec(i,j) = trapezium(f(i,:,j) * ABS(mu),mu,mu1,mu2,stat)
ENDDO
ENDDO

! Integrate over the azimuthal angle
spec = two_pi * spec

END SUBROUTINE spectrum

!===============================================================================
!===============================================================================

END MODULE fluxes


---------------------------


and the compilator result is:



Compiling Fortran...
D:\EBF\Progammes\Parade\v2.2.1\radiation.f90
D:\EBF\Progammes\Parade\v2.2.1\radiation.f90(270) : Error: There is no matching specific subroutine for this generic subroutine call. [TOTAL_FLUX]
CALL total_flux(f(:,:,1,:), cosines, waveln(1:nwav,1,1), (180.0-theta_f), &
-----^
D:\EBF\Progammes\Parade\v2.2.1\radiation.f90(282) : Error: There is no matching specific subroutine for this generic subroutine call. [TOTAL_FLUX]
CALL total_flux(f(:,:,:,1),cosines,waveln(1:nwav,1,1),(180.0-theta_f),&
---------------------^
D:\EBF\Progammes\Parade\v2.2.1\radiation.f90(337) : Error: There is no matching specific subroutine for this generic subroutine call. [SPECTRUM]
CALL spectrum(f(:,:,1,:),cosines,(180.-theta_s),180.0,spec)
---------------^
D:\EBF\Progammes\Parade\v2.2.1\radiation.f90(352) : Error: There is no matching specific subroutine for this generic subroutine call. [SPECTRUM]
CALL spectrum(f(:,:,:,1),cosines,(180.-theta_s),180.0,spec)
0 Kudos
10 Replies
jimdempseyatthecove
Honored Contributor III
3,127 Views

In module fluxes try removing

INTERFACE total_flux
MODULE PROCEDURE total_flux
END INTERFACE

INTERFACE spectrum
MODULE PROCEDURE spectrum
END INTERFACE

Those two subroutines are declared in the CONTAINS section of module fluxes so their interfaces will be known to those that USE FLUXES (without explicitly declaring an INTERFACE).

The source to the problem is you have the same name for the interface as you have for the subroutine. When you have only one subroutine for an interface leave the interface name blank (or mark it up with some text)

INTERFACE
MODULE PROCEDURE total_flux
END INTERFACE

INTERFACE
MODULE PROCEDURE spectrum
END INTERFACE

or

INTERFACE total_flux_interface
MODULE PROCEDURE total_flux
END INTERFACE

INTERFACE spectrum_interface
MODULE PROCEDURE spectrum
END INTERFACE

When using generic interfaces you provide a single generic name on (after)the INTERFACE then you can declare multiple subroutines with different names that are typically not directly accessed. The signature of the arguments are used to select which enclosed subroutine (or function) declarations match.

interface mySum
subroutine mySum_float(S,A,B)
real(4) :: S,A,B
end subroutine mySum_float
subroutine mySum_double(S,A,B)
real(8) :: S,A,B
end subroutine mySum_double
end interface mySum


Now later in your code you can call the same interface name "mySum" and the types and numbers ofarguments you specify select "mySum_float", "mySum_double", or error out with "no matching specific subroutine for this specific generic interface".

Jim Dempsey

Jim Dempsey
0 Kudos
Steven_L_Intel1
Employee
3,127 Views

It is perfectly legal and fine for the generic name and a specific name to be the same. The real problem here is that the ranks of the arguments don't match. For example, in the calls to total_flux, the first argument, f, is rank 4, but the corresponding dummy argument in total_flux, f, is rank 3. The second argument also has mismatched ranks. Solve the rank mismatch and the issues will probably go away.

When you call a generic, there has to be one and only one specific procedure which matches the supplied arguments in type, kind and rank.
0 Kudos
bthekid
Beginner
3,127 Views

It is perfectly legal and fine for the generic name and a specific name to be the same. The real problem here is that the ranks of the arguments don't match. For example, in the calls to total_flux, the first argument, f, is rank 4, but the corresponding dummy argument in total_flux, f, is rank 3. The second argument also has mismatched ranks. Solve the rank mismatch and the issues will probably go away.

When you call a generic, there has to be one and only one specific procedure which matches the supplied arguments in type, kind and rank.

Thanks for your response. But there is no arg problem because there are to f function.. one defined in fluxes with 3 arg and other in radiation.f90 with 4 arg.

For jimmy's suggestion, i tried it but no change.

0 Kudos
Steven_L_Intel1
Employee
3,127 Views

I see only one total_flux function. Are you saying there's another declaration of the generic in a module you didn't show?
0 Kudos
bthekid
Beginner
3,127 Views

I see only one total_flux function. Are you saying there's another declaration of the generic in a module you didn't show?

REAL(KIND=real_opt), DIMENSION(:,:,:), INTENT(IN) :: f
REAL(KIND=real_opt), DIMENSION(SIZE(f,2)), INTENT(IN) :: mu
REAL(KIND=real_opt), DIMENSION(SIZE(f,1)), INTENT(IN) :: lambda
REAL(KIND=real_opt), INTENT(IN) :: t1, t2
REAL(KIND=real_opt), DIMENSION(SIZE(f,3)), INTENT(OUT) :: flux

in fluxes.f90

and


INTEGER :: statINTEGER :: mupts
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:) :: cosines
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:,:,:) :: f
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:,:) :: fb
REAL(KIND=real_opt), ALLOCATABLE, DIMENSION(:,:) :: r

in radiation.f90...


Im not the author of this program so i dont know why there is to different functions...

Anyway , i've tried to replace the f-function by another (waveln(:,:,:) for exapmle)... same errors
0 Kudos
Steven_L_Intel1
Employee
3,127 Views

In radiation.f90 you are declaring variables. In flux.f90, you are declaring procedure dummy arguments. From what you have posted, there is only one actual procedure total_flux, which is the only possible resolution of a call to the generic total_flux. The actual procedure declares the first argument as an array of three dimensions, but you're trying to pass it an array of four dimensions. This is not allowed.

I don't know why you refer to "f-function". There is no function f in this code. f is an array in radiation.f90.

I can't advise you on what to change here, as I don't know your application. You must, however, ensure that the arguments in a call match the called routine arguments in type, kind and rank.
0 Kudos
bthekid
Beginner
3,127 Views

In radiation.f90 you are declaring variables. In flux.f90, you are declaring procedure dummy arguments. From what you have posted, there is only one actual procedure total_flux, which is the only possible resolution of a call to the generic total_flux. The actual procedure declares the first argument as an array of three dimensions, but you're trying to pass it an array of four dimensions. This is not allowed.

I don't know why you refer to "f-function". There is no function f in this code. f is an array in radiation.f90.

I can't advise you on what to change here, as I don't know your application. You must, however, ensure that the arguments in a call match the called routine arguments in type, kind and rank.
Thank you Steve,
i understand now ( the difference between declaring variables and procedure; im a fortran novice)
Im not the author of this program, so i dont understand all procedures... i just try to make an executable (radiation.exe)
I've allready tried to pass it an array of three arguments..

0 Kudos
Steven_L_Intel1
Employee
3,127 Views
I suggest that you contact the code's author and ask for assistance. To correctly solve the problem requires much more context than what you have shown here. If the program is not terribly large, perhaps you can create a ZIP of the project and sources and attach it to a reply here.
0 Kudos
bthekid
Beginner
3,127 Views
I suggest that you contact the code's author and ask for assistance. To correctly solve the problem requires much more context than what you have shown here. If the program is not terribly large, perhaps you can create a ZIP of the project and sources and attach it to a reply here.

I tried to contact teh author but i think he still not work on the project.
I sent you a zip of the folder containing the fortran files, if you can help me

Thank you again
0 Kudos
Steven_L_Intel1
Employee
3,127 Views
I have not received anything from you. You can use the instructions in the link below to attach a ZIP file.
0 Kudos
Reply