MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
loadmf6filemodule Module Reference

This module contains the LoadMf6FileModule. More...

Data Types

type  loadmf6filetype
 Static parser based input loader. More...
 

Functions/Subroutines

subroutine load (this, parser, mf6_input, nc_vars, filename, iout)
 load all static input blocks More...
 
subroutine init (this, parser, mf6_input, filename, iout)
 init More...
 
subroutine load_block (this, iblk)
 load a single block More...
 
subroutine finalize (this)
 finalize More...
 
subroutine block_post_process (this, iblk)
 Post parse block handling. More...
 
recursive subroutine parse_block (this, iblk, recursive_call)
 parse block More...
 
subroutine parse_io_tag (this, iblk, pkgtype, which, tag)
 
subroutine parse_keyword_tag (this, iblk, tag, idt)
 
recursive subroutine parse_tag (this, iblk, recursive_call)
 load an individual input record into memory More...
 
type(inputparamdefinitiontype) function block_index_dfn (this, iblk)
 
subroutine parse_structarray_block (this, iblk)
 parse a structured array record into memory manager More...
 
subroutine load_keyword_type (parser, idt, memoryPath, iout)
 load type keyword More...
 
subroutine load_string_type (parser, idt, memoryPath, iout)
 load type string More...
 
subroutine load_io_tag (parser, idt, memoryPath, which, iout)
 load io tag More...
 
subroutine load_auxvar_names (parser, idt, memoryPath, iout)
 load aux variable names More...
 
subroutine load_integer_type (parser, idt, memoryPath, iout)
 load type integer More...
 
subroutine load_integer1d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 1d integer More...
 
subroutine load_integer2d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 2d integer More...
 
subroutine load_integer3d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 3d integer More...
 
subroutine load_double_type (parser, idt, memoryPath, iout)
 load type double More...
 
subroutine load_double1d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 1d double More...
 
subroutine load_double2d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 2d double More...
 
subroutine load_double3d_type (parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
 load type 3d double More...
 
integer(i4b) function, public read_control_record (parser, oc_inunit, iout)
 

Detailed Description

This module contains the input data model routines for loading static data from a MODFLOW 6 input file using the block parser.

Function/Subroutine Documentation

◆ block_index_dfn()

type(inputparamdefinitiontype) function loadmf6filemodule::block_index_dfn ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)
Returns
input data type object describing this record

Definition at line 519 of file LoadMf6File.f90.

520  ! -- modules
521  ! -- dummy
522  class(LoadMf6FileType) :: this
523  integer(I4B), intent(in) :: iblk
524  ! -- local
525  type(InputParamDefinitionType) :: idt !< input data type object describing this record
526  character(len=LENVARNAME) :: varname
527  integer(I4B) :: ilen
528  character(len=3) :: block_suffix = 'NUM'
529  !
530  ! -- assign first column as the block number
531  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
532  !
533  if (ilen > (lenvarname - len(block_suffix))) then
534  varname = &
535  this%mf6_input%block_dfns(iblk)% &
536  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
537  else
538  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
539  end if
540  !
541  idt%component_type = trim(this%mf6_input%component_type)
542  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
543  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
544  idt%tagname = varname
545  idt%mf6varname = varname
546  idt%datatype = 'INTEGER'

◆ block_post_process()

subroutine loadmf6filemodule::block_post_process ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)

Definition at line 214 of file LoadMf6File.f90.

215  ! -- modules
216  use constantsmodule, only: lenboundname
219  ! -- dummy
220  class(LoadMf6FileType) :: this
221  integer(I4B), intent(in) :: iblk
222  ! -- local
223  type(InputParamDefinitionType), pointer :: idt
224  integer(I4B) :: iparam
225  integer(I4B), pointer :: intptr
226  !
227  ! -- update state based on read tags
228  do iparam = 1, size(this%block_tags)
229  select case (this%mf6_input%block_dfns(iblk)%blockname)
230  case ('OPTIONS')
231  if (this%block_tags(iparam) == 'AUXILIARY') then
232  this%iauxiliary = 1
233  else if (this%block_tags(iparam) == 'BOUNDNAMES') then
234  this%inamedbound = 1
235  else if (this%block_tags(iparam) == 'READASARRAYS') then
236  this%readasarrays = .true.
237  else if (this%block_tags(iparam) == 'TS6') then
238  this%ts_active = .true.
239  else if (this%block_tags(iparam) == 'EXPORT_ARRAY_ASCII') then
240  this%export = .true.
241  end if
242  case default
243  end select
244  end do
245  !
246  ! -- update input context allocations based on dfn set and input
247  select case (this%mf6_input%block_dfns(iblk)%blockname)
248  case ('OPTIONS')
249  ! -- allocate naux and set to 0 if not allocated
250  do iparam = 1, size(this%mf6_input%param_dfns)
251  idt => this%mf6_input%param_dfns(iparam)
252  !
253  if (idt%blockname == 'OPTIONS' .and. &
254  idt%tagname == 'AUXILIARY') then
255  if (this%iauxiliary == 0) then
256  call mem_allocate(intptr, 'NAUX', this%mf6_input%mempath)
257  intptr = 0
258  end if
259  exit
260  end if
261  end do
262  case ('DIMENSIONS')
263  ! -- set model shape if discretization dimensions have been read
264  if (this%mf6_input%pkgtype(1:3) == 'DIS') then
265  call set_model_shape(this%mf6_input%pkgtype, this%filename, &
266  this%mf6_input%component_mempath, &
267  this%mf6_input%mempath, this%mshape)
268  end if
269  case default
270  end select
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
subroutine, public set_model_shape(ftype, fname, model_mempath, dis_mempath, model_shape)
routine for setting the model shape
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Here is the call graph for this function:

