I'm making a function call to a fortran subroutine:
CALL EGFpar(T_e,X_e,Y_e,cpi(1:nx,1:Nspec),WEG,IWEG)
Here IWEG is initialized with integer values in an initialization routine. IWEG and WEG are declared in an include file:
INTEGER LIWEGmax, LWEGMAX
PARAMETER (LIWEGmax=400, LWEGMAX=6000000)
INTEGER IWEG(LIWEGmax)
DOUBLE PRECISION WEG(LWEGmax)
COMMON/EGINI/ IWEG, WEG
While debugging with VSCode, I can see the values I have initialized it with. However, when I step into EGFpar, all the passed arrays have their initialized values except IWEG. IWEG has nothing. Not zeros, but just blank. The subroutine EGFpar is given below
C-----------------------------------------------------------------------
SUBROUTINE EGFPAR ( NP, T, X, Y, CP, WEG, IWEG )
C-----------------------------------------------------------------------
C
C This subroutine initializes the thermomolecular
C parameters that are needed in order to evaluate
C the transport linear systems.
C The parameters that have to be evaluated depend on the transport
C coefficients that will be subsequently computed, as indicated
C by JFLAG. This flag has been initialized when calling EGINI.
C
C Input
C -----
C NP number of nodes
C T(NP) temperature
C X(NP,NS) species mole fractions
C Y(NP,NS) species mass fractions
C CP(NP,NS) species heat capacities at constant pressure
C per unit mass
C WEG double precision work array for EGLIB
C IWEG integer work array for EGLIB
C
C-----------------------------------------------------------------------
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
IMPLICIT INTEGER (I-N)
DIMENSION WEG(*), IWEG(*)
C-----------------------------------------------------------------------
INCLUDE 'eg.cmn'
C-----------------------------------------------------------------------
CALL LFPAR ( NP, JFLAG, WEG(IEGPA),
& T, WEG(IDLT1), WEG(IDLT2), WEG(IDLT3),
& WEG(IDLT4), WEG(IDLT5), WEG(IDLT6),
& WEG(IEGRU), NS, WEG(IAAA), WEG(IBBB),
& WEG(IEGWT), WEG(IBIN), WEG(IETA),
& WEG(IETALG), WEG(ICTAIJ), WEG(IFITA),
& WEG(ICINT), CP, WEG(ICXI),
& WEG(IEPSIJ), WEG(IEGEPS), WEG(IEGCFD), WEG(IEGCFE),
& WEG(IEGZRT), WEG(IEGDIP), IWEG(IEGLIN) )
C-----------------------------------------------------------------------
CALL EGFXY ( NP, NS, WEG(IXTR), WEG(IYTR), WEG(IAUX), X, Y )
C-----------------------------------------------------------------------
RETURN
END
What is going wrong here?