From d4eeae9a63a20a585dcfd910144f4f11b4fa840c Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 30 Jun 2023 12:43:11 -0400 Subject: [PATCH 1/7] rename files primarily for source naming consistency --- msvs/mf6core.vfproj | 10 +++++----- src/Utilities/Idm/{IdmSimulation.f90 => IdmLoad.f90} | 0 .../Idm/{mf6blockfile => mf6file}/IdmMf6File.f90 | 0 .../Idm/{mf6blockfile => mf6file}/LoadMf6File.f90 | 0 .../Idm/{mf6blockfile => mf6file}/StructArray.f90 | 0 .../Idm/{mf6blockfile => mf6file}/StructVector.f90 | 0 src/meson.build | 10 +++++----- 7 files changed, 10 insertions(+), 10 deletions(-) rename src/Utilities/Idm/{IdmSimulation.f90 => IdmLoad.f90} (100%) rename src/Utilities/Idm/{mf6blockfile => mf6file}/IdmMf6File.f90 (100%) rename src/Utilities/Idm/{mf6blockfile => mf6file}/LoadMf6File.f90 (100%) rename src/Utilities/Idm/{mf6blockfile => mf6file}/StructArray.f90 (100%) rename src/Utilities/Idm/{mf6blockfile => mf6file}/StructVector.f90 (100%) diff --git a/msvs/mf6core.vfproj b/msvs/mf6core.vfproj index e2be9f2e7b6..d811b30f51f 100644 --- a/msvs/mf6core.vfproj +++ b/msvs/mf6core.vfproj @@ -259,11 +259,11 @@ - - - - - + + + + + diff --git a/src/Utilities/Idm/IdmSimulation.f90 b/src/Utilities/Idm/IdmLoad.f90 similarity index 100% rename from src/Utilities/Idm/IdmSimulation.f90 rename to src/Utilities/Idm/IdmLoad.f90 diff --git a/src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 b/src/Utilities/Idm/mf6file/IdmMf6File.f90 similarity index 100% rename from src/Utilities/Idm/mf6blockfile/IdmMf6File.f90 rename to src/Utilities/Idm/mf6file/IdmMf6File.f90 diff --git a/src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 b/src/Utilities/Idm/mf6file/LoadMf6File.f90 similarity index 100% rename from src/Utilities/Idm/mf6blockfile/LoadMf6File.f90 rename to src/Utilities/Idm/mf6file/LoadMf6File.f90 diff --git a/src/Utilities/Idm/mf6blockfile/StructArray.f90 b/src/Utilities/Idm/mf6file/StructArray.f90 similarity index 100% rename from src/Utilities/Idm/mf6blockfile/StructArray.f90 rename to src/Utilities/Idm/mf6file/StructArray.f90 diff --git a/src/Utilities/Idm/mf6blockfile/StructVector.f90 b/src/Utilities/Idm/mf6file/StructVector.f90 similarity index 100% rename from src/Utilities/Idm/mf6blockfile/StructVector.f90 rename to src/Utilities/Idm/mf6file/StructVector.f90 diff --git a/src/meson.build b/src/meson.build index 5f57e065d7b..c2540f42758 100644 --- a/src/meson.build +++ b/src/meson.build @@ -148,15 +148,15 @@ modflow_sources = files( 'Utilities' / 'ArrayRead' / 'Integer2dReader.f90', 'Utilities' / 'ArrayRead' / 'LayeredArrayReader.f90', 'Utilities' / 'Idm' / 'DefinitionSelect.f90', + 'Utilities' / 'Idm' / 'IdmLoad.f90', 'Utilities' / 'Idm' / 'IdmLogger.f90', - 'Utilities' / 'Idm' / 'IdmSimulation.f90', 'Utilities' / 'Idm' / 'InputDefinition.f90', 'Utilities' / 'Idm' / 'ModelPackageInputs.f90', 'Utilities' / 'Idm' / 'ModflowInput.f90', - 'Utilities' / 'Idm' / 'mf6blockfile' / 'IdmMf6File.f90', - 'Utilities' / 'Idm' / 'mf6blockfile' / 'LoadMf6File.f90', - 'Utilities' / 'Idm' / 'mf6blockfile' / 'StructArray.f90', - 'Utilities' / 'Idm' / 'mf6blockfile' / 'StructVector.f90', + 'Utilities' / 'Idm' / 'mf6file' / 'IdmMf6File.f90', + 'Utilities' / 'Idm' / 'mf6file' / 'LoadMf6File.f90', + 'Utilities' / 'Idm' / 'mf6file' / 'StructArray.f90', + 'Utilities' / 'Idm' / 'mf6file' / 'StructVector.f90', 'Utilities' / 'Idm' / 'selector' / 'IdmDfnSelector.f90', 'Utilities' / 'Idm' / 'selector' / 'IdmGwfDfnSelector.f90', 'Utilities' / 'Idm' / 'selector' / 'IdmGwtDfnSelector.f90', From 38add4f12b2e756cd54cc187d76341c4cae8201c Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 30 Jun 2023 13:24:43 -0400 Subject: [PATCH 2/7] add infrastructure for dynamic inputs and alternative sources --- msvs/mf6core.vfproj | 8 +- src/Utilities/Idm/IdmLoad.f90 | 476 +++++++++++++----- src/Utilities/Idm/InputLoadType.f90 | 281 +++++++++++ src/Utilities/Idm/ModelPackageInputs.f90 | 95 ++-- src/Utilities/Idm/ModflowInput.f90 | 3 + src/Utilities/Idm/SourceCommon.f90 | 232 +++++++++ src/Utilities/Idm/SourceLoad.F90 | 165 ++++++ src/Utilities/Idm/StressPkgInput.f90 | 47 ++ src/Utilities/Idm/mf6file/IdmMf6File.f90 | 385 +++++++------- src/Utilities/Idm/mf6file/LoadMf6File.f90 | 119 ++--- src/Utilities/Idm/mf6file/StructArray.f90 | 2 - src/Utilities/Idm/selector/IdmDfnSelector.f90 | 17 + src/meson.build | 4 + src/mf6core.f90 | 2 +- utils/idmloader/scripts/dfn2f90.py | 29 +- 15 files changed, 1405 insertions(+), 460 deletions(-) create mode 100644 src/Utilities/Idm/InputLoadType.f90 create mode 100644 src/Utilities/Idm/SourceCommon.f90 create mode 100644 src/Utilities/Idm/SourceLoad.F90 create mode 100644 src/Utilities/Idm/StressPkgInput.f90 diff --git a/msvs/mf6core.vfproj b/msvs/mf6core.vfproj index d811b30f51f..a4a813d68ce 100644 --- a/msvs/mf6core.vfproj +++ b/msvs/mf6core.vfproj @@ -270,11 +270,15 @@ + - + - + + + + diff --git a/src/Utilities/Idm/IdmLoad.f90 b/src/Utilities/Idm/IdmLoad.f90 index ecb8da877a7..4ff4129b131 100644 --- a/src/Utilities/Idm/IdmLoad.f90 +++ b/src/Utilities/Idm/IdmLoad.f90 @@ -1,27 +1,298 @@ -!> @brief This module contains the IdmSimulationModule +!> @brief This module contains the IdmLoadModule !! -!! This module contains the high-level routines for loading -!! sim namefile parameters into the input context +!! This module contains routines for managing static +!! and dynamic input loading for all supported sources. !! !< -module IdmSimulationModule +module IdmLoadModule use KindModule, only: DP, I4B, LGP - use ConstantsModule, only: LINELENGTH, LENMEMPATH - use SimModule, only: store_error - use SimVariablesModule, only: iout - use InputOutputModule, only: openfile, getunit + use SimVariablesModule, only: errmsg + use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENMODELNAME + use SimModule, only: store_error, store_error_filename + use ListModule, only: ListType + use InputLoadTypeModule, only: StaticPkgLoadBaseType, & + DynamicPkgLoadBaseType, & + ModelDynamicPkgsType use InputDefinitionModule, only: InputParamDefinitionType use ModflowInputModule, only: ModflowInputType, getModflowInput - use IdmMf6FileModule, only: input_load implicit none private public :: simnam_load public :: load_models + public :: dynamic_input_load + public :: idm_da + + type(ListType) :: model_dynamic_pkgs contains + !> @brief load an integrated model package from supported source + !< + subroutine model_pkg_load(model_pkg_inputs, itype, ipkg, iout) + use ModelPackageInputsModule, only: ModelPackageInputsType + use SourceLoadModule, only: create_pkg_loader + type(ModelPackageInputsType), intent(in) :: model_pkg_inputs + integer(I4B), intent(in) :: itype + integer(I4B), intent(in) :: ipkg + integer(I4B), intent(in) :: iout + class(StaticPkgLoadBaseType), pointer :: static_loader + class(DynamicPkgLoadBaseType), pointer :: dynamic_loader + class(ModelDynamicPkgsType), pointer :: dynamic_pkgs => null() + ! + ! -- create model package loader + static_loader => & + create_pkg_loader(model_pkg_inputs%component_type, & + model_pkg_inputs%pkglist(itype)%subcomponent_type, & + model_pkg_inputs%pkglist(itype)%pkgnames(ipkg), & + model_pkg_inputs%pkglist(itype)%pkgtype, & + model_pkg_inputs%pkglist(itype)%filenames(ipkg), & + model_pkg_inputs%modelname, & + model_pkg_inputs%modelfname) + ! + ! -- load static input and set dynamic loader + dynamic_loader => static_loader%load(iout) + ! + if (associated(dynamic_loader)) then + ! + ! -- set pointer to model dynamic packages loader + dynamic_pkgs => dynamic_model_pkgs(model_pkg_inputs%modelname, & + static_loader%modelfname) + ! + ! -- add dynamic pkg loader to model load object + call dynamic_pkgs%add(dynamic_loader) + ! + end if + ! + ! -- cleanup + call static_loader%destroy() + deallocate (static_loader) + ! + ! -- return + return + end subroutine model_pkg_load + + !> @brief load integrated model package files + !< + subroutine load_model_pkgs(model_pkg_inputs, iout) + use ModelPackageInputsModule, only: ModelPackageInputsType + use SourceLoadModule, only: open_source_file + use IdmDfnSelectorModule, only: idm_integrated + type(ModelPackageInputsType), intent(inout) :: model_pkg_inputs + integer(i4B), intent(in) :: iout + integer(I4B) :: itype, ipkg + ! + ! -- load package instances by type + do itype = 1, size(model_pkg_inputs%pkglist) + ! + ! -- load package instances + do ipkg = 1, model_pkg_inputs%pkglist(itype)%pnum + + if (idm_integrated(model_pkg_inputs%component_type, & + model_pkg_inputs%pkglist(itype)%subcomponent_type)) & + then + ! + ! -- only load if model pkg can read from input context + call model_pkg_load(model_pkg_inputs, itype, ipkg, iout) + else + ! + ! -- open input file for package parser + model_pkg_inputs%pkglist(itype)%inunits(ipkg) = & + open_source_file(model_pkg_inputs%pkglist(itype)%pkgtype, & + model_pkg_inputs%pkglist(itype)%filenames(ipkg), & + model_pkg_inputs%modelfname, iout) + end if + end do + end do + ! + ! -- return + return + end subroutine load_model_pkgs + + !> @brief load model namfiles and model package files + !< + subroutine load_models(model_loadmask, iout) + ! -- modules + use MemoryHelperModule, only: create_mem_path + use MemoryManagerModule, only: mem_setptr + use CharacterStringModule, only: CharacterStringType + use SimVariablesModule, only: idm_context + use ModelPackageInputsModule, only: ModelPackageInputsType + use SourceCommonModule, only: idm_component_type + use SourceLoadModule, only: load_modelnam + ! -- dummy + integer(I4B), dimension(:), intent(in) :: model_loadmask + integer(I4B), intent(in) :: iout + ! -- locals + character(len=LENMEMPATH) :: input_mempath + type(CharacterStringType), dimension(:), contiguous, & + pointer :: mtypes !< model types + type(CharacterStringType), dimension(:), contiguous, & + pointer :: mfnames !< model file names + type(CharacterStringType), dimension(:), contiguous, & + pointer :: mnames !< model names + character(len=LINELENGTH) :: mtype, mfname + character(len=LENMODELNAME) :: mname + type(ModelPackageInputsType), allocatable :: model_pkg_inputs + integer(I4B) :: n + ! + ! -- set input memory path + input_mempath = create_mem_path('SIM', 'NAM', idm_context) + ! + ! -- set pointers to input context model attribute arrays + call mem_setptr(mtypes, 'MTYPE', input_mempath) + call mem_setptr(mfnames, 'MFNAME', input_mempath) + call mem_setptr(mnames, 'MNAME', input_mempath) + ! + do n = 1, size(mtypes) + ! + ! -- attributes for this model + mtype = mtypes(n) + mfname = mfnames(n) + mname = mnames(n) + ! + ! -- load specified model inputs + if (model_loadmask(n) > 0) then + ! + ! -- load model nam file + call load_modelnam(mtype, mfname, mname, iout) + ! + ! -- create description of model packages + allocate (model_pkg_inputs) + call model_pkg_inputs%init(mtype, mfname, mname, iout) + ! + ! -- load packages + call load_model_pkgs(model_pkg_inputs, iout) + ! + ! -- publish pkg info to input context + call model_pkg_inputs%memload() + ! + ! -- cleanup + call model_pkg_inputs%destroy() + deallocate (model_pkg_inputs) + end if + end do + ! + ! -- return + return + end subroutine load_models + + !> @brief MODFLOW 6 mfsim.nam input load routine + !< + subroutine simnam_load(paramlog) + use SourceLoadModule, only: load_simnam + integer(I4B), intent(inout) :: paramlog + ! + ! -- load sim nam file + call load_simnam() + ! + ! -- allocate any unallocated simnam params + call simnam_allocate() + ! + ! -- read and set input parameter logging keyword + paramlog = input_param_log() + ! + ! -- memload summary info + call simnam_load_dim() + ! + ! --return + return + end subroutine simnam_load + + !> @brief load package dynamic data for period + !< + subroutine dynamic_input_load(iout) + use InputLoadTypeModule, only: GetDynamicModelFromList + integer(I4B), intent(in) :: iout + class(ModelDynamicPkgsType), pointer :: model_dynamic_input + integer(I4B) :: n + ! + do n = 1, model_dynamic_pkgs%Count() + model_dynamic_input => GetDynamicModelFromList(model_dynamic_pkgs, n) + call model_dynamic_input%period_load(iout) + end do + ! + ! -- return + return + end subroutine dynamic_input_load + + function dynamic_model_pkgs(modelname, modelfname) result(model_dynamic_input) + use InputLoadTypeModule, only: AddDynamicModelToList, GetDynamicModelFromList + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + class(ModelDynamicPkgsType), pointer :: model_dynamic_input + class(ModelDynamicPkgsType), pointer :: temp + integer(I4B) :: id + ! + ! -- initialize + nullify (model_dynamic_input) + ! + ! -- assign model loader object if found + do id = 1, model_dynamic_pkgs%Count() + temp => GetDynamicModelFromList(model_dynamic_pkgs, id) + if (temp%modelname == modelname) then + model_dynamic_input => temp + exit + end if + end do + ! + ! -- create if not found + if (.not. associated(model_dynamic_input)) then + allocate (model_dynamic_input) + call model_dynamic_input%init(modelname, modelfname) + call AddDynamicModelToList(model_dynamic_pkgs, model_dynamic_input) + end if + ! + ! -- return + return + end function dynamic_model_pkgs + + subroutine idm_da(iout) + integer(I4B), intent(in) :: iout + ! + call dynamic_da(iout) + ! + ! -- return + return + end subroutine idm_da + + subroutine dynamic_da(iout) + use InputLoadTypeModule, only: GetDynamicModelFromList + integer(I4B), intent(in) :: iout + class(ModelDynamicPkgsType), pointer :: model_dynamic_input + integer(I4B) :: n + ! + do n = 1, model_dynamic_pkgs%Count() + model_dynamic_input => GetDynamicModelFromList(model_dynamic_pkgs, n) + call model_dynamic_input%destroy(iout) + deallocate (model_dynamic_input) + nullify (model_dynamic_input) + end do + ! + call model_dynamic_pkgs%Clear() + ! + ! -- return + return + end subroutine dynamic_da + + function input_param_log() result(paramlog) + use MemoryHelperModule, only: create_mem_path + use MemoryManagerModule, only: mem_setptr + use SimVariablesModule, only: idm_context + character(len=LENMEMPATH) :: simnam_mempath + integer(I4B) :: paramlog + integer(I4B), pointer :: p + ! + ! -- read and set input value of PRINT_INPUT + simnam_mempath = create_mem_path('SIM', 'NAM', idm_context) + call mem_setptr(p, 'PRINT_INPUT', simnam_mempath) + paramlog = p + ! + ! -- return + return + end function input_param_log + !> @brief load simulation summary info to input context !< subroutine simnam_load_dim() @@ -57,43 +328,83 @@ subroutine simnam_load_dim() return end subroutine simnam_load_dim - !> @brief MODFLOW 6 mfsim.nam parameter set default value - !< - subroutine set_default_value(intvar, mf6varname) + subroutine allocate_simnam_int(input_mempath, idt) + use MemoryManagerModule, only: mem_allocate use SimVariablesModule, only: isimcontinue, isimcheck - integer(I4B), pointer, intent(in) :: intvar - character(len=*), intent(in) :: mf6varname - character(len=LINELENGTH) :: errmsg + character(len=LENMEMPATH), intent(in) :: input_mempath + type(InputParamDefinitionType), pointer, intent(in) :: idt + integer(I4B), pointer :: intvar => null() logical(LGP) :: terminate = .true. ! - ! -- load defaults for keyword/integer types - select case (mf6varname) - ! + ! -- allocate and set default + call mem_allocate(intvar, idt%mf6varname, input_mempath) + ! + select case (idt%mf6varname) case ('CONTINUE') intvar = isimcontinue - ! case ('NOCHECK') intvar = isimcheck - ! case ('MAXERRORS') intvar = 1000 !< MessageType max_message - ! case ('MXITER') intvar = 1 - ! case ('PRINT_INPUT') intvar = 0 + case default + write (errmsg, '(a,a)') & + 'IdmLoad set_default_value unhandled variable: ', & + trim(idt%mf6varname) + call store_error(errmsg, terminate) + end select + ! + ! -- return + return + end subroutine allocate_simnam_int + + !> @brief MODFLOW 6 mfsim.nam parameter allocate and set + !< + subroutine allocate_simnam_param(input_mempath, idt) + use MemoryManagerModule, only: mem_allocate + use CharacterStringModule, only: CharacterStringType + character(len=LENMEMPATH), intent(in) :: input_mempath + type(InputParamDefinitionType), pointer, intent(in) :: idt + character(len=LINELENGTH), pointer :: cstr => null() + type(CharacterStringType), dimension(:), & + pointer, contiguous :: acharstr1d => null() + logical(LGP) :: terminate = .true. + ! + ! -- initialize + ! + select case (idt%datatype) + case ('KEYWORD', 'INTEGER') + ! + ! -- allocate and set default + call allocate_simnam_int(input_mempath, idt) ! + case ('STRING') + ! + ! -- did this param originate from sim namfile RECARRAY type + if (idt%in_record) then + ! + ! -- allocate 0 size CharacterStringType array + call mem_allocate(acharstr1d, LINELENGTH, 0, idt%mf6varname, & + input_mempath) + else + ! + ! -- allocate empty string + call mem_allocate(cstr, LINELENGTH, idt%mf6varname, input_mempath) + cstr = '' + end if case default write (errmsg, '(a,a)') & - 'IdmSimulation set_default_value unhandled variable: ', & - trim(mf6varname) + 'IdmLoad unhandled datatype: ', & + trim(idt%datatype) call store_error(errmsg, terminate) end select ! ! -- return return - end subroutine set_default_value + end subroutine allocate_simnam_param !> @brief MODFLOW 6 mfsim.nam input context parameter allocation !< @@ -106,12 +417,6 @@ subroutine simnam_allocate() type(ModflowInputType) :: mf6_input type(InputParamDefinitionType), pointer :: idt integer(I4B) :: iparam, isize - logical(LGP) :: terminate = .true. - integer(I4B), pointer :: intvar - character(len=LINELENGTH), pointer :: cstr - type(CharacterStringType), dimension(:), & - pointer, contiguous :: acharstr1d - character(len=LINELENGTH) :: errmsg ! ! -- set memory path input_mempath = create_mem_path('SIM', 'NAM', idm_context) @@ -130,37 +435,9 @@ subroutine simnam_allocate() ! if (isize < 0) then ! - ! -- reset pointers - nullify (intvar) - nullify (acharstr1d) - nullify (cstr) + ! -- allocate and set parameter + call allocate_simnam_param(input_mempath, idt) ! - select case (idt%datatype) - case ('KEYWORD', 'INTEGER') - ! - ! -- allocate and set default - call mem_allocate(intvar, idt%mf6varname, input_mempath) - call set_default_value(intvar, idt%mf6varname) - case ('STRING') - ! - ! -- did this param originate from sim namfile RECARRAY type - if (idt%in_record) then - ! - ! -- allocate 0 size CharacterStringType array - call mem_allocate(acharstr1d, LINELENGTH, 0, idt%mf6varname, & - input_mempath) - else - ! - ! -- allocate empty string - call mem_allocate(cstr, LINELENGTH, idt%mf6varname, input_mempath) - cstr = '' - end if - case default - write (errmsg, '(a,a)') & - 'IdmSimulation unhandled datatype: ', & - trim(idt%datatype) - call store_error(errmsg, terminate) - end select end if end do ! @@ -168,79 +445,4 @@ subroutine simnam_allocate() return end subroutine simnam_allocate - !> @brief source indenpendent model load entry point - !< - subroutine load_models(model_loadmask, iout) - ! -- modules - use IdmMf6FileModule, only: load_models_mf6 - ! -- dummy - integer(I4B), dimension(:), intent(in) :: model_loadmask - integer(I4B), intent(in) :: iout - ! -- locals - ! - ! -- mf6 blockfile model load - call load_models_mf6(model_loadmask, iout) - ! - ! -- return - return - end subroutine load_models - - function input_param_log() result(paramlog) - use MemoryHelperModule, only: create_mem_path - use MemoryManagerModule, only: mem_setptr - use SimVariablesModule, only: idm_context - character(len=LENMEMPATH) :: simnam_mempath - integer(I4B) :: paramlog - integer(I4B), pointer :: p - ! - ! -- read and set input value of PRINT_INPUT - simnam_mempath = create_mem_path('SIM', 'NAM', idm_context) - call mem_setptr(p, 'PRINT_INPUT', simnam_mempath) - ! - paramlog = p - ! - ! -- return - return - end function input_param_log - - !> @brief MODFLOW 6 mfsim.nam input load routine - !< - subroutine simnam_load(paramlog) - use SimVariablesModule, only: simfile - use GenericUtilitiesModule, only: sim_message - integer(I4B), intent(inout) :: paramlog - integer(I4B) :: inunit - logical :: lexist - character(len=LINELENGTH) :: line - ! - ! -- load mfsim.nam if it exists - inquire (file=trim(adjustl(simfile)), exist=lexist) - ! - if (lexist) then - ! - ! -- write name of namfile to stdout - write (line, '(2(1x,a))') 'Using Simulation name file:', & - trim(adjustl(simfile)) - call sim_message(line, skipafter=1) - ! - ! -- open namfile and load to input context - inunit = getunit() - call openfile(inunit, iout, trim(adjustl(simfile)), 'NAM') - call input_load('NAM6', 'SIM', 'NAM', 'SIM', 'NAM', inunit, iout) - close (inunit) - end if - ! - ! -- allocate any unallocated simnam params - call simnam_allocate() - ! - ! -- read and set input parameter logging keyword - paramlog = input_param_log() - ! - ! -- memload summary info - call simnam_load_dim() - ! - ! --return - return - end subroutine simnam_load - -end module IdmSimulationModule +end module IdmLoadModule diff --git a/src/Utilities/Idm/InputLoadType.f90 b/src/Utilities/Idm/InputLoadType.f90 new file mode 100644 index 00000000000..fc0936dfd9d --- /dev/null +++ b/src/Utilities/Idm/InputLoadType.f90 @@ -0,0 +1,281 @@ +!> @brief This module contains the InputLoadTypeModule +!! +!! This module defines types that support generic IDP +!! static and dynamic input loading. +!! +!< +module InputLoadTypeModule + + use KindModule, only: DP, I4B, LGP + use ConstantsModule, only: LINELENGTH, LENMODELNAME + use ModflowInputModule, only: ModflowInputType + use ListModule, only: ListType + use StressPkgInputModule, only: StressPkgInputType + + implicit none + private + public :: StaticPkgLoadBaseType + public :: DynamicPkgLoadBaseType + public :: ModelDynamicPkgsType + public :: AddDynamicModelToList, GetDynamicModelFromList + + !> @brief derived type for source static load + !! + !! This derived type is a base concrete type for a model + !! package static load + !! + !< + type StaticPkgLoadType + type(ModflowInputType) :: mf6_input !< description of modflow6 input + character(len=LENMODELNAME) :: modelname !< name of model + character(len=LINELENGTH) :: modelfname !< name of model input file + character(len=LINELENGTH) :: source !< source type, e.g. MF6File + contains + procedure :: init => static_init + procedure :: destroy => static_destroy + end type StaticPkgLoadType + + !> @brief base abstract type for source static load + !! + !! IDM sources should extend and implement this type + !! + !< + type, abstract, extends(StaticPkgLoadType) :: StaticPkgLoadBaseType + contains + procedure(load_if), deferred :: load + end type StaticPkgLoadBaseType + + !> @brief derived type for source dynamic load + !! + !! This derived type is a base concrete type for a model + !! package dynamic (period) load + !! + !< + type :: DynamicPkgLoadType + type(ModflowInputType) :: mf6_input !< description of modflow6 input + character(len=LENMODELNAME) :: modelname !< name of model + character(len=LINELENGTH) :: modelfname !< name of model input file + character(len=LINELENGTH) :: source !< source type, e.g. MF6File + type(StressPkgInputType), pointer :: stresspkg !< stress pkg input context + contains + procedure :: init => dynamic_init + procedure :: destroy => dynamic_destroy + end type DynamicPkgLoadType + + !> @brief base abstract type for source dynamic load + !! + !! IDM sources should extend and implement this type + !! + !< + type, abstract, extends(DynamicPkgLoadType) :: DynamicPkgLoadBaseType + contains + procedure(period_load_if), deferred :: period_load + end type DynamicPkgLoadBaseType + + !> @brief load interfaces for source static and dynamic types + !< + abstract interface + function load_if(this, iout) result(dynamic_loader) + import StaticPkgLoadBaseType, DynamicPkgLoadBaseType, I4B + class(StaticPkgLoadBaseType), intent(inout) :: this + integer(I4B), intent(in) :: iout + class(DynamicPkgLoadBaseType), pointer :: dynamic_loader + end function load_if + subroutine period_load_if(this, iout) + import DynamicPkgLoadBaseType, I4B + class(DynamicPkgLoadBaseType), intent(inout) :: this + integer(I4B), intent(in) :: iout + end subroutine + end interface + + !> @brief derived type for storing a dynamic package load list + !! + !! This derived type is used to store a list of package + !! dynamic load types for a model + !! + !< + type :: ModelDynamicPkgsType + character(len=LENMODELNAME) :: modelname !< name of model + character(len=LINELENGTH) :: modelfname !< name of model input file + type(ListType) :: pkglist !< list of pointers to model dynamic package loaders + contains + procedure :: init => dynamicpkgs_init + procedure :: add => dynamicpkgs_add + procedure :: get => dynamicpkgs_get + procedure :: period_load => dynamicpkgs_period_load + procedure :: size => dynamicpkgs_size + procedure :: destroy => dynamicpkgs_destroy + end type ModelDynamicPkgsType + +contains + + subroutine static_init(this, mf6_input, modelname, modelfname, source) + class(StaticPkgLoadType), intent(inout) :: this + type(ModflowInputType), intent(in) :: mf6_input + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + character(len=*), intent(in) :: source + ! + this%mf6_input = mf6_input + this%modelname = modelname + this%modelfname = modelfname + this%source = source + ! + return + end subroutine static_init + + subroutine static_destroy(this) + class(StaticPkgLoadType), intent(inout) :: this + ! + return + end subroutine static_destroy + + subroutine dynamic_init(this, mf6_input, modelname, modelfname, source, iout) + class(DynamicPkgLoadType), intent(inout) :: this + type(ModflowInputType), intent(in) :: mf6_input + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + character(len=*), intent(in) :: source + integer(I4B), intent(in) :: iout + ! + this%mf6_input = mf6_input + this%modelname = modelname + this%modelfname = modelfname + this%source = source + ! + allocate (this%stresspkg) + call this%stresspkg%init(this%mf6_input, iout) + ! + return + end subroutine dynamic_init + + subroutine dynamic_destroy(this) + class(DynamicPkgLoadType), intent(inout) :: this + ! + call this%stresspkg%destroy() + deallocate (this%stresspkg) + ! + return + end subroutine dynamic_destroy + + subroutine dynamicpkgs_init(this, modelname, modelfname) + class(ModelDynamicPkgsType), intent(inout) :: this + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + ! + this%modelname = modelname + this%modelfname = modelfname + ! + return + end subroutine dynamicpkgs_init + + subroutine dynamicpkgs_add(this, dynamic_pkg) + class(ModelDynamicPkgsType), intent(inout) :: this + class(DynamicPkgLoadBaseType), pointer, intent(inout) :: dynamic_pkg + class(*), pointer :: obj + ! + obj => dynamic_pkg + call this%pkglist%add(obj) + ! + return + end subroutine dynamicpkgs_add + + function dynamicpkgs_get(this, idx) result(res) + class(ModelDynamicPkgsType), intent(inout) :: this + integer(I4B), intent(in) :: idx + class(DynamicPkgLoadBaseType), pointer :: res + class(*), pointer :: obj + ! + nullify (res) + obj => this%pkglist%GetItem(idx) + ! + if (associated(obj)) then + select type (obj) + class is (DynamicPkgLoadBaseType) + res => obj + end select + end if + ! + return + end function dynamicpkgs_get + + subroutine dynamicpkgs_period_load(this, iout) + class(ModelDynamicPkgsType), intent(inout) :: this + integer(I4B), intent(in) :: iout + class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg + integer(I4B) :: n + ! + do n = 1, this%pkglist%Count() + dynamic_pkg => this%get(n) + call dynamic_pkg%period_load(iout) + end do + ! + return + end subroutine dynamicpkgs_period_load + + function dynamicpkgs_size(this) result(size) + class(ModelDynamicPkgsType), intent(inout) :: this + integer(I4B) :: size + ! + size = this%pkglist%Count() + ! + return + end function dynamicpkgs_size + + subroutine dynamicpkgs_destroy(this, iout) + class(ModelDynamicPkgsType), intent(inout) :: this + integer(I4B), intent(in) :: iout + class(DynamicPkgLoadBaseType), pointer :: dynamic_pkg + integer(I4B) :: n + ! + do n = 1, this%pkglist%Count() + dynamic_pkg => this%get(n) + call dynamic_pkg%destroy() + deallocate (dynamic_pkg) + nullify (dynamic_pkg) + end do + ! + call this%pkglist%Clear() + ! + return + end subroutine dynamicpkgs_destroy + + subroutine AddDynamicModelToList(list, model_dynamic) + ! -- dummy variables + type(ListType), intent(inout) :: list !< package list + class(ModelDynamicPkgsType), pointer, intent(inout) :: model_dynamic + ! -- local variables + class(*), pointer :: obj + ! + obj => model_dynamic + call list%Add(obj) + ! + ! -- return + return + end subroutine AddDynamicModelToList + + function GetDynamicModelFromList(list, idx) result(res) + ! -- dummy variables + type(ListType), intent(inout) :: list !< spd list + integer(I4B), intent(in) :: idx !< package number + class(ModelDynamicPkgsType), pointer :: res + ! -- local variables + class(*), pointer :: obj + ! + ! -- initialize res + res => null() + ! + ! -- get the package from the list + obj => list%GetItem(idx) + if (associated(obj)) then + select type (obj) + class is (ModelDynamicPkgsType) + res => obj + end select + end if + ! + ! -- return + return + end function GetDynamicModelFromList + +end module InputLoadTypeModule diff --git a/src/Utilities/Idm/ModelPackageInputs.f90 b/src/Utilities/Idm/ModelPackageInputs.f90 index 25ea01001a6..05a47f2bdeb 100644 --- a/src/Utilities/Idm/ModelPackageInputs.f90 +++ b/src/Utilities/Idm/ModelPackageInputs.f90 @@ -7,6 +7,7 @@ module ModelPackageInputsModule use KindModule, only: DP, I4B, LGP + use SimVariablesModule, only: errmsg use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENMODELNAME, LENFTYPE, & LENPACKAGETYPE, LENPACKAGENAME use SimModule, only: store_error, store_error_filename @@ -66,7 +67,9 @@ module ModelPackageInputsModule ! -- package type, e.g. 'DIS6 or CHD6' character(len=LENPACKAGETYPE) :: pkgtype ! -- component type, e.g. 'DIS or CHD' - character(len=LENFTYPE) :: component_type + character(len=LENFTYPE) :: subcomponent_type + ! -- source + character(len=LENPACKAGENAME) :: source ! -- package instance attribute arrays character(len=LINELENGTH), dimension(:), allocatable :: filenames character(len=LENPACKAGENAME), dimension(:), allocatable :: pkgnames @@ -93,7 +96,8 @@ module ModelPackageInputsModule character(len=LENMODELNAME) :: modelname ! -- component type character(len=LENFTYPE) :: component_type ! -- e.g. 'GWF' - ! -- model mempath + ! -- mempaths + character(len=LENMEMPATH) :: input_mempath character(len=LENMEMPATH) :: model_mempath ! -- pointers to created managed memory type(CharacterStringType), dimension(:), contiguous, & @@ -104,6 +108,7 @@ module ModelPackageInputsModule pointer :: mempaths => null() integer(I4B), dimension(:), contiguous, & pointer :: inunits => null() + integer(I4B), pointer :: ncid => null() ! -- loadable package type array type(LoadablePackageType), dimension(:), allocatable :: pkglist ! -- pkgtype definitions @@ -152,30 +157,6 @@ subroutine supported_model_packages(mtype, pkgtypes, numpkgs) return end subroutine supported_model_packages - !> @brief component from package or model type - !< - function component_type(pkgtype) !result(componenttype) - ! -- modules - ! -- dummy - character(len=LENPACKAGETYPE), intent(in) :: pkgtype - ! -- return - character(len=LENFTYPE) :: component_type - ! -- local - integer(I4B) :: i, ilen - ! - component_type = '' - ! - ilen = len_trim(pkgtype) - do i = 1, ilen - if (pkgtype(i:i) == '6') then - write (component_type, '(a)') trim(pkgtype(1:i - 1)) - end if - end do - ! - ! -- return - return - end function component_type - !> @brief does model support multiple instances of this package type !< function multi_pkg_type(mtype_component, ptype_component, pkgtype) & @@ -226,17 +207,19 @@ end function multi_pkg_type !> @brief create a new package type !< - subroutine pkgtype_create(this, modelname, pkgtype) + subroutine pkgtype_create(this, modeltype, modelname, pkgtype) ! -- modules + use SourceCommonModule, only: idm_subcomponent_type ! -- dummy class(LoadablePackageType) :: this + character(len=*), intent(in) :: modeltype character(len=*), intent(in) :: modelname character(len=*), intent(in) :: pkgtype ! -- local ! ! -- initialize this%pkgtype = pkgtype - this%component_type = component_type(pkgtype) + this%subcomponent_type = idm_subcomponent_type(modeltype, pkgtype) this%pnum = 0 ! ! -- allocate arrays @@ -256,8 +239,10 @@ subroutine pkgtype_add(this, modelname, mtype_component, filetype, & ! -- modules use MemoryManagerModule, only: mem_allocate use MemoryHelperModule, only: create_mem_path + use MemoryManagerExtModule, only: mem_set_value use SimVariablesModule, only: idm_context use IdmDfnSelectorModule, only: idm_integrated, idm_multi_package + use SourceCommonModule, only: subcomponent_name ! -- dummy class(LoadablePackageType) :: this character(len=*), intent(in) :: modelname @@ -267,7 +252,7 @@ subroutine pkgtype_add(this, modelname, mtype_component, filetype, & character(len=*), intent(in) :: pkgname integer(I4B), intent(in) :: iout ! -- local - character(len=LENPACKAGENAME) :: sc_name + character(len=LENPACKAGENAME) :: sc_name, pname character(len=LENMEMPATH) :: mempath character(len=LINELENGTH), pointer :: cstr ! @@ -283,17 +268,18 @@ subroutine pkgtype_add(this, modelname, mtype_component, filetype, & this%pkgnames(this%pnum) = pkgname this%inunits(this%pnum) = 0 ! + ! -- set pkgname if empty + if (this%pkgnames(this%pnum) == '') then + write (pname, '(a,i0)') trim(this%subcomponent_type)//'-', this%pnum + this%pkgnames(this%pnum) = pname + end if + ! ! -- set up input context for model - if (idm_integrated(mtype_component, this%component_type)) then + if (idm_integrated(mtype_component, this%subcomponent_type)) then ! ! -- set subcomponent name - if (idm_multi_package(mtype_component, this%component_type)) then - ! - sc_name = pkgname - else - ! - sc_name = this%component_type - end if + sc_name = subcomponent_name(mtype_component, this%subcomponent_type, & + this%pkgnames(this%pnum)) ! ! -- create and store the mempath this%mempaths(this%pnum) = & @@ -303,6 +289,7 @@ subroutine pkgtype_add(this, modelname, mtype_component, filetype, & mempath = create_mem_path(modelname, sc_name, idm_context) call mem_allocate(cstr, LINELENGTH, 'INPUT_FNAME', mempath) cstr = filename + ! else ! ! -- set mempath empty @@ -338,6 +325,7 @@ subroutine modelpkgs_init(this, modeltype, modelfname, modelname, iout) use MemoryHelperModule, only: create_mem_path use MemoryManagerModule, only: mem_allocate use SimVariablesModule, only: idm_context + use SourceCommonModule, only: idm_component_type ! -- dummy class(ModelPackageInputsType) :: this character(len=*), intent(in) :: modeltype @@ -350,13 +338,14 @@ subroutine modelpkgs_init(this, modeltype, modelfname, modelname, iout) this%modeltype = modeltype this%modelfname = modelfname this%modelname = modelname - this%component_type = component_type(modeltype) + this%component_type = idm_component_type(modeltype) this%iout = iout ! ! -- allocate and set model supported package types call supported_model_packages(modeltype, this%cunit, this%niunit) ! - ! -- set model memory path + ! -- set memory paths + this%input_mempath = create_mem_path(this%modelname, 'NAM', idm_context) this%model_mempath = create_mem_path(component=this%modelname, & context=idm_context) ! @@ -368,6 +357,10 @@ subroutine modelpkgs_init(this, modeltype, modelfname, modelname, iout) call mem_allocate(this%mempaths, LENMEMPATH, 0, 'MEMPATHS', & this%model_mempath) call mem_allocate(this%inunits, 0, 'INUNITS', this%model_mempath) + call mem_allocate(this%ncid, 'NCID', this%model_mempath) + ! + ! -- initialize + this%ncid = 0 ! ! build descriptions of packages call this%addpkgs() @@ -390,7 +383,6 @@ subroutine modelpkgs_create(this, ftypes) character(len=LENPACKAGETYPE) :: ftype integer(I4B) :: n, m logical(LGP) :: found - character(len=LINELENGTH) :: errmsg ! ! -- allocate allocate (cunit_idxs(0)) @@ -398,7 +390,7 @@ subroutine modelpkgs_create(this, ftypes) ! -- identify input packages and check that each is supported do n = 1, size(ftypes) ! - ! -- type from model name file packages block + ! -- type from model nam file packages block ftype = ftypes(n) found = .false. ! @@ -440,7 +432,8 @@ subroutine modelpkgs_create(this, ftypes) ! ! -- create sorted LoadablePackageType object list do n = 1, size(cunit_idxs) - call this%pkglist(n)%create(this%modelname, this%cunit(cunit_idxs(n))) + call this%pkglist(n)%create(this%modeltype, this%modelname, & + this%cunit(cunit_idxs(n))) end do ! ! -- cleanup @@ -482,9 +475,7 @@ end subroutine modelpkgs_add !< subroutine modelpkgs_addpkgs(this) ! -- modules - use MemoryHelperModule, only: create_mem_path use MemoryManagerModule, only: mem_setptr - use SimVariablesModule, only: idm_context ! -- dummy class(ModelPackageInputsType) :: this ! -- local @@ -494,17 +485,13 @@ subroutine modelpkgs_addpkgs(this) pointer :: fnames !< file names type(CharacterStringType), dimension(:), contiguous, & pointer :: pnames !< package names - character(len=LENMEMPATH) :: input_mempath character(len=LINELENGTH) :: ftype, fname, pname integer(I4B) :: n ! - ! -- set input memory path - input_mempath = create_mem_path(this%modelname, 'NAM', idm_context) - ! ! -- set pointers to input context model package attribute arrays - call mem_setptr(ftypes, 'FTYPE', input_mempath) - call mem_setptr(fnames, 'FNAME', input_mempath) - call mem_setptr(pnames, 'PNAME', input_mempath) + call mem_setptr(ftypes, 'FTYPE', this%input_mempath) + call mem_setptr(fnames, 'FNAME', this%input_mempath) + call mem_setptr(pnames, 'PNAME', this%input_mempath) ! ! -- create the package list call this%create(ftypes) @@ -517,9 +504,6 @@ subroutine modelpkgs_addpkgs(this) fname = fnames(n) pname = pnames(n) ! - ! TODO: name pkg here if not provided, this is expected to cause - ! failures for multi-pkg types when names aren't provided - ! ! -- add this instance to package list call this%add(ftype, fname, pname) end do @@ -539,7 +523,6 @@ function modelpkgs_pkgcount(this) result(pnum) integer(I4B) :: pnum ! -- local integer(I4B) :: n - character(len=LINELENGTH) :: errmsg ! ! -- initialize pnum = 0 @@ -548,7 +531,7 @@ function modelpkgs_pkgcount(this) result(pnum) do n = 1, size(this%pkglist) ! if (multi_pkg_type(this%component_type, & - this%pkglist(n)%component_type, & + this%pkglist(n)%subcomponent_type, & this%pkglist(n)%pkgtype)) then ! multiple instances ok else diff --git a/src/Utilities/Idm/ModflowInput.f90 b/src/Utilities/Idm/ModflowInput.f90 index d8c316ecfc0..5e46d521607 100644 --- a/src/Utilities/Idm/ModflowInput.f90 +++ b/src/Utilities/Idm/ModflowInput.f90 @@ -38,6 +38,7 @@ module ModflowInputModule character(len=LENCOMPONENTNAME) :: component_name character(len=LENCOMPONENTNAME) :: subcomponent_name character(len=LENMEMPATH) :: mempath + character(len=LENMEMPATH) :: component_mempath type(InputBlockDefinitionType), dimension(:), pointer :: block_dfns type(InputParamDefinitionType), dimension(:), pointer :: aggregate_dfns type(InputParamDefinitionType), dimension(:), pointer :: param_dfns @@ -65,6 +66,8 @@ function getModflowInput(pkgtype, component_type, & mf6_input%mempath = create_mem_path(component_name, subcomponent_name, & idm_context) + mf6_input%component_mempath = create_mem_path(component=component_name, & + context=idm_context) mf6_input%block_dfns => block_definitions(component_type, subcomponent_type) mf6_input%aggregate_dfns => aggregate_definitions(component_type, & diff --git a/src/Utilities/Idm/SourceCommon.f90 b/src/Utilities/Idm/SourceCommon.f90 new file mode 100644 index 00000000000..8582e57e52a --- /dev/null +++ b/src/Utilities/Idm/SourceCommon.f90 @@ -0,0 +1,232 @@ +!> @brief This module contains the SourceCommonModule +!! +!! This module contains source independent input +!! processing helper routines. +!! +!< +module SourceCommonModule + + use KindModule, only: DP, I4B, LGP + use SimVariablesModule, only: errmsg + use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENMODELNAME, LENFTYPE, & + LENPACKAGETYPE, LENPACKAGENAME + use SimModule, only: store_error, store_error_filename + + implicit none + private + public :: package_source_type + public :: idm_component_type, idm_subcomponent_type, subcomponent_name + public :: set_model_shape, get_shape_from_string + +contains + + !> @brief source identifier from model namfile FNAME array + !! + !! Return the source type for a package listed in the + !! model nam file packages block FNAME field. + !! + !< + function package_source_type(sourcename) result(sourcetype) + ! -- modules + use InputOutputModule, only: upcase + ! -- dummy + character(len=*), intent(in) :: sourcename + ! -- result + character(len=LENPACKAGENAME) :: sourcetype + ! -- locals + ! + sourcetype = sourcename + call upcase(sourcetype) + ! + select case (sourcetype) + case default + sourcetype = 'MF6FILE' + end select + ! + ! -- return + return + end function package_source_type + + !> @brief component from package or model type + !! + !! Return the component type typically derived from package file type, + !! i.e. return GWF when input is GWF6. This function checks the + !! resultant commponent type and throws a terminating error if not + !! supported by IDM in some capacity. + !! + !< + function idm_component_type(component) result(component_type) + ! -- modules + use IdmDfnSelectorModule, only: idm_component + ! -- dummy + character(len=LENPACKAGETYPE), intent(in) :: component + ! -- return + character(len=LENFTYPE) :: component_type + ! -- local + integer(I4B) :: i, ilen + ! + ! -- initialize + component_type = '' + ! + ilen = len_trim(component) + do i = 1, ilen + if (component(i:i) == '6') then + component_type = '' + write (component_type, '(a)') trim(component(1:i - 1)) + end if + end do + ! + if (.not. idm_component(component_type)) then + write (errmsg, '(a)') & + 'IDP input error, unrecognized component: "'//trim(component)//'"' + call store_error(errmsg, .true.) + end if + ! + ! -- return + return + end function idm_component_type + + !> @brief component from package or model type + !! + !! Return the subcomponent type typically derived from package file type, + !! i.e. return CHD when input is CHD6. Note this function is called on + !! file types that are both idm integrated and not and should not set + !! an error based on this difference. + !! + !< + function idm_subcomponent_type(component, subcomponent) & + result(subcomponent_type) + ! -- modules + ! -- dummy + character(len=LENPACKAGETYPE), intent(in) :: component !< component, e.g. GWF6 + character(len=LENPACKAGETYPE), intent(in) :: subcomponent !< subcomponent, e.g. CHD6 + ! -- return + character(len=LENFTYPE) :: subcomponent_type + ! -- local + character(len=LENFTYPE) :: component_type + integer(I4B) :: i, ilen + ! + ! -- initialize + subcomponent_type = '' + ! + ! -- verify component + component_type = idm_component_type(component) + ! + ilen = len_trim(subcomponent) + do i = 1, ilen + if (subcomponent(i:i) == '6') then + subcomponent_type = '' + write (subcomponent_type, '(a)') trim(subcomponent(1:i - 1)) + end if + end do + ! + ! -- return + return + end function idm_subcomponent_type + + !> @brief model package subcomponent name + !! + !! Return the IDM component name, which is the pacage type for + !! base packages and the package name for mutli package (i.e. + !! stress) types. + !! + !< + function subcomponent_name(component_type, subcomponent_type, pkgname) + ! -- modules + use IdmDfnSelectorModule, only: idm_multi_package + ! -- dummy + character(len=*), intent(in) :: component_type + character(len=*), intent(in) :: subcomponent_type + character(len=*), intent(in) :: pkgname + ! -- return + character(len=LENPACKAGENAME) :: subcomponent_name + ! -- local + ! + subcomponent_name = '' + ! + if (idm_multi_package(component_type, subcomponent_type)) then + ! + subcomponent_name = pkgname + else + ! + subcomponent_name = subcomponent_type + end if + ! + ! -- return + return + end function subcomponent_name + + subroutine get_shape_from_string(shape_string, array_shape, memoryPath) + use InputOutputModule, only: parseline + use MemoryManagerModule, only: mem_setptr + character(len=*), intent(in) :: shape_string + integer(I4B), dimension(:), allocatable, intent(inout) :: array_shape + character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information + integer(I4B) :: ndim + integer(I4B) :: i + integer(I4B), pointer :: int_ptr + character(len=16), dimension(:), allocatable :: array_shape_string + character(len=:), allocatable :: shape_string_copy + ! + ! -- parse the string into multiple words + shape_string_copy = trim(shape_string)//' ' + call ParseLine(shape_string_copy, ndim, array_shape_string) + allocate (array_shape(ndim)) + ! + ! -- find shape in memory manager and put into array_shape + do i = 1, ndim + call mem_setptr(int_ptr, array_shape_string(i), memoryPath) + array_shape(i) = int_ptr + end do + ! + ! -- return + return + end subroutine get_shape_from_string + + !> @brief routine for setting the model shape + !! + !! The model shape must be set in the memory manager because + !! individual packages need to know the shape of the arrays + !! to read. + !! + !< + subroutine set_model_shape(ftype, model_mempath, dis_mempath, model_shape) + use MemoryTypeModule, only: MemoryType + use MemoryManagerModule, only: mem_allocate, mem_setptr, get_from_memorylist + character(len=*), intent(in) :: ftype + character(len=*), intent(in) :: model_mempath + character(len=*), intent(in) :: dis_mempath + integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: model_shape + integer(I4B), pointer :: ndim1 + integer(I4B), pointer :: ndim2 + integer(I4B), pointer :: ndim3 + integer(I4B), pointer :: ncelldim + ! + ! -- allocate and set model shape in model input context + select case (ftype) + case ('DIS6') + call mem_allocate(model_shape, 3, 'MODEL_SHAPE', model_mempath) + call mem_setptr(ndim1, 'NLAY', dis_mempath) + call mem_setptr(ndim2, 'NROW', dis_mempath) + call mem_setptr(ndim3, 'NCOL', dis_mempath) + model_shape = [ndim1, ndim2, ndim3] + case ('DISV6') + call mem_allocate(model_shape, 2, 'MODEL_SHAPE', model_mempath) + call mem_setptr(ndim1, 'NLAY', dis_mempath) + call mem_setptr(ndim2, 'NCPL', dis_mempath) + model_shape = [ndim1, ndim2] + case ('DISU6') + call mem_allocate(model_shape, 1, 'MODEL_SHAPE', model_mempath) + call mem_setptr(ndim1, 'NODES', dis_mempath) + model_shape = [ndim1] + end select + ! + ! -- allocate and set ncelldim in model input context + call mem_allocate(ncelldim, 'NCELLDIM', model_mempath) + ncelldim = size(model_shape) + ! + ! -- return + return + end subroutine set_model_shape + +end module SourceCommonModule diff --git a/src/Utilities/Idm/SourceLoad.F90 b/src/Utilities/Idm/SourceLoad.F90 new file mode 100644 index 00000000000..070b0e0cd18 --- /dev/null +++ b/src/Utilities/Idm/SourceLoad.F90 @@ -0,0 +1,165 @@ +!> @brief This module contains the SourceLoadModule +!! +!! This module contains the routines needed to generate +!! a loading object for an input source and routines +!! that distribute processing to a particular source. +!! +!< +module SourceLoadModule + + use KindModule, only: DP, I4B, LGP + use SimVariablesModule, only: errmsg + use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENMODELNAME, LENFTYPE, & + LENPACKAGETYPE, LENPACKAGENAME + use SimModule, only: store_error, store_error_filename + + implicit none + private + public :: create_pkg_loader + public :: open_source_file + public :: load_modelnam, load_simnam + +contains + + !> @brief factory function to create and setup model package static loader + !< + function create_pkg_loader(component_type, subcomponent_type, pkgname, & + pkgtype, filename, modelname, modelfname) & + result(loader) + use ModflowInputModule, only: ModflowInputType, getModflowInput + use SourceCommonModule, only: package_source_type, subcomponent_name + use InputLoadTypeModule, only: StaticPkgLoadBaseType + character(len=*), intent(in) :: component_type + character(len=*), intent(in) :: subcomponent_type + character(len=*), intent(in) :: pkgname + character(len=*), intent(in) :: pkgtype + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + class(StaticPkgLoadBaseType), pointer :: loader + type(ModflowInputType) :: mf6_input + character(len=LENPACKAGENAME) :: source_type + character(len=LENPACKAGENAME) :: sc_name + ! + ! -- set subcomponent name + sc_name = subcomponent_name(component_type, subcomponent_type, pkgname) + ! + ! -- create description of input + mf6_input = getModflowInput(pkgtype, component_type, subcomponent_type, & + modelname, sc_name) + ! + ! -- set package source + source_type = package_source_type(filename) + ! + ! -- set source loader for model package + loader => package_loader(source_type) + ! + ! -- initialize loader + call loader%init(mf6_input, modelname, modelfname, filename) + ! + ! -- return + return + end function create_pkg_loader + + !> @brief allocate source model package static loader + !< + function package_loader(source_type) result(loader) + use InputLoadTypeModule, only: StaticPkgLoadBaseType + use IdmMf6FileModule, only: Mf6FileStaticPkgLoadType + character(len=*), intent(inout) :: source_type + class(Mf6FileStaticPkgLoadType), pointer :: mf6file_loader + class(StaticPkgLoadBaseType), pointer :: loader + ! + ! -- initialize + nullify (loader) + ! + ! -- allocate derived object + select case (source_type) + case ('MF6FILE') + allocate (mf6file_loader) + loader => mf6file_loader + case default + write (errmsg, '(a)') & + 'Simulation package input source type "'//trim(source_type)// & + '" not currently supported.' + call store_error(errmsg, .true.) + end select + ! + ! -- return + return + end function package_loader + + function open_source_file(pkgtype, filename, modelfname, iout) result(fd) + use SourceCommonModule, only: package_source_type + use IdmMf6FileModule, only: open_mf6file + character(len=*), intent(in) :: pkgtype + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: modelfname + integer(I4B), intent(in) :: iout + integer(I4B) :: fd + character(len=LENPACKAGENAME) :: source_type + ! + ! -- initialize + fd = 0 + ! + ! -- set source type + source_type = package_source_type(filename) + ! + select case (source_type) + case ('MF6FILE') + fd = open_mf6file(pkgtype, filename, modelfname, iout) + case default + end select + ! + ! -- return + return + end function open_source_file + + subroutine load_modelnam(mtype, mfname, mname, iout) + use SourceCommonModule, only: package_source_type, idm_component_type + use IdmMf6FileModule, only: model_load + character(len=*), intent(in) :: mtype + character(len=*), intent(in) :: mfname + character(len=*), intent(in) :: mname + integer(I4B), intent(in) :: iout + character(len=LENPACKAGENAME) :: source_type + ! + ! -- set source type + source_type = package_source_type(mfname) + ! + select case (source_type) + case ('MF6FILE') + call model_load(idm_component_type(mtype), mtype, mfname, mname, iout) + case default + end select + ! + ! -- return + return + end subroutine load_modelnam + + subroutine load_simnam() + use SimVariablesModule, only: simfile, iout + use GenericUtilitiesModule, only: sim_message + use IdmMf6FileModule, only: input_load + character(len=LINELENGTH) :: line + logical :: lexist + ! + ! -- load mfsim.nam if it exists + inquire (file=trim(adjustl(simfile)), exist=lexist) + ! + if (lexist) then + ! + ! -- write name of namfile to stdout + write (line, '(2(1x,a))') 'Using Simulation name file:', & + trim(adjustl(simfile)) + call sim_message(line, skipafter=1) + ! + ! -- open namfile and load to input context + call input_load(simfile, 'NAM6', 'SIM', 'NAM', 'SIM', 'NAM', simfile, iout) + end if + ! + ! -- return + return + end subroutine load_simnam + +end module SourceLoadModule diff --git a/src/Utilities/Idm/StressPkgInput.f90 b/src/Utilities/Idm/StressPkgInput.f90 new file mode 100644 index 00000000000..8b99a64b199 --- /dev/null +++ b/src/Utilities/Idm/StressPkgInput.f90 @@ -0,0 +1,47 @@ +!> @brief This module contains the StressPkgInputModule +!! +!! This module defines a type that manages input +!! context dynamic loading for a stress package. +!! +!! This type is not fully implemented. +!! +!< +module StressPkgInputModule + + use KindModule, only: DP, I4B, LGP + use ModflowInputModule, only: ModflowInputType + + implicit none + private + public :: StressPkgInputType + + !> @brief StressPkgInputType, not fully implemented + !< + type :: StressPkgInputType + contains + procedure :: init => stresspkg_init + procedure :: destroy => stresspkg_destroy + end type StressPkgInputType + +contains + + subroutine stresspkg_init(this, mf6_input, iout) + ! -- modules + ! -- dummy + class(StressPkgInputType) :: this + type(ModflowInputType), intent(in) :: mf6_input + integer(I4B), intent(in) :: iout + ! -- local + ! + ! -- return + return + end subroutine stresspkg_init + + subroutine stresspkg_destroy(this) + class(StressPkgInputType) :: this + ! + ! -- return + return + end subroutine stresspkg_destroy + +end module StressPkgInputModule diff --git a/src/Utilities/Idm/mf6file/IdmMf6File.f90 b/src/Utilities/Idm/mf6file/IdmMf6File.f90 index 4e844c23fed..3f900253d12 100644 --- a/src/Utilities/Idm/mf6file/IdmMf6File.f90 +++ b/src/Utilities/Idm/mf6file/IdmMf6File.f90 @@ -1,25 +1,29 @@ !> @brief This module contains the IdmMf6FileModule !! -!! This module contains the high-level routines for loading -!! a MODFLOW input file to the input context. +!! This module contains high-level routines for loading +!! MODFLOW 6 ASCII source input. !! !< module IdmMf6FileModule use KindModule, only: DP, I4B, LGP + use SimVariablesModule, only: errmsg use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENMODELNAME, & - LENPACKAGENAME, LENFTYPE, LENPACKAGETYPE + LENPACKAGENAME, LENFTYPE, LENPACKAGETYPE, & + LENAUXNAME, LENBOUNDNAME, LENTIMESERIESNAME, & + LENLISTLABEL use SimModule, only: store_error, store_error_filename use InputOutputModule, only: openfile, getunit use BlockParserModule, only: BlockParserType use ModflowInputModule, only: ModflowInputType, getModflowInput use CharacterStringModule, only: CharacterStringType - use ModelPackageInputsModule, only: ModelPackageInputsType + use InputLoadTypeModule, only: StaticPkgLoadBaseType, DynamicPkgLoadBaseType implicit none private - public :: input_load ! TODO: remove - public :: load_models_mf6 + public :: input_load, model_load + public :: Mf6FileStaticPkgLoadType, Mf6FileDynamicPkgLoadType + public :: open_mf6file !> @brief derived type for storing package loader !! @@ -44,6 +48,26 @@ subroutine IPackageLoad(parser, mf6_input, iout) end subroutine IPackageLoad end interface + !> @brief MF6File static loader derived type + !< + type, extends(StaticPkgLoadBaseType) :: Mf6FileStaticPkgLoadType + contains + procedure :: init => static_init + procedure :: load => static_load + procedure :: destroy => static_destroy + end type Mf6FileStaticPkgLoadType + + !> @brief MF6File dynamic loader derived type + !< + type, extends(DynamicPkgLoadBaseType) :: Mf6FileDynamicPkgLoadType + type(BlockParserType), pointer :: parser !< parser for MF6File period blocks + contains + procedure :: init => dynamic_init + procedure :: set => dynamic_set + procedure :: period_load => dynamic_load + procedure :: destroy => dynamic_destroy + end type Mf6FileDynamicPkgLoadType + contains !> @brief generic procedure to MODFLOW 6 load routine @@ -63,274 +87,243 @@ end subroutine generic_mf6_load !> @brief input load for traditional mf6 simulation input file !< - subroutine input_load(pkgtype, & + subroutine input_load(filename, pkgtype, & component_type, subcomponent_type, & component_name, subcomponent_name, & - inunit, iout) + component_filename, iout, mf6_parser) + character(len=*), intent(in) :: filename character(len=*), intent(in) :: pkgtype !< pkgtype to load, such as DIS6, DISV6, NPF6 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF character(len=*), intent(in) :: component_name !< component name, such as MYGWFMODEL character(len=*), intent(in) :: subcomponent_name !< subcomponent name, such as MYWELLPACKAGE - integer(I4B), intent(in) :: inunit !< unit number for input + character(len=*), intent(in) :: component_filename integer(I4B), intent(in) :: iout !< unit number for output - type(BlockParserType), allocatable :: parser !< block parser + type(BlockParserType), pointer, optional, intent(inout) :: mf6_parser + type(BlockParserType), allocatable, target :: parser !< block parser type(ModflowInputType) :: mf6_input type(PackageLoad) :: pkgloader + integer(I4B) :: inunit, iblock + logical(LGP) :: clear_parser = .true. ! ! -- create description of input mf6_input = getModflowInput(pkgtype, component_type, & subcomponent_type, component_name, & subcomponent_name) ! - ! -- set mf6 parser based package loader by file type + ! -- set parser based package loader by file type select case (pkgtype) case default + ! + ! -- open input file + inunit = open_mf6file(pkgtype, filename, component_filename, iout) + ! + ! -- allocate and initialize parser allocate (parser) call parser%Initialize(inunit, iout) + ! + ! -- set load interface pkgloader%load_package => generic_mf6_load + ! end select ! ! -- invoke the selected load routine call pkgloader%load_package(parser, mf6_input, iout) ! - ! -- close files and deallocate + ! -- generate a dynamic loader parser if requested and relevant + if (present(mf6_parser)) then + ! + ! -- initialize + nullify (mf6_parser) + ! + ! -- check if package has dynamic input + do iblock = 1, size(mf6_input%block_dfns) + ! + if (mf6_input%block_dfns(iblock)%blockname == 'PERIOD') then + ! + ! -- dynamic package, allocate parser + allocate (mf6_parser, source=parser) + clear_parser = .false. + ! + exit + ! + end if + end do + end if + ! + ! -- deallocate static load parser if (allocated(parser)) then - !call parser%clear() + ! + if (clear_parser) call parser%clear() deallocate (parser) + ! end if ! ! -- return return end subroutine input_load - !> @brief input load model idm supported package files - !< - subroutine load_model_pkgfiles(model_pkg_inputs, iout) - ! -- modules - use IdmDfnSelectorModule, only: idm_integrated, idm_multi_package - ! -- dummy - type(ModelPackageInputsType), intent(inout) :: model_pkg_inputs + subroutine static_init(this, mf6_input, modelname, modelfname, source) + class(Mf6FileStaticPkgLoadType), intent(inout) :: this + type(ModflowInputType), intent(in) :: mf6_input + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + character(len=*), intent(in) :: source + ! + call this%StaticPkgLoadType%init(mf6_input, modelname, modelfname, source) + ! + end subroutine static_init + + function static_load(this, iout) result(period_loader) + class(Mf6FileStaticPkgLoadType), intent(inout) :: this integer(I4B), intent(in) :: iout - ! -- locals - integer(I4B) :: n, m - character(len=LENPACKAGETYPE) :: pkgtype - character(len=LENPACKAGENAME) :: sc_name + class(DynamicPkgLoadBaseType), pointer :: period_loader + class(Mf6FileDynamicPkgLoadType), pointer :: mf6file_period_loader => null() + type(BlockParserType), pointer :: parser => null() + ! + ! -- initialize + nullify (period_loader) ! - do n = 1, size(model_pkg_inputs%pkglist) + ! -- load model package to input context + call input_load(this%source, this%mf6_input%pkgtype, & + this%mf6_input%component_type, & + this%mf6_input%subcomponent_type, & + this%mf6_input%component_name, & + this%mf6_input%subcomponent_name, & + this%modelfname, iout, parser) + ! + if (associated(parser)) then ! - ! -- this list package type - pkgtype = model_pkg_inputs%pkglist(n)%pkgtype + ! -- package is dynamic, allocate loader + allocate (mf6file_period_loader) ! - ! -- load all idm integrated package type file instances - do m = 1, model_pkg_inputs%pkglist(n)%pnum - ! - if (idm_integrated(model_pkg_inputs%component_type, & - model_pkg_inputs%pkglist(n)%component_type)) then - ! - ! -- set subcomponent name - if (idm_multi_package(model_pkg_inputs%component_type, & - model_pkg_inputs%pkglist(n)%component_type)) then - ! - sc_name = model_pkg_inputs%pkglist(n)%pkgnames(m) - else - ! - sc_name = model_pkg_inputs%pkglist(n)%component_type - end if - ! - ! -- load model package to input context - call input_load(pkgtype, model_pkg_inputs%component_type, & - model_pkg_inputs%pkglist(n)%component_type, & - model_pkg_inputs%modelname, sc_name, & - model_pkg_inputs%pkglist(n)%inunits(m), iout) - ! - ! -- close file and update unit number - close (model_pkg_inputs%pkglist(n)%inunits(m)) - model_pkg_inputs%pkglist(n)%inunits(m) = 0 - ! - else - ! Not an IDM supported package, leave inunit open - end if - end do - end do + ! -- initialize dynamic loader + call mf6file_period_loader%init(this%mf6_input, this%modelname, & + this%modelfname, this%source, iout) + ! + ! -- set parser + call mf6file_period_loader%set(parser, iout) + ! + ! -- set return pointer to base dynamic loader + period_loader => mf6file_period_loader + ! + end if + ! + end function static_load + + subroutine static_destroy(this) + class(Mf6FileStaticPkgLoadType), intent(inout) :: this + ! + call this%StaticPkgLoadType%destroy() + ! + end subroutine static_destroy + + subroutine dynamic_init(this, mf6_input, modelname, modelfname, source, iout) + class(Mf6FileDynamicPkgLoadType), intent(inout) :: this + type(ModflowInputType), intent(in) :: mf6_input + character(len=*), intent(in) :: modelname + character(len=*), intent(in) :: modelfname + character(len=*), intent(in) :: source + integer(I4B), intent(in) :: iout + ! + call this%DynamicPkgLoadType%init(mf6_input, modelname, modelfname, & + source, iout) ! ! -- return return - end subroutine load_model_pkgfiles + end subroutine dynamic_init - !> @brief open all model package files - !< - subroutine open_model_pkgfiles(model_pkg_inputs, iout) - ! -- modules - ! -- dummy - type(ModelPackageInputsType), intent(inout) :: model_pkg_inputs + subroutine dynamic_set(this, parser, iout) + class(Mf6FileDynamicPkgLoadType), intent(inout) :: this + type(BlockParserType), pointer, intent(inout) :: parser integer(I4B), intent(in) :: iout - ! -- locals - integer(I4B) :: n, m - character(len=LINELENGTH) :: filename - character(len=LENPACKAGETYPE) :: filetype - character(len=LINELENGTH) :: errmsg ! - do n = 1, size(model_pkg_inputs%pkglist) - ! - ! -- this package type - filetype = model_pkg_inputs%pkglist(n)%pkgtype - ! - ! -- open each package type file instance - do m = 1, model_pkg_inputs%pkglist(n)%pnum - ! - ! -- set filename - filename = model_pkg_inputs%pkglist(n)%filenames(m) - ! - if (filename /= '') then - ! - ! -- get unit number, update object and open file - model_pkg_inputs%pkglist(n)%inunits(m) = getunit() - call openfile(model_pkg_inputs%pkglist(n)%inunits(m), iout, & - trim(adjustl(filename)), filetype, 'FORMATTED', & - 'SEQUENTIAL', 'OLD') - ! - else - write (errmsg, '(a,a,a,a,a)') & - 'Package file unspecified, cannot load model package & - &[model=', trim(model_pkg_inputs%modelname), & - ', type=', trim(filetype), '].' - call store_error(errmsg) - call store_error_filename(model_pkg_inputs%modelfname) - end if - end do - end do + ! -- Not currently implemented ! - ! -- returh + ! -- return return - end subroutine open_model_pkgfiles + end subroutine dynamic_set - !> @brief load and make pkg info available to models - !< - subroutine modelpkgs_load(mtype, mfname, mname, iout) + subroutine dynamic_load(this, iout) ! -- modules ! -- dummy - character(len=*), intent(in) :: mtype - character(len=*), intent(in) :: mfname - character(len=*), intent(in) :: mname + class(Mf6FileDynamicPkgLoadType), intent(inout) :: this integer(I4B), intent(in) :: iout ! -- locals - type(ModelPackageInputsType) :: model_pkg_inputs - ! - ! -- set baseline state for model package instances - call model_pkg_inputs%init(mtype, mfname, mname, iout) ! - ! -- open model package files - call open_model_pkgfiles(model_pkg_inputs, iout) + ! -- Not currently implemented + write (errmsg, '(a)') & + 'MODFLOW 6 internal error: input context dynamic load & + ¬ implemented' + call store_error(errmsg) + call store_error_filename(this%modelfname) ! - ! -- load model idm integrated package files - call load_model_pkgfiles(model_pkg_inputs, iout) + ! -- return + return + end subroutine dynamic_load + + subroutine dynamic_destroy(this) + class(Mf6FileDynamicPkgLoadType), intent(inout) :: this ! - ! -- load descriptions of packages to model input context - call model_pkg_inputs%memload() + call this%parser%clear() + deallocate (this%parser) ! - ! -- cleanup - call model_pkg_inputs%destroy() + call this%DynamicPkgLoadType%destroy() ! - ! -- return - return - end subroutine modelpkgs_load + end subroutine dynamic_destroy - !> @brief input load a single model namfile and model package files + !> @brief open a model package files !< - subroutine model_load(mtype, mfname, mname, iout) + function open_mf6file(filetype, filename, component_fname, iout) result(inunit) ! -- modules - use SimVariablesModule, only: simfile ! -- dummy - character(len=*), intent(in) :: mtype - character(len=*), intent(in) :: mfname - character(len=*), intent(in) :: mname + character(len=*), intent(in) :: filetype + character(len=*), intent(in) :: filename + character(len=*), intent(in) :: component_fname integer(I4B), intent(in) :: iout - ! -- locals - character(len=LINELENGTH) :: errmsg + ! -- return integer(I4B) :: inunit + ! -- locals ! - ! -- open namfile - inunit = getunit() - call openfile(inunit, iout, trim(mfname), 'NAM') + ! -- initialize + inunit = 0 ! - select case (mtype) - case ('GWF6') - ! - ! -- load model namfile to the input context - call input_load('GWF6', 'GWF', 'NAM', mname, 'NAM', inunit, iout) - ! - ! -- load and create descriptions of model package files - call modelpkgs_load(mtype, mfname, mname, iout) + if (filename /= '') then ! - case ('GWT6') - ! - call input_load('GWT6', 'GWT', 'NAM', mname, 'NAM', inunit, iout) - ! - call modelpkgs_load(mtype, mfname, mname, iout) - ! - case default - write (errmsg, '(a,a,a,a,a)') & - 'Unknown simulation model type & - &[model=', trim(mname), & - ', type=', trim(mtype), '].' + ! -- get unit number, update object and open file + inunit = getunit() + call openfile(inunit, iout, trim(adjustl(filename)), filetype, & + 'FORMATTED', 'SEQUENTIAL', 'OLD') + else + write (errmsg, '(a,a,a)') & + 'File unspecified, cannot load model or package & + &type "', trim(filetype), '".' call store_error(errmsg) - call store_error_filename(simfile) - end select - ! - ! -- close namfile - close (inunit) + call store_error_filename(component_fname) + end if ! ! -- return return - end subroutine model_load + end function open_mf6file - !> @brief input load model namfiles and model package files + !> @brief input load a single model namfile and model package files !< - subroutine load_models_mf6(model_loadmask, iout) + subroutine model_load(component, mtype, mfname, mname, iout) ! -- modules - use MemoryHelperModule, only: create_mem_path - use MemoryManagerModule, only: mem_setptr - use CharacterStringModule, only: CharacterStringType - use SimVariablesModule, only: idm_context + use SimVariablesModule, only: simfile ! -- dummy - integer(I4B), dimension(:), intent(in) :: model_loadmask + character(len=LENFTYPE), intent(in) :: component + character(len=*), intent(in) :: mtype + character(len=*), intent(in) :: mfname + character(len=*), intent(in) :: mname integer(I4B), intent(in) :: iout ! -- locals - character(len=LENMEMPATH) :: input_mempath - type(CharacterStringType), dimension(:), contiguous, & - pointer :: mtypes !< model types - type(CharacterStringType), dimension(:), contiguous, & - pointer :: mfnames !< model file names - type(CharacterStringType), dimension(:), contiguous, & - pointer :: mnames !< model names - character(len=LINELENGTH) :: mtype, mfname - character(len=LENMODELNAME) :: mname - integer(I4B) :: n - ! - ! -- set input memory path - input_mempath = create_mem_path('SIM', 'NAM', idm_context) - ! - ! -- set pointers to input context model attribute arrays - call mem_setptr(mtypes, 'MTYPE', input_mempath) - call mem_setptr(mfnames, 'MFNAME', input_mempath) - call mem_setptr(mnames, 'MNAME', input_mempath) ! - do n = 1, size(mtypes) - ! - ! -- attributes for this model - mtype = mtypes(n) - mfname = mfnames(n) - mname = mnames(n) - ! - ! -- load model namfile - if (model_loadmask(n) > 0) then - call model_load(mtype, mfname, mname, iout) - end if - end do + ! -- load model namfile to the input context + call input_load(mfname, mtype, component, 'NAM', mname, 'NAM', simfile, iout) ! ! -- return return - end subroutine load_models_mf6 + end subroutine model_load end module IdmMf6FileModule diff --git a/src/Utilities/Idm/mf6file/LoadMf6File.f90 b/src/Utilities/Idm/mf6file/LoadMf6File.f90 index 41c7d84b622..5fcab76fc70 100644 --- a/src/Utilities/Idm/mf6file/LoadMf6File.f90 +++ b/src/Utilities/Idm/mf6file/LoadMf6File.f90 @@ -8,9 +8,9 @@ module LoadMf6FileModule use KindModule, only: DP, I4B, LGP - use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENVARNAME use SimVariablesModule, only: errmsg use SimModule, only: store_error + use ConstantsModule, only: LINELENGTH, LENMEMPATH, LENVARNAME use BlockParserModule, only: BlockParserType use LayeredArrayReaderModule, only: read_dbl1d_layered, & read_dbl2d_layered, & @@ -48,6 +48,7 @@ subroutine idm_load(parser, pkgtype, & component_name, subcomponent_name, & iout) use SimVariablesModule, only: idm_context + use SourceCommonModule, only: set_model_shape type(BlockParserType), intent(inout) :: parser !< block parser character(len=*), intent(in) :: pkgtype !< file type to load, such as DIS6, DISV6, NPF6 character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT @@ -79,6 +80,10 @@ subroutine idm_load(parser, pkgtype, & ! ! -- process blocks do iblock = 1, size(mf6_input%block_dfns) + ! + ! -- don't load dynamic input data + if (mf6_input%block_dfns(iblock)%blockname == 'PERIOD') exit + ! call parse_block(parser, mf6_input, iblock, mshape, filename, iout, .false.) ! ! -- set model shape if discretization dimensions have been read @@ -293,7 +298,11 @@ recursive subroutine parse_tag(parser, mf6_input, iblock, mshape, filename, & call parser%DevOpt() end if case ('STRING') - call load_string_type(parser, idt, mf6_input%mempath, iout) + if (idt%shape == 'NAUX') then + call load_auxvar_names(parser, idt, mf6_input%mempath, iout) + else + call load_string_type(parser, idt, mf6_input%mempath, iout) + end if case ('INTEGER') call load_integer_type(parser, idt, mf6_input%mempath, iout) case ('INTEGER1D') @@ -318,7 +327,7 @@ recursive subroutine parse_tag(parser, mf6_input, iblock, mshape, filename, & ! ! -- continue line if in same record if (idt%in_record) then - + ! ! recursively call parse tag again to read rest of line call parse_tag(parser, mf6_input, iblock, mshape, filename, iout, .true.) end if @@ -475,6 +484,42 @@ subroutine load_string_type(parser, idt, memoryPath, iout) return end subroutine load_string_type + !> @brief load aux variable names + !! + !< + subroutine load_auxvar_names(parser, idt, memoryPath, iout) + use ConstantsModule, only: LENAUXNAME, LINELENGTH, LENPACKAGENAME + use InputOutputModule, only: urdaux + use CharacterStringModule, only: CharacterStringType + type(BlockParserType), intent(inout) :: parser !< block parser + type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record + character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information + integer(I4B), intent(in) :: iout !< unit number for output + character(len=:), allocatable :: line + character(len=LENAUXNAME), dimension(:), allocatable :: caux + integer(I4B) :: lloc + integer(I4B) :: istart + integer(I4B) :: istop + integer(I4B) :: i + character(len=LENPACKAGENAME) :: text = '' + integer(I4B), pointer :: intvar + type(CharacterStringType), dimension(:), & + pointer, contiguous :: acharstr1d !< variable for allocation + call mem_allocate(intvar, idt%shape, memoryPath) + intvar = 0 + call parser%GetRemainingLine(line) + lloc = 1 + call urdaux(intvar, parser%iuactive, iout, lloc, & + istart, istop, caux, line, text) + call mem_allocate(acharstr1d, LENAUXNAME, intvar, idt%mf6varname, memoryPath) + do i = 1, intvar + acharstr1d(i) = caux(i) + end do + deallocate (line) + deallocate (caux) + return + end subroutine load_auxvar_names + !> @brief load type integer !< subroutine load_integer_type(parser, idt, memoryPath, iout) @@ -492,6 +537,7 @@ end subroutine load_integer_type !> @brief load type 1d integer !< subroutine load_integer1d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -539,6 +585,7 @@ end subroutine load_integer1d_type !> @brief load type 2d integer !< subroutine load_integer2d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -582,6 +629,7 @@ end subroutine load_integer2d_type !> @brief load type 3d integer !< subroutine load_integer3d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -645,6 +693,7 @@ end subroutine load_double_type !> @brief load type 1d double !< subroutine load_double1d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -691,6 +740,7 @@ end subroutine load_double1d_type !> @brief load type 2d double !< subroutine load_double2d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -734,6 +784,7 @@ end subroutine load_double2d_type !> @brief load type 3d double !< subroutine load_double3d_type(parser, idt, memoryPath, mshape, iout) + use SourceCommonModule, only: get_shape_from_string type(BlockParserType), intent(inout) :: parser !< block parser type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information @@ -780,45 +831,6 @@ subroutine load_double3d_type(parser, idt, memoryPath, mshape, iout) return end subroutine load_double3d_type - !> @brief routine for setting the model shape - !! - !! The model shape must be set in the memory manager because - !! individual packages need to know the shape of the arrays - !! to read. - !! - !< - subroutine set_model_shape(ftype, model_mempath, dis_mempath, model_shape) - use MemoryTypeModule, only: MemoryType - use MemoryManagerModule, only: get_from_memorylist - character(len=*), intent(in) :: ftype - character(len=*), intent(in) :: model_mempath - character(len=*), intent(in) :: dis_mempath - integer(I4B), dimension(:), pointer, contiguous, intent(inout) :: model_shape - integer(I4B), pointer :: ndim1 - integer(I4B), pointer :: ndim2 - integer(I4B), pointer :: ndim3 - - select case (ftype) - case ('DIS6') - call mem_allocate(model_shape, 3, 'MODEL_SHAPE', model_mempath) - call mem_setptr(ndim1, 'NLAY', dis_mempath) - call mem_setptr(ndim2, 'NROW', dis_mempath) - call mem_setptr(ndim3, 'NCOL', dis_mempath) - model_shape = [ndim1, ndim2, ndim3] - case ('DISV6') - call mem_allocate(model_shape, 2, 'MODEL_SHAPE', model_mempath) - call mem_setptr(ndim1, 'NLAY', dis_mempath) - call mem_setptr(ndim2, 'NCPL', dis_mempath) - model_shape = [ndim1, ndim2] - case ('DISU6') - call mem_allocate(model_shape, 1, 'MODEL_SHAPE', model_mempath) - call mem_setptr(ndim1, 'NODES', dis_mempath) - model_shape = [ndim1] - end select - - return - end subroutine set_model_shape - subroutine get_layered_shape(mshape, nlay, layer_shape) integer(I4B), dimension(:), intent(in) :: mshape integer(I4B), intent(out) :: nlay @@ -845,27 +857,4 @@ subroutine get_layered_shape(mshape, nlay, layer_shape) end subroutine get_layered_shape - subroutine get_shape_from_string(shape_string, array_shape, memoryPath) - character(len=*), intent(in) :: shape_string - integer(I4B), dimension(:), allocatable, intent(inout) :: array_shape - character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information - integer(I4B) :: ndim - integer(I4B) :: i - integer(I4B), pointer :: int_ptr - character(len=16), dimension(:), allocatable :: array_shape_string - character(len=:), allocatable :: shape_string_copy - - ! parse the string into multiple words - shape_string_copy = trim(shape_string)//' ' - call ParseLine(shape_string_copy, ndim, array_shape_string) - allocate (array_shape(ndim)) - - ! find shape in memory manager and put into array_shape - do i = 1, ndim - call mem_setptr(int_ptr, array_shape_string(i), memoryPath) - array_shape(i) = int_ptr - end do - - end subroutine get_shape_from_string - end module LoadMf6FileModule diff --git a/src/Utilities/Idm/mf6file/StructArray.f90 b/src/Utilities/Idm/mf6file/StructArray.f90 index 5dca7d8becd..d6c00353978 100644 --- a/src/Utilities/Idm/mf6file/StructArray.f90 +++ b/src/Utilities/Idm/mf6file/StructArray.f90 @@ -9,8 +9,6 @@ module StructArrayModule use KindModule, only: I4B, DP, LGP use ConstantsModule, only: DNODATA, LINELENGTH - use SimVariablesModule, only: errmsg - use SimModule, only: store_error use StructVectorModule, only: StructVectorType use MemoryManagerModule, only: mem_allocate, mem_reallocate, mem_setptr use CharacterStringModule, only: CharacterStringType diff --git a/src/Utilities/Idm/selector/IdmDfnSelector.f90 b/src/Utilities/Idm/selector/IdmDfnSelector.f90 index a3e13b0ead0..362bfdfc0b8 100644 --- a/src/Utilities/Idm/selector/IdmDfnSelector.f90 +++ b/src/Utilities/Idm/selector/IdmDfnSelector.f90 @@ -27,6 +27,7 @@ module IdmDfnSelectorModule public :: block_definitions public :: idm_multi_package public :: idm_integrated + public :: idm_component contains @@ -117,4 +118,20 @@ function idm_integrated(component, subcomponent) result(integrated) return end function idm_integrated + function idm_component(component) result(integrated) + character(len=*), intent(in) :: component + logical :: integrated + integrated = .false. + select case (component) + case ('GWF') + integrated = .true. + case ('GWT') + integrated = .true. + case ('SIM') + integrated = .true. + case default + end select + return + end function idm_component + end module IdmDfnSelectorModule diff --git a/src/meson.build b/src/meson.build index c2540f42758..d0cfb49cc07 100644 --- a/src/meson.build +++ b/src/meson.build @@ -151,8 +151,12 @@ modflow_sources = files( 'Utilities' / 'Idm' / 'IdmLoad.f90', 'Utilities' / 'Idm' / 'IdmLogger.f90', 'Utilities' / 'Idm' / 'InputDefinition.f90', + 'Utilities' / 'Idm' / 'InputLoadType.f90', 'Utilities' / 'Idm' / 'ModelPackageInputs.f90', 'Utilities' / 'Idm' / 'ModflowInput.f90', + 'Utilities' / 'Idm' / 'SourceCommon.f90', + 'Utilities' / 'Idm' / 'SourceLoad.F90', + 'Utilities' / 'Idm' / 'StressPkgInput.f90', 'Utilities' / 'Idm' / 'mf6file' / 'IdmMf6File.f90', 'Utilities' / 'Idm' / 'mf6file' / 'LoadMf6File.f90', 'Utilities' / 'Idm' / 'mf6file' / 'StructArray.f90', diff --git a/src/mf6core.f90 b/src/mf6core.f90 index f173596e33f..5d5fe2c45c5 100644 --- a/src/mf6core.f90 +++ b/src/mf6core.f90 @@ -263,7 +263,7 @@ subroutine static_input_load() ! -- modules use ConstantsModule, only: LENMEMPATH use SimVariablesModule, only: iout - use IdmSimulationModule, only: simnam_load, load_models + use IdmLoadModule, only: simnam_load, load_models use MemoryHelperModule, only: create_mem_path use MemoryManagerModule, only: mem_setptr, mem_allocate use SimVariablesModule, only: idm_context, iparamlog diff --git a/utils/idmloader/scripts/dfn2f90.py b/utils/idmloader/scripts/dfn2f90.py index 6f59df4b38b..dea81ca9271 100644 --- a/utils/idmloader/scripts/dfn2f90.py +++ b/utils/idmloader/scripts/dfn2f90.py @@ -523,6 +523,7 @@ def _write_master(self): self._write_master_defn(fh, defn="block", dtype="block") self._write_master_multi(fh) self._write_master_integration(fh) + self._write_master_component(fh) fh.write(f"end module IdmDfnSelectorModule\n") def _write_selectors(self): @@ -732,7 +733,8 @@ def _write_master_decl(self, fh=None): f" public :: aggregate_definitions\n" f" public :: block_definitions\n" f" public :: idm_multi_package\n" - f" public :: idm_integrated\n\n" + f" public :: idm_integrated\n" + f" public :: idm_component\n\n" f"contains\n\n" ) @@ -823,6 +825,31 @@ def _write_master_integration(self, fh=None): fh.write(s) + def _write_master_component(self, fh=None): + s = ( + f" function idm_component(component) " + f"result(integrated)\n" + f" character(len=*), intent(in) :: component\n" + f" logical :: integrated\n" + f" integrated = .false.\n" + f" select case (component)\n" + ) + + for c in dfn_d: + s += ( + f" case ('{c}')\n" + f" integrated = .true.\n" + ) + + s += ( + f" case default\n" + f" end select\n" + f" return\n" + f" end function idm_component\n\n" + ) + + fh.write(s) + if __name__ == "__main__": From 4622c9c1d6da49e68df45f0cfceb3267e18ed020 Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 30 Jun 2023 13:37:08 -0400 Subject: [PATCH 3/7] rebuild makefiles --- make/makefile | 112 +++++++++++++++++++------------------ utils/mf5to6/make/makefile | 8 +-- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/make/makefile b/make/makefile index 552d7c70a1d..dfa95288d4e 100644 --- a/make/makefile +++ b/make/makefile @@ -6,34 +6,34 @@ include ./makedefaults # Define the source file directories SOURCEDIR1=../src 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 +SOURCEDIR3=../src/Model +SOURCEDIR4=../src/Model/Geometry +SOURCEDIR5=../src/Model/ModelUtilities +SOURCEDIR6=../src/Model/Connection +SOURCEDIR7=../src/Model/GroundWaterTransport +SOURCEDIR8=../src/Model/GroundWaterFlow +SOURCEDIR9=../src/Distributed +SOURCEDIR10=../src/Solution +SOURCEDIR11=../src/Solution/PETSc +SOURCEDIR12=../src/Solution/LinearMethods +SOURCEDIR13=../src/Timing +SOURCEDIR14=../src/Utilities +SOURCEDIR15=../src/Utilities/TimeSeries SOURCEDIR16=../src/Utilities/Libraries SOURCEDIR17=../src/Utilities/Libraries/rcm -SOURCEDIR18=../src/Utilities/Libraries/blas +SOURCEDIR18=../src/Utilities/Libraries/sparsekit 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/Geometry +SOURCEDIR20=../src/Utilities/Libraries/blas +SOURCEDIR21=../src/Utilities/Libraries/daglib +SOURCEDIR22=../src/Utilities/Idm +SOURCEDIR23=../src/Utilities/Idm/selector +SOURCEDIR24=../src/Utilities/Idm/mf6file +SOURCEDIR25=../src/Utilities/Matrix +SOURCEDIR26=../src/Utilities/Vector +SOURCEDIR27=../src/Utilities/Observation +SOURCEDIR28=../src/Utilities/OutputControl +SOURCEDIR29=../src/Utilities/Memory +SOURCEDIR30=../src/Utilities/ArrayRead VPATH = \ ${SOURCEDIR1} \ @@ -123,6 +123,7 @@ $(OBJDIR)/Obs3.o \ $(OBJDIR)/NumericalPackage.o \ $(OBJDIR)/Budget.o \ $(OBJDIR)/SeqVector.o \ +$(OBJDIR)/InputDefinition.o \ $(OBJDIR)/sort.o \ $(OBJDIR)/SfrCrossSectionUtils.o \ $(OBJDIR)/BudgetTerm.o \ @@ -133,17 +134,6 @@ $(OBJDIR)/LinearSolverBase.o \ $(OBJDIR)/ims8reordering.o \ $(OBJDIR)/VirtualBase.o \ $(OBJDIR)/STLVecInt.o \ -$(OBJDIR)/InputDefinition.o \ -$(OBJDIR)/SfrCrossSectionManager.o \ -$(OBJDIR)/dag_module.o \ -$(OBJDIR)/BudgetObject.o \ -$(OBJDIR)/NumericalModel.o \ -$(OBJDIR)/BaseExchange.o \ -$(OBJDIR)/ImsLinearSolver.o \ -$(OBJDIR)/ims8base.o \ -$(OBJDIR)/VirtualDataLists.o \ -$(OBJDIR)/VirtualDataContainer.o \ -$(OBJDIR)/SimStages.o \ $(OBJDIR)/simnamidm.o \ $(OBJDIR)/gwt1idm.o \ $(OBJDIR)/gwt1dsp1idm.o \ @@ -155,6 +145,19 @@ $(OBJDIR)/gwf3idm.o \ $(OBJDIR)/gwf3disv8idm.o \ $(OBJDIR)/gwf3disu8idm.o \ $(OBJDIR)/gwf3dis8idm.o \ +$(OBJDIR)/SfrCrossSectionManager.o \ +$(OBJDIR)/dag_module.o \ +$(OBJDIR)/BudgetObject.o \ +$(OBJDIR)/NumericalModel.o \ +$(OBJDIR)/BaseExchange.o \ +$(OBJDIR)/ImsLinearSolver.o \ +$(OBJDIR)/ims8base.o \ +$(OBJDIR)/VirtualDataLists.o \ +$(OBJDIR)/VirtualDataContainer.o \ +$(OBJDIR)/SimStages.o \ +$(OBJDIR)/IdmSimDfnSelector.o \ +$(OBJDIR)/IdmGwtDfnSelector.o \ +$(OBJDIR)/IdmGwfDfnSelector.o \ $(OBJDIR)/PackageBudget.o \ $(OBJDIR)/HeadFileReader.o \ $(OBJDIR)/PrintSaveManager.o \ @@ -175,9 +178,7 @@ $(OBJDIR)/ims8linear.o \ $(OBJDIR)/BaseSolution.o \ $(OBJDIR)/IndexMap.o \ $(OBJDIR)/VirtualModel.o \ -$(OBJDIR)/IdmSimDfnSelector.o \ -$(OBJDIR)/IdmGwtDfnSelector.o \ -$(OBJDIR)/IdmGwfDfnSelector.o \ +$(OBJDIR)/IdmDfnSelector.o \ $(OBJDIR)/UzfCellGroup.o \ $(OBJDIR)/gwt1fmi1.o \ $(OBJDIR)/OutputControlData.o \ @@ -189,8 +190,9 @@ $(OBJDIR)/gwf3vsc8.o \ $(OBJDIR)/GwfNpfOptions.o \ $(OBJDIR)/NumericalSolution.o \ $(OBJDIR)/InterfaceMap.o \ +$(OBJDIR)/ArrayReaderBase.o \ $(OBJDIR)/CellWithNbrs.o \ -$(OBJDIR)/IdmDfnSelector.o \ +$(OBJDIR)/SourceCommon.o \ $(OBJDIR)/gwf3uzf8.o \ $(OBJDIR)/gwt1apt1.o \ $(OBJDIR)/GwtSpc.o \ @@ -207,7 +209,7 @@ $(OBJDIR)/GwfMvrPeriodData.o \ $(OBJDIR)/ims8misc.o \ $(OBJDIR)/GwfBuyInputData.o \ $(OBJDIR)/VirtualSolution.o \ -$(OBJDIR)/ArrayReaderBase.o \ +$(OBJDIR)/Integer2dReader.o \ $(OBJDIR)/VirtualExchange.o \ $(OBJDIR)/gwf3disu8.o \ $(OBJDIR)/GridSorting.o \ @@ -244,17 +246,21 @@ $(OBJDIR)/GhostNode.o \ $(OBJDIR)/gwf3evt8.o \ $(OBJDIR)/gwf3chd8.o \ $(OBJDIR)/RouterBase.o \ -$(OBJDIR)/Integer2dReader.o \ -$(OBJDIR)/GridConnection.o \ -$(OBJDIR)/DistributedVariable.o \ -$(OBJDIR)/gwt1.o \ -$(OBJDIR)/gwf3.o \ -$(OBJDIR)/SerialRouter.o \ $(OBJDIR)/StructVector.o \ $(OBJDIR)/IdmLogger.o \ $(OBJDIR)/Integer1dReader.o \ $(OBJDIR)/Double2dReader.o \ $(OBJDIR)/Double1dReader.o \ +$(OBJDIR)/ModflowInput.o \ +$(OBJDIR)/GridConnection.o \ +$(OBJDIR)/DistributedVariable.o \ +$(OBJDIR)/gwt1.o \ +$(OBJDIR)/gwf3.o \ +$(OBJDIR)/SerialRouter.o \ +$(OBJDIR)/StructArray.o \ +$(OBJDIR)/LayeredArrayReader.o \ +$(OBJDIR)/DefinitionSelect.o \ +$(OBJDIR)/StressPkgInput.o \ $(OBJDIR)/ExplicitModel.o \ $(OBJDIR)/SpatialModelConnection.o \ $(OBJDIR)/GwtInterfaceModel.o \ @@ -263,16 +269,14 @@ $(OBJDIR)/GwfInterfaceModel.o \ $(OBJDIR)/GwfGwfExchange.o \ $(OBJDIR)/RouterFactory.o \ $(OBJDIR)/MappedMemory.o \ -$(OBJDIR)/StructArray.o \ -$(OBJDIR)/ModflowInput.o \ -$(OBJDIR)/LayeredArrayReader.o \ -$(OBJDIR)/DefinitionSelect.o \ +$(OBJDIR)/LoadMf6File.o \ +$(OBJDIR)/InputLoadType.o \ $(OBJDIR)/ExplicitSolution.o \ $(OBJDIR)/GwtGwtConnection.o \ $(OBJDIR)/GwfGwfConnection.o \ $(OBJDIR)/VirtualDataManager.o \ $(OBJDIR)/Mapper.o \ -$(OBJDIR)/LoadMf6File.o \ +$(OBJDIR)/IdmMf6File.o \ $(OBJDIR)/VirtualGwtModel.o \ $(OBJDIR)/VirtualGwtExchange.o \ $(OBJDIR)/VirtualGwfModel.o \ @@ -281,10 +285,10 @@ $(OBJDIR)/SolutionGroup.o \ $(OBJDIR)/SolutionFactory.o \ $(OBJDIR)/GwfGwtExchange.o \ $(OBJDIR)/RunControl.o \ -$(OBJDIR)/IdmMf6File.o \ +$(OBJDIR)/SourceLoad.o \ $(OBJDIR)/SimulationCreate.o \ $(OBJDIR)/RunControlFactory.o \ -$(OBJDIR)/IdmSimulation.o \ +$(OBJDIR)/IdmLoad.o \ $(OBJDIR)/ConnectionBuilder.o \ $(OBJDIR)/comarg.o \ $(OBJDIR)/mf6core.o \ diff --git a/utils/mf5to6/make/makefile b/utils/mf5to6/make/makefile index d8eb7e6963d..f5273f0ae0c 100644 --- a/utils/mf5to6/make/makefile +++ b/utils/mf5to6/make/makefile @@ -5,10 +5,10 @@ include ./makedefaults # Define the source file directories SOURCEDIR1=../src -SOURCEDIR2=../src/NWT -SOURCEDIR3=../src/LGR -SOURCEDIR4=../src/Preproc -SOURCEDIR5=../src/MF2005 +SOURCEDIR2=../src/LGR +SOURCEDIR3=../src/Preproc +SOURCEDIR4=../src/MF2005 +SOURCEDIR5=../src/NWT SOURCEDIR6=../../../src/Utilities/Memory SOURCEDIR7=../../../src/Utilities/TimeSeries SOURCEDIR8=../../../src/Utilities From b1e5813fe42302087d7f5e217480646c26d5d8f7 Mon Sep 17 00:00:00 2001 From: mjreno Date: Fri, 30 Jun 2023 15:25:37 -0400 Subject: [PATCH 4/7] expose concrete base package loader types --- src/Utilities/Idm/InputLoadType.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Utilities/Idm/InputLoadType.f90 b/src/Utilities/Idm/InputLoadType.f90 index fc0936dfd9d..6e934edfa9a 100644 --- a/src/Utilities/Idm/InputLoadType.f90 +++ b/src/Utilities/Idm/InputLoadType.f90 @@ -18,6 +18,7 @@ module InputLoadTypeModule public :: DynamicPkgLoadBaseType public :: ModelDynamicPkgsType public :: AddDynamicModelToList, GetDynamicModelFromList + public :: StaticPkgLoadType, DynamicPkgLoadType !> @brief derived type for source static load !! From 6d6605b29641f048229f108e0279ad53b8f7b0ab Mon Sep 17 00:00:00 2001 From: mjreno Date: Tue, 4 Jul 2023 20:16:38 -0400 Subject: [PATCH 5/7] some cleanup --- src/Utilities/Idm/IdmLoad.f90 | 16 +++++++++++++--- src/Utilities/Idm/InputLoadType.f90 | 8 ++++---- src/Utilities/Idm/ModelPackageInputs.f90 | 7 ------- src/Utilities/Idm/mf6file/IdmMf6File.f90 | 10 +++++----- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/Utilities/Idm/IdmLoad.f90 b/src/Utilities/Idm/IdmLoad.f90 index 4ff4129b131..6cd346cabd0 100644 --- a/src/Utilities/Idm/IdmLoad.f90 +++ b/src/Utilities/Idm/IdmLoad.f90 @@ -1,7 +1,7 @@ !> @brief This module contains the IdmLoadModule !! !! This module contains routines for managing static -!! and dynamic input loading for all supported sources. +!! and dynamic input loading for supported sources. !! !< module IdmLoadModule @@ -56,11 +56,11 @@ subroutine model_pkg_load(model_pkg_inputs, itype, ipkg, iout) ! if (associated(dynamic_loader)) then ! - ! -- set pointer to model dynamic packages loader + ! -- set pointer to model dynamic packages list dynamic_pkgs => dynamic_model_pkgs(model_pkg_inputs%modelname, & static_loader%modelfname) ! - ! -- add dynamic pkg loader to model load object + ! -- add dynamic pkg loader to list call dynamic_pkgs%add(dynamic_loader) ! end if @@ -217,6 +217,8 @@ subroutine dynamic_input_load(iout) return end subroutine dynamic_input_load + !> @brief retrieve list of model dynamic loaders + !< function dynamic_model_pkgs(modelname, modelfname) result(model_dynamic_input) use InputLoadTypeModule, only: AddDynamicModelToList, GetDynamicModelFromList character(len=*), intent(in) :: modelname @@ -248,6 +250,8 @@ function dynamic_model_pkgs(modelname, modelfname) result(model_dynamic_input) return end function dynamic_model_pkgs + !> @brief idm deallocate routine + !< subroutine idm_da(iout) integer(I4B), intent(in) :: iout ! @@ -257,6 +261,8 @@ subroutine idm_da(iout) return end subroutine idm_da + !> @brief deallocate all model dynamic loader collections + !< subroutine dynamic_da(iout) use InputLoadTypeModule, only: GetDynamicModelFromList integer(I4B), intent(in) :: iout @@ -276,6 +282,8 @@ subroutine dynamic_da(iout) return end subroutine dynamic_da + !> @brief return sim input context PRINT_INTPUT value + !< function input_param_log() result(paramlog) use MemoryHelperModule, only: create_mem_path use MemoryManagerModule, only: mem_setptr @@ -328,6 +336,8 @@ subroutine simnam_load_dim() return end subroutine simnam_load_dim + !> @brief set sim nam input context default integer value + !< subroutine allocate_simnam_int(input_mempath, idt) use MemoryManagerModule, only: mem_allocate use SimVariablesModule, only: isimcontinue, isimcheck diff --git a/src/Utilities/Idm/InputLoadType.f90 b/src/Utilities/Idm/InputLoadType.f90 index 6e934edfa9a..d7303973079 100644 --- a/src/Utilities/Idm/InputLoadType.f90 +++ b/src/Utilities/Idm/InputLoadType.f90 @@ -30,7 +30,7 @@ module InputLoadTypeModule type(ModflowInputType) :: mf6_input !< description of modflow6 input character(len=LENMODELNAME) :: modelname !< name of model character(len=LINELENGTH) :: modelfname !< name of model input file - character(len=LINELENGTH) :: source !< source type, e.g. MF6File + character(len=LINELENGTH) :: sourcename !< source name, e.g. name of file contains procedure :: init => static_init procedure :: destroy => static_destroy @@ -56,7 +56,7 @@ module InputLoadTypeModule type(ModflowInputType) :: mf6_input !< description of modflow6 input character(len=LENMODELNAME) :: modelname !< name of model character(len=LINELENGTH) :: modelfname !< name of model input file - character(len=LINELENGTH) :: source !< source type, e.g. MF6File + character(len=LINELENGTH) :: sourcename !< source name, e.g. name of file type(StressPkgInputType), pointer :: stresspkg !< stress pkg input context contains procedure :: init => dynamic_init @@ -120,7 +120,7 @@ subroutine static_init(this, mf6_input, modelname, modelfname, source) this%mf6_input = mf6_input this%modelname = modelname this%modelfname = modelfname - this%source = source + this%sourcename = source ! return end subroutine static_init @@ -142,7 +142,7 @@ subroutine dynamic_init(this, mf6_input, modelname, modelfname, source, iout) this%mf6_input = mf6_input this%modelname = modelname this%modelfname = modelfname - this%source = source + this%sourcename = source ! allocate (this%stresspkg) call this%stresspkg%init(this%mf6_input, iout) diff --git a/src/Utilities/Idm/ModelPackageInputs.f90 b/src/Utilities/Idm/ModelPackageInputs.f90 index 05a47f2bdeb..07ab590fe05 100644 --- a/src/Utilities/Idm/ModelPackageInputs.f90 +++ b/src/Utilities/Idm/ModelPackageInputs.f90 @@ -68,8 +68,6 @@ module ModelPackageInputsModule character(len=LENPACKAGETYPE) :: pkgtype ! -- component type, e.g. 'DIS or CHD' character(len=LENFTYPE) :: subcomponent_type - ! -- source - character(len=LENPACKAGENAME) :: source ! -- package instance attribute arrays character(len=LINELENGTH), dimension(:), allocatable :: filenames character(len=LENPACKAGENAME), dimension(:), allocatable :: pkgnames @@ -108,7 +106,6 @@ module ModelPackageInputsModule pointer :: mempaths => null() integer(I4B), dimension(:), contiguous, & pointer :: inunits => null() - integer(I4B), pointer :: ncid => null() ! -- loadable package type array type(LoadablePackageType), dimension(:), allocatable :: pkglist ! -- pkgtype definitions @@ -357,10 +354,6 @@ subroutine modelpkgs_init(this, modeltype, modelfname, modelname, iout) call mem_allocate(this%mempaths, LENMEMPATH, 0, 'MEMPATHS', & this%model_mempath) call mem_allocate(this%inunits, 0, 'INUNITS', this%model_mempath) - call mem_allocate(this%ncid, 'NCID', this%model_mempath) - ! - ! -- initialize - this%ncid = 0 ! ! build descriptions of packages call this%addpkgs() diff --git a/src/Utilities/Idm/mf6file/IdmMf6File.f90 b/src/Utilities/Idm/mf6file/IdmMf6File.f90 index 3f900253d12..e36d2ed4144 100644 --- a/src/Utilities/Idm/mf6file/IdmMf6File.f90 +++ b/src/Utilities/Idm/mf6file/IdmMf6File.f90 @@ -43,7 +43,7 @@ subroutine IPackageLoad(parser, mf6_input, iout) use BlockParserModule, only: BlockParserType use ModflowInputModule, only: ModflowInputType type(BlockParserType), intent(inout) :: parser !< block parser - type(ModflowInputType), intent(in) :: mf6_input !< ModflowInputType object that describes the input + type(ModflowInputType), intent(in) :: mf6_input !< description of input integer(I4B), intent(in) :: iout !< unit number for output end subroutine IPackageLoad end interface @@ -75,7 +75,7 @@ end subroutine IPackageLoad subroutine generic_mf6_load(parser, mf6_input, iout) use LoadMf6FileModule, only: idm_load type(BlockParserType), intent(inout) :: parser !< block parser - type(ModflowInputType), intent(in) :: mf6_input !< ModflowInputType object that describes the input + type(ModflowInputType), intent(in) :: mf6_input !< description of input integer(I4B), intent(in) :: iout !< unit number for output call idm_load(parser, mf6_input%pkgtype, & @@ -97,7 +97,7 @@ subroutine input_load(filename, pkgtype, & character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF character(len=*), intent(in) :: component_name !< component name, such as MYGWFMODEL character(len=*), intent(in) :: subcomponent_name !< subcomponent name, such as MYWELLPACKAGE - character(len=*), intent(in) :: component_filename + character(len=*), intent(in) :: component_filename !< component (e.g. model) filename integer(I4B), intent(in) :: iout !< unit number for output type(BlockParserType), pointer, optional, intent(inout) :: mf6_parser type(BlockParserType), allocatable, target :: parser !< block parser @@ -185,7 +185,7 @@ function static_load(this, iout) result(period_loader) nullify (period_loader) ! ! -- load model package to input context - call input_load(this%source, this%mf6_input%pkgtype, & + call input_load(this%sourcename, this%mf6_input%pkgtype, & this%mf6_input%component_type, & this%mf6_input%subcomponent_type, & this%mf6_input%component_name, & @@ -199,7 +199,7 @@ function static_load(this, iout) result(period_loader) ! ! -- initialize dynamic loader call mf6file_period_loader%init(this%mf6_input, this%modelname, & - this%modelfname, this%source, iout) + this%modelfname, this%sourcename, iout) ! ! -- set parser call mf6file_period_loader%set(parser, iout) From 3240406db70af95aee63b9c9db6bc1bc29bc4a5e Mon Sep 17 00:00:00 2001 From: mjreno Date: Wed, 5 Jul 2023 09:05:56 -0400 Subject: [PATCH 6/7] more cleanup --- src/Utilities/Idm/InputLoadType.f90 | 4 +- ...essPkgInput.f90 => StressPackageInput.f90} | 18 +++---- src/Utilities/Idm/mf6file/IdmMf6File.f90 | 54 ++++++++++++------- src/meson.build | 2 +- 4 files changed, 47 insertions(+), 31 deletions(-) rename src/Utilities/Idm/{StressPkgInput.f90 => StressPackageInput.f90} (66%) diff --git a/src/Utilities/Idm/InputLoadType.f90 b/src/Utilities/Idm/InputLoadType.f90 index d7303973079..0e31b360c40 100644 --- a/src/Utilities/Idm/InputLoadType.f90 +++ b/src/Utilities/Idm/InputLoadType.f90 @@ -10,7 +10,7 @@ module InputLoadTypeModule use ConstantsModule, only: LINELENGTH, LENMODELNAME use ModflowInputModule, only: ModflowInputType use ListModule, only: ListType - use StressPkgInputModule, only: StressPkgInputType + use StressPackageInputModule, only: StressPackageInputType implicit none private @@ -57,7 +57,7 @@ module InputLoadTypeModule character(len=LENMODELNAME) :: modelname !< name of model character(len=LINELENGTH) :: modelfname !< name of model input file character(len=LINELENGTH) :: sourcename !< source name, e.g. name of file - type(StressPkgInputType), pointer :: stresspkg !< stress pkg input context + type(StressPackageInputType), pointer :: stresspkg !< stress pkg input context contains procedure :: init => dynamic_init procedure :: destroy => dynamic_destroy diff --git a/src/Utilities/Idm/StressPkgInput.f90 b/src/Utilities/Idm/StressPackageInput.f90 similarity index 66% rename from src/Utilities/Idm/StressPkgInput.f90 rename to src/Utilities/Idm/StressPackageInput.f90 index 8b99a64b199..967c9b5dc5a 100644 --- a/src/Utilities/Idm/StressPkgInput.f90 +++ b/src/Utilities/Idm/StressPackageInput.f90 @@ -1,4 +1,4 @@ -!> @brief This module contains the StressPkgInputModule +!> @brief This module contains the StressPackageInputModule !! !! This module defines a type that manages input !! context dynamic loading for a stress package. @@ -6,29 +6,29 @@ !! This type is not fully implemented. !! !< -module StressPkgInputModule +module StressPackageInputModule use KindModule, only: DP, I4B, LGP use ModflowInputModule, only: ModflowInputType implicit none private - public :: StressPkgInputType + public :: StressPackageInputType - !> @brief StressPkgInputType, not fully implemented + !> @brief StressPackageInputType, not fully implemented !< - type :: StressPkgInputType + type :: StressPackageInputType contains procedure :: init => stresspkg_init procedure :: destroy => stresspkg_destroy - end type StressPkgInputType + end type StressPackageInputType contains subroutine stresspkg_init(this, mf6_input, iout) ! -- modules ! -- dummy - class(StressPkgInputType) :: this + class(StressPackageInputType) :: this type(ModflowInputType), intent(in) :: mf6_input integer(I4B), intent(in) :: iout ! -- local @@ -38,10 +38,10 @@ subroutine stresspkg_init(this, mf6_input, iout) end subroutine stresspkg_init subroutine stresspkg_destroy(this) - class(StressPkgInputType) :: this + class(StressPackageInputType) :: this ! ! -- return return end subroutine stresspkg_destroy -end module StressPkgInputModule +end module StressPackageInputModule diff --git a/src/Utilities/Idm/mf6file/IdmMf6File.f90 b/src/Utilities/Idm/mf6file/IdmMf6File.f90 index e36d2ed4144..ba32136c314 100644 --- a/src/Utilities/Idm/mf6file/IdmMf6File.f90 +++ b/src/Utilities/Idm/mf6file/IdmMf6File.f90 @@ -85,6 +85,36 @@ subroutine generic_mf6_load(parser, mf6_input, iout) end subroutine generic_mf6_load + function create_dynamic_parser(mf6_input, mf6_parser, static_parser) & + result(created) + type(ModflowInputType), intent(in) :: mf6_input + type(BlockParserType), pointer, intent(inout) :: mf6_parser + type(BlockParserType), allocatable, target, intent(inout) :: static_parser + logical(LGP) :: created + integer(I4B) :: iblock + ! + ! -- initialize + nullify (mf6_parser) + created = .false. + ! + ! -- check if package has dynamic input + do iblock = 1, size(mf6_input%block_dfns) + ! + if (mf6_input%block_dfns(iblock)%blockname == 'PERIOD') then + ! + ! -- dynamic package, allocate parser + allocate (mf6_parser, source=static_parser) + created = .true. + ! + exit + ! + end if + end do + ! + ! -- return + return + end function + !> @brief input load for traditional mf6 simulation input file !< subroutine input_load(filename, pkgtype, & @@ -103,8 +133,8 @@ subroutine input_load(filename, pkgtype, & type(BlockParserType), allocatable, target :: parser !< block parser type(ModflowInputType) :: mf6_input type(PackageLoad) :: pkgloader - integer(I4B) :: inunit, iblock - logical(LGP) :: clear_parser = .true. + integer(I4B) :: inunit + logical(LGP) :: created = .false. ! ! -- create description of input mf6_input = getModflowInput(pkgtype, component_type, & @@ -133,28 +163,14 @@ subroutine input_load(filename, pkgtype, & ! -- generate a dynamic loader parser if requested and relevant if (present(mf6_parser)) then ! - ! -- initialize - nullify (mf6_parser) - ! - ! -- check if package has dynamic input - do iblock = 1, size(mf6_input%block_dfns) - ! - if (mf6_input%block_dfns(iblock)%blockname == 'PERIOD') then - ! - ! -- dynamic package, allocate parser - allocate (mf6_parser, source=parser) - clear_parser = .false. - ! - exit - ! - end if - end do + ! -- create dynamic parser + created = create_dynamic_parser(mf6_input, mf6_parser, parser) end if ! ! -- deallocate static load parser if (allocated(parser)) then ! - if (clear_parser) call parser%clear() + if (.not. created) call parser%clear() deallocate (parser) ! end if diff --git a/src/meson.build b/src/meson.build index d0cfb49cc07..f2f52bbe760 100644 --- a/src/meson.build +++ b/src/meson.build @@ -156,7 +156,7 @@ modflow_sources = files( 'Utilities' / 'Idm' / 'ModflowInput.f90', 'Utilities' / 'Idm' / 'SourceCommon.f90', 'Utilities' / 'Idm' / 'SourceLoad.F90', - 'Utilities' / 'Idm' / 'StressPkgInput.f90', + 'Utilities' / 'Idm' / 'StressPackageInput.f90', 'Utilities' / 'Idm' / 'mf6file' / 'IdmMf6File.f90', 'Utilities' / 'Idm' / 'mf6file' / 'LoadMf6File.f90', 'Utilities' / 'Idm' / 'mf6file' / 'StructArray.f90', From 6becb5ed16cd14d5193cdd102c9e9ff4aa704e66 Mon Sep 17 00:00:00 2001 From: mjreno Date: Wed, 5 Jul 2023 10:00:54 -0400 Subject: [PATCH 7/7] rebuild makefiles --- make/makefile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/make/makefile b/make/makefile index dfa95288d4e..ddbc5789a62 100644 --- a/make/makefile +++ b/make/makefile @@ -122,18 +122,14 @@ $(OBJDIR)/PackageMover.o \ $(OBJDIR)/Obs3.o \ $(OBJDIR)/NumericalPackage.o \ $(OBJDIR)/Budget.o \ -$(OBJDIR)/SeqVector.o \ $(OBJDIR)/InputDefinition.o \ $(OBJDIR)/sort.o \ $(OBJDIR)/SfrCrossSectionUtils.o \ $(OBJDIR)/BudgetTerm.o \ -$(OBJDIR)/BoundaryPackage.o \ -$(OBJDIR)/BaseModel.o \ -$(OBJDIR)/SparseMatrix.o \ -$(OBJDIR)/LinearSolverBase.o \ -$(OBJDIR)/ims8reordering.o \ $(OBJDIR)/VirtualBase.o \ $(OBJDIR)/STLVecInt.o \ +$(OBJDIR)/BoundaryPackage.o \ +$(OBJDIR)/BaseModel.o \ $(OBJDIR)/simnamidm.o \ $(OBJDIR)/gwt1idm.o \ $(OBJDIR)/gwt1dsp1idm.o \ @@ -148,13 +144,10 @@ $(OBJDIR)/gwf3dis8idm.o \ $(OBJDIR)/SfrCrossSectionManager.o \ $(OBJDIR)/dag_module.o \ $(OBJDIR)/BudgetObject.o \ -$(OBJDIR)/NumericalModel.o \ -$(OBJDIR)/BaseExchange.o \ -$(OBJDIR)/ImsLinearSolver.o \ -$(OBJDIR)/ims8base.o \ $(OBJDIR)/VirtualDataLists.o \ $(OBJDIR)/VirtualDataContainer.o \ $(OBJDIR)/SimStages.o \ +$(OBJDIR)/NumericalModel.o \ $(OBJDIR)/IdmSimDfnSelector.o \ $(OBJDIR)/IdmGwtDfnSelector.o \ $(OBJDIR)/IdmGwfDfnSelector.o \ @@ -171,13 +164,9 @@ $(OBJDIR)/gwf3lak8.o \ $(OBJDIR)/GwfVscInputData.o \ $(OBJDIR)/gwf3ghb8.o \ $(OBJDIR)/gwf3drn8.o \ -$(OBJDIR)/Timer.o \ -$(OBJDIR)/NumericalExchange.o \ -$(OBJDIR)/LinearSolverFactory.o \ -$(OBJDIR)/ims8linear.o \ -$(OBJDIR)/BaseSolution.o \ $(OBJDIR)/IndexMap.o \ $(OBJDIR)/VirtualModel.o \ +$(OBJDIR)/BaseExchange.o \ $(OBJDIR)/IdmDfnSelector.o \ $(OBJDIR)/UzfCellGroup.o \ $(OBJDIR)/gwt1fmi1.o \ @@ -188,10 +177,11 @@ $(OBJDIR)/gwf3tvk8.o \ $(OBJDIR)/MemoryManagerExt.o \ $(OBJDIR)/gwf3vsc8.o \ $(OBJDIR)/GwfNpfOptions.o \ -$(OBJDIR)/NumericalSolution.o \ $(OBJDIR)/InterfaceMap.o \ +$(OBJDIR)/SeqVector.o \ $(OBJDIR)/ArrayReaderBase.o \ $(OBJDIR)/CellWithNbrs.o \ +$(OBJDIR)/NumericalExchange.o \ $(OBJDIR)/SourceCommon.o \ $(OBJDIR)/gwf3uzf8.o \ $(OBJDIR)/gwt1apt1.o \ @@ -209,6 +199,9 @@ $(OBJDIR)/GwfMvrPeriodData.o \ $(OBJDIR)/ims8misc.o \ $(OBJDIR)/GwfBuyInputData.o \ $(OBJDIR)/VirtualSolution.o \ +$(OBJDIR)/SparseMatrix.o \ +$(OBJDIR)/LinearSolverBase.o \ +$(OBJDIR)/ims8reordering.o \ $(OBJDIR)/Integer2dReader.o \ $(OBJDIR)/VirtualExchange.o \ $(OBJDIR)/gwf3disu8.o \ @@ -246,6 +239,8 @@ $(OBJDIR)/GhostNode.o \ $(OBJDIR)/gwf3evt8.o \ $(OBJDIR)/gwf3chd8.o \ $(OBJDIR)/RouterBase.o \ +$(OBJDIR)/ImsLinearSolver.o \ +$(OBJDIR)/ims8base.o \ $(OBJDIR)/StructVector.o \ $(OBJDIR)/IdmLogger.o \ $(OBJDIR)/Integer1dReader.o \ @@ -257,10 +252,14 @@ $(OBJDIR)/DistributedVariable.o \ $(OBJDIR)/gwt1.o \ $(OBJDIR)/gwf3.o \ $(OBJDIR)/SerialRouter.o \ +$(OBJDIR)/Timer.o \ +$(OBJDIR)/LinearSolverFactory.o \ +$(OBJDIR)/ims8linear.o \ +$(OBJDIR)/BaseSolution.o \ $(OBJDIR)/StructArray.o \ $(OBJDIR)/LayeredArrayReader.o \ $(OBJDIR)/DefinitionSelect.o \ -$(OBJDIR)/StressPkgInput.o \ +$(OBJDIR)/StressPackageInput.o \ $(OBJDIR)/ExplicitModel.o \ $(OBJDIR)/SpatialModelConnection.o \ $(OBJDIR)/GwtInterfaceModel.o \ @@ -268,6 +267,7 @@ $(OBJDIR)/GwtGwtExchange.o \ $(OBJDIR)/GwfInterfaceModel.o \ $(OBJDIR)/GwfGwfExchange.o \ $(OBJDIR)/RouterFactory.o \ +$(OBJDIR)/NumericalSolution.o \ $(OBJDIR)/MappedMemory.o \ $(OBJDIR)/LoadMf6File.o \ $(OBJDIR)/InputLoadType.o \