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

This module contains the LoadMf6FileModule. More...

Data Types

type  staticsatype
 Fortran workaround for allocatable arrays of pointers; wraps a StructArray pointer for deferred TS linking. More...
 
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)
 
recursive subroutine parse_record_tag (this, iblk, inidt, recursive_call)
 
subroutine load_tag (this, iblk, idt)
 load input keyword Load input associated with tag key into the memory manager. More...
 
type(inputparamdefinitiontype) function block_index_dfn (this, iblk)
 
subroutine parse_structarray_block (this, iblk)
 parse a structured array record into memory manager More...
 
integer(i4b) function ts_sa_count (this)
 Return number of saved static StructArrays with deferred TS strlocs. More...
 
type(structarraytype) function, pointer get_ts_sa (this, n)
 Return the n-th saved static StructArray pointer. 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)
 
subroutine save_ts_sa (this)
 Save structarray pointer for deferred TS linking. More...
 
subroutine cleanup (this)
 Clean up saved static structarrays. More...
 

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 531 of file LoadMf6File.f90.

532  class(LoadMf6FileType) :: this
533  integer(I4B), intent(in) :: iblk
534  type(InputParamDefinitionType) :: idt !< input data type object describing this record
535  character(len=LENVARNAME) :: varname
536  integer(I4B) :: ilen
537  character(len=3) :: block_suffix = 'NUM'
538 
539  ! assign first column as the block number
540  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
541 
542  if (ilen > (lenvarname - len(block_suffix))) then
543  varname = &
544  this%mf6_input%block_dfns(iblk)% &
545  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
546  else
547  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
548  end if
549 
550  idt%component_type = trim(this%mf6_input%component_type)
551  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
552  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
553  idt%tagname = varname
554  idt%mf6varname = varname
555  idt%datatype = 'INTEGER'

◆ block_post_process()

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

Definition at line 211 of file LoadMf6File.f90.

213  class(LoadMf6FileType) :: this
214  integer(I4B), intent(in) :: iblk
215  type(InputParamDefinitionType), pointer :: idt
216  integer(I4B) :: iparam
217  integer(I4B), pointer :: intptr
218 
219  ! update state based on read tags
220  do iparam = 1, size(this%block_tags)
221  select case (this%mf6_input%block_dfns(iblk)%blockname)
222  case ('OPTIONS')
223  if (this%block_tags(iparam) == 'AUXILIARY') then
224  this%iauxiliary = 1
225  else if (this%block_tags(iparam) == 'BOUNDNAMES') then
226  this%inamedbound = 1
227  else if (this%block_tags(iparam) == 'READASARRAYS') then
228  this%readasarrays = .true.
229  else if (this%block_tags(iparam) == 'READARRAYGRID') then
230  this%readarraygrid = .true.
231  else if (this%block_tags(iparam) == 'TS6_FILENAME') then
232  this%ts_active = .true.
233  else if (this%block_tags(iparam) == 'EXPORT_ARRAY_ASCII') then
234  this%export = .true.
235  end if
236  case default
237  end select
238  end do
239 
240  ! update input context allocations based on dfn set and input
241  select case (this%mf6_input%block_dfns(iblk)%blockname)
242  case ('OPTIONS')
243  ! allocate naux and set to 0 if not allocated
244  do iparam = 1, size(this%mf6_input%param_dfns)
245  idt => this%mf6_input%param_dfns(iparam)
246  if (idt%blockname == 'OPTIONS' .and. &
247  idt%tagname == 'AUXILIARY') then
248  if (this%iauxiliary == 0) then
249  call mem_allocate(intptr, 'NAUX', this%mf6_input%mempath)
250  intptr = 0
251  end if
252  exit
253  end if
254  end do
255  case ('DIMENSIONS')
256  ! set model shape if discretization dimensions have been read
257  if (this%mf6_input%pkgtype(1:3) == 'DIS') then
258  call set_model_shape(this%mf6_input%pkgtype, this%filename, &
259  this%mf6_input%component_mempath, &
260  this%mf6_input%mempath, this%mshape)
261  end if
262  case default
263  end select
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
Here is the call graph for this function:

◆ cleanup()

subroutine loadmf6filemodule::cleanup ( class(loadmf6filetype), intent(inout)  this)
private

Called from destroy() of dynamic loaders.

