MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
modflowinputmodule Module Reference

This module contains the ModflowInputModule. More...

Data Types

type  modflowinputtype
 derived type for storing input definition for a file More...
 

Functions/Subroutines

type(modflowinputtype) function, public getmodflowinput (pkgtype, component_type, subcomponent_type, component_name, subcomponent_name, filename)
 function to return ModflowInputType More...
 
character(len=lenpackagetype) function update_sc_type (filetype, filename, component_type, subcomponent_type)
 
character(len=lenpackagetype) function read_as_arrays (filetype, filename, component_type, subcomponent_type)
 

Detailed Description

This module contains a helper object and function for accessing the ModflowInput, which is a description of the structure of a modflow input file.

Function/Subroutine Documentation

◆ getmodflowinput()

type(modflowinputtype) function, public modflowinputmodule::getmodflowinput ( character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  component_type,
character(len=*), intent(in)  subcomponent_type,
character(len=*), intent(in)  component_name,
character(len=*), intent(in)  subcomponent_name,
character(len=*), intent(in), optional  filename 
)
Parameters
[in]pkgtypepackage type to load, such as DIS6, DISV6, NPF6
[in]component_typecomponent type, such as GWF or GWT
[in]subcomponent_typesubcomponent type, such as DIS or NPF
[in]component_namecomponent name, such as MYGWFMODEL
[in]subcomponent_namesubcomponent name, such as MYWELLPACKAGE
[in]filenameoptional name of package input file

Definition at line 51 of file ModflowInput.f90.

54  character(len=*), intent(in) :: pkgtype !< package type to load, such as DIS6, DISV6, NPF6
55  character(len=*), intent(in) :: component_type !< component type, such as GWF or GWT
56  character(len=*), intent(in) :: subcomponent_type !< subcomponent type, such as DIS or NPF
57  character(len=*), intent(in) :: component_name !< component name, such as MYGWFMODEL
58  character(len=*), intent(in) :: subcomponent_name !< subcomponent name, such as MYWELLPACKAGE
59  character(len=*), optional, intent(in) :: filename !< optional name of package input file
60  type(ModflowInputType) :: mf6_input
61  character(len=LENPACKAGETYPE) :: dfn_subcomponent_type
62 
63  ! -- set subcomponent type
64  if (present(filename)) then
65  dfn_subcomponent_type = update_sc_type(pkgtype, filename, component_type, &
66  subcomponent_type)
67  else
68  dfn_subcomponent_type = trim(subcomponent_type)
69  end if
70 
71  ! -- set input attributes
72  mf6_input%pkgtype = trim(pkgtype)
73  mf6_input%component_type = trim(component_type)
74  mf6_input%subcomponent_type = trim(dfn_subcomponent_type)
75  mf6_input%component_name = trim(component_name)
76  mf6_input%subcomponent_name = trim(subcomponent_name)
77 
78  ! -- set mempaths
79  mf6_input%mempath = create_mem_path(component_name, subcomponent_name, &
80  idm_context)
81  mf6_input%component_mempath = create_mem_path(component=component_name, &
82  context=idm_context)
83 
84  ! -- set input definitions
85  mf6_input%block_dfns => block_definitions(mf6_input%component_type, &
86  mf6_input%subcomponent_type)
87  mf6_input%aggregate_dfns => aggregate_definitions(mf6_input%component_type, &
88  mf6_input%subcomponent_type)
89  mf6_input%param_dfns => param_definitions(mf6_input%component_type, &
90  mf6_input%subcomponent_type)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_as_arrays()

character(len=lenpackagetype) function modflowinputmodule::read_as_arrays ( character(len=*), intent(in)  filetype,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  component_type,
character(len=*), intent(in)  subcomponent_type 
)
private

Definition at line 115 of file ModflowInput.f90.

117  use constantsmodule, only: linelength
120  character(len=*), intent(in) :: component_type
121  character(len=*), intent(in) :: subcomponent_type
122  character(len=*), intent(in) :: filetype
123  character(len=*), intent(in) :: filename
124  ! -- result
125  character(len=LENPACKAGETYPE) :: sc_type
126  type(BlockParserType) :: parser
127  integer(I4B) :: ierr, inunit
128  logical(LGP) :: isfound
129  logical(LGP) :: endOfBlock
130  character(len=LINELENGTH) :: keyword
131  !
132  sc_type = subcomponent_type
133  !
134  inunit = getunit()
135  !
136  call openfile(inunit, 0, trim(adjustl(filename)), filetype, &
137  'FORMATTED', 'SEQUENTIAL', 'OLD')
138  !
139  call parser%Initialize(inunit, 0)
140  !
141  ! -- get options block
142  call parser%GetBlock('OPTIONS', isfound, ierr, &
143  supportopenclose=.true., blockrequired=.false.)
144  !
145  ! -- parse options block if detected
146  if (isfound) then
147  do
148  call parser%GetNextLine(endofblock)
149  !
150  if (endofblock) exit
151  !
152  call parser%GetStringCaps(keyword)
153  !
154  if (keyword == 'READASARRAYS') then
155  write (sc_type, '(a)') trim(subcomponent_type)//'A'
156  exit
157  end if
158  end do
159  end if
160  !
161  call parser%clear()
162  !
163  ! -- return
164  return
This module contains block parser methods.
Definition: BlockParser.f90:7
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_sc_type()

character(len=lenpackagetype) function modflowinputmodule::update_sc_type ( character(len=*), intent(in)  filetype,
character(len=*), intent(in)  filename,
character(len=*), intent(in)  component_type,
character(len=*), intent(in)  subcomponent_type 
)
private

Definition at line 93 of file ModflowInput.f90.

95  character(len=*), intent(in) :: component_type
96  character(len=*), intent(in) :: subcomponent_type
97  character(len=*), intent(in) :: filetype
98  character(len=*), intent(in) :: filename
99  ! -- result
100  character(len=LENPACKAGETYPE) :: sc_type
101  !
102  sc_type = subcomponent_type
103  !
104  select case (subcomponent_type)
105  case ('RCH', 'EVT', 'SCP')
106  sc_type = read_as_arrays(filetype, filename, component_type, &
107  subcomponent_type)
108  case default
109  end select
110  !
111  ! -- return
112  return
Here is the call graph for this function:
Here is the caller graph for this function: