Skip to content

Commit

Permalink
feat(idm): update CHD to source static and dynamic list input from th…
Browse files Browse the repository at this point in the history
…e input context (#1366)

* align mempath initialization in NumericalPackage and DiscretizationBase

* add helper routine to set FILEIN filename when 0 or 1 files are expected

* add MemoryManager CharacterStringType checkin routine

* CHD and bound package updates to support sourcing static and dynamic list input

* run build_makefiles.py

* BoundaryPackageExt cleanup

---------

Co-authored-by: mjreno <[email protected]>
  • Loading branch information
mjreno and mjreno authored Sep 26, 2023
1 parent 0cf3d1f commit 173dc50
Show file tree
Hide file tree
Showing 21 changed files with 1,531 additions and 180 deletions.
15 changes: 15 additions & 0 deletions doc/mf6io/mf6ivar/dfn/gwf-chd.dfn
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# --------------------- gwf chd options ---------------------
# flopy multi-package
# modflow6 aux-sfac-param head

block options
name auxiliary
Expand Down Expand Up @@ -35,6 +36,7 @@ reader urword
optional true
longname print input to listing file
description REPLACE print_input {'{#1}': 'constant-head'}
mf6internal iprpak

block options
name print_flows
Expand All @@ -43,6 +45,7 @@ reader urword
optional true
longname print CHD flows to listing file
description REPLACE print_flows {'{#1}': 'constant-head'}
mf6internal iprflow

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

block options
name ts_filerecord
Expand Down Expand Up @@ -127,6 +131,15 @@ optional false
longname obs6 input filename
description REPLACE obs6_filename {'{#1}': 'constant-head'}

# dev options
block options
name dev_no_newton
type keyword
reader urword
optional true
longname turn off Newton for unconfined cells
description turn off Newton for unconfined cells
mf6internal inewton

# --------------------- gwf chd dimensions ---------------------

Expand Down Expand Up @@ -161,6 +174,7 @@ shape (maxbound)
reader urword
longname
description
mf6internal spd

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

block period
name boundname
Expand Down
82 changes: 42 additions & 40 deletions make/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,21 @@ $(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 \
$(OBJDIR)/gwt1disv1idm.o \
$(OBJDIR)/gwt1disu1idm.o \
$(OBJDIR)/gwt1dis1idm.o \
$(OBJDIR)/gwf3npf8idm.o \
$(OBJDIR)/gwf3idm.o \
$(OBJDIR)/gwf3disv8idm.o \
$(OBJDIR)/gwf3disu8idm.o \
$(OBJDIR)/gwf3dis8idm.o \
$(OBJDIR)/gwf3chd8idm.o \
$(OBJDIR)/TimeSeriesLink.o \
$(OBJDIR)/TimeSeriesFileList.o \
$(OBJDIR)/tdis.o \
Expand All @@ -105,65 +118,62 @@ $(OBJDIR)/VectorBase.o \
$(OBJDIR)/Sparse.o \
$(OBJDIR)/DisvGeom.o \
$(OBJDIR)/ArrayReaders.o \
$(OBJDIR)/IdmSimDfnSelector.o \
$(OBJDIR)/IdmGwtDfnSelector.o \
$(OBJDIR)/IdmGwfDfnSelector.o \
$(OBJDIR)/TimeSeriesManager.o \
$(OBJDIR)/SmoothingFunctions.o \
$(OBJDIR)/MemoryManagerExt.o \
$(OBJDIR)/MatrixBase.o \
$(OBJDIR)/ListReader.o \
$(OBJDIR)/Connections.o \
$(OBJDIR)/InputDefinition.o \
$(OBJDIR)/IdmDfnSelector.o \
$(OBJDIR)/TimeArray.o \
$(OBJDIR)/ArrayReaderBase.o \
$(OBJDIR)/ObsOutput.o \
$(OBJDIR)/DiscretizationBase.o \
$(OBJDIR)/simnamidm.o \
$(OBJDIR)/gwt1idm.o \
$(OBJDIR)/gwt1dsp1idm.o \
$(OBJDIR)/gwt1disv1idm.o \
$(OBJDIR)/gwt1disu1idm.o \
$(OBJDIR)/gwt1dis1idm.o \
$(OBJDIR)/gwf3npf8idm.o \
$(OBJDIR)/gwf3idm.o \
$(OBJDIR)/gwf3disv8idm.o \
$(OBJDIR)/gwf3disu8idm.o \
$(OBJDIR)/gwf3dis8idm.o \
$(OBJDIR)/STLVecInt.o \
$(OBJDIR)/ModflowInput.o \
$(OBJDIR)/TimeArraySeries.o \
$(OBJDIR)/Integer2dReader.o \
$(OBJDIR)/ObsOutputList.o \
$(OBJDIR)/Observe.o \
$(OBJDIR)/IdmSimDfnSelector.o \
$(OBJDIR)/IdmGwtDfnSelector.o \
$(OBJDIR)/IdmGwfDfnSelector.o \
$(OBJDIR)/StructVector.o \
$(OBJDIR)/IdmLogger.o \
$(OBJDIR)/DefinitionSelect.o \
$(OBJDIR)/InputLoadType.o \
$(OBJDIR)/TimeArraySeriesLink.o \
$(OBJDIR)/Integer1dReader.o \
$(OBJDIR)/Double2dReader.o \
$(OBJDIR)/Double1dReader.o \
$(OBJDIR)/ObsUtility.o \
$(OBJDIR)/ObsContainer.o \
$(OBJDIR)/BudgetFileReader.o \
$(OBJDIR)/IdmDfnSelector.o \
$(OBJDIR)/ArrayReaderBase.o \
$(OBJDIR)/StructArray.o \
$(OBJDIR)/BoundInputContext.o \
$(OBJDIR)/AsciiInputLoadType.o \
$(OBJDIR)/TimeArraySeriesManager.o \
$(OBJDIR)/SourceCommon.o \
$(OBJDIR)/LayeredArrayReader.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)/STLVecInt.o \
$(OBJDIR)/ModflowInput.o \
$(OBJDIR)/MemoryManagerExt.o \
$(OBJDIR)/Integer2dReader.o \
$(OBJDIR)/VirtualBase.o \
$(OBJDIR)/BoundaryPackage.o \
$(OBJDIR)/BaseModel.o \
$(OBJDIR)/PackageBudget.o \
$(OBJDIR)/HeadFileReader.o \
$(OBJDIR)/BudgetObject.o \
$(OBJDIR)/IdmMf6File.o \
$(OBJDIR)/SfrCrossSectionManager.o \
$(OBJDIR)/dag_module.o \
$(OBJDIR)/StructVector.o \
$(OBJDIR)/IdmLogger.o \
$(OBJDIR)/DefinitionSelect.o \
$(OBJDIR)/InputLoadType.o \
$(OBJDIR)/Integer1dReader.o \
$(OBJDIR)/Double2dReader.o \
$(OBJDIR)/Double1dReader.o \
$(OBJDIR)/VirtualDataLists.o \
$(OBJDIR)/VirtualDataContainer.o \
$(OBJDIR)/SimStages.o \
Expand All @@ -172,6 +182,8 @@ $(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 @@ -181,11 +193,6 @@ $(OBJDIR)/GwfVscInputData.o \
$(OBJDIR)/gwf3ghb8.o \
$(OBJDIR)/gwf3drn8.o \
$(OBJDIR)/IndexMap.o \
$(OBJDIR)/StructArray.o \
$(OBJDIR)/BoundInputContext.o \
$(OBJDIR)/AsciiInputLoadType.o \
$(OBJDIR)/SourceCommon.o \
$(OBJDIR)/LayeredArrayReader.o \
$(OBJDIR)/VirtualModel.o \
$(OBJDIR)/BaseExchange.o \
$(OBJDIR)/UzfCellGroup.o \
Expand All @@ -194,13 +201,11 @@ $(OBJDIR)/OutputControlData.o \
$(OBJDIR)/gwf3ic8.o \
$(OBJDIR)/Xt3dInterface.o \
$(OBJDIR)/gwf3tvk8.o \
$(OBJDIR)/IdmLoad.o \
$(OBJDIR)/gwf3vsc8.o \
$(OBJDIR)/GwfNpfOptions.o \
$(OBJDIR)/InterfaceMap.o \
$(OBJDIR)/SeqVector.o \
$(OBJDIR)/StressListInput.o \
$(OBJDIR)/StressGridInput.o \
$(OBJDIR)/LoadMf6File.o \
$(OBJDIR)/CellWithNbrs.o \
$(OBJDIR)/NumericalExchange.o \
$(OBJDIR)/gwf3uzf8.o \
Expand All @@ -218,18 +223,17 @@ $(OBJDIR)/Mover.o \
$(OBJDIR)/GwfMvrPeriodData.o \
$(OBJDIR)/ims8misc.o \
$(OBJDIR)/GwfBuyInputData.o \
$(OBJDIR)/BoundaryPackageExt.o \
$(OBJDIR)/VirtualSolution.o \
$(OBJDIR)/SparseMatrix.o \
$(OBJDIR)/LinearSolverBase.o \
$(OBJDIR)/ims8reordering.o \
$(OBJDIR)/IdmMf6File.o \
$(OBJDIR)/VirtualExchange.o \
$(OBJDIR)/gwf3disu8.o \
$(OBJDIR)/GridSorting.o \
$(OBJDIR)/DisConnExchange.o \
$(OBJDIR)/CsrUtils.o \
$(OBJDIR)/tsp1.o \
$(OBJDIR)/ModelPackageInputs.o \
$(OBJDIR)/gwt1uzt1.o \
$(OBJDIR)/gwt1ssm1.o \
$(OBJDIR)/gwt1src1.o \
Expand Down Expand Up @@ -261,7 +265,6 @@ $(OBJDIR)/gwf3chd8.o \
$(OBJDIR)/RouterBase.o \
$(OBJDIR)/ImsLinearSolver.o \
$(OBJDIR)/ims8base.o \
$(OBJDIR)/SourceLoad.o \
$(OBJDIR)/GridConnection.o \
$(OBJDIR)/DistributedVariable.o \
$(OBJDIR)/gwt1.o \
Expand All @@ -270,7 +273,6 @@ $(OBJDIR)/SerialRouter.o \
$(OBJDIR)/Timer.o \
$(OBJDIR)/LinearSolverFactory.o \
$(OBJDIR)/ims8linear.o \
$(OBJDIR)/IdmLoad.o \
$(OBJDIR)/BaseSolution.o \
$(OBJDIR)/ExplicitModel.o \
$(OBJDIR)/SpatialModelConnection.o \
Expand Down
2 changes: 2 additions & 0 deletions msvs/mf6core.vfproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3api8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3buy8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3chd8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3chd8idm.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3csub8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3dis8.f90"/>
<File RelativePath="..\src\Model\GroundWaterFlow\gwf3dis8idm.f90"/>
Expand Down Expand Up @@ -179,6 +180,7 @@
<File RelativePath="..\src\Model\TransportModel\tsp1.f90"/></Filter>
<Filter Name="ModelUtilities">
<File RelativePath="..\src\Model\ModelUtilities\BoundaryPackage.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\BoundaryPackageExt.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\Connections.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\DiscretizationBase.f90"/>
<File RelativePath="..\src\Model\ModelUtilities\DisvGeom.f90"/>
Expand Down
4 changes: 2 additions & 2 deletions src/Exchange/GwfGwtExchange.f90
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ subroutine gwfbnd2gwtfmi(this)
packobj => GetBndFromList(gwfmodel%bndlist, ip)
call gwtmodel%fmi%gwfpackages(iterm)%set_pointers( &
'SIMVALS', &
packobj%memoryPath)
packobj%memoryPath, packobj%input_mempath)
iterm = iterm + 1
!
! -- If a mover is active for this package, then establish a separate
Expand All @@ -561,7 +561,7 @@ subroutine gwfbnd2gwtfmi(this)
if (imover /= 0) then
call gwtmodel%fmi%gwfpackages(iterm)%set_pointers( &
'SIMTOMVR', &
packobj%memoryPath)
packobj%memoryPath, packobj%input_mempath)
iterm = iterm + 1
end if
end do
Expand Down
17 changes: 10 additions & 7 deletions src/Model/GroundWaterFlow/gwf3.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1254,8 +1254,8 @@ end subroutine allocate_scalars
!! (2) add a pointer to the package
!!
!<
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, inunit, &
iout)
subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, mempath, &
inunit, iout)
! -- modules
use ConstantsModule, only: LINELENGTH
use SimModule, only: store_error
Expand All @@ -1278,6 +1278,7 @@ subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, inunit, &
integer(I4B), intent(in) :: ipakid
integer(I4B), intent(in) :: ipaknum
character(len=*), intent(in) :: pakname
character(len=*), intent(in) :: mempath
integer(I4B), intent(in) :: inunit
integer(I4B), intent(in) :: iout
! -- local
Expand All @@ -1289,7 +1290,8 @@ subroutine package_create(this, filtyp, ipakid, ipaknum, pakname, inunit, &
! -- This part creates the package object
select case (filtyp)
case ('CHD6')
call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
call chd_create(packobj, ipakid, ipaknum, inunit, iout, this%name, &
pakname, mempath)
case ('WEL6')
call wel_create(packobj, ipakid, ipaknum, inunit, iout, this%name, pakname)
case ('DRN6')
Expand Down Expand Up @@ -1432,8 +1434,8 @@ subroutine create_bndpkgs(this, bndpkgs, pkgtypes, pkgnames, &
bndptype = pkgtype
end if
!
call this%package_create(pkgtype, ipakid, ipaknum, pkgname, inunit, &
this%iout)
call this%package_create(pkgtype, ipakid, ipaknum, pkgname, mempath, &
inunit, this%iout)
ipakid = ipakid + 1
ipaknum = ipaknum + 1
end do
Expand Down Expand Up @@ -1541,8 +1543,9 @@ subroutine create_packages(this)
this%inoc = inunit
case ('OBS6')
this%inobs = inunit
case ('WEL6', 'DRN6', 'RIV6', 'GHB6', 'RCH6', 'EVT6', &
'API6', 'CHD6', 'MAW6', 'SFR6', 'LAK6', 'UZF6')
case ('WEL6', 'DRN6', 'RIV6', 'GHB6', 'RCH6', &
'EVT6', 'API6', 'CHD6', 'MAW6', 'SFR6', &
'LAK6', 'UZF6')
call expandarray(bndpkgs)
bndpkgs(size(bndpkgs)) = n
case default
Expand Down
Loading

0 comments on commit 173dc50

Please sign in to comment.