Definition at line 1282 of file LoadMf6File.f90.

1284  class(LoadMf6FileType), intent(inout) :: this
1285  integer(I4B) :: n
1286 
1287  if (allocated(this%ts_sas)) then
1288  do n = 1, size(this%ts_sas)
1289  if (associated(this%ts_sas(n)%sa)) then
1290  call destructstructarray(this%ts_sas(n)%sa)
1291  nullify (this%ts_sas(n)%sa)
1292  end if
1293  end do
1294  deallocate (this%ts_sas)
1295  end if
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:

◆ finalize()

subroutine loadmf6filemodule::finalize ( class(loadmf6filetype this)

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

Definition at line 195 of file LoadMf6File.f90.

197  class(LoadMf6FileType) :: this
198  ! cleanup
199  if (associated(this%structarray)) then
200  ! destroy the structured array reader
201  call destructstructarray(this%structarray)
202  end if
203  ! close logging block
204  call idm_log_close(this%mf6_input%component_name, &
205  this%mf6_input%subcomponent_name, this%iout)
Here is the call graph for this function:

◆ get_ts_sa()

type(structarraytype) function, pointer loadmf6filemodule::get_ts_sa ( class(loadmf6filetype), intent(in)  this,
integer(i4b), intent(in)  n 
)
private

Definition at line 681 of file LoadMf6File.f90.

682  class(LoadMf6FileType), intent(in) :: this
683  integer(I4B), intent(in) :: n
684  type(StructArrayType), pointer :: sa
685  sa => this%ts_sas(n)%sa

◆ 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 132 of file LoadMf6File.f90.

133  use memorymanagermodule, only: get_isize
134  class(LoadMf6FileType) :: this
135  type(BlockParserType), target, intent(inout) :: parser
136  type(ModflowInputType), intent(in) :: mf6_input
137  character(len=*), intent(in) :: filename
138  integer(I4B), intent(in) :: iout
139  integer(I4B) :: isize
140 
141  this%parser => parser
142  this%mf6_input = mf6_input
143  this%filename = filename
144  this%ts_active = .false.
145  this%export = .false.
146  this%readasarrays = .false.
147  this%readarraygrid = .false.
148  this%inamedbound = 0
149  this%iauxiliary = 0
150  this%iout = iout
151 
152  call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize)
153  if (isize > 0) then
154  call mem_setptr(this%mshape, 'MODEL_SHAPE', mf6_input%component_mempath)
155  end if
156 
157  ! log lst file header
158  call idm_log_header(this%mf6_input%component_name, &
159  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 96 of file LoadMf6File.f90.

98  class(LoadMf6FileType) :: this
99  type(BlockParserType), target, intent(inout) :: parser
100  type(ModflowInputType), intent(in) :: mf6_input
101  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
102  character(len=*), intent(in) :: filename
103  integer(I4B), intent(in) :: iout
104  integer(I4B) :: iblk
105 
106  ! initialize static load
107  call this%init(parser, mf6_input, filename, iout)
108 
109  ! set netcdf vars
110  this%nc_vars => nc_vars
111 
112  ! process blocks
113  do iblk = 1, size(this%mf6_input%block_dfns)
114  ! don't load dynamic input data
115  if (this%mf6_input%block_dfns(iblk)%blockname == 'PERIOD') exit
116  ! load the block
117  call this%load_block(iblk)
118  end do
119 
120  ! finalize static load
121  call this%finalize()
122 
123  ! ensure ts_sas is allocated after load
124  if (.not. allocated(this%ts_sas)) allocate (this%ts_sas(0))
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 762 of file LoadMf6File.f90.

764  use inputoutputmodule, only: urdaux
766  type(BlockParserType), intent(inout) :: parser !< block parser
767  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
768  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
769  integer(I4B), intent(in) :: iout !< unit number for output
770  character(len=:), allocatable :: line
771  character(len=LENAUXNAME), dimension(:), allocatable :: caux
772  integer(I4B) :: lloc
773  integer(I4B) :: istart
774  integer(I4B) :: istop
775  integer(I4B) :: i
776  character(len=LENPACKAGENAME) :: text = ''
777  integer(I4B), pointer :: intvar
778  type(CharacterStringType), dimension(:), &
779  pointer, contiguous :: acharstr1d !< variable for allocation
780  call mem_allocate(intvar, idt%shape, memorypath)
781  intvar = 0
782  call parser%GetRemainingLine(line)
783  lloc = 1
784  call urdaux(intvar, parser%iuactive, iout, lloc, &
785  istart, istop, caux, line, text)
786  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
787  do i = 1, intvar
788  acharstr1d(i) = caux(i)
789  end do
790  deallocate (line)
791  deallocate (caux)
This module contains simulation constants.
Definition: Constants.f90:9
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.
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:
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 170 of file LoadMf6File.f90.

172  class(LoadMf6FileType) :: this
173  integer(I4B), intent(in) :: iblk
174 
175  ! reset structarray if it was created for previous block
176  if (associated(this%structarray)) then
177  ! destroy the structured array reader
178  call destructstructarray(this%structarray)
179  end if
180 
181  allocate (this%block_tags(0))
182  ! load the block
183  call this%parse_block(iblk, .false.)
184  ! post process block
185  call this%block_post_process(iblk)
186  ! cleanup
187  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 998 of file LoadMf6File.f90.

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

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

986  type(BlockParserType), intent(inout) :: parser !< block parser
987  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
988  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
989  integer(I4B), intent(in) :: iout !< unit number for output
990  real(DP), pointer :: dblvar
991  call mem_allocate(dblvar, idt%mf6varname, memorypath)
992  dblvar = parser%GetDouble()
993  call idm_log_var(dblvar, idt%tagname, memorypath, iout)
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 809 of file LoadMf6File.f90.

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

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

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

797  type(BlockParserType), intent(inout) :: parser !< block parser
798  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
799  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
800  integer(I4B), intent(in) :: iout !< unit number for output
801  integer(I4B), pointer :: intvar
802  call mem_allocate(intvar, idt%mf6varname, memorypath)
803  intvar = parser%GetInteger()
804  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
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 728 of file LoadMf6File.f90.

732  type(BlockParserType), intent(inout) :: parser !< block parser
733  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
734  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
735  character(len=*), intent(in) :: which
736  integer(I4B), intent(in) :: iout !< unit number for output
737  character(len=LINELENGTH) :: cstr
738  type(CharacterStringType), dimension(:), pointer, contiguous :: charstr1d
739  integer(I4B) :: ilen, isize, idx
740  ilen = linelength
741  if (which == 'FILEIN') then
742  call get_isize(idt%mf6varname, memorypath, isize)
743  if (isize < 0) then
744  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
745  idx = 1
746  else
747  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
748  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
749  memorypath)
750  idx = isize + 1
751  end if
752  call parser%GetString(cstr, (.not. idt%preserve_case))
753  charstr1d(idx) = cstr
754  else if (which == 'FILEOUT') then
755  call load_string_type(parser, idt, memorypath, iout)
756  end if
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 
)
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 690 of file LoadMf6File.f90.

