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

Getting this error while rebuilding my code in IVFC 19.0

Sharma__Tushar
Beginner
464 Views
subroutine calculateHeatTransCoefPipeOut(tFilm,tInf,tWall,lenght,hOut)
    
        use spfGlobalConst
        implicit none
        
        double precision, intent(in)  :: lenght,tFilm,tInf,tWall
        double precision, intent(out) :: hOut
        double precision :: cp_f, k_f, rho_f, nu_f, beta_f, Pr_f, alpha_f, Ra, Nu_o,&
		    
        myTFilm = max(tFilm,0.1)    -------> Error line 
        
        cp_f    = getCpWater(myTFilm)            ! : specific heat
        k_f     = getLambdaWater(myTFilm)        ! : conductivity
        rho_f   = getRhoWater(myTFilm)           ! : density
        nu_f    = getNuWater(myTFilm)            ! : kinematic viscosity
        beta_f  = getBetaWater(myTFilm)          ! : volumetric expansion coeff.
        Pr_f    = getPrandtlWater(myTFilm)       ! : Prandtl number
        alpha_f = k_f / (rho_f * cp_f)         ! : thermal diffusivity
        
        Ra = g * beta_f * abs(tWall - tInf) *  lenght**3 / (nu_f * alpha_f)
        

Getting the following errors when compiling 

error #6592: This symbol must be a defined parameter, an enumerator, or an argument of an inquiry function that evaluates to a compile-time constant.   [TFILM]

 error #6973: This is not a valid initialization expression.   [MAX]

I'm totally new to Fortran F90 so it's taking me longer to understand Syntax errors. However, I would also like to give some additional info about the method I used till now. I have a code written in F90 but was initially compiled using some older Intel Fortran compiler unknown to me. Currently, I'm using Intel Fortran compiler 19 using Visual studio 2017 as IDE. Is it possible that there is some version mismatch which the compiler doesn't understand? Also, what I want to finally accomplish is the generation of a .dll file which is needed for further use. Kindly help me out. 

Thanks 

Tushar 

 

0 Kudos
2 Replies
Steve_Lionel
Honored Contributor III
464 Views

Line 8 ends in &, so the compiler treats the next nonblank line as continuation, which is 

 myTFilm = max(tFilm,0.1) 

If this was intended (maybe, since myTFilm isn't visibly declared otherwise), it is given an initial value of max(tFilm,0.1). In Fortran, initial values must be "constant expressions", which requires that all of the entities in the expression also be constant expressions. tFilm is a dummy argument, so it doesn't qualify.

You may be used to other languages that treat initialization as a run-time thing, but Fortran doesn't.

If you intended to initialize myTFilm the correct way is to omit the initialization in the declaration and to add an assignment statement. Since you already have a line that looks like an assignment, just replace the & with myTfilm.

 

0 Kudos
Steve_Lionel
Honored Contributor III
464 Views

As for generating a DLL, the first thing you need to do is determine which procedures you want to be visible outside the DLL. In each of these, add the line:

!DIR$ ATTRIBUTES DLLEXPORT :: routine-name

where "routine-name" is the name of the routine. This can go anywhere inside the routine, but traditionally is soon after the SUBROUTINE or FUNCTION line.

You will then need to create a Intel Visual Fortran > Library > Dynamic Link Library project type, add your sources to it, and build.

0 Kudos
Reply