Skip to content

Commit

Permalink
feat(idm): update DRN package for IDM (#1375)
Browse files Browse the repository at this point in the history
* update DRN package for IDM

* rebuild makefiles

* integrate DRN updates with BUY package

* restructure for IFX compiler error

* cleanup BUY

* cleanup

* rebuild makefiles

---------

Co-authored-by: mjreno <[email protected]>
  • Loading branch information
mjreno and mjreno authored Sep 29, 2023
1 parent 2ff4acd commit 25e3efa
Show file tree
Hide file tree
Showing 12 changed files with 840 additions and 162 deletions.
15 changes: 15 additions & 0 deletions doc/mf6io/mf6ivar/dfn/gwf-drn.dfn
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ reader urword
optional true
longname print input to listing file
description REPLACE print_input {'{#1}': 'drain'}
mf6internal iprpak

block options
name print_flows
Expand All @@ -52,6 +53,7 @@ reader urword
optional true
longname print calculated flows to listing file
description REPLACE print_flows {'{#1}': 'drain'}
mf6internal iprflow

block options
name save_flows
Expand All @@ -60,6 +62,7 @@ reader urword
optional true
longname save CHD flows to budget file
description REPLACE save_flows {'{#1}': 'drain'}
mf6internal ipakcb

block options
name ts_filerecord
Expand Down Expand Up @@ -145,6 +148,16 @@ optional true
longname
description REPLACE mover {'{#1}': 'Drain'}

# dev options
block options
name dev_cubic_scaling
type keyword
reader urword
optional true
longname cubic-scaling
description cubic-scaling is used to scale the drain conductance
mf6internal icubicsfac

# --------------------- gwf drn dimensions ---------------------

block dimensions
Expand Down Expand Up @@ -178,6 +191,7 @@ shape (maxbound)
reader urword
longname
description
mf6internal spd

block period
name cellid
Expand Down Expand Up @@ -222,6 +236,7 @@ optional true
time_series true
longname auxiliary variables
description REPLACE aux {'{#1}': 'drain'}
mf6internal auxvar

block period
name boundname
Expand Down
127 changes: 64 additions & 63 deletions make/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ include ./makedefaults

# Define the source file directories
SOURCEDIR1=../src
SOURCEDIR2=../src/Model
SOURCEDIR3=../src/Model/TransportModel
SOURCEDIR4=../src/Model/GroundWaterFlow
SOURCEDIR5=../src/Model/Geometry
SOURCEDIR2=../src/Exchange
SOURCEDIR3=../src/Model
SOURCEDIR4=../src/Model/Geometry
SOURCEDIR5=../src/Model/TransportModel
SOURCEDIR6=../src/Model/ModelUtilities
SOURCEDIR7=../src/Model/GroundWaterTransport
SOURCEDIR8=../src/Model/Connection
SOURCEDIR9=../src/Distributed
SOURCEDIR10=../src/Utilities
SOURCEDIR11=../src/Utilities/Idm
SOURCEDIR12=../src/Utilities/Idm/mf6blockfile
SOURCEDIR13=../src/Utilities/Idm/selector
SOURCEDIR14=../src/Utilities/Vector
SOURCEDIR15=../src/Utilities/Matrix
SOURCEDIR16=../src/Utilities/Observation
SOURCEDIR17=../src/Utilities/ArrayRead
SOURCEDIR18=../src/Utilities/OutputControl
SOURCEDIR19=../src/Utilities/Libraries
SOURCEDIR20=../src/Utilities/Libraries/blas
SOURCEDIR21=../src/Utilities/Libraries/rcm
SOURCEDIR22=../src/Utilities/Libraries/sparsekit
SOURCEDIR23=../src/Utilities/Libraries/sparskit2
SOURCEDIR24=../src/Utilities/Libraries/daglib
SOURCEDIR25=../src/Utilities/Memory
SOURCEDIR26=../src/Utilities/TimeSeries
SOURCEDIR27=../src/Timing
SOURCEDIR28=../src/Solution
SOURCEDIR29=../src/Solution/PETSc
SOURCEDIR30=../src/Solution/LinearMethods
SOURCEDIR31=../src/Exchange
SOURCEDIR7=../src/Model/Connection
SOURCEDIR8=../src/Model/GroundWaterTransport
SOURCEDIR9=../src/Model/GroundWaterFlow
SOURCEDIR10=../src/Distributed
SOURCEDIR11=../src/Solution
SOURCEDIR12=../src/Solution/PETSc
SOURCEDIR13=../src/Solution/LinearMethods
SOURCEDIR14=../src/Timing
SOURCEDIR15=../src/Utilities
SOURCEDIR16=../src/Utilities/TimeSeries
SOURCEDIR17=../src/Utilities/Libraries
SOURCEDIR18=../src/Utilities/Libraries/rcm
SOURCEDIR19=../src/Utilities/Libraries/sparsekit
SOURCEDIR20=../src/Utilities/Libraries/sparskit2
SOURCEDIR21=../src/Utilities/Libraries/blas
SOURCEDIR22=../src/Utilities/Libraries/daglib
SOURCEDIR23=../src/Utilities/Idm
SOURCEDIR24=../src/Utilities/Idm/selector
SOURCEDIR25=../src/Utilities/Idm/mf6blockfile
SOURCEDIR26=../src/Utilities/Matrix
SOURCEDIR27=../src/Utilities/Vector
SOURCEDIR28=../src/Utilities/Observation
SOURCEDIR29=../src/Utilities/OutputControl
SOURCEDIR30=../src/Utilities/Memory
SOURCEDIR31=../src/Utilities/ArrayRead

VPATH = \
${SOURCEDIR1} \
Expand Down Expand Up @@ -90,14 +90,9 @@ $(OBJDIR)/MemoryHelper.o \
$(OBJDIR)/CharString.o \
$(OBJDIR)/Memory.o \
$(OBJDIR)/List.o \
$(OBJDIR)/InputDefinition.o \
$(OBJDIR)/LongLineReader.o \
$(OBJDIR)/MemoryList.o \
$(OBJDIR)/TimeSeriesRecord.o \
$(OBJDIR)/BlockParser.o \
$(OBJDIR)/MemoryManager.o \
$(OBJDIR)/InputDefinition.o \
$(OBJDIR)/TimeSeries.o \
$(OBJDIR)/ats.o \
$(OBJDIR)/simnamidm.o \
$(OBJDIR)/gwt1idm.o \
$(OBJDIR)/gwt1dsp1idm.o \
Expand All @@ -107,74 +102,84 @@ $(OBJDIR)/gwt1dis1idm.o \
$(OBJDIR)/gwf3wel8idm.o \
$(OBJDIR)/gwf3npf8idm.o \
$(OBJDIR)/gwf3idm.o \
$(OBJDIR)/gwf3drn8idm.o \
$(OBJDIR)/gwf3disv8idm.o \
$(OBJDIR)/gwf3disu8idm.o \
$(OBJDIR)/gwf3dis8idm.o \
$(OBJDIR)/gwf3chd8idm.o \
$(OBJDIR)/TimeSeriesRecord.o \
$(OBJDIR)/BlockParser.o \
$(OBJDIR)/MemoryManager.o \
$(OBJDIR)/IdmSimDfnSelector.o \
$(OBJDIR)/IdmGwtDfnSelector.o \
$(OBJDIR)/IdmGwfDfnSelector.o \
$(OBJDIR)/TimeSeries.o \
$(OBJDIR)/ats.o \
$(OBJDIR)/IdmDfnSelector.o \
$(OBJDIR)/TimeArray.o \
$(OBJDIR)/ArrayReaders.o \
$(OBJDIR)/TimeSeriesLink.o \
$(OBJDIR)/TimeSeriesFileList.o \
$(OBJDIR)/tdis.o \
$(OBJDIR)/HashTable.o \
$(OBJDIR)/VectorBase.o \
$(OBJDIR)/Sparse.o \
$(OBJDIR)/DisvGeom.o \
$(OBJDIR)/ArrayReaders.o \
$(OBJDIR)/IdmSimDfnSelector.o \
$(OBJDIR)/IdmGwtDfnSelector.o \
$(OBJDIR)/IdmGwfDfnSelector.o \
$(OBJDIR)/ArrayReaderBase.o \
$(OBJDIR)/STLVecInt.o \
$(OBJDIR)/ModflowInput.o \
$(OBJDIR)/MemoryManagerExt.o \
$(OBJDIR)/TimeArraySeries.o \
$(OBJDIR)/TimeSeriesManager.o \
$(OBJDIR)/SmoothingFunctions.o \
$(OBJDIR)/MemoryManagerExt.o \
$(OBJDIR)/MatrixBase.o \
$(OBJDIR)/ListReader.o \
$(OBJDIR)/Connections.o \
$(OBJDIR)/IdmDfnSelector.o \
$(OBJDIR)/TimeArray.o \
$(OBJDIR)/ArrayReaderBase.o \
$(OBJDIR)/ObsOutput.o \
$(OBJDIR)/DiscretizationBase.o \
$(OBJDIR)/STLVecInt.o \
$(OBJDIR)/ModflowInput.o \
$(OBJDIR)/TimeArraySeries.o \
$(OBJDIR)/Integer2dReader.o \
$(OBJDIR)/ObsOutputList.o \
$(OBJDIR)/Observe.o \
$(OBJDIR)/StructVector.o \
$(OBJDIR)/IdmLogger.o \
$(OBJDIR)/DefinitionSelect.o \
$(OBJDIR)/InputLoadType.o \
$(OBJDIR)/TimeArraySeriesLink.o \
$(OBJDIR)/DiscretizationBase.o \
$(OBJDIR)/Integer1dReader.o \
$(OBJDIR)/Double2dReader.o \
$(OBJDIR)/Double1dReader.o \
$(OBJDIR)/ObsUtility.o \
$(OBJDIR)/ObsContainer.o \
$(OBJDIR)/BudgetFileReader.o \
$(OBJDIR)/StructArray.o \
$(OBJDIR)/BoundInputContext.o \
$(OBJDIR)/AsciiInputLoadType.o \
$(OBJDIR)/TimeArraySeriesManager.o \
$(OBJDIR)/SourceCommon.o \
$(OBJDIR)/LayeredArrayReader.o \
$(OBJDIR)/ObsOutput.o \
$(OBJDIR)/StressListInput.o \
$(OBJDIR)/StressGridInput.o \
$(OBJDIR)/LoadMf6File.o \
$(OBJDIR)/ObsOutputList.o \
$(OBJDIR)/Observe.o \
$(OBJDIR)/IdmMf6File.o \
$(OBJDIR)/sort.o \
$(OBJDIR)/ObsUtility.o \
$(OBJDIR)/ObsContainer.o \
$(OBJDIR)/BudgetFileReader.o \
$(OBJDIR)/SourceLoad.o \
$(OBJDIR)/ModelPackageInputs.o \
$(OBJDIR)/PackageMover.o \
$(OBJDIR)/Obs3.o \
$(OBJDIR)/NumericalPackage.o \
$(OBJDIR)/Budget.o \
$(OBJDIR)/BudgetTerm.o \
$(OBJDIR)/StressListInput.o \
$(OBJDIR)/StressGridInput.o \
$(OBJDIR)/LoadMf6File.o \
$(OBJDIR)/sort.o \
$(OBJDIR)/SfrCrossSectionUtils.o \
$(OBJDIR)/VirtualBase.o \
$(OBJDIR)/IdmLoad.o \
$(OBJDIR)/BoundaryPackage.o \
$(OBJDIR)/VirtualBase.o \
$(OBJDIR)/BaseModel.o \
$(OBJDIR)/PackageBudget.o \
$(OBJDIR)/HeadFileReader.o \
$(OBJDIR)/BudgetObject.o \
$(OBJDIR)/IdmMf6File.o \
$(OBJDIR)/SfrCrossSectionManager.o \
$(OBJDIR)/dag_module.o \
$(OBJDIR)/BoundaryPackageExt.o \
$(OBJDIR)/VirtualDataLists.o \
$(OBJDIR)/VirtualDataContainer.o \
$(OBJDIR)/SimStages.o \
Expand All @@ -183,8 +188,6 @@ $(OBJDIR)/FlowModelInterface.o \
$(OBJDIR)/PrintSaveManager.o \
$(OBJDIR)/Xt3dAlgorithm.o \
$(OBJDIR)/gwf3tvbase8.o \
$(OBJDIR)/SourceLoad.o \
$(OBJDIR)/ModelPackageInputs.o \
$(OBJDIR)/gwf3sfr8.o \
$(OBJDIR)/gwf3riv8.o \
$(OBJDIR)/gwf3maw8.o \
Expand All @@ -202,7 +205,6 @@ $(OBJDIR)/OutputControlData.o \
$(OBJDIR)/gwf3ic8.o \
$(OBJDIR)/Xt3dInterface.o \
$(OBJDIR)/gwf3tvk8.o \
$(OBJDIR)/IdmLoad.o \
$(OBJDIR)/gwf3vsc8.o \
$(OBJDIR)/GwfNpfOptions.o \
$(OBJDIR)/InterfaceMap.o \
Expand All @@ -220,7 +222,6 @@ $(OBJDIR)/gwt1mst1.o \
$(OBJDIR)/GwtDspOptions.o \
$(OBJDIR)/gwf3npf8.o \
$(OBJDIR)/GwtAdvOptions.o \
$(OBJDIR)/BoundaryPackageExt.o \
$(OBJDIR)/gwf3tvs8.o \
$(OBJDIR)/GwfStorageUtils.o \
$(OBJDIR)/Mover.o \
Expand Down
1 change: 1 addition & 0 deletions msvs/mf6core.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3disv8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3disv8idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3drn8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3drn8idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3evt8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3ghb8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3hfb8.f90"/>
Expand Down
3 changes: 2 additions & 1 deletion src/Model/GroundWaterFlow/gwf3.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,8 @@ subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, &
call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
pakname, mempath)
case ('DRN6')
call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
call drn_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
pakname, mempath)
case ('RIV6')
call riv_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
case ('GHB6')
Expand Down
30 changes: 17 additions & 13 deletions src/Model/GroundWaterFlow/gwf3buy8.f90
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ subroutine buy_cf_drn(packobj, hnew, dense, denseref)
! ------------------------------------------------------------------------------
! -- modules
use BndModule, only: BndType
use DrnModule, only: DrnType
class(BndType), pointer :: packobj
! -- dummy
real(DP), intent(in), dimension(:) :: hnew
Expand All @@ -737,19 +738,22 @@ subroutine buy_cf_drn(packobj, hnew, dense, denseref)
! ------------------------------------------------------------------------------
!
! -- Process density terms for each DRN
do n = 1, packobj%nbound
node = packobj%nodelist(n)
if (packobj%ibound(node) <= 0) cycle
rho = dense(node)
hbnd = packobj%bound(1, n)
cond = packobj%bound(2, n)
if (hnew(node) > hbnd) then
hcofterm = -cond * (rho / denseref - DONE)
rhsterm = hcofterm * hbnd
packobj%hcof(n) = packobj%hcof(n) + hcofterm
packobj%rhs(n) = packobj%rhs(n) + rhsterm
end if
end do
select type (packobj)
type is (DrnType)
do n = 1, packobj%nbound
node = packobj%nodelist(n)
if (packobj%ibound(node) <= 0) cycle
rho = dense(node)
hbnd = packobj%elev(n)
cond = packobj%cond(n)
if (hnew(node) > hbnd) then
hcofterm = -cond * (rho / denseref - DONE)
rhsterm = hcofterm * hbnd
packobj%hcof(n) = packobj%hcof(n) + hcofterm
packobj%rhs(n) = packobj%rhs(n) + rhsterm
end if
end do
end select
!
! -- Return
return
Expand Down
Loading

0 comments on commit 25e3efa

Please sign in to comment.