691  type(BlockParserType), intent(inout) :: parser !< block parser
692  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
693  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
694  integer(I4B), intent(in) :: iout !< unit number for output
695  integer(I4B), pointer :: intvar
696  call mem_allocate(intvar, idt%mf6varname, memorypath)
697  intvar = 1
698  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
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 703 of file LoadMf6File.f90.

704  use constantsmodule, only: lenbigline
705  type(BlockParserType), intent(inout) :: parser !< block parser
706  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
707  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
708  integer(I4B), intent(in) :: iout !< unit number for output
709  character(len=LINELENGTH), pointer :: cstr
710  character(len=LENBIGLINE), pointer :: bigcstr
711  integer(I4B) :: ilen
712  select case (idt%shape)
713  case ('LENBIGLINE')
714  ilen = lenbigline
715  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
716  call parser%GetString(bigcstr, (.not. idt%preserve_case))
717  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
718  case default
719  ilen = linelength
720  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
721  call parser%GetString(cstr, (.not. idt%preserve_case))
722  call idm_log_var(cstr, idt%tagname, memorypath, iout)
723  end select
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
Here is the caller graph for this function:

◆ load_tag()

subroutine loadmf6filemodule::load_tag ( class(loadmf6filetype this,
integer(i4b), intent(in)  iblk,
type(inputparamdefinitiontype), intent(in), pointer  idt 
)
Parameters
[in]idtinput data type object describing this record

Definition at line 463 of file LoadMf6File.f90.

466  class(LoadMf6FileType) :: this
467  integer(I4B), intent(in) :: iblk
468  type(InputParamDefinitionType), pointer, intent(in) :: idt !< input data type object describing this record
469  character(len=LINELENGTH) :: dev_msg
470 
471  ! check if input param is developmode
472  if (idt%developmode) then
473  dev_msg = 'Input tag "'//trim(idt%tagname)// &
474  &'" read from file "'//trim(this%filename)// &
475  &'" is still under development. Install the &
476  &nightly build or compile from source with IDEVELOPMODE = 1.'
477  call developmode(dev_msg, this%iout)
478  end if
479 
480  ! allocate and load data type
481  select case (idt%datatype)
482  case ('KEYWORD')
483  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
484  ! check/set as dev option
485  if (idt%tagname(1:4) == 'DEV_' .and. &
486  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
487  call this%parser%DevOpt()
488  end if
489  case ('STRING')
490  if (idt%shape == 'NAUX') then
491  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
492  this%iout)
493  else
494  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
495  end if
496  case ('INTEGER')
497  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
498  case ('INTEGER1D')
499  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
500  this%export, this%nc_vars, this%filename, &
501  this%iout)
502  case ('INTEGER2D')
503  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
504  this%export, this%nc_vars, this%filename, &
505  this%iout)
506  case ('INTEGER3D')
507  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
508  this%export, this%nc_vars, this%filename, &
509  this%iout)
510  case ('DOUBLE')
511  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
512  case ('DOUBLE1D')
513  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
514  this%export, this%nc_vars, this%filename, this%iout)
515  case ('DOUBLE2D')
516  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
517  this%export, this%nc_vars, this%filename, this%iout)
518  case ('DOUBLE3D')
519  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
520  this%export, this%nc_vars, this%filename, this%iout)
521  case default
522  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(idt%tagname)
523  call store_error(errmsg)
524  call this%parser%StoreErrorUnit()
525  end select
526 
527  call expandarray(this%block_tags)
528  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
Disable development features in release mode.
Definition: FeatureFlags.f90:2
subroutine, public developmode(errmsg, iunit)
Terminate if in release mode (guard development features)
Here is the call 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 269 of file LoadMf6File.f90.

