Topic: Problem with modules

Hi Jeff,
I have another one for you.

In trying to build my project, notice that A_Struct_Mod.f90 compiles without errors

Compiling .\Source\A_PSInfo_Mod.f90
Compiling .\Source\A_Struct_Mod.f90
Compiling .\Source\AllBlank.f90

However, when it trys to compile ElevGet.f90, I get the error listed below:

Compiling .\Source\DNorm.f90
Compiling .\Source\ElevGet.f90

     Vol = Interp(Etry, Expd%Elev, Expd%Volume, Expd%nStrPts)
Error: Symbol 'expd' at (1) has no IMPLICIT type
Error(E42): Last command making (.\Build\ElevGet.o) returned a bad status
Error(E02): Make execution terminated

* Failed *

This is the module that contains the "Type(Expanded) :: Expd" statement:
Module A_Struct_Mod
! Module to establish allocatable arrays and their associated variables.
! Used with the Vegetative Overtopping Protection program.
! Written by Don Hazlewood, November 26, 2003
Implicit None
Type Reservoir
    Real(8), Allocatable :: Elev(:)        ! Structure Elevation Table
    Real(8), Allocatable :: PSDisch(:)     ! Structure Prin. Spillway Discharge Table
    Real(8), Allocatable :: Area(:)        ! Structure Area in acres
    Real(8), Allocatable :: Volume(:)      ! Structure Volume in acre-feet
    Integer(4) ::           nStrPts        ! Number of points in the Revervoir table
    Character(10) :: Str_ID                ! Structure Identifier
    Real(8) :: StrInt                      ! Structure rating table interval
End Type Reservoir
Type (Reservoir) :: Str
Type Expanded
    Real(8), Allocatable  :: Elev(:)       ! Expanded elevation table
    Real(8), Allocatable  :: PSDisch(:)    ! Expanded PS discharge table
    Real(8), Allocatable  :: Area(:)       ! Expanded structure Area table
    Real(8), Allocatable  :: Volume(:)     ! Expanded structure volume table
    Integer(4)            :: nStrPts       ! Number of points in expanded structure tables
End Type Expanded
Type (Expanded) :: Expd
Real(8)                   :: StrZero       ! Elevation of zero reservoir storage
Logical(1)                :: VolGiven      ! True-volume given; False-not given
Logical(1)                :: AreaGiven     ! True-area given; False-not given
Logical(1)                :: ElevChange    ! True-elevation changed more than 0.01'; False-no
Logical(1)                :: Breached      ! Switch to indicate stress greater than 100%

End Module A_Struct_Mod

I have tried everything I can think of to get around this problem, but no luck. It has worked in the past, but after I changed Exp (which was the Type (Expanded) name originally) to avoid confusion with the EXP function, I started getting this error.  It's almost like it isn't deleting the old compiled module.

This happen with 2.19 and 2.20 builds.  Any suggestions?

Re: Problem with modules


Could you also post a portion of the routine or file that uses this module (ElevGet.f90)?  Also, I'm assuming you've tried it already, but performing a Clean first doesn't fix the problem?

Jeff Armstrong
Approximatrix, LLC

Re: Problem with modules

Here is the subroutine ElevGet.

! Subroutine ElevGet
!        Routine to establish the elevation when a discontinuity occurs in the outflow discharges.
Subroutine ElevGet(Ell, Eul, Qo2, Vol, Qps, Qaux, Qot, Hc1, Ys, Xs, HdCutBase1, Wb1, X, &
                   Qb, Qbr, nMax, iusc, icr, Qumx, HydCtl)
Use A_AuxSpw_Mod
Use A_Embank_Mod
Use A_Struct_Mod
Use A_PSInfo_Mod
Implicit None
! Passed Variables
Integer(4), Intent(in) :: iusc         ! the index in the Xs array indicating the position of
!                                         the upstream end of the crest
Integer(4), Intent(in) :: icr          ! the index in the Xs/Ys arrays indicating the position
!                                         of the most downstream node having maximum elevation
Integer(4), Intent(in) :: nMax         ! the number of points in the Xs/Ys arrays

Real(8), Intent(inout) :: Ell          ! Lower elevation bound
Real(8), Intent(inout) :: Eul          ! Upper elevation bound
Real(8), Intent(inout) :: Qo2          ! Lower discharge bound
Real(8), Intent(out)   :: Vol          ! Associated volume
Real(8), Intent(out)   :: Qps          ! Outflow through the principal spillway
Real(8), Intent(out)   :: Qaux(nSpWay) ! Outflow through the aux. spillway(s)
Real(8), Intent(out)   :: Qot          ! Total outflow, PS and AS(s)
Real(8), Intent(out)   :: HydCtl       ! Hydraulic control elevation from QBreach Routine
Real(8), Intent(in)    :: Hc1          ! the elevation of the crest of the headcut for time step
Real(8), Intent(in)    :: HdCutBase1   ! the elevation of the base of the headcut at time step
Real(8), Intent(in)    :: Qumx         ! the maximum unit discharge from previous computations.
Real(8), Intent(in)    :: X            ! the position (Station) of the headcut at time step
Real(8), Intent(in)    :: Xs(nMax)     ! X array describing dam cross section at low point
Real(8), Intent(in)    :: Ys(nMax)     ! Y array describing dam cross section at low point
Real(8), Intent(in)    :: Wb1          !
Real(8), Intent(in)    :: Qb           ! Breach discharge
Real(8), Intent(in)    :: Qbr          !
! External Function
Real(8), External      :: Interp   ! Linear interpolation routine
! Local variables
Real(8)                :: Etry     ! Test elevation
Real(8)                :: Qcou
Real(8)                :: QAS
Real(8)                :: Eh
Integer(4)             :: ierr

!Interval Halving Loop to Find Correct Elevation
If (Ell > Eul) Then
End If
Do While ((Eul - Ell) > 0.0001)
    Etry = (Eul + Ell) / 2.

!          Find Discharge Through Aux. Spw. for End of Time Step
   Call TotalSpwFlow(Etry, Qps, Qaux, QAS, Qot, Qumx, Qb, Qbr, Qcou, Wb1, Hc1, &
                     X, Xs, Ys, HdCutBase1, nMax, iusc, icr, ierr, HydCtl)

!              Find Error in Mass Balance Equation
     Vol = Interp(Etry, Expd%Elev, Expd%Volume, Expd%nStrPts)
     If (Qcou > Qo2) Then
         Eul = Etry
         Ell = Etry
     End If
End Do
End Subroutine ElevGet

Yes, I tried cleaning and no, it didn't help.

Re: Problem with modules

Hi Jeff - I think I have discovered the problem with modules.  My project is set up as follows:

C:\Projects\WinDAM B  which contains the .prj, .exe and test dataset.  There are three sub-folders - Build, Modules and Source.  The Build and Modules folders are the used by Simply Fortran.  Source contains all my source programs - modules, subroutines and main.  I discovered that in the source folder, for each module, there was a corresponding .mod file that were not being removed by "Clean".  I deleted them and the program compiled and ran to conclusion.  I checked after my last compile and source does not contain any .mod files.  I think we can probably chalk this one up to operator error....