◆ finalize()

subroutine loadmf6filemodule::finalize ( class(loadmf6filetype this)

init / finalize are only used when load_block() will be called

Definition at line 193 of file LoadMf6File.f90.

194  ! -- modules
196  ! -- dummy
197  class(LoadMf6FileType) :: this
198  ! -- local
199  !
200  ! -- cleanup
201  if (associated(this%structarray)) then
202  ! -- destroy the structured array reader
203  call destructstructarray(this%structarray)
204  end if
205  !
206  ! -- close logging block
207  call idm_log_close(this%mf6_input%component_name, &
208  this%mf6_input%subcomponent_name, this%iout)
This module contains the StructArrayModule.
Definition: StructArray.f90:8
subroutine, public destructstructarray(struct_array)
destructor for a struct_array
Here is the call graph for this function:

◆ init()

subroutine loadmf6filemodule::init ( class(loadmf6filetype this,
type(blockparsertype), intent(inout), target  parser,
type(modflowinputtype), intent(in)  mf6_input,
character(len=*), intent(in)  filename,
integer(i4b), intent(in)  iout 
)

init / finalize are only used when load_block() will be called

Definition at line 122 of file LoadMf6File.f90.

123  ! -- modules
124  use memorymanagermodule, only: get_isize
125  ! -- dummy
126  class(LoadMf6FileType) :: this
127  type(BlockParserType), target, intent(inout) :: parser
128  type(ModflowInputType), intent(in) :: mf6_input
129  character(len=*), intent(in) :: filename
130  integer(I4B), intent(in) :: iout
131  ! -- local
132  integer(I4B) :: isize
133  !
134  this%parser => parser
135  this%mf6_input = mf6_input
136  this%filename = filename
137  this%ts_active = .false.
138  this%export = .false.
139  this%readasarrays = .false.
140  this%inamedbound = 0
141  this%iauxiliary = 0
142  this%iout = iout
143  !
144  call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize)
145  !
146  if (isize > 0) then
147  call mem_setptr(this%mshape, 'MODEL_SHAPE', mf6_input%component_mempath)
148  end if
149  !
150  ! -- log lst file header
151  call idm_log_header(this%mf6_input%component_name, &
152  this%mf6_input%subcomponent_name, this%iout)
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
Here is the call graph for this function:

◆ load()

subroutine loadmf6filemodule::load ( class(loadmf6filetype this,
type(blockparsertype), intent(inout), target  parser,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  filename,
integer(i4b), intent(in)  iout 
)
private

Invoke this routine to load all static input blocks in single call.

Definition at line 84 of file LoadMf6File.f90.

85  ! -- modules
87  ! -- dummy
88  class(LoadMf6FileType) :: this
89  type(BlockParserType), target, intent(inout) :: parser
90  type(ModflowInputType), intent(in) :: mf6_input
91  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
92  character(len=*), intent(in) :: filename
93  integer(I4B), intent(in) :: iout
94  ! -- local
95  integer(I4B) :: iblk
96  !
97  ! -- initialize static load
98  call this%init(parser, mf6_input, filename, iout)
99  !
100  this%nc_vars => nc_vars
101  !
102  ! -- process blocks
103  do iblk = 1, size(this%mf6_input%block_dfns)
104  !
105  ! -- don't load dynamic input data
106  if (this%mf6_input%block_dfns(iblk)%blockname == 'PERIOD') exit
107  !
108  ! -- load the block
109  call this%load_block(iblk)
110  !
111  end do
112  !
113  ! -- finalize static load
114  call this%finalize()
Here is the call graph for this function:

◆ load_auxvar_names()

subroutine loadmf6filemodule::load_auxvar_names ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 749 of file LoadMf6File.f90.

751  use inputoutputmodule, only: urdaux
753  type(BlockParserType), intent(inout) :: parser !< block parser
754  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
755  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
756  integer(I4B), intent(in) :: iout !< unit number for output
757  character(len=:), allocatable :: line
758  character(len=LENAUXNAME), dimension(:), allocatable :: caux
759  integer(I4B) :: lloc
760  integer(I4B) :: istart
761  integer(I4B) :: istop
762  integer(I4B) :: i
763  character(len=LENPACKAGENAME) :: text = ''
764  integer(I4B), pointer :: intvar
765  type(CharacterStringType), dimension(:), &
766  pointer, contiguous :: acharstr1d !< variable for allocation
767  call mem_allocate(intvar, idt%shape, memorypath)
768  intvar = 0
769  call parser%GetRemainingLine(line)
770  lloc = 1
771  call urdaux(intvar, parser%iuactive, iout, lloc, &
772  istart, istop, caux, line, text)
773  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
774  do i = 1, intvar
775  acharstr1d(i) = caux(i)
776  end do
777  deallocate (line)
778  deallocate (caux)
779  return
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b), parameter lenpackagename
maximum length of the package name
Definition: Constants.f90:23
integer(i4b), parameter lenauxname
maximum length of a aux variable
Definition: Constants.f90:35
subroutine, public urdaux(naux, inunit, iout, lloc, istart, istop, auxname, line, text)
Read auxiliary variables from an input line.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_block()

subroutine loadmf6filemodule::load_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)

Assumed in order load of single (next) block. If a StructArray object is allocated to load this block it persists until this routine (or finalize) is called again.