270  use memorytypemodule, only: memorytype
272  class(LoadMf6FileType) :: this
273  integer(I4B), intent(in) :: iblk
274  logical(LGP), intent(in) :: recursive_call !< true if recursive call
275  logical(LGP) :: isblockfound
276  logical(LGP) :: endOfBlock
277  logical(LGP) :: supportOpenClose
278  integer(I4B) :: ierr
279  logical(LGP) :: found, required
280  type(MemoryType), pointer :: mt
281  character(len=LINELENGTH) :: tag
282  type(InputParamDefinitionType), pointer :: idt
283 
284  ! disu vertices/cell2d blocks are contingent on NVERT dimension
285  if (this%mf6_input%pkgtype == 'DISU6' .or. &
286  this%mf6_input%pkgtype == 'DISV1D6' .or. &
287  this%mf6_input%pkgtype == 'DISV2D6') then
288  if (this%mf6_input%block_dfns(iblk)%blockname == 'VERTICES' .or. &
289  this%mf6_input%block_dfns(iblk)%blockname == 'CELL2D') then
290  call get_from_memorystore('NVERT', this%mf6_input%mempath, mt, found, &
291  .false.)
292  if (.not. found) return
293  if (mt%intsclr == 0) return
294  end if
295  end if
296 
297  ! block open/close support
298  supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /= 'GRIDDATA')
299 
300  ! parser search for block
301  required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
302  call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
303  isblockfound, ierr, &
304  supportopenclose=supportopenclose, &
305  blockrequired=required)
306  ! process block
307  if (isblockfound) then
308  if (this%mf6_input%block_dfns(iblk)%aggregate) then
309  ! process block recarray type, set of variable 1d/2d types
310  call this%parse_structarray_block(iblk)
311  else
312  do
313  ! process each line in block
314  call this%parser%GetNextLine(endofblock)
315  if (endofblock) exit
316  ! process line as tag(s)
317  call this%parser%GetStringCaps(tag)
318  idt => get_param_definition_type( &
319  this%mf6_input%param_dfns, &
320  this%mf6_input%component_type, &
321  this%mf6_input%subcomponent_type, &
322  this%mf6_input%block_dfns(iblk)%blockname, &
323  tag, this%filename)
324  if (idt%in_record) then
325  call this%parse_record_tag(iblk, idt, .false.)
326  else
327  call this%load_tag(iblk, idt)
328  end if
329  end do
330  end if
331  end if
332 
333  ! recurse if block is reloadable and was just read
334  if (this%mf6_input%block_dfns(iblk)%block_variable) then
335  if (isblockfound) then
336  call this%parse_block(iblk, .true.)
337  end if
338  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 341 of file LoadMf6File.f90.

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

◆ parse_record_tag()

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

Definition at line 362 of file LoadMf6File.f90.

366  class(LoadMf6FileType) :: this
367  integer(I4B), intent(in) :: iblk
368  type(InputParamDefinitionType), pointer, intent(in) :: inidt
369  logical(LGP), intent(in) :: recursive_call !< true if recursive call
370  type(InputParamDefinitionType), pointer :: idt
371  character(len=40), dimension(:), allocatable :: words
372  integer(I4B) :: n, istart, nwords
373  character(len=LINELENGTH) :: tag
374 
375  nullify (idt)
376  istart = 1
377 
378  if (recursive_call) then
379  call split_record_dfn_tag1(this%mf6_input%param_dfns, &
380  this%mf6_input%component_type, &
381  this%mf6_input%subcomponent_type, &
382  inidt%tagname, nwords, words)
383  call this%load_tag(iblk, inidt)
384  istart = 3
385  else
386  call this%parser%GetStringCaps(tag)
387  if (tag /= '') then
388  call split_record_dfn_tag2(this%mf6_input%param_dfns, &
389  this%mf6_input%component_type, &
390  this%mf6_input%subcomponent_type, &
391  inidt%tagname, tag, nwords, words)
392  if (nwords == 4 .and. &
393  (tag == 'FILEIN' .or. &
394  tag == 'FILEOUT')) then
395  call this%parse_io_tag(iblk, words(2), words(3), words(4))
396  nwords = 0
397  else
398  idt => get_param_definition_type( &
399  this%mf6_input%param_dfns, &
400  this%mf6_input%component_type, &
401  this%mf6_input%subcomponent_type, &
402  this%mf6_input%block_dfns(iblk)%blockname, &
403  tag, this%filename)
404  ! avoid namespace collisions (CIM)
405  if (tag /= 'PRINT_FORMAT') call this%load_tag(iblk, inidt)
406  call this%load_tag(iblk, idt)
407  istart = 4
408  end if
409  else
410  call this%load_tag(iblk, inidt)
411  nwords = 0
412  end if
413  end if
414 
415  if (istart > 1 .and. nwords == 0) then
416  write (errmsg, '(5a)') &
417  '"', trim(this%mf6_input%block_dfns(iblk)%blockname), &
418  '" block input record that includes keyword "', trim(inidt%tagname), &
419  '" is not properly formed.'
420  call store_error(errmsg)
421  call this%parser%StoreErrorUnit()
422  end if
423 
424  do n = istart, nwords
425  idt => get_param_definition_type( &
426  this%mf6_input%param_dfns, &
427  this%mf6_input%component_type, &
428  this%mf6_input%subcomponent_type, &
429  this%mf6_input%block_dfns(iblk)%blockname, &
430  words(n), this%filename)
431  if (idt_datatype(idt) == 'RECORD') then
432  call this%parser%GetStringCaps(tag)
433  idt => get_param_definition_type( &
434  this%mf6_input%param_dfns, &
435  this%mf6_input%component_type, &
436  this%mf6_input%subcomponent_type, &
437  this%mf6_input%block_dfns(iblk)%blockname, &
438  tag, this%filename)
439  call this%parse_record_tag(iblk, idt, .true.)
440  exit
441  else
442  if (idt%tagname /= 'FORMAT') then
443  call this%parser%GetStringCaps(tag)
444  if (tag == '') then
445  exit
446  else if (idt%tagname /= tag) then
447  write (errmsg, '(5a)') 'Expecting record input tag "', &
448  trim(idt%tagname), '" but instead found "', trim(tag), '".'
449  call store_error(errmsg)
450  call this%parser%StoreErrorUnit()
451  end if
452  end if
453  call this%load_tag(iblk, idt)
454  end if
455  end do
456 
457  if (allocated(words)) deallocate (words)
This module contains the DefinitionSelectModule.
subroutine, public split_record_dfn_tag1(input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
Return aggregate definition.
subroutine, public split_record_dfn_tag2(input_definition_types, component_type, subcomponent_type, tagname, tag2, nwords, words)
Return aggregate definition.
character(len=linelength) function, public idt_datatype(idt)
return input definition type datatype
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 566 of file LoadMf6File.f90.

569  class(LoadMf6FileType) :: this
570  integer(I4B), intent(in) :: iblk
571  type(LoadContextType) :: ctx
572  character(len=LINELENGTH), dimension(:), allocatable :: param_names
573  type(InputParamDefinitionType), pointer :: idt !< input data type object describing this record
574  type(InputParamDefinitionType), target :: blockvar_idt
575  integer(I4B) :: blocknum
576  integer(I4B), pointer :: nrow
577  integer(I4B) :: nrows, nrowsread
578  integer(I4B) :: ibinary, oc_inunit
579  integer(I4B) :: icol, iparam
580  integer(I4B) :: ncol, nparam
581 
582  ! initialize load context
583  call ctx%init(this%mf6_input, blockname= &
584  this%mf6_input%block_dfns(iblk)%blockname)
585  ! set in scope params for load
586  call ctx%tags(param_names, nparam, this%filename)
587  ! set input definition for this block
588  idt => &
589  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
590  this%mf6_input%component_type, &
591  this%mf6_input%subcomponent_type, &
592  this%mf6_input%block_dfns(iblk)%blockname)
593  ! if block is reloadable read the block number
594  if (this%mf6_input%block_dfns(iblk)%block_variable) then
595  blocknum = this%parser%GetInteger()
596  else
597  blocknum = 0
598  end if
599 
600  ! set ncol
601  ncol = nparam
602  ! add col if block is reloadable
603  if (blocknum > 0) ncol = ncol + 1
604  ! use shape to set the max num of rows
605  if (idt%shape /= '') then
606  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
607  nrows = nrow
608  else
609  nrows = -1
610  end if
611 
612  ! create a structured array
613  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
614  blocknum, this%mf6_input%mempath, &
615  this%mf6_input%component_mempath)
616  ! create structarray vectors for each column
617  do icol = 1, ncol
618  ! if block is reloadable, block number is first column
619  if (blocknum > 0) then
620  if (icol == 1) then
621  blockvar_idt = this%block_index_dfn(iblk)
622  idt => blockvar_idt
623  call this%structarray%mem_create_vector(icol, idt)
624  ! continue as this column managed by internally SA object
625  cycle
626  end if
627  ! set indexes (where first column is blocknum)
628  iparam = icol - 1
629  else
630  ! set indexes (no blocknum column)
631  iparam = icol
632  end if
633  ! set pointer to input definition for this 1d vector
634  idt => &
635  get_param_definition_type(this%mf6_input%param_dfns, &
636  this%mf6_input%component_type, &
637  this%mf6_input%subcomponent_type, &
638  this%mf6_input%block_dfns(iblk)%blockname, &
639  param_names(iparam), this%filename)
640  ! allocate variable in memory manager
641  call this%structarray%mem_create_vector(icol, idt)
642  end do
643 
644  ! finish context setup after allocating vectors
645  call ctx%allocate_arrays()
646 
647  ! read the block control record
648  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
649 
650  if (ibinary == 1) then
651  ! read from binary
652  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
653  call this%parser%terminateblock()
654  close (oc_inunit)
655  else
656  ! read from ascii
657  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
658  this%iout, this%filename)
659  ! save structarray for deferred TS linking in df() if any strlocs were stored
660  if (this%ts_active) call this%save_ts_sa()
661  end if
662 
663  ! clean up
664  call ctx%destroy()
This module contains the LoadContextModule.
Definition: LoadContext.f90:10
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
Definition: StructArray.f90:80
derived type for boundary package input context
Definition: LoadContext.f90:65
type for structured array
Definition: StructArray.f90:41
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 1171 of file LoadMf6File.f90.

