diff --git a/src/Utilities/Idm/SourceContext.f90 b/src/Utilities/Idm/SourceContext.f90 index b833f31e6ec..3f25ef7d75f 100644 --- a/src/Utilities/Idm/SourceContext.f90 +++ b/src/Utilities/Idm/SourceContext.f90 @@ -23,7 +23,7 @@ module InputModelContextModule !> @brief type for storing model context !! - !! This type is used to store a list of context objects + !! This type is used to store a set of context objects !! associated with a model. Add additional context types as !! appropriate. !! @@ -31,7 +31,7 @@ module InputModelContextModule type :: ModelContextType character(len=LENMODELNAME) :: modelname !< name of model character(len=LINELENGTH) :: modelfname !< name of model input file - type(NC4ModelInputsType), pointer :: nc4_context + type(NC4ModelInputsType), pointer :: nc4_context !< model netcdf context contains procedure :: init => modelctx_init procedure :: destroy => modelctx_destroy @@ -148,7 +148,11 @@ subroutine ModelContextDestroy() return end subroutine ModelContextDestroy - !> @brief get model context object from list + !> @brief add netcdf context to model context object + !! + !! Add netcdf context to a model on the model context list. + !! If model context object does not exist, create and add + !! to the model context list. !! !< subroutine AddModelNC4Context(modelname, modelfname, nc4_context) @@ -177,7 +181,10 @@ subroutine AddModelNC4Context(modelname, modelfname, nc4_context) return end subroutine AddModelNC4Context - !> @brief get model context object from list + !> @brief get netcdf context associated with model + !! + !! Retrieve and return netcdf context associated with a model + !! context object on the model context list. !! !< function GetModelNC4Context(modelname) result(nc4_context) diff --git a/src/Utilities/Idm/mf6blockfile/AsciiInputLoadType.f90 b/src/Utilities/Idm/mf6blockfile/AsciiInputLoadType.f90 index 081f31f1579..978559b83c9 100644 --- a/src/Utilities/Idm/mf6blockfile/AsciiInputLoadType.f90 +++ b/src/Utilities/Idm/mf6blockfile/AsciiInputLoadType.f90 @@ -8,8 +8,10 @@ module AsciiInputLoadTypeModule use KindModule, only: DP, I4B, LGP + use ConstantsModule, only: LENVARNAME use InputLoadTypeModule, only: DynamicPkgLoadType use BlockParserModule, only: BlockParserType + use BoundInputContextModule, only: BoundInputContextType implicit none private @@ -19,6 +21,10 @@ module AsciiInputLoadTypeModule !! !< type, abstract, extends(DynamicPkgLoadType) :: AsciiDynamicPkgLoadBaseType + integer(I4B) :: nparam + character(len=LENVARNAME), dimension(:), & + allocatable :: param_names !< dynamic param names + type(BoundInputContextType) :: bndctx contains procedure(ascii_period_load_if), deferred :: rp end type AsciiDynamicPkgLoadBaseType diff --git a/src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 b/src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 index b2845e1d74a..8f0fe795be4 100644 --- a/src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 +++ b/src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 @@ -36,7 +36,7 @@ module IdmMf6FileModule !! !< type :: PackageLoad - procedure(IPackageLoad), nopass, pointer, public :: load_package => null() !< procedure pointer to the load routine + procedure(IPackageLoad), nopass, pointer, public :: load_package !< procedure pointer to the load routine end type PackageLoad abstract interface @@ -63,9 +63,9 @@ end subroutine IPackageLoad !< type, extends(DynamicPkgLoadBaseType) :: Mf6FileDynamicPkgLoadType type(BlockParserType), pointer :: parser !< parser for MF6File period blocks - integer(I4B), pointer :: iper => null() - integer(I4B), pointer :: ionper => null() - class(AsciiDynamicPkgLoadBaseType), pointer :: block_loader => null() + integer(I4B), pointer :: iper + integer(I4B), pointer :: ionper + class(AsciiDynamicPkgLoadBaseType), pointer :: rp_loader contains procedure :: init => dynamic_init procedure :: df => dynamic_df @@ -104,6 +104,9 @@ subroutine input_load(filename, mf6_input, component_filename, iout, & type(PackageLoad) :: pkgloader integer(I4B) :: inunit ! + ! -- initialize + nullify (pkgloader%load_package) + ! ! -- set parser based package loader by file type select case (mf6_input%pkgtype) case default @@ -156,15 +159,17 @@ end subroutine static_init !> @brief load routine for static loader !< - function static_load(this, iout) result(period_loader) + function static_load(this, iout) result(rp_loader) class(Mf6FileStaticPkgLoadType), intent(inout) :: this integer(I4B), intent(in) :: iout - class(DynamicPkgLoadBaseType), pointer :: period_loader - class(Mf6FileDynamicPkgLoadType), pointer :: mf6_loader => null() - type(BlockParserType), pointer :: parser => null() + class(DynamicPkgLoadBaseType), pointer :: rp_loader + class(Mf6FileDynamicPkgLoadType), pointer :: mf6_loader + type(BlockParserType), pointer :: parser ! ! -- initialize - nullify (period_loader) + nullify (rp_loader) + nullify (mf6_loader) + nullify (parser) ! ! -- load model package to input context if (this%iperblock > 0) then @@ -185,7 +190,7 @@ function static_load(this, iout) result(period_loader) call mf6_loader%set(parser) ! ! -- set return pointer to base dynamic loader - period_loader => mf6_loader + rp_loader => mf6_loader ! else ! @@ -228,6 +233,8 @@ subroutine dynamic_init(this, mf6_input, modelname, modelfname, source, & call mem_allocate(this%iper, 'IPER', this%mf6_input%mempath) call mem_allocate(this%ionper, 'IONPER', this%mf6_input%mempath) ! + ! -- initialize package + nullify (this%rp_loader) this%iper = 0 this%ionper = 0 ! @@ -261,7 +268,7 @@ subroutine dynamic_df(this) ! -- read first iper call this%read_ionper() ! - call this%block_loader%df() + call this%rp_loader%df() ! ! -- return return @@ -272,7 +279,7 @@ end subroutine dynamic_df subroutine dynamic_ad(this) class(Mf6FileDynamicPkgLoadType), intent(inout) :: this ! - call this%block_loader%ad() + call this%rp_loader%ad() ! ! -- return return @@ -283,7 +290,6 @@ end subroutine dynamic_ad subroutine dynamic_rp(this) ! -- modules use TdisModule, only: kper, nper - use MemoryManagerModule, only: mem_setptr ! -- dummy class(Mf6FileDynamicPkgLoadType), intent(inout) :: this ! -- locals @@ -292,7 +298,7 @@ subroutine dynamic_rp(this) if (this%ionper /= kper) return ! ! -- dynamic load - call this%block_loader%rp(this%parser) + call this%rp_loader%rp(this%parser) ! ! -- update loaded iper this%iper = kper @@ -372,19 +378,19 @@ subroutine dynamic_create_loader(this) ! -- allocate and set loader if (this%readasarrays) then allocate (grid_loader) - this%block_loader => grid_loader + this%rp_loader => grid_loader else allocate (list_loader) - this%block_loader => list_loader + this%rp_loader => list_loader end if ! ! -- initialize loader - call this%block_loader%init(this%mf6_input, & - this%modelname, & - this%modelfname, & - this%sourcename, & - this%iperblock, & - this%iout) + call this%rp_loader%init(this%mf6_input, & + this%modelname, & + this%modelfname, & + this%sourcename, & + this%iperblock, & + this%iout) ! ! -- return return @@ -396,8 +402,8 @@ subroutine dynamic_destroy(this) class(Mf6FileDynamicPkgLoadType), intent(inout) :: this ! ! -- deallocate loader - call this%block_loader%destroy() - deallocate (this%block_loader) + call this%rp_loader%destroy() + deallocate (this%rp_loader) ! ! -- deallocate parser call this%parser%clear() diff --git a/src/Utilities/Idm/mf6blockfile/StressGridInput.f90 b/src/Utilities/Idm/mf6blockfile/StressGridInput.f90 index 0a65f59995c..e20d8a22040 100644 --- a/src/Utilities/Idm/mf6blockfile/StressGridInput.f90 +++ b/src/Utilities/Idm/mf6blockfile/StressGridInput.f90 @@ -30,16 +30,12 @@ module StressGridInputModule !< type, extends(AsciiDynamicPkgLoadBaseType) :: StressGridInputType integer(I4B) :: tas_active !< Are TAS6 inputs defined - integer(I4B) :: nparam !< number of dynamic parameters other than AUX type(CharacterStringType), dimension(:), contiguous, & - pointer :: aux_tasnames => null() !< array of AUXVAR TAS names + pointer :: aux_tasnames !< array of AUXVAR TAS names type(CharacterStringType), dimension(:), contiguous, & - pointer :: param_tasnames => null() !< array of dynamic param TAS names - character(len=LENVARNAME), dimension(:), & - allocatable :: param_names !< dynamic param names + pointer :: param_tasnames !< array of dynamic param TAS names type(ReadStateVarType), dimension(:), allocatable :: param_reads !< read states for current load - type(TimeArraySeriesManagerType), pointer :: tasmanager => null() !< TAS manager object - type(BoundInputContextType) :: bndctx !< boundary package input context + type(TimeArraySeriesManagerType), pointer :: tasmanager !< TAS manager contains procedure :: init => ingrid_init procedure :: df => ingrid_df @@ -73,6 +69,8 @@ subroutine ingrid_init(this, mf6_input, modelname, modelfname, & call this%DynamicPkgLoadType%init(mf6_input, modelname, modelfname, & source, iperblock, iout) ! -- initialize + nullify (this%aux_tasnames) + nullify (this%param_tasnames) this%tas_active = 0 this%nparam = 0 this%iout = iout diff --git a/src/Utilities/Idm/mf6blockfile/StressListInput.f90 b/src/Utilities/Idm/mf6blockfile/StressListInput.f90 index ae7778e908b..2a26905ea76 100644 --- a/src/Utilities/Idm/mf6blockfile/StressListInput.f90 +++ b/src/Utilities/Idm/mf6blockfile/StressListInput.f90 @@ -32,12 +32,9 @@ module StressListInputModule integer(I4B) :: ts_active integer(I4B) :: ibinary integer(I4B) :: oc_inunit - integer(I4B) :: ncol integer(I4B) :: iboundname - character(len=LENVARNAME), dimension(:), allocatable :: cols - type(TimeSeriesManagerType), pointer :: tsmanager => null() + type(TimeSeriesManagerType), pointer :: tsmanager type(StructArrayType), pointer :: structarray - type(BoundInputContextType) :: bndctx contains procedure :: init => inlist_init procedure :: df => inlist_df @@ -99,7 +96,7 @@ subroutine inlist_init(this, mf6_input, modelname, modelfname, & call this%bndctx%init(mf6_input, .false.) ! ! -- set SA cols in scope for list input - call this%bndctx%filtered_params(this%cols, this%ncol) + call this%bndctx%filtered_params(this%param_names, this%nparam) ! ! -- construct and set up the struct array object call this%create_structarray() @@ -180,7 +177,7 @@ subroutine inlist_destroy(this) ! -- modules class(StressListInputType), intent(inout) :: this !< StressListInputType ! - deallocate (this%cols) + deallocate (this%param_names) deallocate (this%tsmanager) call destructStructArray(this%structarray) call this%bndctx%destroy() @@ -211,16 +208,16 @@ subroutine inlist_ts_link(this, structvector, ts_strloc) type(StructVectorType), pointer, intent(in) :: structvector type(TSStringLocType), pointer, intent(in) :: ts_strloc ! -- locals - real(DP), pointer :: bndElem => null() - type(TimeSeriesLinkType), pointer :: tsLinkBnd => null() - type(TimeSeriesLinkType), pointer :: tsLinkAux => null() + real(DP), pointer :: bndElem + type(TimeSeriesLinkType), pointer :: tsLinkBnd + type(TimeSeriesLinkType), pointer :: tsLinkAux type(StructVectorType), pointer :: sv_bound character(len=LENBOUNDNAME) :: boundname ! select case (structvector%memtype) case (2) ! - tsLinkBnd => NULL() + nullify (tsLinkBnd) ! ! -- set bound element bndElem => structvector%dbl1d(ts_strloc%row) @@ -250,7 +247,7 @@ subroutine inlist_ts_link(this, structvector, ts_strloc) ! case (6) ! - tsLinkAux => NULL() + nullify (tsLinkAux) ! ! -- set bound element bndElem => structvector%dbl2d(ts_strloc%col, ts_strloc%row) @@ -325,18 +322,18 @@ subroutine create_structarray(this) integer(I4B) :: icol ! ! -- construct and set up the struct array object - this%structarray => constructStructArray(this%ncol, this%bndctx%maxbound, & + this%structarray => constructStructArray(this%nparam, this%bndctx%maxbound, & 0, this%mf6_input%mempath, & this%mf6_input%component_mempath) ! ! -- set up struct array - do icol = 1, this%ncol + do icol = 1, this%nparam ! idt => get_param_definition_type(this%mf6_input%param_dfns, & this%mf6_input%component_type, & this%mf6_input%subcomponent_type, & 'PERIOD', & - this%cols(icol), this%sourcename) + this%param_names(icol), this%sourcename) ! ! -- allocate variable in memory manager call this%structarray%mem_create_vector(icol, idt) diff --git a/src/Utilities/Idm/netcdf/IdmNetCDFFile.f90 b/src/Utilities/Idm/netcdf/IdmNetCDFFile.f90 index 4f48fb19a3a..fc0d6377db4 100644 --- a/src/Utilities/Idm/netcdf/IdmNetCDFFile.f90 +++ b/src/Utilities/Idm/netcdf/IdmNetCDFFile.f90 @@ -24,12 +24,19 @@ module IdmNetCDFFileModule public :: open_ncfile public :: NC4StaticPkgLoadType - !> @brief base abstract type for netcdf source dynamic load + !> @brief base abstract type for netcdf dynamic loader !! !< type, abstract, extends(DynamicPkgLoadType) :: NCDynamicPkgLoadBaseType + integer(I4B) :: ncid + integer(I4B) :: iiper + integer(I4B) :: nparam + character(len=LENVARNAME), dimension(:), & + allocatable :: param_names + type(BoundInputContextType) :: bndctx contains procedure(nc_period_load_if), deferred :: rp + procedure :: validate end type NCDynamicPkgLoadBaseType abstract interface @@ -41,66 +48,58 @@ subroutine nc_period_load_if(this, ncid, ncpkg) end subroutine end interface + !> @brief NetCDF4 file static loader type + !< type, extends(StaticPkgLoadBaseType) :: NC4StaticPkgLoadType integer(I4B) :: ncid - type(NC4ModelPackageInputType), pointer :: ncpkg => null() + type(NC4ModelPackageInputType), pointer :: ncpkg contains procedure :: init => static_init procedure :: load => static_load + procedure :: destroy => static_destroy end type NC4StaticPkgLoadType + !> @brief NetCDF4 file dynamic loader type + !< type, extends(DynamicPkgLoadBaseType) :: NC4DynamicPkgLoadType - integer(I4B), pointer :: iper => null() - integer(I4B), pointer :: ionper => null() + integer(I4B), pointer :: iper + integer(I4B), pointer :: ionper integer(I4B) :: iiper integer(I4B) :: ncid - type(NC4ModelPackageInputType), pointer :: ncpkg => null() - class(NCDynamicPkgLoadBaseType), pointer :: loader => null() + type(NC4ModelPackageInputType), pointer :: ncpkg + class(NCDynamicPkgLoadBaseType), pointer :: rp_loader contains procedure :: init => dynamic_init procedure :: set => dynamic_set procedure :: df => dynamic_df - procedure :: rp => dynamic_load + procedure :: rp => dynamic_rp procedure :: create_loader => dynamic_create_loader procedure :: destroy => dynamic_destroy end type NC4DynamicPkgLoadType - !> @brief NetCDF list based dynamic loader type + !> @brief NetCDF4 list based dynamic loader type !< type, extends(NCDynamicPkgLoadBaseType) :: NCListInputType - integer(I4B) :: ncid - integer(I4B) :: iiper - integer(I4B) :: nparam - character(len=LENVARNAME), dimension(:), & - allocatable :: param_names - type(BoundInputContextType) :: bndctx contains procedure :: init => inlist_init procedure :: rp => inlist_rp - procedure :: validate => inlist_validate procedure :: destroy => inlist_destroy end type NCListInputType - !> @brief NetCDF array based dynamic loader type + !> @brief NetCDF4 array based dynamic loader type !< type, extends(NCDynamicPkgLoadBaseType) :: NCGridInputType - integer(I4B) :: ncid - integer(I4B) :: iiper - integer(I4B) :: nparam !< number of in scope dynamic parameters - character(len=LENVARNAME), dimension(:), & - allocatable :: param_names !< dynamic param names type(ReadStateVarType), dimension(:), allocatable :: param_reads !< read states for current load - type(BoundInputContextType) :: bndctx !< boundary package input context contains procedure :: init => ingrid_init - procedure :: alloc => ingrid_alloc procedure :: rp => ingrid_rp - procedure :: validate => ingrid_validate procedure :: destroy => ingrid_destroy end type NCGridInputType contains + !> @brief static loader init + !< subroutine static_init(this, mf6_input, modelname, modelfname, source) use InputModelContextModule, only: GetModelNC4Context class(NC4StaticPkgLoadType), intent(inout) :: this @@ -110,6 +109,9 @@ subroutine static_init(this, mf6_input, modelname, modelfname, source) character(len=*), intent(in) :: source type(NC4ModelInputsType), pointer :: nc4_context ! + ! -- initialize + nullify (this%ncpkg) + ! call this%StaticPkgLoadType%init(mf6_input, modelname, modelfname, source) ! ! -- set context from input file @@ -126,15 +128,18 @@ subroutine static_init(this, mf6_input, modelname, modelfname, source) return end subroutine static_init - function static_load(this, iout) result(period_loader) + !> @brief load routine for static loader + !< + function static_load(this, iout) result(rp_loader) use LoadNetCDFDataModule, only: input_load class(NC4StaticPkgLoadType), intent(inout) :: this integer(I4B), intent(in) :: iout - class(DynamicPkgLoadBaseType), pointer :: period_loader - class(NC4DynamicPkgLoadType), pointer :: nc4_loader => null() + class(DynamicPkgLoadBaseType), pointer :: rp_loader + class(NC4DynamicPkgLoadType), pointer :: nc4_loader ! ! -- initialize - nullify (period_loader) + nullify (rp_loader) + nullify (nc4_loader) ! ! -- load model package to input context call input_load(this%mf6_input, this%ncpkg, this%ncid, this%sourcename, iout) @@ -154,7 +159,7 @@ function static_load(this, iout) result(period_loader) call nc4_loader%set(this%ncpkg, this%ncid) ! ! -- set returned base pointer - period_loader => nc4_loader + rp_loader => nc4_loader ! end if ! @@ -162,6 +167,17 @@ function static_load(this, iout) result(period_loader) return end function static_load + !> @brief static loader destroy + !< + subroutine static_destroy(this) + class(NC4StaticPkgLoadType), intent(inout) :: this + ! + call this%StaticPkgLoadType%destroy() + ! + end subroutine static_destroy + + !> @brief dynamic loader init + !< subroutine dynamic_init(this, mf6_input, modelname, modelfname, & source, iperblock, iout) use MemoryManagerModule, only: mem_allocate @@ -181,6 +197,8 @@ subroutine dynamic_init(this, mf6_input, modelname, modelfname, & call mem_allocate(this%ionper, 'IONPER', this%mf6_input%mempath) ! ! -- initialize package + nullify (this%ncpkg) + nullify (this%rp_loader) this%iper = 0 this%ionper = 0 this%iiper = 0 @@ -189,8 +207,12 @@ subroutine dynamic_init(this, mf6_input, modelname, modelfname, & return end subroutine dynamic_init + !> @brief dynamic loader set + !! + !! Set NC4 package context for dynamic loader + !! + !< subroutine dynamic_set(this, ncpkg, ncid) - use MemoryManagerModule, only: mem_allocate class(NC4DynamicPkgLoadType), intent(inout) :: this type(NC4ModelPackageInputType), pointer, intent(in) :: ncpkg integer(I4B), intent(in) :: ncid @@ -214,6 +236,8 @@ subroutine dynamic_set(this, ncpkg, ncid) return end subroutine dynamic_set + !> @brief dynamic loader define + !< subroutine dynamic_df(this) use TdisModule, only: nper class(NC4DynamicPkgLoadType), intent(inout) :: this @@ -230,7 +254,9 @@ subroutine dynamic_df(this) return end subroutine dynamic_df - subroutine dynamic_load(this) + !> @brief dyanamic loader read and prepare + !< + subroutine dynamic_rp(this) use TdisModule, only: kper, nper class(NC4DynamicPkgLoadType), intent(inout) :: this ! @@ -238,7 +264,7 @@ subroutine dynamic_load(this) if (this%ionper /= kper) return ! ! -- package dynamic load - call this%loader%rp(this%ncid, this%ncpkg) + call this%rp_loader%rp(this%ncid, this%ncpkg) ! ! -- update loaded iper this%iper = kper @@ -253,7 +279,7 @@ subroutine dynamic_load(this) ! ! -- return return - end subroutine dynamic_load + end subroutine dynamic_rp !> @brief allocate a dynamic loader based on load context !< @@ -266,38 +292,36 @@ subroutine dynamic_create_loader(this) ! -- allocate and set loader if (this%readasarrays) then allocate (grid_loader) - this%loader => grid_loader + this%rp_loader => grid_loader else allocate (list_loader) - this%loader => list_loader + this%rp_loader => list_loader end if ! ! -- initialize loader - call this%loader%init(this%mf6_input, & - this%modelname, & - this%modelfname, & - this%sourcename, & - this%iperblock, & - this%iout) + call this%rp_loader%init(this%mf6_input, & + this%modelname, & + this%modelfname, & + this%sourcename, & + this%iperblock, & + this%iout) ! ! -- validate package netcdf inputs - if (this%readasarrays) then - call grid_loader%validate(this%ncpkg) - else - call list_loader%validate(this%ncpkg) - end if + call this%rp_loader%validate(this%ncpkg) ! ! -- return return end subroutine dynamic_create_loader + !> @brief dynamic loader destroy + !< subroutine dynamic_destroy(this) class(NC4DynamicPkgLoadType), intent(inout) :: this ! ! -- destroy and deallocate loader - call this%loader%destroy() - deallocate (this%loader) - nullify (this%loader) + call this%rp_loader%destroy() + deallocate (this%rp_loader) + nullify (this%rp_loader) ! ! -- deallocate input context call this%DynamicPkgLoadType%destroy() @@ -310,7 +334,6 @@ end subroutine dynamic_destroy !< function open_ncfile(nc_fname, iout) result(ncid) ! -- modules - use MemoryManagerExtModule, only: mem_set_value use LoadNetCDFDataModule, only: nc_fopen ! -- dummy character(len=*) :: nc_fname @@ -338,6 +361,56 @@ function open_ncfile(nc_fname, iout) result(ncid) return end function open_ncfile + !> @brief dynamic loader validate + !< + subroutine validate(this, ncpkg) + ! -- modules + use InputDefinitionModule, only: InputParamDefinitionType + use DefinitionSelectModule, only: get_param_definition_type + ! -- dummy + class(NCDynamicPkgLoadBaseType), intent(inout) :: this + type(NC4ModelPackageInputType), pointer, intent(inout) :: ncpkg + ! -- local + type(InputParamDefinitionType), pointer :: idt + integer(I4B) :: iparam, ivar + character(len=LINELENGTH) :: tagname, varname + logical(LGP) :: found + ! + ! -- verify required package variables are defined + do iparam = 1, this%nparam + tagname = this%param_names(iparam) + ! + idt => & + get_param_definition_type(this%mf6_input%param_dfns, & + this%mf6_input%component_type, & + this%mf6_input%subcomponent_type, & + 'PERIOD', tagname, '') + ! + if (idt%required) then + found = .false. + do ivar = 1, ncpkg%blocklist(this%iperblock)%varnum + varname = ncpkg%blocklist(this%iperblock)%varnames(ivar) + if (varname == tagname) then + found = .true. + exit + end if + end do + ! + if (.not. found) then + errmsg = 'Required PERIOD variable not found: "'//trim(tagname)// & + '" for package "'//trim(this%mf6_input%subcomponent_name)//'".' + call store_error(errmsg) + call store_error_filename(this%sourcename) + end if + end if + end do + ! + ! -- return + return + end subroutine validate + + !> @brief dynamic list loader init + !< subroutine inlist_init(this, mf6_input, modelname, modelfname, & source, iperblock, iout) ! -- modules @@ -360,12 +433,16 @@ subroutine inlist_init(this, mf6_input, modelname, modelfname, & ! ! -- allocate bound params call this%bndctx%alloc(this%sourcename) + ! + ! -- set in scope param names call this%bndctx%filtered_params(this%param_names, this%nparam) ! ! -- return return end subroutine inlist_init + !> @brief dynamic list loader read and prepare + !< subroutine inlist_rp(this, ncid, ncpkg) ! -- modules use LoadNetCDFDataModule, only: nc4_rp_list @@ -385,63 +462,26 @@ subroutine inlist_rp(this, ncid, ncpkg) return end subroutine inlist_rp - subroutine inlist_validate(this, ncpkg) + !> @brief dynamic list loader destroy + !< + subroutine inlist_destroy(this) ! -- modules - use MemoryManagerModule, only: mem_setptr - use InputDefinitionModule, only: InputParamDefinitionType - use DefinitionSelectModule, only: get_param_definition_type ! -- dummy class(NCListInputType), intent(inout) :: this - type(NC4ModelPackageInputType), pointer, intent(inout) :: ncpkg - ! -- local - type(InputParamDefinitionType), pointer :: idt - integer(I4B) :: iparam, ivar - character(len=LINELENGTH) :: tagname, varname - logical(LGP) :: found ! - ! -- verify required package variables are defined - do iparam = 1, this%nparam - tagname = this%param_names(iparam) - ! - idt => & - get_param_definition_type(this%mf6_input%param_dfns, & - this%mf6_input%component_type, & - this%mf6_input%subcomponent_type, & - 'PERIOD', tagname, '') - ! - if (idt%required) then - found = .false. - do ivar = 1, ncpkg%blocklist(this%iperblock)%varnum - varname = ncpkg%blocklist(this%iperblock)%varnames(ivar) - if (varname == tagname) then - found = .true. - exit - end if - end do - ! - if (.not. found) then - errmsg = 'Required PERIOD package variable not found => '//trim(tagname) - call store_error(errmsg) - call store_error_filename(this%sourcename) - end if - end if - end do + if (allocated(this%param_names)) deallocate (this%param_names) + call this%bndctx%destroy() ! ! -- return return - end subroutine inlist_validate - - subroutine inlist_destroy(this) - ! -- modules - ! -- dummy - class(NCListInputType), intent(inout) :: this - if (allocated(this%param_names)) deallocate (this%param_names) - call this%bndctx%destroy() end subroutine inlist_destroy + !> @brief dynamic grid loader init + !< subroutine ingrid_init(this, mf6_input, modelname, modelfname, & source, iperblock, iout) ! -- modules + use MemoryManagerModule, only: mem_setptr ! -- dummy class(NCGridInputType), intent(inout) :: this type(ModflowInputType), intent(in) :: mf6_input @@ -450,6 +490,10 @@ subroutine ingrid_init(this, mf6_input, modelname, modelfname, & character(len=*), intent(in) :: source integer(I4B), intent(in) :: iperblock integer(I4B), intent(in) :: iout + ! -- local + character(len=LENVARNAME) :: rs_varname + integer(I4B), pointer :: intvar + integer(I4B) :: iparam ! ! -- initialize context call this%DynamicPkgLoadType%init(mf6_input, modelname, modelfname, & @@ -457,25 +501,10 @@ subroutine ingrid_init(this, mf6_input, modelname, modelfname, & ! this%iiper = 0 ! + ! -- initialize context call this%bndctx%init(this%mf6_input, .true.) ! ! -- allocate bound params - call this%alloc() - ! - ! -- return - return - end subroutine ingrid_init - - subroutine ingrid_alloc(this) - ! -- modules - use MemoryManagerModule, only: mem_setptr - ! -- dummy - class(NCGridInputType), intent(inout) :: this !< StressGridInputType - character(len=LENVARNAME) :: rs_varname - integer(I4B), pointer :: intvar - integer(I4B) :: iparam - ! - ! -- allocate period dfn params call this%bndctx%alloc(this%sourcename) ! ! -- set in scope param names @@ -495,8 +524,10 @@ subroutine ingrid_alloc(this) ! ! -- return return - end subroutine ingrid_alloc + end subroutine ingrid_init + !> @brief dynamic grid loader read and prepare + !< subroutine ingrid_rp(this, ncid, ncpkg) ! -- modules use LoadNetCDFDataModule, only: nc4_rp_array @@ -523,52 +554,8 @@ subroutine ingrid_rp(this, ncid, ncpkg) return end subroutine ingrid_rp - subroutine ingrid_validate(this, ncpkg) - ! -- modules - use InputDefinitionModule, only: InputParamDefinitionType - use DefinitionSelectModule, only: get_param_definition_type - ! -- dummy - class(NCGridInputType), intent(inout) :: this - type(NC4ModelPackageInputType), pointer, intent(inout) :: ncpkg - ! -- local - type(InputParamDefinitionType), pointer :: idt - character(len=LINELENGTH) :: tagname, varname - integer(I4B) :: iparam, ivar - logical(LGP) :: found - ! - do iparam = 1, this%nparam - tagname = this%param_names(iparam) - ! - idt => & - get_param_definition_type(this%mf6_input%param_dfns, & - this%mf6_input%component_type, & - this%mf6_input%subcomponent_type, & - 'PERIOD', tagname, '') - ! - if (idt%required) then - found = .false. - do ivar = 1, ncpkg%blocklist(this%iperblock)%varnum - varname = ncpkg%blocklist(this%iperblock)%varnames(ivar) - if (varname == tagname) then - found = .true. - exit - end if - end do - ! - if (.not. found) then - errmsg = 'Required PERIOD variable not found: "'//trim(tagname)// & - '" for package "'//trim(this%mf6_input%subcomponent_name)//'".' - call store_error(errmsg) - call store_error_filename(this%sourcename) - end if - end if - ! - end do - ! - ! -- return - return - end subroutine ingrid_validate - + !> @brief dynamic grid loader destroy + !< subroutine ingrid_destroy(this) ! -- modules ! -- dummy