Definition at line 163 of file LoadMf6File.f90.

164  ! -- modules
166  ! -- dummy
167  class(LoadMf6FileType) :: this
168  integer(I4B), intent(in) :: iblk
169  ! -- local
170  !
171  ! -- reset structarray if it was created for previous block
172  if (associated(this%structarray)) then
173  ! -- destroy the structured array reader
174  call destructstructarray(this%structarray)
175  end if
176  !
177  allocate (this%block_tags(0))
178  !
179  ! -- load the block
180  call this%parse_block(iblk, .false.)
181  !
182  ! -- post process block
183  call this%block_post_process(iblk)
184  !
185  deallocate (this%block_tags)
Here is the call graph for this function:

◆ load_double1d_type()

subroutine loadmf6filemodule::load_double1d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 994 of file LoadMf6File.f90.

998  type(BlockParserType), intent(inout) :: parser !< block parser
999  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
1000  type(ModflowInputType), intent(in) :: mf6_input !< description of input
1001  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1002  logical(LGP), intent(in) :: export !< export to ascii layer files
1003  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
1004  character(len=*), intent(in) :: input_fname !< ascii input file name
1005  integer(I4B), intent(in) :: iout !< unit number for output
1006  real(DP), dimension(:), pointer, contiguous :: dbl1d
1007  integer(I4B) :: nlay
1008  integer(I4B) :: nvals
1009  integer(I4B), dimension(:), allocatable :: array_shape
1010  integer(I4B), dimension(:), allocatable :: layer_shape
1011  character(len=LINELENGTH) :: keyword
1012 
1013  ! Check if it is a full grid sized array (NODES)
1014  if (idt%shape == 'NODES') then
1015  nvals = product(mshape)
1016  else
1017  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1018  nvals = array_shape(1)
1019  end if
1020 
1021  ! allocate memory for the array
1022  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
1023 
1024  ! read keyword
1025  keyword = ''
1026  call parser%GetStringCaps(keyword)
1027 
1028  ! check for "NETCDF" and "LAYERED"
1029  if (keyword == 'NETCDF') then
1030  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
1031  input_fname, iout)
1032  else if (keyword == 'LAYERED' .and. idt%layered) then
1033  call get_layered_shape(mshape, nlay, layer_shape)
1034  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
1035  else
1036  call read_dbl1d(parser, dbl1d, idt%mf6varname)
1037  end if
1038 
1039  ! log information on the loaded array to the list file
1040  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
1041 
1042  ! create export file for griddata parameters if optioned
1043  if (export) then
1044  if (idt%blockname == 'GRIDDATA') then
1045  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1046  end if
1047  end if
1048 
1049  return
This module contains the LoadNCInputModule.
Definition: LoadNCInput.F90:7
subroutine, public get_layered_shape(mshape, nlay, layer_shape)
subroutine, public get_shape_from_string(shape_string, array_shape, memoryPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double2d_type()

subroutine loadmf6filemodule::load_double2d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 1054 of file LoadMf6File.f90.

1058  type(BlockParserType), intent(inout) :: parser !< block parser
1059  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
1060  type(ModflowInputType), intent(in) :: mf6_input !< description of input
1061  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1062  logical(LGP), intent(in) :: export !< export to ascii layer files
1063  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
1064  character(len=*), intent(in) :: input_fname !< ascii input file name
1065  integer(I4B), intent(in) :: iout !< unit number for output
1066  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
1067  integer(I4B) :: nlay
1068  integer(I4B) :: nsize1, nsize2
1069  integer(I4B), dimension(:), allocatable :: array_shape
1070  integer(I4B), dimension(:), allocatable :: layer_shape
1071  character(len=LINELENGTH) :: keyword
1072 
1073  ! determine the array shape from the input data definition (idt%shape),
1074  ! which looks like "NCOL, NROW, NLAY"
1075  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1076  nsize1 = array_shape(1)
1077  nsize2 = array_shape(2)
1078 
1079  ! create a new 3d memory managed variable
1080  call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1081 
1082  ! read keyword
1083  keyword = ''
1084  call parser%GetStringCaps(keyword)
1085 
1086  ! check for "NETCDF" and "LAYERED"
1087  if (keyword == 'NETCDF') then
1088  call netcdf_read_array(dbl2d, mshape, idt, mf6_input, nc_vars, &
1089  input_fname, iout)
1090  else if (keyword == 'LAYERED' .and. idt%layered) then
1091  call get_layered_shape(mshape, nlay, layer_shape)
1092  call read_dbl2d_layered(parser, dbl2d, idt%mf6varname, nlay, layer_shape)
1093  else
1094  call read_dbl2d(parser, dbl2d, idt%mf6varname)
1095  end if
1096 
1097  ! log information on the loaded array to the list file
1098  call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1099 
1100  ! create export file for griddata parameters if optioned
1101  if (export) then
1102  if (idt%blockname == 'GRIDDATA') then
1103  call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1104  end if
1105  end if
1106 
1107  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double3d_type()

subroutine loadmf6filemodule::load_double3d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 1112 of file LoadMf6File.f90.

1116  type(BlockParserType), intent(inout) :: parser !< block parser
1117  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
1118  type(ModflowInputType), intent(in) :: mf6_input !< description of input
1119  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1120  logical(LGP), intent(in) :: export !< export to ascii layer files
1121  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
1122  character(len=*), intent(in) :: input_fname !< ascii input file name
1123  integer(I4B), intent(in) :: iout !< unit number for output
1124  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
1125  integer(I4B) :: nlay
1126  integer(I4B) :: nsize1, nsize2, nsize3
1127  integer(I4B), dimension(:), allocatable :: array_shape
1128  integer(I4B), dimension(:), allocatable :: layer_shape
1129  real(DP), dimension(:), pointer, contiguous :: dbl1d_ptr
1130  character(len=LINELENGTH) :: keyword
1131 
1132  ! determine the array shape from the input data definition (idt%shape),
1133  ! which looks like "NCOL, NROW, NLAY"
1134  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1135  nsize1 = array_shape(1)
1136  nsize2 = array_shape(2)
1137  nsize3 = array_shape(3)
1138 
1139  ! create a new 3d memory managed variable
1140  call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1141  mf6_input%mempath)
1142 
1143  ! read keyword
1144  keyword = ''
1145  call parser%GetStringCaps(keyword)
1146 
1147  ! check for "NETCDF" and "LAYERED"
1148  if (keyword == 'NETCDF') then
1149  call netcdf_read_array(dbl3d, mshape, idt, mf6_input, nc_vars, &
1150  input_fname, iout)
1151  else if (keyword == 'LAYERED' .and. idt%layered) then
1152  call get_layered_shape(mshape, nlay, layer_shape)
1153  call read_dbl3d_layered(parser, dbl3d, idt%mf6varname, nlay, &
1154  layer_shape)
1155  else
1156  dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1157  call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1158  end if
1159 
1160  ! log information on the loaded array to the list file
1161  call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1162 
1163  ! create export file for griddata parameters if optioned
1164  if (export) then
1165  if (idt%blockname == 'GRIDDATA') then
1166  call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1167  end if
1168  end if
1169 
1170  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double_type()

