MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
LoadMf6File.f90
Go to the documentation of this file.
1 !> @brief This module contains the LoadMf6FileModule
2 !!
3 !! This module contains the input data model routines for
4 !! loading static data from a MODFLOW 6 input file using the
5 !! block parser.
6 !!
7 !<
9 
10  use kindmodule, only: dp, i4b, lgp
11  use simvariablesmodule, only: errmsg
12  use simmodule, only: store_error
25  use inputoutputmodule, only: parseline
36 
37  implicit none
38  private
39  public :: loadmf6filetype
40  public :: read_control_record
41 
42  !> @brief Static parser based input loader
43  !!
44  !! This type defines a static input context loader
45  !! for traditional mf6 ascii input files.
46  !!
47  !<
49  type(blockparsertype), pointer :: parser !< ascii block parser
50  integer(I4B), dimension(:), pointer, contiguous :: mshape => null() !< model shape
51  type(structarraytype), pointer :: structarray => null() !< structarray for loading list input
52  type(modflowinputtype) :: mf6_input !< description of input
53  type(ncpackagevarstype), pointer :: nc_vars => null()
54  character(len=LINELENGTH) :: filename !< name of ascii input file
55  character(len=LINELENGTH), dimension(:), allocatable :: block_tags !< read block tags
56  logical(LGP) :: ts_active !< is timeseries active
57  logical(LGP) :: export !< is array export active
58  logical(LGP) :: readasarrays
59  integer(I4B) :: inamedbound
60  integer(I4B) :: iauxiliary
61  integer(I4B) :: iout !< inunit for list log
62  contains
63  procedure :: load
64  procedure :: init
65  procedure :: load_block
66  procedure :: finalize
67  procedure :: parse_block
68  procedure :: block_post_process
69  procedure :: parse_io_tag
70  procedure :: parse_keyword_tag
71  procedure :: parse_tag
72  procedure :: block_index_dfn
74  end type loadmf6filetype
75 
76 contains
77 
78  !> @brief load all static input blocks
79  !!
80  !! Invoke this routine to load all static input blocks
81  !! in single call.
82  !!
83  !<
84  subroutine load(this, parser, mf6_input, nc_vars, filename, iout)
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()
115  end subroutine load
116 
117  !> @brief init
118  !!
119  !! init / finalize are only used when load_block() will be called
120  !!
121  !<
122  subroutine init(this, parser, mf6_input, filename, iout)
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)
153  end subroutine init
154 
155  !> @brief load a single block
156  !!
157  !! Assumed in order load of single (next) block. If a
158  !! StructArray object is allocated to load this block
159  !! it persists until this routine (or finalize) is
160  !! called again.
161  !!
162  !<
163  subroutine load_block(this, iblk)
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)
186  end subroutine load_block
187 
188  !> @brief finalize
189  !!
190  !! init / finalize are only used when load_block() will be called
191  !!
192  !<
193  subroutine finalize(this)
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)
209  end subroutine finalize
210 
211  !> @brief Post parse block handling
212  !!
213  !<
214  subroutine block_post_process(this, iblk)
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
271  end subroutine block_post_process
272 
273  !> @brief parse block
274  !!
275  !<
276  recursive subroutine parse_block(this, iblk, recursive_call)
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
341  end subroutine parse_block
342 
343  subroutine parse_io_tag(this, iblk, pkgtype, which, tag)
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)
364  end subroutine parse_io_tag
365 
366  subroutine parse_keyword_tag(this, iblk, tag, idt)
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
429  end subroutine parse_keyword_tag
430 
431  !> @brief load an individual input record into memory
432  !!
433  !! Load an individual input record into the memory
434  !! manager. Allow for recursive calls in the case that multiple
435  !! tags are on a single line.
436  !!
437  !<
438  recursive subroutine parse_tag(this, iblk, recursive_call)
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)
517  end subroutine parse_tag
518 
519  function block_index_dfn(this, iblk) result(idt)
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'
547  end function block_index_dfn
548 
549  !> @brief parse a structured array record into memory manager
550  !!
551  !! A structarray is similar to a numpy recarray. It it used to
552  !! load a list of data in which each column in the list may be a
553  !! different type. Each column in the list is stored as a 1d
554  !! vector.
555  !!
556  !<
557  subroutine parse_structarray_block(this, iblk)
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()
670  end subroutine parse_structarray_block
671 
672  !> @brief load type keyword
673  !<
674  subroutine load_keyword_type(parser, idt, memoryPath, iout)
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
684  end subroutine load_keyword_type
685 
686  !> @brief load type string
687  !<
688  subroutine load_string_type(parser, idt, memoryPath, iout)
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
710  end subroutine load_string_type
711 
712  !> @brief load io tag
713  !<
714  subroutine load_io_tag(parser, idt, memoryPath, which, iout)
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
744  end subroutine load_io_tag
745 
746  !> @brief load aux variable names
747  !!
748  !<
749  subroutine load_auxvar_names(parser, idt, memoryPath, iout)
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
780  end subroutine load_auxvar_names
781 
782  !> @brief load type integer
783  !<
784  subroutine load_integer_type(parser, idt, memoryPath, iout)
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
794  end subroutine load_integer_type
795 
796  !> @brief load type 1d integer
797  !<
798  subroutine load_integer1d_type(parser, idt, mf6_input, mshape, export, &
799  nc_vars, input_fname, iout)
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
855  end subroutine load_integer1d_type
856 
857  !> @brief load type 2d integer
858  !<
859  subroutine load_integer2d_type(parser, idt, mf6_input, mshape, export, &
860  nc_vars, input_fname, iout)
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
913  end subroutine load_integer2d_type
914 
915  !> @brief load type 3d integer
916  !<
917  subroutine load_integer3d_type(parser, idt, mf6_input, mshape, export, &
918  nc_vars, input_fname, iout)
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
976  end subroutine load_integer3d_type
977 
978  !> @brief load type double
979  !<
980  subroutine load_double_type(parser, idt, memoryPath, iout)
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
990  end subroutine load_double_type
991 
992  !> @brief load type 1d double
993  !<
994  subroutine load_double1d_type(parser, idt, mf6_input, mshape, export, &
995  nc_vars, input_fname, iout)
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
1050  end subroutine load_double1d_type
1051 
1052  !> @brief load type 2d double
1053  !<
1054  subroutine load_double2d_type(parser, idt, mf6_input, mshape, export, &
1055  nc_vars, input_fname, iout)
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
1108  end subroutine load_double2d_type
1109 
1110  !> @brief load type 3d double
1111  !<
1112  subroutine load_double3d_type(parser, idt, mf6_input, mshape, export, &
1113  nc_vars, input_fname, iout)
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
1171  end subroutine load_double3d_type
1172 
1173  function read_control_record(parser, oc_inunit, iout) result(ibinary)
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
1253  end function read_control_record
1254 
1255 end module loadmf6filemodule
subroutine init()
Definition: GridSorting.f90:24
This module contains block parser methods.
Definition: BlockParser.f90:7
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b), parameter lenpackagename
maximum length of the package name
Definition: Constants.f90:23
integer(i4b), parameter lenbigline
maximum length of a big line
Definition: Constants.f90:15
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition: Constants.f90:17
integer(i4b), parameter lenauxname
maximum length of a aux variable
Definition: Constants.f90:35
integer(i4b), parameter lenboundname
maximum length of a bound name
Definition: Constants.f90:36
This module contains the DefinitionSelectModule.
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename)
Return parameter definition.
subroutine, public split_record_definition(input_definition_types, component_type, subcomponent_type, tagname, nwords, words)
Return aggregate definition.
type(inputparamdefinitiontype) function, pointer, public get_aggregate_definition_type(input_definition_types, component_type, subcomponent_type, blockname)
Return aggregate definition.
subroutine, public read_dbl1d(parser, dbl1d, aname)
subroutine, public read_dbl2d(parser, dbl2d, aname)
This module contains the DynamicPackageParamsModule.
This module contains the Input Data Model Logger Module.
Definition: IdmLogger.f90:7
subroutine, public idm_log_close(component, subcomponent, iout)
@ brief log the closing message
Definition: IdmLogger.f90:57
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
Definition: IdmLogger.f90:44
This module contains the InputDefinitionModule.
subroutine, public urdaux(naux, inunit, iout, lloc, istart, istop, auxname, line, text)
Read auxiliary variables from an input line.
subroutine, public parseline(line, nwords, words, inunit, filename)
Parse a line into words.
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.
subroutine, public read_int1d(parser, int1d, aname)
subroutine, public read_int2d(parser, int2d, aname)
This module defines variable data types.
Definition: kind.f90:8
subroutine, public read_int1d_layered(parser, int1d, aname, nlay, layer_shape)
subroutine, public read_dbl1d_layered(parser, dbl1d, aname, nlay, layer_shape)
subroutine, public read_dbl2d_layered(parser, dbl2d, aname, nlay, layer_shape)
subroutine, public read_int3d_layered(parser, int3d, aname, nlay, layer_shape)
subroutine, public read_dbl3d_layered(parser, dbl3d, aname, nlay, layer_shape)
subroutine, public read_int2d_layered(parser, int2d, aname, nlay, layer_shape)
This module contains the LoadMf6FileModule.
Definition: LoadMf6File.f90:8
type(inputparamdefinitiontype) function block_index_dfn(this, iblk)
subroutine parse_keyword_tag(this, iblk, tag, idt)
recursive subroutine parse_tag(this, iblk, recursive_call)
load an individual input record into memory
subroutine load_integer1d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 1d integer
subroutine load_io_tag(parser, idt, memoryPath, which, iout)
load io tag
subroutine load_double3d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 3d double
subroutine load_string_type(parser, idt, memoryPath, iout)
load type string
subroutine load_keyword_type(parser, idt, memoryPath, iout)
load type keyword
subroutine load_auxvar_names(parser, idt, memoryPath, iout)
load aux variable names
subroutine load_double1d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 1d double
subroutine load_block(this, iblk)
load a single block
subroutine parse_io_tag(this, iblk, pkgtype, which, tag)
subroutine load_double2d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 2d double
subroutine load_integer_type(parser, idt, memoryPath, iout)
load type integer
recursive subroutine parse_block(this, iblk, recursive_call)
parse block
subroutine load_integer3d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 3d integer
subroutine block_post_process(this, iblk)
Post parse block handling.
subroutine finalize(this)
finalize
subroutine load_double_type(parser, idt, memoryPath, iout)
load type double
subroutine load_integer2d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 2d integer
subroutine parse_structarray_block(this, iblk)
parse a structured array record into memory manager
subroutine load(this, parser, mf6_input, nc_vars, filename, iout)
load all static input blocks
Definition: LoadMf6File.f90:85
integer(i4b) function, public read_control_record(parser, oc_inunit, iout)
This module contains the LoadNCInputModule.
Definition: LoadNCInput.F90:7
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public get_from_memorystore(name, mem_path, mt, found, check)
@ brief Get a memory type entry from the memory list
subroutine, public get_isize(name, mem_path, isize)
@ brief Get the number of elements for this variable
This module contains the ModflowInputModule.
Definition: ModflowInput.f90:9
type(modflowinputtype) function, public getmodflowinput(pkgtype, component_type, subcomponent_type, component_name, subcomponent_name, filename)
function to return ModflowInputType
This module contains the NCFileVarsModule.
Definition: NCFileVars.f90:7
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(msg, terminate)
Store an error message.
Definition: Sim.f90:92
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
Definition: Sim.f90:168
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=maxcharlen) errmsg
error message string
This module contains the SourceCommonModule.
Definition: SourceCommon.f90:7
subroutine, public get_layered_shape(mshape, nlay, layer_shape)
subroutine, public get_shape_from_string(shape_string, array_shape, memoryPath)
subroutine, public set_model_shape(ftype, fname, model_mempath, dis_mempath, model_shape)
routine for setting the model shape
This module contains the StructArrayModule.
Definition: StructArray.f90:8
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath)
constructor for a struct_array
Definition: StructArray.f90:74
subroutine, public destructstructarray(struct_array)
destructor for a struct_array
This class is used to store a single deferred-length character string. It was designed to work in an ...
Definition: CharString.f90:23
Static parser based input loader.
Definition: LoadMf6File.f90:48
derived type for storing input definition for a file
Type describing input variables for a package in NetCDF file.
Definition: NCFileVars.f90:22
type for structured array
Definition: StructArray.f90:37