Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mjreno authored and mjreno committed Jul 5, 2023
1 parent 40e2a4e commit 9596a33
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
16 changes: 13 additions & 3 deletions src/Utilities/Idm/IdmLoad.f90
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
!
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Utilities/Idm/InputLoadType.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions src/Utilities/Idm/ModelPackageInputs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions src/Utilities/Idm/mf6file/IdmMf6File.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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, &
Expand All @@ -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
Expand Down Expand Up @@ -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, &
Expand All @@ -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)
Expand Down

0 comments on commit 9596a33

Please sign in to comment.