subroutine loadmf6filemodule::load_double_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 980 of file LoadMf6File.f90.

981  type(BlockParserType), intent(inout) :: parser !< block parser
982  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
983  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
984  integer(I4B), intent(in) :: iout !< unit number for output
985  real(DP), pointer :: dblvar
986  call mem_allocate(dblvar, idt%mf6varname, memorypath)
987  dblvar = parser%GetDouble()
988  call idm_log_var(dblvar, idt%tagname, memorypath, iout)
989  return
Here is the caller graph for this function:

◆ load_integer1d_type()

subroutine loadmf6filemodule::load_integer1d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 798 of file LoadMf6File.f90.

802  type(BlockParserType), intent(inout) :: parser !< block parser
803  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
804  type(ModflowInputType), intent(in) :: mf6_input !< description of input
805  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
806  logical(LGP), intent(in) :: export !< export to ascii layer files
807  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
808  character(len=*), intent(in) :: input_fname !< ascii input file name
809  integer(I4B), intent(in) :: iout !< unit number for output
810  integer(I4B), dimension(:), pointer, contiguous :: int1d
811  integer(I4B) :: nlay
812  integer(I4B) :: nvals
813  integer(I4B), dimension(:), allocatable :: array_shape
814  integer(I4B), dimension(:), allocatable :: layer_shape
815  character(len=LINELENGTH) :: keyword
816 
817  ! Check if it is a full grid sized array (NODES), otherwise use
818  ! idt%shape to construct shape from variables in memoryPath
819  if (idt%shape == 'NODES') then
820  nvals = product(mshape)
821  else
822  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
823  nvals = array_shape(1)
824  end if
825 
826  ! allocate memory for the array
827  call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
828 
829  ! read keyword
830  keyword = ''
831  call parser%GetStringCaps(keyword)
832 
833  ! check for "NETCDF" and "LAYERED"
834  if (keyword == 'NETCDF') then
835  call netcdf_read_array(int1d, mshape, idt, mf6_input, nc_vars, &
836  input_fname, iout)
837  else if (keyword == 'LAYERED' .and. idt%layered) then
838  call get_layered_shape(mshape, nlay, layer_shape)
839  call read_int1d_layered(parser, int1d, idt%mf6varname, nlay, layer_shape)
840  else
841  call read_int1d(parser, int1d, idt%mf6varname)
842  end if
843 
844  ! log information on the loaded array to the list file
845  call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
846 
847  ! create export file for griddata parameters if optioned
848  if (export) then
849  if (idt%blockname == 'GRIDDATA') then
850  call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
851  end if
852  end if
853 
854  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer2d_type()

subroutine loadmf6filemodule::load_integer2d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 859 of file LoadMf6File.f90.

863  type(BlockParserType), intent(inout) :: parser !< block parser
864  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
865  type(ModflowInputType), intent(in) :: mf6_input !< description of input
866  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
867  logical(LGP), intent(in) :: export !< export to ascii layer files
868  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
869  character(len=*), intent(in) :: input_fname !< ascii input file name
870  integer(I4B), intent(in) :: iout !< unit number for output
871  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
872  integer(I4B) :: nlay
873  integer(I4B) :: nsize1, nsize2
874  integer(I4B), dimension(:), allocatable :: array_shape
875  integer(I4B), dimension(:), allocatable :: layer_shape
876  character(len=LINELENGTH) :: keyword
877 
878  ! determine the array shape from the input data definition (idt%shape),
879  ! which looks like "NCOL, NROW, NLAY"
880  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
881  nsize1 = array_shape(1)
882  nsize2 = array_shape(2)
883 
884  ! create a new 3d memory managed variable
885  call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
886 
887  ! read keyword
888  keyword = ''
889  call parser%GetStringCaps(keyword)
890 
891  ! check for "NETCDF" and "LAYERED"
892  if (keyword == 'NETCDF') then
893  call netcdf_read_array(int2d, mshape, idt, mf6_input, nc_vars, &
894  input_fname, iout)
895  else if (keyword == 'LAYERED' .and. idt%layered) then
896  call get_layered_shape(mshape, nlay, layer_shape)
897  call read_int2d_layered(parser, int2d, idt%mf6varname, nlay, layer_shape)
898  else
899  call read_int2d(parser, int2d, idt%mf6varname)
900  end if
901 
902  ! log information on the loaded array to the list file
903  call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
904 
905  ! create export file for griddata parameters if optioned
906  if (export) then
907  if (idt%blockname == 'GRIDDATA') then
908  call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
909  end if
910  end if
911 
912  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer3d_type()

subroutine loadmf6filemodule::load_integer3d_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
logical(lgp), intent(in)  export,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]mf6_inputdescription of input
[in]mshapemodel shape
[in]exportexport to ascii layer files
[in]input_fnameascii input file name
[in]ioutunit number for output

Definition at line 917 of file LoadMf6File.f90.

921  type(BlockParserType), intent(inout) :: parser !< block parser
922  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
923  type(ModflowInputType), intent(in) :: mf6_input !< description of input
924  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
925  logical(LGP), intent(in) :: export !< export to ascii layer files
926  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
927  character(len=*), intent(in) :: input_fname !< ascii input file name
928  integer(I4B), intent(in) :: iout !< unit number for output
929  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
930  integer(I4B) :: nlay
931  integer(I4B) :: nsize1, nsize2, nsize3
932  integer(I4B), dimension(:), allocatable :: array_shape
933  integer(I4B), dimension(:), allocatable :: layer_shape
934  integer(I4B), dimension(:), pointer, contiguous :: int1d_ptr
935  character(len=LINELENGTH) :: keyword
936 
937  ! determine the array shape from the input data definition (idt%shape),
938  ! which looks like "NCOL, NROW, NLAY"
939  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
940  nsize1 = array_shape(1)
941  nsize2 = array_shape(2)
942  nsize3 = array_shape(3)
943 
944  ! create a new 3d memory managed variable
945  call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
946  mf6_input%mempath)
947 
948  ! read keyword
949  keyword = ''
950  call parser%GetStringCaps(keyword)
951 
952  ! check for "NETCDF" and "LAYERED"
953  if (keyword == 'NETCDF') then
954  call netcdf_read_array(int3d, mshape, idt, mf6_input, nc_vars, &
955  input_fname, iout)
956  else if (keyword == 'LAYERED' .and. idt%layered) then
957  call get_layered_shape(mshape, nlay, layer_shape)
958  call read_int3d_layered(parser, int3d, idt%mf6varname, nlay, &
959  layer_shape)
960  else
961  int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
962  call read_int1d(parser, int1d_ptr, idt%mf6varname)
963  end if
964 
965  ! log information on the loaded array to the list file
966  call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
967 
968  ! create export file for griddata parameters if optioned
969  if (export) then
970  if (idt%blockname == 'GRIDDATA') then
971  call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
972  end if
973  end if
974 
975  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer_type()

subroutine loadmf6filemodule::load_integer_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 784 of file LoadMf6File.f90.

785  type(BlockParserType), intent(inout) :: parser !< block parser
786  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
787  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
788  integer(I4B), intent(in) :: iout !< unit number for output
789  integer(I4B), pointer :: intvar
790  call mem_allocate(intvar, idt%mf6varname, memorypath)
791  intvar = parser%GetInteger()
792  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
793  return
Here is the caller graph for this function:

◆ load_io_tag()

subroutine loadmf6filemodule::load_io_tag ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
character(len=*), intent(in)  which,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 714 of file LoadMf6File.f90.

718  type(BlockParserType), intent(inout) :: parser !< block parser
719  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
720  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
721  character(len=*), intent(in) :: which
722  integer(I4B), intent(in) :: iout !< unit number for output
723  character(len=LINELENGTH) :: cstr
724  type(CharacterStringType), dimension(:), pointer, contiguous :: charstr1d
725  integer(I4B) :: ilen, isize, idx
726  ilen = linelength
727  if (which == 'FILEIN') then
728  call get_isize(idt%mf6varname, memorypath, isize)
729  if (isize < 0) then
730  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
731  idx = 1
732  else
733  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
734  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
735  memorypath)
736  idx = isize + 1
737  end if
738  call parser%GetString(cstr, (.not. idt%preserve_case))
739  charstr1d(idx) = cstr
740  else if (which == 'FILEOUT') then
741  call load_string_type(parser, idt, memorypath, iout)
742  end if
743  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_keyword_type()

subroutine loadmf6filemodule::load_keyword_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 674 of file LoadMf6File.f90.

675  type(BlockParserType), intent(inout) :: parser !< block parser
676  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
677  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
678  integer(I4B), intent(in) :: iout !< unit number for output
679  integer(I4B), pointer :: intvar
680  call mem_allocate(intvar, idt%mf6varname, memorypath)
681  intvar = 1
682  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
683  return
Here is the caller graph for this function:

◆ load_string_type()

subroutine loadmf6filemodule::load_string_type ( type(blockparsertype), intent(inout)  parser,
type(inputparamdefinitiontype), intent(in)  idt,
character(len=*), intent(in)  memoryPath,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in,out]parserblock parser
[in]idtinput data type object describing this record
[in]memorypathmemorypath to put loaded information
[in]ioutunit number for output

Definition at line 688 of file LoadMf6File.f90.