1172  use simmodule, only: store_error_unit
1173  use inputoutputmodule, only: urword
1174  use inputoutputmodule, only: openfile
1175  use openspecmodule, only: form, access
1176  use constantsmodule, only: linelength
1178  type(BlockParserType), intent(inout) :: parser
1179  integer(I4B), intent(inout) :: oc_inunit
1180  integer(I4B), intent(in) :: iout
1181  integer(I4B) :: ibinary
1182  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1183  integer(I4B) :: nunopn = 99
1184  character(len=:), allocatable :: line
1185  character(len=LINELENGTH) :: fname
1186  logical(LGP) :: exists
1187  real(DP) :: r
1188  character(len=*), parameter :: fmtocne = &
1189  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1190  character(len=*), parameter :: fmtobf = &
1191  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1192 
1193  ! initialize oc_inunit and ibinary
1194  oc_inunit = 0
1195  ibinary = 0
1196  inunit = parser%getunit()
1197 
1198  ! Read to the first non-commented line
1199  lloc = 1
1200  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1201  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1202 
1203  if (line(istart:istop) == 'OPEN/CLOSE') then
1204  ! get filename
1205  call urword(line, lloc, istart, istop, 0, idum, r, &
1206  iout, inunit)
1207  fname = line(istart:istop)
1208  ! check to see if file OPEN/CLOSE file exists
1209  inquire (file=fname, exist=exists)
1210  if (.not. exists) then
1211  write (errmsg, fmtocne) line(istart:istop)
1212  call store_error(errmsg)
1213  call store_error('Specified OPEN/CLOSE file does not exist')
1214  call store_error_unit(inunit)
1215  end if
1216 
1217  ! Check for (BINARY) keyword
1218  call urword(line, lloc, istart, istop, 1, idum, r, &
1219  iout, inunit)
1220 
1221  if (line(istart:istop) == '(BINARY)') ibinary = 1
1222  ! Open the file depending on ibinary flag
1223  if (ibinary == 1) then
1224  oc_inunit = nunopn
1225  itmp = iout
1226  if (iout > 0) then
1227  itmp = 0
1228  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1229  end if
1230  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1231  fmtarg_opt=form, accarg_opt=access)
1232  end if
1233  end if
1234 
1235  if (ibinary == 0) then
1236  call parser%line_reader%bkspc(parser%getunit())
1237  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:

◆ save_ts_sa()

subroutine loadmf6filemodule::save_ts_sa ( class(loadmf6filetype), intent(inout)  this)

Saves the current structarray pointer when it contains TS string locs, then nullifies the pointer so load_block does not destroy it.

Definition at line 1245 of file LoadMf6File.f90.

1246  class(LoadMf6FileType), intent(inout) :: this
1247  type(StructVectorType), pointer :: svect
1248  type(StaticSAType), allocatable :: tmp(:)
1249  logical(LGP) :: has_ts
1250  integer(I4B) :: m, n
1251 
1252  ! check if any column has deferred TS strlocs
1253  has_ts = .false.
1254  do m = 1, this%structarray%count()
1255  svect => this%structarray%get(m)
1256  if (svect%idt%timeseries .and. svect%ts_strlocs%count() > 0) then
1257  has_ts = .true.
1258  exit
1259  end if
1260  end do
1261 
1262  if (has_ts) then
1263  if (.not. allocated(this%ts_sas)) then
1264  allocate (this%ts_sas(1))
1265  this%ts_sas(1)%sa => this%structarray
1266  else
1267  n = size(this%ts_sas)
1268  allocate (tmp(n + 1))
1269  tmp(1:n) = this%ts_sas
1270  tmp(n + 1)%sa => this%structarray
1271  call move_alloc(tmp, this%ts_sas)
1272  end if
1273  ! nullify so load_block does not destroy the saved SA
1274  nullify (this%structarray)
1275  end if

◆ ts_sa_count()

integer(i4b) function loadmf6filemodule::ts_sa_count ( class(loadmf6filetype), intent(in)  this)

Definition at line 669 of file LoadMf6File.f90.

670  class(LoadMf6FileType), intent(in) :: this
671  integer(I4B) :: n
672  if (allocated(this%ts_sas)) then
673  n = size(this%ts_sas)
674  else
675  n = 0
676  end if