Skip to content

Commit

Permalink
Modified the test054 problem to use non-symmetric DISU input. Added d…
Browse files Browse the repository at this point in the history
…eallocate statements for a bunch of variables identified with Intel Inspector (Issue #44).
  • Loading branch information
langevin-usgs committed Feb 24, 2019
1 parent 1127a24 commit bbe3ae3
Show file tree
Hide file tree
Showing 11 changed files with 351 additions and 39,914 deletions.
9 changes: 9 additions & 0 deletions msvs/mfusg.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{6989167D-11E4-40FE-8C1A-2192A86A7E90}") = "mfusg", "mfusg.vfproj", "{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}"
EndProject
Global
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
profile|Win32 = profile|Win32
profile|x64 = profile|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
Expand All @@ -17,6 +22,10 @@ Global
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Debug|Win32.Build.0 = Debug|Win32
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Debug|x64.ActiveCfg = Debug|x64
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Debug|x64.Build.0 = Debug|x64
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.profile|Win32.ActiveCfg = profile|Win32
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.profile|Win32.Build.0 = profile|Win32
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.profile|x64.ActiveCfg = profile|x64
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.profile|x64.Build.0 = profile|x64
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Release|Win32.ActiveCfg = Release|Win32
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Release|Win32.Build.0 = Release|Win32
{85A96A57-BA33-4A96-B785-D0A5BD1EBA8C}.Release|x64.ActiveCfg = Release|x64
Expand Down
22 changes: 21 additions & 1 deletion msvs/mfusg.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platform Name="x64"/></Platforms>
<Configurations>
<Configuration Name="Debug|Win32">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" Traceback="true" BoundsCheck="true" StackFrameCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" WarnInterfaces="true" FloatingPointExceptionHandling="fpe0" Traceback="true" BoundsCheck="true" StackFrameCheck="true" RuntimeLibrary="rtMultiThreadedDebug"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemConsole"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
Expand Down Expand Up @@ -43,6 +43,26 @@
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="profile|Win32">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" SubSystem="subSystemConsole"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration>
<Configuration Name="profile|x64">
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeFull" FloatingPointExceptionHandling="fpe0"/>
<Tool Name="VFLinkerTool" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" GenerateDebugInformation="true" SubSystem="subSystemConsole"/>
<Tool Name="VFResourceCompilerTool"/>
<Tool Name="VFMidlTool" SuppressStartupBanner="true" TargetEnvironment="midlTargetAMD64"/>
<Tool Name="VFCustomBuildTool"/>
<Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFManifestTool" SuppressStartupBanner="true"/></Configuration></Configurations>
<Files>
<Filter Name="Header Files" Filter="fi;fd"/>
Expand Down
19 changes: 18 additions & 1 deletion src/cln2basu1.f
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ SUBROUTINE SDIS2CLN1AR(IUCLN)
1 'PROCESS, VERSION 1, 3/3/2012 INPUT READ FROM UNIT ',I4)
C
C2------ALLOCATE SCALAR VARIABLES AND INITIALIZE.
ALLOCATE(NCLN,ICLNCB,ICLNHD,ICLNDD,ICLNIB,NCLNNDS,NCLNGWC,NJA_CLN)
ALLOCATE(NCLN)
ALLOCATE(ICLNCB)
ALLOCATE(ICLNHD)
ALLOCATE(ICLNDD)
ALLOCATE(ICLNIB)
ALLOCATE(NCLNNDS)
ALLOCATE(NCLNGWC)
ALLOCATE(NJA_CLN)
ALLOCATE(NCONDUITYP) !OTHER CLN TYPES CAN BE DIMENSIONED HERE
ALLOCATE(ICLNTIB) !TRANSIENT IBOUND OPTION
ALLOCATE(ICLNPCB) !aq CLN CCF
Expand Down Expand Up @@ -943,6 +950,7 @@ SUBROUTINE SFILLPGF_CLN
C5A-----------CONNECTION IS ACROSS A LEAKANCE TERM LIKE CONDUIT FLOW PROCESS OF MF2K5, COMPUTE LEAKANCE
FLENG = ACLNGWC(IFN,6)
CWCn = FSKIN * FPER * FLENG/ FANISO
CALL CLNR(IFTYP,FRAD)
ELSEIF(IFCON.EQ.2)THEN
C
C5B-----------CONNECTION IS ACROSS A LEAKANCE TERM LIKE CONDUIT FLOW PROCESS PACKAGE, LEAKANCE IS INPUT
Expand Down Expand Up @@ -2064,6 +2072,15 @@ SUBROUTINE CLN1DA
DEALLOCATE(NCLN,ICLNCB,ICLNHD,ICLNDD,ICLNIB,NCLNNDS)
DEALLOCATE(ACLNNDS)
DEALLOCATE(IFLINCLN,ICCWADICLN,ICGWADICLN,ACLNGWC,ACLNCOND)
DEALLOCATE(NCLNGWC)
DEALLOCATE(NJA_CLN)
DEALLOCATE(NCONDUITYP)
DEALLOCATE(ICLNTIB)
DEALLOCATE(ICLNPCB)
DEALLOCATE(ICLNGWCB)
DEALLOCATE(IA_CLN)
DEALLOCATE(JA_CLN)
DEALLOCATE(IDXGLO_CLN)
C
RETURN
END
25 changes: 21 additions & 4 deletions src/glo2basu1.f
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ SUBROUTINE GLO2BAS8AR(INUNIT,CUNIT,VERSION,IUDIS,IUZON,IUMLT,
allocate(iunsat)
iunsat = 0 ! unsat formulation
ALLOCATE(NCOL,NROW,NLAY,NPER,NBOTM,NCNFBD,ITMUNI,LENUNI,ITRSS)
ALLOCATE(NJA,NJAS,NJAG,ILAYCON4,WADIEPS,IWADI,IWADICLN,IDPF,IDPT)
ALLOCATE(NJA)
ALLOCATE(NJAS)
ALLOCATE(NJAG)
ALLOCATE(ILAYCON4)
ALLOCATE(WADIEPS)
ALLOCATE(IWADI)
ALLOCATE(IWADICLN)
ALLOCATE(IDPF)
ALLOCATE(IDPT)
ALLOCATE(IXSEC,INBAS,IFREFM,NODES,IOUT,MXNODLAY,IUNSTR,IVSD)
ALLOCATE(IDEALLOC_LPF,IDEALLOC_HY,ITRNSP,NEQS,IDSYMRD,IPRCONN)
ALLOCATE(INCLN,INGNC,INGNC2,INGNCn,ISYMFLG,IDDREF,IDDREFNEW)
Expand Down Expand Up @@ -733,7 +741,6 @@ SUBROUTINE FILLISYM
CALL USTOP('')
ENDIF
C2------ALLOCATE SYMMETRIC INDEX POINTER ARRAY JAS
ALLOCATE(NJAS)
NJAS = (NJA-NEQS) / 2
ALLOCATE(JAS(NJA))
C3------FILL JAS WITH LOCATION VARIABLE IN SYMMETRIC ARRAY
Expand Down Expand Up @@ -2294,6 +2301,7 @@ SUBROUTINE GWF2BAS7U1DA
USE PARAMMODULE
USE GWFBASMODULE
C
DEALLOCATE(IUNSAT)
DEALLOCATE(NCOL)
DEALLOCATE(NROW)
DEALLOCATE(NLAY)
Expand All @@ -2308,7 +2316,11 @@ SUBROUTINE GWF2BAS7U1DA
DEALLOCATE(IFREFM)
DEALLOCATE(NODES)
DEALLOCATE(NEQS)
DEALLOCATE(IDSYMRD)
DEALLOCATE(IPRCONN)
DEALLOCATE(IOUT)
DEALLOCATE(MXNODLAY)
DEALLOCATE(IVSD)
C
DEALLOCATE(IUNIT)
DEALLOCATE(LAYCBD)
Expand Down Expand Up @@ -2338,7 +2350,7 @@ SUBROUTINE GWF2BAS7U1DA
DEALLOCATE(AMAT)
DEALLOCATE(IA)
DEALLOCATE(JA)
DEALLOCATE(NJAS, JAS)
DEALLOCATE(JAS)
IF(INCLN.NE.0.OR.INGNC.NE.0.OR.INGNC2.NE.0.OR.INGNCn.NE.0) THEN
DEALLOCATE(JAFL)
ENDIF
Expand Down Expand Up @@ -2378,6 +2390,8 @@ SUBROUTINE GWF2BAS7U1DA
DEALLOCATE(LBHDSV)
DEALLOCATE(LBDDSV)
DEALLOCATE(LBBOSV)
DEALLOCATE(ISPCFM)
DEALLOCATE(ISPCUN)
DEALLOCATE(IBUDFL)
DEALLOCATE(ICBCFL)
DEALLOCATE(IHDDFL)
Expand All @@ -2397,6 +2411,7 @@ SUBROUTINE GWF2BAS7U1DA
DEALLOCATE(CHEDFM)
DEALLOCATE(CDDNFM)
DEALLOCATE(CBOUFM)
DEALLOCATE(CSPCFM)
!IF(NPTIMES.GT.0) DEALLOCATE(TIMOT)
!DEALLOCATE(IATS,NPTIMES,NPSTPS,IBUDFLAT,ICBCFLAT,IHDDFLAT)
!DEALLOCATE(DELTAT,TMINAT,TMAXAT,TADJAT,TCUTAT)
Expand All @@ -2410,7 +2425,9 @@ SUBROUTINE GWF2BAS7U1DA
DEALLOCATE(IDEALLOC_HY)
DEALLOCATE(ITRNSP)
C
NULLIFY(IATMP,NJA)
NULLIFY(IATMP)
DEALLOCATE(NJA,NJAS,NJAG)
DEALLOCATE(ILAYCON4,WADIEPS,IWADI,IWADICLN,IDPF,IDPT)
DEALLOCATE(CL1,CL2)
C
RETURN
Expand Down
17 changes: 14 additions & 3 deletions src/gwf2bcf-lpf-u1.f
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ SUBROUTINE READBCF(IN)
IF(ABS(CHANI(K) - 1.0).GT.1.0E-6) IHANISO = 1
ENDDO
ENDIF
IF(IHANISO.EQ.1) ALLOCATE(ARAD(NJAS))
IF(IHANISO.EQ.1) THEN
ALLOCATE(ARAD(NJAS))
ELSE
ALLOCATE(ARAD(1))
ENDIF
C---------------------------------------------------------------------------------
C8------READ PARAMETERS AND CONVERT FOR UNSTRUCTURED AND STRUCTURED GRIDS
IF(IUNSTR.EQ.0) THEN
Expand Down Expand Up @@ -2520,7 +2524,11 @@ SUBROUTINE READLPF(IN,INLAK)
DO K=1,NLAY
IF(ABS(CHANI(K) - 1.0).GT.1.0E-6) IHANISO = 1
ENDDO
IF(IHANISO.EQ.1) ALLOCATE(ARAD(NJAS))
IF(IHANISO.EQ.1) THEN
ALLOCATE(ARAD(NJAS))
ELSE
ALLOCATE(ARAD(1))
ENDIF
C
C4F-----BASED ON LAYTYP, LAYAVG, CHANI, LAYWET, COUNT THE NUMBER OF EACH
C4F-----TYPE OF 2-D ARRAY; CHECK VALUES FOR CONSISTENCY; AND SETUP
Expand Down Expand Up @@ -3751,7 +3759,7 @@ SUBROUTINE SGWF2LPFU1CK(IOUT,NP,PTYP)
C-----------------------------------------------------------------------
SUBROUTINE GWF2BCFU1DA(INLPF)
USE GWFBCFMODULE
USE GLOBAL, ONLY:NLAY,IUNSTR,IDEALLOC_HY
USE GLOBAL, ONLY:NLAY,IUNSTR,IDEALLOC_HY,ARAD
C
IF(IDEALLOC_HY.EQ.0) DEALLOCATE(HK)
DEALLOCATE(IBCFCB)
Expand All @@ -3766,8 +3774,11 @@ SUBROUTINE GWF2BCFU1DA(INLPF)
DEALLOCATE(IWDFLG)
DEALLOCATE(IWETIT)
DEALLOCATE(IHDWET)
DEALLOCATE(IKVFLAG)
DEALLOCATE(IKCFLAG)
DEALLOCATE(IHANISO)
DEALLOCATE(CHANI)
DEALLOCATE(ARAD)
IF(INLPF.NE.0)THEN
DEALLOCATE(ITHFLG)
DEALLOCATE(ISFAC)
Expand Down
1 change: 1 addition & 0 deletions src/xmd.f
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ SUBROUTINE XMD7DA
& , STAT = ALLOC_ERR)
DEALLOCATE (EPSRN,RRCTOL, STAT = ALLOC_ERR)
DEALLOCATE (REDSYS, STAT = ALLOC_ERR)
DEALLOCATE (ILUREUSE, STAT = ALLOC_ERR)
DEALLOCATE(DGSCAL, STAT = ALLOC_ERR)
RETURN
END
7 changes: 7 additions & 0 deletions src/xmdlib_2.f
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ subroutine realloc(a, n)
allocate (tmp(2*nold), stat=ierr)
if (ierr /= 0) stop "allocate error"
tmp(1:nold) = a(1:nold)
tmp(nold+1:2*nold) = 0.D0
deallocate (a)

call move_alloc(tmp, a)
Expand All @@ -54,6 +55,7 @@ subroutine ialloc(a, n)
allocate (tmp(2*nold), stat=ierr)
if (ierr /= 0) stop "allocate error"
tmp(1:nold) = a(1:nold)
tmp(nold+1:2*nold) = 0
deallocate (a)

call move_alloc(tmp, a)
Expand Down Expand Up @@ -153,6 +155,8 @@ subroutine xmdsfacl(iaf, jafwk, idiagf, ia, ja,
if (allocated(jafwk)) deallocate (jafwk)
allocate( jafwk(1), levptr(1), stat = ierror )
if (ierror /= 0) stop "== not enough memory (xmdsfacl) =="
jafwk(1) = 0
levptr(1) = 0

allocate( lrowptr(n), list(nblack), stat = ierror )
if (ierror /= 0) stop "== not enough memory (xmdsfacl) =="
Expand Down Expand Up @@ -373,10 +377,13 @@ subroutine xmdsfacd(a, b, afwk, epsrn, iaf, jafwk, idiagf,
double precision, dimension(:), allocatable :: afwk, afwk0

allocate( levptr(1) )
levptr(1) = 0
if (allocated(jafwk)) deallocate (jafwk)
if (allocated(afwk)) deallocate (afwk)
allocate( jafwk(1), afwk(1) , stat = ierror )
if (ierror /= 0) stop "== not enough memory (xmdsfacd) =="
jafwk(1) = 0
afwk(1) = 0.D0


c lsize = njaf+nblack
Expand Down
Binary file modified test-cmp/test054_gwfu-cln/.cmp/model01.hds.cmp
Binary file not shown.
Loading

0 comments on commit bbe3ae3

Please sign in to comment.