689  use constantsmodule, only: lenbigline
690  type(BlockParserType), intent(inout) :: parser !< block parser
691  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
692  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
693  integer(I4B), intent(in) :: iout !< unit number for output
694  character(len=LINELENGTH), pointer :: cstr
695  character(len=LENBIGLINE), pointer :: bigcstr
696  integer(I4B) :: ilen
697  select case (idt%shape)
698  case ('LENBIGLINE')
699  ilen = lenbigline
700  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
701  call parser%GetString(bigcstr, (.not. idt%preserve_case))
702  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
703  case default
704  ilen = linelength
705  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
706  call parser%GetString(cstr, (.not. idt%preserve_case))
707  call idm_log_var(cstr, idt%tagname, memorypath, iout)
708  end select
709  return
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
Here is the caller graph for this function:

◆ parse_block()

recursive subroutine loadmf6filemodule::parse_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
logical(lgp), intent(in)  recursive_call 
)
Parameters
[in]recursive_calltrue if recursive call

Definition at line 276 of file LoadMf6File.f90.

277  ! -- modules
278  use memorytypemodule, only: memorytype
280  ! -- dummy
281  class(LoadMf6FileType) :: this
282  integer(I4B), intent(in) :: iblk
283  logical(LGP), intent(in) :: recursive_call !< true if recursive call
284  ! -- local
285  logical(LGP) :: isblockfound
286  logical(LGP) :: endOfBlock
287  logical(LGP) :: supportOpenClose
288  integer(I4B) :: ierr
289  logical(LGP) :: found, required
290  type(MemoryType), pointer :: mt
291  !
292  ! -- disu vertices/cell2d blocks are contingent on NVERT dimension
293  if (this%mf6_input%pkgtype == 'DISU6' .or. &
294  this%mf6_input%pkgtype == 'DISV1D6' .or. &
295  this%mf6_input%pkgtype == 'DISV2D6') then
296  if (this%mf6_input%block_dfns(iblk)%blockname == 'VERTICES' .or. &
297  this%mf6_input%block_dfns(iblk)%blockname == 'CELL2D') then
298  call get_from_memorystore('NVERT', this%mf6_input%mempath, mt, found, &
299  .false.)
300  if (.not. found) return
301  if (mt%intsclr == 0) return
302  end if
303  end if
304  !
305  ! -- block open/close support
306  supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /= 'GRIDDATA')
307  !
308  ! -- parser search for block
309  required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
310  call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
311  isblockfound, ierr, &
312  supportopenclose=supportopenclose, &
313  blockrequired=required)
314  !
315  ! -- process block
316  if (isblockfound) then
317  if (this%mf6_input%block_dfns(iblk)%aggregate) then
318  !
319  ! -- process block recarray type, set of variable 1d/2d types
320  call this%parse_structarray_block(iblk)
321  !
322  else
323  do
324  ! process each line in block
325  call this%parser%GetNextLine(endofblock)
326  if (endofblock) exit
327  !
328  ! -- process line as tag(s)
329  call this%parse_tag(iblk, .false.)
330  !
331  end do
332  end if
333  end if
334  !
335  ! -- recurse if block is reloadable and was just read
336  if (this%mf6_input%block_dfns(iblk)%block_variable) then
337  if (isblockfound) then
338  call this%parse_block(iblk, .true.)
339  end if
340  end if
subroutine, public get_from_memorystore(name, mem_path, mt, found, check)
@ brief Get a memory type entry from the memory list
Here is the call graph for this function:

◆ parse_io_tag()

subroutine loadmf6filemodule::parse_io_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
character(len=*), intent(in)  pkgtype,
character(len=*), intent(in)  which,
character(len=*), intent(in)  tag 
)

Definition at line 343 of file LoadMf6File.f90.

344  ! -- modules
345  ! -- dummy
346  class(LoadMf6FileType) :: this
347  integer(I4B), intent(in) :: iblk
348  character(len=*), intent(in) :: pkgtype
349  character(len=*), intent(in) :: which
350  character(len=*), intent(in) :: tag
351  ! -- local
352  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
353  !
354  ! -- matches, read and load file name
355  idt => &
356  get_param_definition_type(this%mf6_input%param_dfns, &
357  this%mf6_input%component_type, &
358  this%mf6_input%subcomponent_type, &
359  this%mf6_input%block_dfns(iblk)%blockname, &
360  tag, this%filename)
361  !
362  ! -- load io tag
363  call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
Here is the call graph for this function:

◆ parse_keyword_tag()

subroutine loadmf6filemodule::parse_keyword_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
character(len=linelength), intent(in)  tag,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)
private

Definition at line 366 of file LoadMf6File.f90.

