From 1b220d470ccf1f52781b6c23751d9308b7ab9d0a Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Tue, 7 Nov 2023 14:17:04 -0500 Subject: [PATCH] refactor(IC): integrate initial conditions pkg with IDM (#1425) * refactor(IC): integrate initial conditions pkg with IDM * update makefiles * revisions --- make/makefile | 68 ++--- msvs/mf6core.vfproj | 2 + src/Model/GroundWaterFlow/gwf3.f90 | 6 +- src/Model/GroundWaterFlow/gwf3ic8.f90 | 249 ++++++------------ src/Model/GroundWaterFlow/gwf3ic8idm.f90 | 79 ++++++ src/Model/GroundWaterTransport/gwt1ic1idm.f90 | 79 ++++++ src/Model/TransportModel/tsp1.f90 | 6 +- src/Model/TransportModel/tsp1ic1.f90 | 69 +---- .../Idm/selector/IdmGwfDfnSelector.f90 | 11 + .../Idm/selector/IdmGwtDfnSelector.f90 | 11 + src/meson.build | 2 + utils/idmloader/scripts/dfn2f90.py | 8 + 12 files changed, 313 insertions(+), 277 deletions(-) create mode 100644 src/Model/GroundWaterFlow/gwf3ic8idm.f90 create mode 100644 src/Model/GroundWaterTransport/gwt1ic1idm.f90 diff --git a/make/makefile b/make/makefile index 425cb0d5eaa..b8508959f76 100644 --- a/make/makefile +++ b/make/makefile @@ -1,41 +1,40 @@ -# makefile created by pymake (version 1.2.7) for the 'mf6' executable. +# makefile created by pymake (version 1.2.9.dev0) for the 'mf6' executable. include ./makedefaults # Define the source file directories SOURCEDIR1=../src -SOURCEDIR2=../src/Distributed -SOURCEDIR3=../src/Exchange -SOURCEDIR4=../src/Model -SOURCEDIR5=../src/Model/Connection -SOURCEDIR6=../src/Model/Geometry -SOURCEDIR7=../src/Model/GroundWaterFlow -SOURCEDIR8=../src/Model/GroundWaterTransport -SOURCEDIR9=../src/Model/ModelUtilities -SOURCEDIR10=../src/Model/TransportModel -SOURCEDIR11=../src/Solution -SOURCEDIR12=../src/Solution/LinearMethods -SOURCEDIR13=../src/Solution/ParticleTracker -SOURCEDIR14=../src/Solution/PETSc -SOURCEDIR15=../src/Timing -SOURCEDIR16=../src/Utilities -SOURCEDIR17=../src/Utilities/ArrayRead -SOURCEDIR18=../src/Utilities/Idm -SOURCEDIR19=../src/Utilities/Idm/mf6blockfile -SOURCEDIR20=../src/Utilities/Idm/selector -SOURCEDIR21=../src/Utilities/Libraries -SOURCEDIR22=../src/Utilities/Libraries/blas -SOURCEDIR23=../src/Utilities/Libraries/daglib -SOURCEDIR24=../src/Utilities/Libraries/rcm -SOURCEDIR25=../src/Utilities/Libraries/sparsekit -SOURCEDIR26=../src/Utilities/Libraries/sparskit2 -SOURCEDIR27=../src/Utilities/Matrix -SOURCEDIR28=../src/Utilities/Memory -SOURCEDIR29=../src/Utilities/Observation -SOURCEDIR30=../src/Utilities/OutputControl -SOURCEDIR31=../src/Utilities/TimeSeries -SOURCEDIR32=../src/Utilities/Vector +SOURCEDIR2=../src/Exchange +SOURCEDIR3=../src/Distributed +SOURCEDIR4=../src/Solution +SOURCEDIR5=../src/Solution/LinearMethods +SOURCEDIR6=../src/Solution/PETSc +SOURCEDIR7=../src/Timing +SOURCEDIR8=../src/Utilities +SOURCEDIR9=../src/Utilities/Idm +SOURCEDIR10=../src/Utilities/Idm/selector +SOURCEDIR11=../src/Utilities/Idm/mf6blockfile +SOURCEDIR12=../src/Utilities/TimeSeries +SOURCEDIR13=../src/Utilities/Memory +SOURCEDIR14=../src/Utilities/OutputControl +SOURCEDIR15=../src/Utilities/ArrayRead +SOURCEDIR16=../src/Utilities/Libraries +SOURCEDIR17=../src/Utilities/Libraries/rcm +SOURCEDIR18=../src/Utilities/Libraries/blas +SOURCEDIR19=../src/Utilities/Libraries/sparskit2 +SOURCEDIR20=../src/Utilities/Libraries/daglib +SOURCEDIR21=../src/Utilities/Libraries/sparsekit +SOURCEDIR22=../src/Utilities/Vector +SOURCEDIR23=../src/Utilities/Matrix +SOURCEDIR24=../src/Utilities/Observation +SOURCEDIR25=../src/Model +SOURCEDIR26=../src/Model/Connection +SOURCEDIR27=../src/Model/GroundWaterTransport +SOURCEDIR28=../src/Model/ModelUtilities +SOURCEDIR29=../src/Model/GroundWaterFlow +SOURCEDIR30=../src/Model/TransportModel +SOURCEDIR31=../src/Model/Geometry VPATH = \ ${SOURCEDIR1} \ @@ -68,8 +67,7 @@ ${SOURCEDIR27} \ ${SOURCEDIR28} \ ${SOURCEDIR29} \ ${SOURCEDIR30} \ -${SOURCEDIR31} \ -$(SOURCEDIR32) +${SOURCEDIR31} .SUFFIXES: .f90 .F90 .o @@ -98,6 +96,7 @@ $(OBJDIR)/DevFeature.o \ $(OBJDIR)/MemoryList.o \ $(OBJDIR)/simnamidm.o \ $(OBJDIR)/gwt1idm.o \ +$(OBJDIR)/gwt1ic1idm.o \ $(OBJDIR)/gwt1dsp1idm.o \ $(OBJDIR)/gwt1disv1idm.o \ $(OBJDIR)/gwt1disu1idm.o \ @@ -109,6 +108,7 @@ $(OBJDIR)/gwf3rch8idm.o \ $(OBJDIR)/gwf3rcha8idm.o \ $(OBJDIR)/gwf3npf8idm.o \ $(OBJDIR)/gwf3idm.o \ +$(OBJDIR)/gwf3ic8idm.o \ $(OBJDIR)/gwf3ghb8idm.o \ $(OBJDIR)/gwf3evt8idm.o \ $(OBJDIR)/gwf3evta8idm.o \ diff --git a/msvs/mf6core.vfproj b/msvs/mf6core.vfproj index dbc042f220d..a9b6413ba3c 100644 --- a/msvs/mf6core.vfproj +++ b/msvs/mf6core.vfproj @@ -139,6 +139,7 @@ + @@ -171,6 +172,7 @@ + diff --git a/src/Model/GroundWaterFlow/gwf3.f90 b/src/Model/GroundWaterFlow/gwf3.f90 index 3f17c8bc77c..8871a49cb18 100644 --- a/src/Model/GroundWaterFlow/gwf3.f90 +++ b/src/Model/GroundWaterFlow/gwf3.f90 @@ -1497,6 +1497,7 @@ subroutine create_packages(this) integer(I4B) :: n integer(I4B) :: indis = 0 ! DIS enabled flag character(len=LENMEMPATH) :: mempathnpf = '' + character(len=LENMEMPATH) :: mempathic = '' ! ! -- set input model memory path model_mempath = create_mem_path(component=this%name, context=idm_context) @@ -1542,7 +1543,8 @@ subroutine create_packages(this) case ('CSUB6') this%incsub = inunit case ('IC6') - this%inic = inunit + this%inic = 1 + mempathic = mempath case ('MVR6') this%inmvr = inunit case ('OC6') @@ -1569,7 +1571,7 @@ subroutine create_packages(this) call sto_cr(this%sto, this%name, this%insto, this%iout) call csub_cr(this%csub, this%name, this%insto, this%sto%packName, & this%incsub, this%iout) - call ic_cr(this%ic, this%name, this%inic, this%iout, this%dis) + call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis) call mvr_cr(this%mvr, this%name, this%inmvr, this%iout, this%dis) call oc_cr(this%oc, this%name, this%inoc, this%iout) call gwf_obs_cr(this%obs, this%inobs) diff --git a/src/Model/GroundWaterFlow/gwf3ic8.f90 b/src/Model/GroundWaterFlow/gwf3ic8.f90 index 033f565819b..e75de23bba2 100644 --- a/src/Model/GroundWaterFlow/gwf3ic8.f90 +++ b/src/Model/GroundWaterFlow/gwf3ic8.f90 @@ -1,6 +1,7 @@ module GwfIcModule - use KindModule, only: DP, I4B + use KindModule, only: DP, I4B, LGP + use ConstantsModule, only: LINELENGTH use NumericalPackageModule, only: NumericalPackageType use BlockParserModule, only: BlockParserType use BaseDisModule, only: DisBaseType @@ -15,234 +16,136 @@ module GwfIcModule contains procedure :: ic_ar procedure :: ic_da + procedure, private :: ic_load procedure, private :: allocate_arrays - procedure, private :: read_options - procedure :: read_data + procedure, private :: source_griddata end type GwfIcType contains - subroutine ic_cr(ic, name_model, inunit, iout, dis) -! ****************************************************************************** -! ic_cr -- Create a new initial conditions object -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ + !> @brief Create a new initial conditions object + subroutine ic_cr(ic, name_model, input_mempath, inunit, iout, dis) + ! -- modules + use MemoryManagerExtModule, only: mem_set_value ! -- dummy type(GwfIcType), pointer :: ic character(len=*), intent(in) :: name_model + character(len=*), intent(in) :: input_mempath integer(I4B), intent(in) :: inunit integer(I4B), intent(in) :: iout class(DisBaseType), pointer, intent(in) :: dis -! ------------------------------------------------------------------------------ - ! - ! -- Create the object + ! -- formats + character(len=*), parameter :: fmtic = & + "(1x, /1x, 'IC -- Initial Conditions Package, Version 8, 3/28/2015', & + &' input read from mempath: ', A, //)" + + ! -- create IC object allocate (ic) - ! + ! -- create name and memory path - call ic%set_names(1, name_model, 'IC', 'IC') - ! - ! -- Allocate scalars + call ic%set_names(1, name_model, 'IC', 'IC', input_mempath) + + ! -- allocate scalars call ic%allocate_scalars() - ! + + ! -- set variables ic%inunit = inunit ic%iout = iout - ! + ! -- set pointers ic%dis => dis - ! - ! -- Initialize block parser - call ic%parser%Initialize(ic%inunit, ic%iout) - ! - ! -- Return - return + + ! -- check if pkg is enabled, + if (inunit > 0) then + ! print message identifying pkg + write (ic%iout, fmtic) input_mempath + end if end subroutine ic_cr - subroutine ic_ar(this, x) -! ****************************************************************************** -! ic_ar -- Allocate and read initial conditions -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ - ! -- modules + !> @brief Load data from IDM into package + subroutine ic_load(this) use BaseDisModule, only: DisBaseType - use SimModule, only: store_error - ! -- dummy + class(GwfIcType) :: this + call this%source_griddata() + end subroutine ic_load + + !> @brief Allocate arrays, load from IDM, and assign head. + subroutine ic_ar(this, x) class(GwfIcType) :: this real(DP), dimension(:), intent(inout) :: x - ! -- locals integer(I4B) :: n -! ------------------------------------------------------------------------------ - ! - ! -- Print a message identifying the initial conditions package. - write (this%iout, 1) this%inunit -1 format(1x, /1x, 'IC -- INITIAL CONDITIONS PACKAGE, VERSION 8, 3/28/2015', & - ' INPUT READ FROM UNIT ', i0) - ! - ! -- Allocate arrays + + ! -- allocate arrays call this%allocate_arrays(this%dis%nodes) - ! - ! -- Read options - call this%read_options() - ! - ! -- Read data - call this%read_data() - ! - ! -- Assign x equal to strt + + ! -- load from IDM + call this%ic_load() + + ! -- assign starting head do n = 1, this%dis%nodes x(n) = this%strt(n) end do - ! - ! -- Return - return end subroutine ic_ar + !> @brief Deallocate subroutine ic_da(this) -! ****************************************************************************** -! ic_da -- Deallocate -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_deallocate + use MemoryManagerExtModule, only: memorylist_remove + use SimVariablesModule, only: idm_context ! -- dummy class(GwfIcType) :: this -! ------------------------------------------------------------------------------ ! - ! -- deallocate parent - call this%NumericalPackageType%da() + ! -- deallocate IDM memory + call memorylist_remove(this%name_model, 'IC', idm_context) ! - ! -- Scalars - ! - ! -- Arrays + ! -- deallocate arrays call mem_deallocate(this%strt) ! - ! -- Return - return + ! -- deallocate parent + call this%NumericalPackageType%da() end subroutine ic_da + ! @brief Allocate arrays subroutine allocate_arrays(this, nodes) -! ****************************************************************************** -! allocate_arrays -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ ! -- modules use MemoryManagerModule, only: mem_allocate ! -- dummy class(GwfIcType) :: this integer(I4B), intent(in) :: nodes - ! -- local -! ------------------------------------------------------------------------------ ! ! -- Allocate call mem_allocate(this%strt, nodes, 'STRT', this%memoryPath) - ! - ! -- Return - return end subroutine allocate_arrays - subroutine read_options(this) -! ****************************************************************************** -! read_options -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ + !> @brief Copy grid data from IDM into package + subroutine source_griddata(this) ! -- modules - use ConstantsModule, only: LINELENGTH - use SimModule, only: store_error + use SimModule, only: store_error, store_error_filename + use MemoryManagerExtModule, only: mem_set_value + use GwfIcInputModule, only: GwfIcParamFoundType ! -- dummy class(GwfIcType) :: this ! -- local - character(len=LINELENGTH) :: errmsg, keyword - integer(I4B) :: ierr - logical :: isfound, endOfBlock - ! -- formats -! ------------------------------------------------------------------------------ - ! - ! -- get options block - call this%parser%GetBlock('OPTIONS', isfound, ierr, & - supportOpenClose=.true., blockRequired=.false.) - ! - ! -- parse options block if detected - if (isfound) then - write (this%iout, '(1x,a)') 'PROCESSING IC OPTIONS' - do - call this%parser%GetNextLine(endOfBlock) - if (endOfBlock) exit - call this%parser%GetStringCaps(keyword) - select case (keyword) - case default - write (errmsg, '(a,a)') 'Unknown IC option: ', trim(keyword) - call store_error(errmsg) - call this%parser%StoreErrorUnit() - end select - end do - write (this%iout, '(1x,a)') 'END OF IC OPTIONS' - end if - ! - ! -- Return - return - end subroutine read_options - - subroutine read_data(this) -! ****************************************************************************** -! read_data -! ****************************************************************************** -! -! SPECIFICATIONS: -! ------------------------------------------------------------------------------ - ! -- modules - use ConstantsModule, only: LINELENGTH - use SimModule, only: store_error - ! -- dummy - class(GwfIcType) :: this - ! -- local - character(len=LINELENGTH) :: errmsg, keyword - character(len=:), allocatable :: line - integer(I4B) :: istart, istop, lloc, ierr - logical :: isfound, endOfBlock - character(len=24) :: aname(1) - ! -- formats -! ------------------------------------------------------------------------------ - ! - ! -- Setup the label - aname(1) = ' INITIAL HEAD' - ! - ! -- get griddata block - call this%parser%GetBlock('GRIDDATA', isfound, ierr) - if (isfound) then - write (this%iout, '(1x,a)') 'PROCESSING GRIDDATA' - do - call this%parser%GetNextLine(endOfBlock) - if (endOfBlock) exit - call this%parser%GetStringCaps(keyword) - call this%parser%GetRemainingLine(line) - lloc = 1 - select case (keyword) - case ('STRT') - call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, & - this%parser%iuactive, this%strt, & - aname(1)) - case default - write (errmsg, '(a,a)') 'Unknown GRIDDATA tag: ', trim(keyword) - call store_error(errmsg) - call this%parser%StoreErrorUnit() - end select - end do - write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA' - else - call store_error('Required GRIDDATA block not found.') - call this%parser%StoreErrorUnit() + character(len=LINELENGTH) :: errmsg + type(GwfIcParamFoundType) :: found + integer(I4B), dimension(:), pointer, contiguous :: map + ! + ! -- set map to convert user to reduced node data + map => null() + if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser + ! + ! -- set values + call mem_set_value(this%strt, 'STRT', this%input_mempath, map, found%strt) + ! + ! -- ensure STRT was found + if (.not. found%strt) then + write (errmsg, '(a)') 'Error in GRIDDATA block: STRT not found.' + call store_error(errmsg, terminate=.false.) + call store_error_filename(this%input_fname) + else if (this%iout > 0) then + write (this%iout, '(4x,a)') 'STRT set from input file' end if - ! - ! -- Return - return - end subroutine read_data + end subroutine source_griddata end module GwfIcModule diff --git a/src/Model/GroundWaterFlow/gwf3ic8idm.f90 b/src/Model/GroundWaterFlow/gwf3ic8idm.f90 new file mode 100644 index 00000000000..f943a35dc98 --- /dev/null +++ b/src/Model/GroundWaterFlow/gwf3ic8idm.f90 @@ -0,0 +1,79 @@ +! ** Do Not Modify! MODFLOW 6 system generated file. ** +module GwfIcInputModule + use ConstantsModule, only: LENVARNAME + use InputDefinitionModule, only: InputParamDefinitionType, & + InputBlockDefinitionType + private + public gwf_ic_param_definitions + public gwf_ic_aggregate_definitions + public gwf_ic_block_definitions + public GwfIcParamFoundType + public gwf_ic_multi_package + + type GwfIcParamFoundType + logical :: strt = .false. + end type GwfIcParamFoundType + + logical :: gwf_ic_multi_package = .false. + + type(InputParamDefinitionType), parameter :: & + gwfic_strt = InputParamDefinitionType & + ( & + 'GWF', & ! component + 'IC', & ! subcomponent + 'GRIDDATA', & ! block + 'STRT', & ! tag name + 'STRT', & ! fortran variable + 'DOUBLE1D', & ! type + 'NODES', & ! shape + .true., & ! required + .false., & ! multi-record + .false., & ! preserve case + .true., & ! layered + .false. & ! timeseries + ) + + type(InputParamDefinitionType), parameter :: & + gwf_ic_param_definitions(*) = & + [ & + gwfic_strt & + ] + + type(InputParamDefinitionType), parameter :: & + gwf_ic_aggregate_definitions(*) = & + [ & + InputParamDefinitionType & + ( & + '', & ! component + '', & ! subcomponent + '', & ! block + '', & ! tag name + '', & ! fortran variable + '', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) & + ] + + type(InputBlockDefinitionType), parameter :: & + gwf_ic_block_definitions(*) = & + [ & + InputBlockDefinitionType( & + 'OPTIONS', & ! blockname + .false., & ! required + .false., & ! aggregate + .false. & ! block_variable + ), & + InputBlockDefinitionType( & + 'GRIDDATA', & ! blockname + .true., & ! required + .false., & ! aggregate + .false. & ! block_variable + ) & + ] + +end module GwfIcInputModule diff --git a/src/Model/GroundWaterTransport/gwt1ic1idm.f90 b/src/Model/GroundWaterTransport/gwt1ic1idm.f90 new file mode 100644 index 00000000000..a2fa79f8d63 --- /dev/null +++ b/src/Model/GroundWaterTransport/gwt1ic1idm.f90 @@ -0,0 +1,79 @@ +! ** Do Not Modify! MODFLOW 6 system generated file. ** +module GwtIcInputModule + use ConstantsModule, only: LENVARNAME + use InputDefinitionModule, only: InputParamDefinitionType, & + InputBlockDefinitionType + private + public gwt_ic_param_definitions + public gwt_ic_aggregate_definitions + public gwt_ic_block_definitions + public GwtIcParamFoundType + public gwt_ic_multi_package + + type GwtIcParamFoundType + logical :: strt = .false. + end type GwtIcParamFoundType + + logical :: gwt_ic_multi_package = .false. + + type(InputParamDefinitionType), parameter :: & + gwtic_strt = InputParamDefinitionType & + ( & + 'GWT', & ! component + 'IC', & ! subcomponent + 'GRIDDATA', & ! block + 'STRT', & ! tag name + 'STRT', & ! fortran variable + 'DOUBLE1D', & ! type + 'NODES', & ! shape + .true., & ! required + .false., & ! multi-record + .false., & ! preserve case + .true., & ! layered + .false. & ! timeseries + ) + + type(InputParamDefinitionType), parameter :: & + gwt_ic_param_definitions(*) = & + [ & + gwtic_strt & + ] + + type(InputParamDefinitionType), parameter :: & + gwt_ic_aggregate_definitions(*) = & + [ & + InputParamDefinitionType & + ( & + '', & ! component + '', & ! subcomponent + '', & ! block + '', & ! tag name + '', & ! fortran variable + '', & ! type + '', & ! shape + .false., & ! required + .false., & ! multi-record + .false., & ! preserve case + .false., & ! layered + .false. & ! timeseries + ) & + ] + + type(InputBlockDefinitionType), parameter :: & + gwt_ic_block_definitions(*) = & + [ & + InputBlockDefinitionType( & + 'OPTIONS', & ! blockname + .false., & ! required + .false., & ! aggregate + .false. & ! block_variable + ), & + InputBlockDefinitionType( & + 'GRIDDATA', & ! blockname + .true., & ! required + .false., & ! aggregate + .false. & ! block_variable + ) & + ] + +end module GwtIcInputModule diff --git a/src/Model/TransportModel/tsp1.f90 b/src/Model/TransportModel/tsp1.f90 index 1ed3e16b313..00c999e2c18 100644 --- a/src/Model/TransportModel/tsp1.f90 +++ b/src/Model/TransportModel/tsp1.f90 @@ -778,6 +778,7 @@ subroutine create_tsp_packages(this, indis) character(len=LENMEMPATH) :: mempath integer(I4B), pointer :: inunit integer(I4B) :: n + character(len=LENMEMPATH) :: mempathic = '' ! ! -- Initialize indis = 0 @@ -811,7 +812,8 @@ subroutine create_tsp_packages(this, indis) indis = 1 call disu_cr(this%dis, this%name, mempath, indis, this%iout) case ('IC6') - this%inic = inunit + this%inic = 1 + mempathic = mempath case ('FMI6') this%infmi = inunit case ('MVT6') @@ -830,7 +832,7 @@ subroutine create_tsp_packages(this, indis) end do ! ! -- Create packages that are tied directly to model - call ic_cr(this%ic, this%name, this%inic, this%iout, this%dis, & + call ic_cr(this%ic, this%name, mempathic, this%inic, this%iout, this%dis, & this%depvartype) call fmi_cr(this%fmi, this%name, this%infmi, this%iout, this%eqnsclfac, & this%depvartype) diff --git a/src/Model/TransportModel/tsp1ic1.f90 b/src/Model/TransportModel/tsp1ic1.f90 index cb060cfb658..e36ca15a88e 100644 --- a/src/Model/TransportModel/tsp1ic1.f90 +++ b/src/Model/TransportModel/tsp1ic1.f90 @@ -15,21 +15,17 @@ module TspIcModule type, extends(GwfIcType) :: TspIcType ! -- strings character(len=LENVARNAME) :: depvartype = '' - - contains - - procedure :: read_data - end type TspIcType contains !> @brief Create a new initial conditions object !< - subroutine ic_cr(ic, name_model, inunit, iout, dis, depvartype) + subroutine ic_cr(ic, name_model, input_mempath, inunit, iout, dis, depvartype) ! -- dummy type(TspIcType), pointer :: ic character(len=*), intent(in) :: name_model + character(len=*), intent(in) :: input_mempath integer(I4B), intent(in) :: inunit integer(I4B), intent(in) :: iout class(DisBaseType), pointer, intent(in) :: dis @@ -39,7 +35,7 @@ subroutine ic_cr(ic, name_model, inunit, iout, dis, depvartype) allocate (ic) ! ! -- create name and memory path - call ic%set_names(1, name_model, 'IC', 'IC') + call ic%set_names(1, name_model, 'IC', 'IC', input_mempath) ! ! -- Allocate scalars call ic%allocate_scalars() @@ -52,65 +48,6 @@ subroutine ic_cr(ic, name_model, inunit, iout, dis, depvartype) ! ! -- Give package access to the assigned labelsd based on dependent variable ic%depvartype = depvartype - ! - ! -- Initialize block parser - call ic%parser%Initialize(ic%inunit, ic%iout) - ! - ! -- Return - return end subroutine ic_cr - !> @brief Read initial conditions - !! - !! Read initial concentrations or temperatures depending on model type - !< - subroutine read_data(this) - ! -- modules - use ConstantsModule, only: LINELENGTH - use SimModule, only: store_error - ! -- dummy - class(TspIcType) :: this - ! -- local - character(len=LINELENGTH) :: errmsg, keyword - character(len=:), allocatable :: line - integer(I4B) :: istart, istop, lloc, ierr - logical :: isfound, endOfBlock - character(len=24) :: aname(1) - ! -- formats - ! - ! -- Setup the label - write (aname(1), '(a,1x,a)') 'INITIAL', trim(adjustl(this%depvartype)) - ! - ! -- get griddata block - call this%parser%GetBlock('GRIDDATA', isfound, ierr) - if (isfound) then - write (this%iout, '(1x,a)') 'PROCESSING GRIDDATA' - do - call this%parser%GetNextLine(endOfBlock) - if (endOfBlock) exit - call this%parser%GetStringCaps(keyword) - call this%parser%GetRemainingLine(line) - lloc = 1 - select case (keyword) - case ('STRT') - call this%dis%read_grid_array(line, lloc, istart, istop, this%iout, & - this%parser%iuactive, this%strt, & - aname(1)) - case default - write (errmsg, '(a,a)') 'Unknown GRIDDATA tag: ', & - trim(keyword) - call store_error(errmsg) - call this%parser%StoreErrorUnit() - end select - end do - write (this%iout, '(1x,a)') 'END PROCESSING GRIDDATA' - else - call store_error('Required GRIDDATA block not found.') - call this%parser%StoreErrorUnit() - end if - ! - ! -- Return - return - end subroutine read_data - end module TspIcModule diff --git a/src/Utilities/Idm/selector/IdmGwfDfnSelector.f90 b/src/Utilities/Idm/selector/IdmGwfDfnSelector.f90 index daa1162dd4e..7cfc9ccd101 100644 --- a/src/Utilities/Idm/selector/IdmGwfDfnSelector.f90 +++ b/src/Utilities/Idm/selector/IdmGwfDfnSelector.f90 @@ -13,6 +13,7 @@ module IdmGwfDfnSelectorModule use GwfEvtInputModule use GwfEvtaInputModule use GwfGhbInputModule + use GwfIcInputModule use GwfNpfInputModule use GwfRchInputModule use GwfRchaInputModule @@ -63,6 +64,8 @@ function gwf_param_definitions(subcomponent) result(input_definition) call set_param_pointer(input_definition, gwf_evta_param_definitions) case ('GHB') call set_param_pointer(input_definition, gwf_ghb_param_definitions) + case ('IC') + call set_param_pointer(input_definition, gwf_ic_param_definitions) case ('NPF') call set_param_pointer(input_definition, gwf_npf_param_definitions) case ('RCH') @@ -101,6 +104,8 @@ function gwf_aggregate_definitions(subcomponent) result(input_definition) call set_param_pointer(input_definition, gwf_evta_aggregate_definitions) case ('GHB') call set_param_pointer(input_definition, gwf_ghb_aggregate_definitions) + case ('IC') + call set_param_pointer(input_definition, gwf_ic_aggregate_definitions) case ('NPF') call set_param_pointer(input_definition, gwf_npf_aggregate_definitions) case ('RCH') @@ -139,6 +144,8 @@ function gwf_block_definitions(subcomponent) result(input_definition) call set_block_pointer(input_definition, gwf_evta_block_definitions) case ('GHB') call set_block_pointer(input_definition, gwf_ghb_block_definitions) + case ('IC') + call set_block_pointer(input_definition, gwf_ic_block_definitions) case ('NPF') call set_block_pointer(input_definition, gwf_npf_block_definitions) case ('RCH') @@ -176,6 +183,8 @@ function gwf_idm_multi_package(subcomponent) result(multi_package) multi_package = gwf_evta_multi_package case ('GHB') multi_package = gwf_ghb_multi_package + case ('IC') + multi_package = gwf_ic_multi_package case ('NPF') multi_package = gwf_npf_multi_package case ('RCH') @@ -217,6 +226,8 @@ function gwf_idm_integrated(subcomponent) result(integrated) integrated = .true. case ('GHB') integrated = .true. + case ('IC') + integrated = .true. case ('NPF') integrated = .true. case ('RCH') diff --git a/src/Utilities/Idm/selector/IdmGwtDfnSelector.f90 b/src/Utilities/Idm/selector/IdmGwtDfnSelector.f90 index 72b56b37b8b..f9e71164ffa 100644 --- a/src/Utilities/Idm/selector/IdmGwtDfnSelector.f90 +++ b/src/Utilities/Idm/selector/IdmGwtDfnSelector.f90 @@ -10,6 +10,7 @@ module IdmGwtDfnSelectorModule use GwtDisvInputModule use GwtDspInputModule use GwtCncInputModule + use GwtIcInputModule use GwtNamInputModule implicit none @@ -49,6 +50,8 @@ function gwt_param_definitions(subcomponent) result(input_definition) call set_param_pointer(input_definition, gwt_dsp_param_definitions) case ('CNC') call set_param_pointer(input_definition, gwt_cnc_param_definitions) + case ('IC') + call set_param_pointer(input_definition, gwt_ic_param_definitions) case ('NAM') call set_param_pointer(input_definition, gwt_nam_param_definitions) case default @@ -71,6 +74,8 @@ function gwt_aggregate_definitions(subcomponent) result(input_definition) call set_param_pointer(input_definition, gwt_dsp_aggregate_definitions) case ('CNC') call set_param_pointer(input_definition, gwt_cnc_aggregate_definitions) + case ('IC') + call set_param_pointer(input_definition, gwt_ic_aggregate_definitions) case ('NAM') call set_param_pointer(input_definition, gwt_nam_aggregate_definitions) case default @@ -93,6 +98,8 @@ function gwt_block_definitions(subcomponent) result(input_definition) call set_block_pointer(input_definition, gwt_dsp_block_definitions) case ('CNC') call set_block_pointer(input_definition, gwt_cnc_block_definitions) + case ('IC') + call set_block_pointer(input_definition, gwt_ic_block_definitions) case ('NAM') call set_block_pointer(input_definition, gwt_nam_block_definitions) case default @@ -114,6 +121,8 @@ function gwt_idm_multi_package(subcomponent) result(multi_package) multi_package = gwt_dsp_multi_package case ('CNC') multi_package = gwt_cnc_multi_package + case ('IC') + multi_package = gwt_ic_multi_package case ('NAM') multi_package = gwt_nam_multi_package case default @@ -139,6 +148,8 @@ function gwt_idm_integrated(subcomponent) result(integrated) integrated = .true. case ('CNC') integrated = .true. + case ('IC') + integrated = .true. case ('NAM') integrated = .true. case default diff --git a/src/meson.build b/src/meson.build index c5ee53ab891..3367f2c0924 100644 --- a/src/meson.build +++ b/src/meson.build @@ -67,6 +67,7 @@ modflow_sources = files( 'Model' / 'GroundWaterFlow' / 'gwf3ghb8idm.f90', 'Model' / 'GroundWaterFlow' / 'gwf3hfb8.f90', 'Model' / 'GroundWaterFlow' / 'gwf3ic8.f90', + 'Model' / 'GroundWaterFlow' / 'gwf3ic8idm.f90', 'Model' / 'GroundWaterFlow' / 'gwf3idm.f90', 'Model' / 'GroundWaterFlow' / 'gwf3lak8.f90', 'Model' / 'GroundWaterFlow' / 'gwf3maw8.f90', @@ -98,6 +99,7 @@ modflow_sources = files( 'Model' / 'GroundWaterTransport' / 'gwt1disv1idm.f90', 'Model' / 'GroundWaterTransport' / 'gwt1dsp1.f90', 'Model' / 'GroundWaterTransport' / 'gwt1dsp1idm.f90', + 'Model' / 'GroundWaterTransport' / 'gwt1ic1idm.f90', 'Model' / 'GroundWaterTransport' / 'gwt1idm.f90', 'Model' / 'GroundWaterTransport' / 'gwt1ist1.f90', 'Model' / 'GroundWaterTransport' / 'gwt1lkt1.f90', diff --git a/utils/idmloader/scripts/dfn2f90.py b/utils/idmloader/scripts/dfn2f90.py index 965cdff2b34..75f7c4b4bce 100644 --- a/utils/idmloader/scripts/dfn2f90.py +++ b/utils/idmloader/scripts/dfn2f90.py @@ -893,6 +893,10 @@ def _write_master_component(self, fh=None): Path("../../../doc/mf6io/mf6ivar/dfn", "gwf-ghb.dfn"), Path("../../../src/Model/GroundWaterFlow", "gwf3ghb8idm.f90"), ], + [ + Path("../../../doc/mf6io/mf6ivar/dfn", "gwf-ic.dfn"), + Path("../../../src/Model/GroundWaterFlow", "gwf3ic8idm.f90"), + ], [ Path("../../../doc/mf6io/mf6ivar/dfn", "gwf-npf.dfn"), Path("../../../src/Model/GroundWaterFlow", "gwf3npf8idm.f90"), @@ -933,6 +937,10 @@ def _write_master_component(self, fh=None): Path("../../../doc/mf6io/mf6ivar/dfn", "gwt-cnc.dfn"), Path("../../../src/Model/GroundWaterTransport", "gwt1cnc1idm.f90"), ], + [ + Path("../../../doc/mf6io/mf6ivar/dfn", "gwt-ic.dfn"), + Path("../../../src/Model/GroundWaterTransport", "gwt1ic1idm.f90"), + ], [ Path("../../../doc/mf6io/mf6ivar/dfn", "gwf-nam.dfn"), Path("../../../src/Model/GroundWaterFlow", "gwf3idm.f90"),