367  ! -- modules
369  ! -- dummy
370  class(LoadMf6FileType) :: this
371  integer(I4B), intent(in) :: iblk
372  character(len=LINELENGTH), intent(in) :: tag
373  type(InputParamDefinitionType), pointer, intent(in) :: idt
374  ! -- local
375  character(len=40), dimension(:), allocatable :: words
376  integer(I4B) :: nwords
377  character(len=LINELENGTH) :: io_tag
378  logical(LGP) :: found
379  !
380  ! -- initialization
381  found = .false.
382  !
383  ! -- if in record tag check and load if input/output file
384  if (idt%in_record) then
385  !
386  ! -- get tokens in matching definition
387  call split_record_definition(this%mf6_input%param_dfns, &
388  this%mf6_input%component_type, &
389  this%mf6_input%subcomponent_type, &
390  tag, nwords, words)
391  !
392  ! -- a filein/fileout record tag definition has 4 tokens
393  if (nwords == 4) then
394  !
395  ! -- verify third definition token is FILEIN/FILEOUT
396  if (words(3) == 'FILEIN' .or. words(3) == 'FILEOUT') then
397  !
398  ! -- read 3rd token
399  call this%parser%GetStringCaps(io_tag)
400  !
401  ! -- check if 3rd token matches definition
402  if (io_tag == words(3)) then
403  call this%parse_io_tag(iblk, words(2), words(3), words(4))
404  found = .true.
405  else
406  errmsg = 'Expected "'//trim(words(3))//'" following keyword "'// &
407  trim(tag)//'" but instead found "'//trim(io_tag)//'"'
408  call store_error(errmsg)
409  call this%parser%StoreErrorUnit()
410  end if
411  !
412  end if
413  end if
414  !
415  ! -- deallocate words
416  if (allocated(words)) deallocate (words)
417  end if
418  !
419  if (.not. found) then
420  ! -- load standard keyword tag
421  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
422  !
423  ! -- check/set as dev option
424  if (idt%tagname(1:4) == 'DEV_' .and. &
425  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
426  call this%parser%DevOpt()
427  end if
428  end if
This module contains the DefinitionSelectModule.
subroutine, public split_record_definition(input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
Return aggregate definition.
Here is the call graph for this function:

◆ parse_structarray_block()

subroutine loadmf6filemodule::parse_structarray_block ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk 
)
private

A structarray is similar to a numpy recarray. It it used to load a list of data in which each column in the list may be a different type. Each column in the list is stored as a 1d vector.

Definition at line 557 of file LoadMf6File.f90.

558  ! -- modules
561  ! -- dummy
562  class(LoadMf6FileType) :: this
563  integer(I4B), intent(in) :: iblk
564  ! -- local
565  type(DynamicPackageParamsType) :: block_params
566  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
567  type(InputParamDefinitionType), target :: blockvar_idt
568  integer(I4B) :: blocknum
569  integer(I4B), pointer :: nrow
570  integer(I4B) :: nrows, nrowsread
571  integer(I4B) :: ibinary, oc_inunit
572  integer(I4B) :: icol, iparam
573  integer(I4B) :: ncol
574  !
575  ! -- initialize package params object
576  call block_params%init(this%mf6_input, &
577  this%mf6_input%block_dfns(iblk)%blockname, &
578  this%readasarrays, this%iauxiliary, this%inamedbound)
579  !
580  ! -- set input definition for this block
581  idt => &
582  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
583  this%mf6_input%component_type, &
584  this%mf6_input%subcomponent_type, &
585  this%mf6_input%block_dfns(iblk)%blockname)
586  !
587  ! -- if block is reloadable read the block number
588  if (this%mf6_input%block_dfns(iblk)%block_variable) then
589  blocknum = this%parser%GetInteger()
590  else
591  blocknum = 0
592  end if
593  !
594  ! -- set ncol
595  ncol = block_params%nparam
596  !
597  ! -- add col if block is reloadable
598  if (blocknum > 0) ncol = ncol + 1
599  !
600  ! -- use shape to set the max num of rows
601  if (idt%shape /= '') then
602  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
603  nrows = nrow
604  else
605  nrows = -1
606  end if
607  !
608  ! -- create a structured array
609  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
610  blocknum, this%mf6_input%mempath, &
611  this%mf6_input%component_mempath)
612  !
613  ! -- create structarray vectors for each column
614  do icol = 1, ncol
615  !
616  ! -- if block is reloadable, block number is first column
617  if (blocknum > 0) then
618  if (icol == 1) then
619  !
620  blockvar_idt = this%block_index_dfn(iblk)
621  idt => blockvar_idt
622  !
623  call this%structarray%mem_create_vector(icol, idt)
624  !
625  ! -- continue as this column managed by internally SA object
626  cycle
627  end if
628  !
629  ! -- set indexes (where first column is blocknum)
630  iparam = icol - 1
631  else
632  !
633  ! -- set indexes (no blocknum column)
634  iparam = icol
635  end if
636  !
637  ! -- set pointer to input definition for this 1d vector
638  idt => &
639  get_param_definition_type(this%mf6_input%param_dfns, &
640  this%mf6_input%component_type, &
641  this%mf6_input%subcomponent_type, &
642  this%mf6_input%block_dfns(iblk)%blockname, &
643  block_params%params(iparam), this%filename)
644  !
645  ! -- allocate variable in memory manager
646  call this%structarray%mem_create_vector(icol, idt)
647  end do
648  !
649  ! -- read the block control record
650  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
651  !
652  if (ibinary == 1) then
653  !
654  ! -- read from binary
655  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
656  !
657  call this%parser%terminateblock()
658  !
659  close (oc_inunit)
660  !
661  else
662  !
663  ! -- read from ascii
664  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
665  this%iout)
666  end if
667  !
668  ! -- clean up
669  call block_params%destroy()
This module contains the DynamicPackageParamsModule.
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
Definition: StructArray.f90:74
type for structured array
Definition: StructArray.f90:37
Here is the call graph for this function:

◆ parse_tag()

recursive subroutine loadmf6filemodule::parse_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
logical(lgp), intent(in)  recursive_call 
)

Load an individual input record into the memory manager. Allow for recursive calls in the case that multiple tags are on a single line.

Parameters
[in]recursive_calltrue if recursive call

Definition at line 438 of file LoadMf6File.f90.

439  ! -- modules
441  ! -- dummy
442  class(LoadMf6FileType) :: this
443  integer(I4B), intent(in) :: iblk
444  logical(LGP), intent(in) :: recursive_call !< true if recursive call
445  ! -- local
446  character(len=LINELENGTH) :: tag
447  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
448  !
449  ! -- read tag name
450  call this%parser%GetStringCaps(tag)
451  if (recursive_call) then
452  if (tag == '') then
453  ! no data on line so return
454  return
455  end if
456  end if
457  !
458  ! -- find keyword in input definition
459  idt => get_param_definition_type(this%mf6_input%param_dfns, &
460  this%mf6_input%component_type, &
461  this%mf6_input%subcomponent_type, &
462  this%mf6_input%block_dfns(iblk)%blockname, &
463  tag, this%filename)
464  !
465  ! -- allocate and load data type
466  select case (idt%datatype)
467  case ('KEYWORD')
468  call this%parse_keyword_tag(iblk, tag, idt)
469  case ('STRING')
470  if (idt%shape == 'NAUX') then
471  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
472  this%iout)
473  else
474  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
475  end if
476  case ('INTEGER')
477  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
478  case ('INTEGER1D')
479  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
480  this%export, this%nc_vars, this%filename, &
481  this%iout)
482  case ('INTEGER2D')
483  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
484  this%export, this%nc_vars, this%filename, &
485  this%iout)
486  case ('INTEGER3D')
487  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
488  this%export, this%nc_vars, this%filename, &
489  this%iout)
490  case ('DOUBLE')
491  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
492  case ('DOUBLE1D')
493  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
494  this%export, this%nc_vars, this%filename, this%iout)
495  case ('DOUBLE2D')
496  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
497  this%export, this%nc_vars, this%filename, this%iout)
498  case ('DOUBLE3D')
499  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
500  this%export, this%nc_vars, this%filename, this%iout)
501  case default
502  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(tag)
503  call store_error(errmsg)
504  call this%parser%StoreErrorUnit()
505  end select
506  !
507  ! -- continue line if in same record
508  if (idt%in_record) then
509  !
510  ! recursively call parse tag again to read rest of line
511  call this%parse_tag(iblk, .true.)
512  end if
513  !
514  !
515  call expandarray(this%block_tags)
516  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
Here is the call graph for this function:

◆ read_control_record()

integer(i4b) function, public loadmf6filemodule::read_control_record ( type(blockparsertype), intent(inout)  parser,
integer(i4b), intent(inout)  oc_inunit,
integer(i4b), intent(in)  iout 
)

Definition at line 1173 of file LoadMf6File.f90.

1174  ! -- modules
1175  use simmodule, only: store_error_unit
1176  use inputoutputmodule, only: urword
1177  use inputoutputmodule, only: openfile
1178  use openspecmodule, only: form, access
1179  use constantsmodule, only: linelength
1181  ! -- dummy
1182  type(BlockParserType), intent(inout) :: parser
1183  integer(I4B), intent(inout) :: oc_inunit
1184  integer(I4B), intent(in) :: iout
1185  ! -- return
1186  integer(I4B) :: ibinary
1187  ! -- local
1188  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1189  integer(I4B) :: nunopn = 99
1190  character(len=:), allocatable :: line
1191  character(len=LINELENGTH) :: fname
1192  logical :: exists
1193  real(DP) :: r
1194  ! -- formats
1195  character(len=*), parameter :: fmtocne = &
1196  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1197  character(len=*), parameter :: fmtobf = &
1198  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1199  !
1200  ! -- initialize oc_inunit and ibinary
1201  oc_inunit = 0
1202  ibinary = 0
1203  !
1204  inunit = parser%getunit()
1205  !
1206  ! -- Read to the first non-commented line
1207  lloc = 1
1208  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1209  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1210  !
1211  if (line(istart:istop) == 'OPEN/CLOSE') then
1212  !
1213  ! -- get filename
1214  call urword(line, lloc, istart, istop, 0, idum, r, &
1215  iout, inunit)
1216  !
1217  fname = line(istart:istop)
1218  !
1219  ! -- check to see if file OPEN/CLOSE file exists
1220  inquire (file=fname, exist=exists)
1221  !
1222  if (.not. exists) then
1223  write (errmsg, fmtocne) line(istart:istop)
1224  call store_error(errmsg)
1225  call store_error('Specified OPEN/CLOSE file does not exist')
1226  call store_error_unit(inunit)
1227  end if
1228  !
1229  ! -- Check for (BINARY) keyword
1230  call urword(line, lloc, istart, istop, 1, idum, r, &
1231  iout, inunit)
1232  !
1233  if (line(istart:istop) == '(BINARY)') ibinary = 1
1234  !
1235  ! -- Open the file depending on ibinary flag
1236  if (ibinary == 1) then
1237  oc_inunit = nunopn
1238  itmp = iout
1239  !
1240  if (iout > 0) then
1241  itmp = 0
1242  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1243  end if
1244  !
1245  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1246  fmtarg_opt=form, accarg_opt=access)
1247  end if
1248  end if
1249  !
1250  if (ibinary == 0) then
1251  call parser%line_reader%bkspc(parser%getunit())
1252  end if
This module contains block parser methods.
Definition: BlockParser.f90:7
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
subroutine, public urword(line, icol, istart, istop, ncode, n, r, iout, in)
Extract a word from a string.
character(len=20) access
Definition: OpenSpec.f90:7
character(len=20) form
Definition: OpenSpec.f90:7
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
Here is the call graph for this function:
Here is the caller graph for this function: