MODFLOW 6  version 6.8.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
35 
36  implicit none
37  private
38  public :: loadmf6filetype
39  public :: read_control_record
40 
41  !> @brief Static parser based input loader
42  !!
43  !! This type defines a static input context loader
44  !! for traditional mf6 ascii input files.
45  !!
46  !<
48  type(blockparsertype), pointer :: parser !< ascii block parser
49  integer(I4B), dimension(:), pointer, contiguous :: mshape => null() !< model shape
50  type(structarraytype), pointer :: structarray => null() !< structarray for loading list input
51  type(modflowinputtype) :: mf6_input !< description of input
52  type(ncpackagevarstype), pointer :: nc_vars => null()
53  character(len=LINELENGTH) :: filename !< name of ascii input file
54  character(len=LINELENGTH), dimension(:), allocatable :: block_tags !< read block tags
55  logical(LGP) :: ts_active !< is timeseries active
56  logical(LGP) :: export !< is array export active
57  logical(LGP) :: readasarrays
58  logical(LGP) :: readarraygrid
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_record_tag
71  procedure :: load_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)
86  class(loadmf6filetype) :: this
87  type(blockparsertype), target, intent(inout) :: parser
88  type(modflowinputtype), intent(in) :: mf6_input
89  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
90  character(len=*), intent(in) :: filename
91  integer(I4B), intent(in) :: iout
92  integer(I4B) :: iblk
93 
94  ! initialize static load
95  call this%init(parser, mf6_input, filename, iout)
96 
97  ! set netcdf vars
98  this%nc_vars => nc_vars
99 
100  ! process blocks
101  do iblk = 1, size(this%mf6_input%block_dfns)
102  ! don't load dynamic input data
103  if (this%mf6_input%block_dfns(iblk)%blockname == 'PERIOD') exit
104  ! load the block
105  call this%load_block(iblk)
106  end do
107 
108  ! finalize static load
109  call this%finalize()
110  end subroutine load
111 
112  !> @brief init
113  !!
114  !! init / finalize are only used when load_block() will be called
115  !!
116  !<
117  subroutine init(this, parser, mf6_input, filename, iout)
118  use memorymanagermodule, only: get_isize
119  class(loadmf6filetype) :: this
120  type(blockparsertype), target, intent(inout) :: parser
121  type(modflowinputtype), intent(in) :: mf6_input
122  character(len=*), intent(in) :: filename
123  integer(I4B), intent(in) :: iout
124  integer(I4B) :: isize
125 
126  this%parser => parser
127  this%mf6_input = mf6_input
128  this%filename = filename
129  this%ts_active = .false.
130  this%export = .false.
131  this%readasarrays = .false.
132  this%readarraygrid = .false.
133  this%inamedbound = 0
134  this%iauxiliary = 0
135  this%iout = iout
136 
137  call get_isize('MODEL_SHAPE', mf6_input%component_mempath, isize)
138  if (isize > 0) then
139  call mem_setptr(this%mshape, 'MODEL_SHAPE', mf6_input%component_mempath)
140  end if
141 
142  ! log lst file header
143  call idm_log_header(this%mf6_input%component_name, &
144  this%mf6_input%subcomponent_name, this%iout)
145  end subroutine init
146 
147  !> @brief load a single block
148  !!
149  !! Assumed in order load of single (next) block. If a
150  !! StructArray object is allocated to load this block
151  !! it persists until this routine (or finalize) is
152  !! called again.
153  !!
154  !<
155  subroutine load_block(this, iblk)
157  class(loadmf6filetype) :: this
158  integer(I4B), intent(in) :: iblk
159 
160  ! reset structarray if it was created for previous block
161  if (associated(this%structarray)) then
162  ! destroy the structured array reader
163  call destructstructarray(this%structarray)
164  end if
165 
166  allocate (this%block_tags(0))
167  ! load the block
168  call this%parse_block(iblk, .false.)
169  ! post process block
170  call this%block_post_process(iblk)
171  ! cleanup
172  deallocate (this%block_tags)
173  end subroutine load_block
174 
175  !> @brief finalize
176  !!
177  !! init / finalize are only used when load_block() will be called
178  !!
179  !<
180  subroutine finalize(this)
182  class(loadmf6filetype) :: this
183  ! cleanup
184  if (associated(this%structarray)) then
185  ! destroy the structured array reader
186  call destructstructarray(this%structarray)
187  end if
188  ! close logging block
189  call idm_log_close(this%mf6_input%component_name, &
190  this%mf6_input%subcomponent_name, this%iout)
191  end subroutine finalize
192 
193  !> @brief Post parse block handling
194  !!
195  !<
196  subroutine block_post_process(this, iblk)
197  use constantsmodule, only: lenboundname
200  class(loadmf6filetype) :: this
201  integer(I4B), intent(in) :: iblk
202  type(inputparamdefinitiontype), pointer :: idt
203  integer(I4B) :: iparam
204  integer(I4B), pointer :: intptr
205 
206  ! update state based on read tags
207  do iparam = 1, size(this%block_tags)
208  select case (this%mf6_input%block_dfns(iblk)%blockname)
209  case ('OPTIONS')
210  if (this%block_tags(iparam) == 'AUXILIARY') then
211  this%iauxiliary = 1
212  else if (this%block_tags(iparam) == 'BOUNDNAMES') then
213  this%inamedbound = 1
214  else if (this%block_tags(iparam) == 'READASARRAYS') then
215  this%readasarrays = .true.
216  else if (this%block_tags(iparam) == 'READARRAYGRID') then
217  this%readarraygrid = .true.
218  else if (this%block_tags(iparam) == 'TS6') then
219  this%ts_active = .true.
220  else if (this%block_tags(iparam) == 'EXPORT_ARRAY_ASCII') then
221  this%export = .true.
222  end if
223  case default
224  end select
225  end do
226 
227  ! update input context allocations based on dfn set and input
228  select case (this%mf6_input%block_dfns(iblk)%blockname)
229  case ('OPTIONS')
230  ! allocate naux and set to 0 if not allocated
231  do iparam = 1, size(this%mf6_input%param_dfns)
232  idt => this%mf6_input%param_dfns(iparam)
233  if (idt%blockname == 'OPTIONS' .and. &
234  idt%tagname == 'AUXILIARY') then
235  if (this%iauxiliary == 0) then
236  call mem_allocate(intptr, 'NAUX', this%mf6_input%mempath)
237  intptr = 0
238  end if
239  exit
240  end if
241  end do
242  case ('DIMENSIONS')
243  ! set model shape if discretization dimensions have been read
244  if (this%mf6_input%pkgtype(1:3) == 'DIS') then
245  call set_model_shape(this%mf6_input%pkgtype, this%filename, &
246  this%mf6_input%component_mempath, &
247  this%mf6_input%mempath, this%mshape)
248  end if
249  case default
250  end select
251  end subroutine block_post_process
252 
253  !> @brief parse block
254  !!
255  !<
256  recursive subroutine parse_block(this, iblk, recursive_call)
257  use memorytypemodule, only: memorytype
259  class(loadmf6filetype) :: this
260  integer(I4B), intent(in) :: iblk
261  logical(LGP), intent(in) :: recursive_call !< true if recursive call
262  logical(LGP) :: isblockfound
263  logical(LGP) :: endofblock
264  logical(LGP) :: supportopenclose
265  integer(I4B) :: ierr
266  logical(LGP) :: found, required
267  type(memorytype), pointer :: mt
268  character(len=LINELENGTH) :: tag
269  type(inputparamdefinitiontype), pointer :: idt
270 
271  ! disu vertices/cell2d blocks are contingent on NVERT dimension
272  if (this%mf6_input%pkgtype == 'DISU6' .or. &
273  this%mf6_input%pkgtype == 'DISV1D6' .or. &
274  this%mf6_input%pkgtype == 'DISV2D6') then
275  if (this%mf6_input%block_dfns(iblk)%blockname == 'VERTICES' .or. &
276  this%mf6_input%block_dfns(iblk)%blockname == 'CELL2D') then
277  call get_from_memorystore('NVERT', this%mf6_input%mempath, mt, found, &
278  .false.)
279  if (.not. found) return
280  if (mt%intsclr == 0) return
281  end if
282  end if
283 
284  ! block open/close support
285  supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /= 'GRIDDATA')
286 
287  ! parser search for block
288  required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
289  call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
290  isblockfound, ierr, &
291  supportopenclose=supportopenclose, &
292  blockrequired=required)
293  ! process block
294  if (isblockfound) then
295  if (this%mf6_input%block_dfns(iblk)%aggregate) then
296  ! process block recarray type, set of variable 1d/2d types
297  call this%parse_structarray_block(iblk)
298  else
299  do
300  ! process each line in block
301  call this%parser%GetNextLine(endofblock)
302  if (endofblock) exit
303  ! process line as tag(s)
304  call this%parser%GetStringCaps(tag)
305  idt => get_param_definition_type( &
306  this%mf6_input%param_dfns, &
307  this%mf6_input%component_type, &
308  this%mf6_input%subcomponent_type, &
309  this%mf6_input%block_dfns(iblk)%blockname, &
310  tag, this%filename)
311  if (idt%in_record) then
312  call this%parse_record_tag(iblk, idt, .false.)
313  else
314  call this%load_tag(iblk, idt)
315  end if
316  end do
317  end if
318  end if
319 
320  ! recurse if block is reloadable and was just read
321  if (this%mf6_input%block_dfns(iblk)%block_variable) then
322  if (isblockfound) then
323  call this%parse_block(iblk, .true.)
324  end if
325  end if
326  end subroutine parse_block
327 
328  subroutine parse_io_tag(this, iblk, pkgtype, which, tag)
329  class(loadmf6filetype) :: this
330  integer(I4B), intent(in) :: iblk
331  character(len=*), intent(in) :: pkgtype
332  character(len=*), intent(in) :: which
333  character(len=*), intent(in) :: tag
334  type(inputparamdefinitiontype), pointer :: idt !< input data type object describing this record
335  ! matches, read and load file name
336  idt => &
337  get_param_definition_type(this%mf6_input%param_dfns, &
338  this%mf6_input%component_type, &
339  this%mf6_input%subcomponent_type, &
340  this%mf6_input%block_dfns(iblk)%blockname, &
341  tag, this%filename)
342  ! load io tag
343  call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
344  end subroutine parse_io_tag
345 
346  recursive subroutine parse_record_tag(this, iblk, inidt, recursive_call)
350  class(loadmf6filetype) :: this
351  integer(I4B), intent(in) :: iblk
352  type(inputparamdefinitiontype), pointer, intent(in) :: inidt
353  logical(LGP), intent(in) :: recursive_call !< true if recursive call
354  type(inputparamdefinitiontype), pointer :: idt
355  character(len=40), dimension(:), allocatable :: words
356  integer(I4B) :: n, istart, nwords
357  character(len=LINELENGTH) :: tag
358 
359  nullify (idt)
360  istart = 1
361 
362  if (recursive_call) then
363  call split_record_dfn_tag1(this%mf6_input%param_dfns, &
364  this%mf6_input%component_type, &
365  this%mf6_input%subcomponent_type, &
366  inidt%tagname, nwords, words)
367  call this%load_tag(iblk, inidt)
368  istart = 3
369  else
370  call this%parser%GetStringCaps(tag)
371  if (tag /= '') then
372  call split_record_dfn_tag2(this%mf6_input%param_dfns, &
373  this%mf6_input%component_type, &
374  this%mf6_input%subcomponent_type, &
375  inidt%tagname, tag, nwords, words)
376  if (nwords == 4 .and. &
377  (tag == 'FILEIN' .or. &
378  tag == 'FILEOUT')) then
379  call this%parse_io_tag(iblk, words(2), words(3), words(4))
380  nwords = 0
381  else
382  idt => get_param_definition_type( &
383  this%mf6_input%param_dfns, &
384  this%mf6_input%component_type, &
385  this%mf6_input%subcomponent_type, &
386  this%mf6_input%block_dfns(iblk)%blockname, &
387  tag, this%filename)
388  ! avoid namespace collisions (CIM)
389  if (tag /= 'PRINT_FORMAT') call this%load_tag(iblk, inidt)
390  call this%load_tag(iblk, idt)
391  istart = 4
392  end if
393  else
394  call this%load_tag(iblk, inidt)
395  nwords = 0
396  end if
397  end if
398 
399  if (istart > 1 .and. nwords == 0) then
400  write (errmsg, '(5a)') &
401  '"', trim(this%mf6_input%block_dfns(iblk)%blockname), &
402  '" block input record that includes keyword "', trim(inidt%tagname), &
403  '" is not properly formed.'
404  call store_error(errmsg)
405  call this%parser%StoreErrorUnit()
406  end if
407 
408  do n = istart, nwords
409  idt => get_param_definition_type( &
410  this%mf6_input%param_dfns, &
411  this%mf6_input%component_type, &
412  this%mf6_input%subcomponent_type, &
413  this%mf6_input%block_dfns(iblk)%blockname, &
414  words(n), this%filename)
415  if (idt_datatype(idt) == 'RECORD') then
416  call this%parser%GetStringCaps(tag)
417  idt => get_param_definition_type( &
418  this%mf6_input%param_dfns, &
419  this%mf6_input%component_type, &
420  this%mf6_input%subcomponent_type, &
421  this%mf6_input%block_dfns(iblk)%blockname, &
422  tag, this%filename)
423  call this%parse_record_tag(iblk, idt, .true.)
424  exit
425  else
426  if (idt%tagname /= 'FORMAT') then
427  call this%parser%GetStringCaps(tag)
428  if (tag == '') then
429  exit
430  else if (idt%tagname /= tag) then
431  write (errmsg, '(5a)') 'Expecting record input tag "', &
432  trim(idt%tagname), '" but instead found "', trim(tag), '".'
433  call store_error(errmsg)
434  call this%parser%StoreErrorUnit()
435  end if
436  end if
437  call this%load_tag(iblk, idt)
438  end if
439  end do
440 
441  if (allocated(words)) deallocate (words)
442  end subroutine parse_record_tag
443 
444  !> @brief load input keyword
445  !! Load input associated with tag key into the memory manager.
446  !<
447  subroutine load_tag(this, iblk, idt)
450  class(loadmf6filetype) :: this
451  integer(I4B), intent(in) :: iblk
452  type(inputparamdefinitiontype), pointer, intent(in) :: idt !< input data type object describing this record
453  character(len=LINELENGTH) :: dev_msg
454 
455  ! check if input param is developmode
456  if (idt%developmode) then
457  dev_msg = 'Input tag "'//trim(idt%tagname)// &
458  &'" read from file "'//trim(this%filename)// &
459  &'" is still under development. Install the &
460  &nightly build or compile from source with IDEVELOPMODE = 1.'
461  call developmode(dev_msg, this%iout)
462  end if
463 
464  ! allocate and load data type
465  select case (idt%datatype)
466  case ('KEYWORD')
467  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
468  ! check/set as dev option
469  if (idt%tagname(1:4) == 'DEV_' .and. &
470  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
471  call this%parser%DevOpt()
472  end if
473  case ('STRING')
474  if (idt%shape == 'NAUX') then
475  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
476  this%iout)
477  else
478  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
479  end if
480  case ('INTEGER')
481  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
482  case ('INTEGER1D')
483  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
484  this%export, this%nc_vars, this%filename, &
485  this%iout)
486  case ('INTEGER2D')
487  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
488  this%export, this%nc_vars, this%filename, &
489  this%iout)
490  case ('INTEGER3D')
491  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
492  this%export, this%nc_vars, this%filename, &
493  this%iout)
494  case ('DOUBLE')
495  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
496  case ('DOUBLE1D')
497  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
498  this%export, this%nc_vars, this%filename, this%iout)
499  case ('DOUBLE2D')
500  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
501  this%export, this%nc_vars, this%filename, this%iout)
502  case ('DOUBLE3D')
503  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
504  this%export, this%nc_vars, this%filename, this%iout)
505  case default
506  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(idt%tagname)
507  call store_error(errmsg)
508  call this%parser%StoreErrorUnit()
509  end select
510 
511  call expandarray(this%block_tags)
512  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
513  end subroutine load_tag
514 
515  function block_index_dfn(this, iblk) result(idt)
516  class(loadmf6filetype) :: this
517  integer(I4B), intent(in) :: iblk
518  type(inputparamdefinitiontype) :: idt !< input data type object describing this record
519  character(len=LENVARNAME) :: varname
520  integer(I4B) :: ilen
521  character(len=3) :: block_suffix = 'NUM'
522 
523  ! assign first column as the block number
524  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
525 
526  if (ilen > (lenvarname - len(block_suffix))) then
527  varname = &
528  this%mf6_input%block_dfns(iblk)% &
529  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
530  else
531  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
532  end if
533 
534  idt%component_type = trim(this%mf6_input%component_type)
535  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
536  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
537  idt%tagname = varname
538  idt%mf6varname = varname
539  idt%datatype = 'INTEGER'
540  end function block_index_dfn
541 
542  !> @brief parse a structured array record into memory manager
543  !!
544  !! A structarray is similar to a numpy recarray. It it used to
545  !! load a list of data in which each column in the list may be a
546  !! different type. Each column in the list is stored as a 1d
547  !! vector.
548  !!
549  !<
550  subroutine parse_structarray_block(this, iblk)
553  class(loadmf6filetype) :: this
554  integer(I4B), intent(in) :: iblk
555  type(loadcontexttype) :: ctx
556  character(len=LINELENGTH), dimension(:), allocatable :: param_names
557  type(inputparamdefinitiontype), pointer :: idt !< input data type object describing this record
558  type(inputparamdefinitiontype), target :: blockvar_idt
559  integer(I4B) :: blocknum
560  integer(I4B), pointer :: nrow
561  integer(I4B) :: nrows, nrowsread
562  integer(I4B) :: ibinary, oc_inunit
563  integer(I4B) :: icol, iparam
564  integer(I4B) :: ncol, nparam
565 
566  ! initialize load context
567  call ctx%init(this%mf6_input, blockname= &
568  this%mf6_input%block_dfns(iblk)%blockname)
569  ! set in scope params for load
570  call ctx%tags(param_names, nparam, this%filename)
571  ! set input definition for this block
572  idt => &
573  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
574  this%mf6_input%component_type, &
575  this%mf6_input%subcomponent_type, &
576  this%mf6_input%block_dfns(iblk)%blockname)
577  ! if block is reloadable read the block number
578  if (this%mf6_input%block_dfns(iblk)%block_variable) then
579  blocknum = this%parser%GetInteger()
580  else
581  blocknum = 0
582  end if
583 
584  ! set ncol
585  ncol = nparam
586  ! add col if block is reloadable
587  if (blocknum > 0) ncol = ncol + 1
588  ! use shape to set the max num of rows
589  if (idt%shape /= '') then
590  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
591  nrows = nrow
592  else
593  nrows = -1
594  end if
595 
596  ! create a structured array
597  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
598  blocknum, this%mf6_input%mempath, &
599  this%mf6_input%component_mempath)
600  ! create structarray vectors for each column
601  do icol = 1, ncol
602  ! if block is reloadable, block number is first column
603  if (blocknum > 0) then
604  if (icol == 1) then
605  blockvar_idt = this%block_index_dfn(iblk)
606  idt => blockvar_idt
607  call this%structarray%mem_create_vector(icol, idt)
608  ! continue as this column managed by internally SA object
609  cycle
610  end if
611  ! set indexes (where first column is blocknum)
612  iparam = icol - 1
613  else
614  ! set indexes (no blocknum column)
615  iparam = icol
616  end if
617  ! set pointer to input definition for this 1d vector
618  idt => &
619  get_param_definition_type(this%mf6_input%param_dfns, &
620  this%mf6_input%component_type, &
621  this%mf6_input%subcomponent_type, &
622  this%mf6_input%block_dfns(iblk)%blockname, &
623  param_names(iparam), this%filename)
624  ! allocate variable in memory manager
625  call this%structarray%mem_create_vector(icol, idt)
626  end do
627 
628  ! finish context setup after allocating vectors
629  call ctx%allocate_arrays()
630 
631  ! read the block control record
632  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
633 
634  if (ibinary == 1) then
635  ! read from binary
636  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
637  call this%parser%terminateblock()
638  close (oc_inunit)
639  else
640  ! read from ascii
641  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
642  this%iout)
643  end if
644 
645  ! clean up
646  call ctx%destroy()
647  end subroutine parse_structarray_block
648 
649  !> @brief load type keyword
650  !<
651  subroutine load_keyword_type(parser, idt, memoryPath, iout)
652  type(blockparsertype), intent(inout) :: parser !< block parser
653  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
654  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
655  integer(I4B), intent(in) :: iout !< unit number for output
656  integer(I4B), pointer :: intvar
657  call mem_allocate(intvar, idt%mf6varname, memorypath)
658  intvar = 1
659  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
660  end subroutine load_keyword_type
661 
662  !> @brief load type string
663  !<
664  subroutine load_string_type(parser, idt, memoryPath, iout)
665  use constantsmodule, only: lenbigline
666  type(blockparsertype), intent(inout) :: parser !< block parser
667  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
668  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
669  integer(I4B), intent(in) :: iout !< unit number for output
670  character(len=LINELENGTH), pointer :: cstr
671  character(len=LENBIGLINE), pointer :: bigcstr
672  integer(I4B) :: ilen
673  select case (idt%shape)
674  case ('LENBIGLINE')
675  ilen = lenbigline
676  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
677  call parser%GetString(bigcstr, (.not. idt%preserve_case))
678  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
679  case default
680  ilen = linelength
681  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
682  call parser%GetString(cstr, (.not. idt%preserve_case))
683  call idm_log_var(cstr, idt%tagname, memorypath, iout)
684  end select
685  end subroutine load_string_type
686 
687  !> @brief load io tag
688  !<
689  subroutine load_io_tag(parser, idt, memoryPath, which, iout)
693  type(blockparsertype), intent(inout) :: parser !< block parser
694  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
695  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
696  character(len=*), intent(in) :: which
697  integer(I4B), intent(in) :: iout !< unit number for output
698  character(len=LINELENGTH) :: cstr
699  type(characterstringtype), dimension(:), pointer, contiguous :: charstr1d
700  integer(I4B) :: ilen, isize, idx
701  ilen = linelength
702  if (which == 'FILEIN') then
703  call get_isize(idt%mf6varname, memorypath, isize)
704  if (isize < 0) then
705  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
706  idx = 1
707  else
708  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
709  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
710  memorypath)
711  idx = isize + 1
712  end if
713  call parser%GetString(cstr, (.not. idt%preserve_case))
714  charstr1d(idx) = cstr
715  else if (which == 'FILEOUT') then
716  call load_string_type(parser, idt, memorypath, iout)
717  end if
718  end subroutine load_io_tag
719 
720  !> @brief load aux variable names
721  !!
722  !<
723  subroutine load_auxvar_names(parser, idt, memoryPath, iout)
725  use inputoutputmodule, only: urdaux
727  type(blockparsertype), intent(inout) :: parser !< block parser
728  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
729  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
730  integer(I4B), intent(in) :: iout !< unit number for output
731  character(len=:), allocatable :: line
732  character(len=LENAUXNAME), dimension(:), allocatable :: caux
733  integer(I4B) :: lloc
734  integer(I4B) :: istart
735  integer(I4B) :: istop
736  integer(I4B) :: i
737  character(len=LENPACKAGENAME) :: text = ''
738  integer(I4B), pointer :: intvar
739  type(characterstringtype), dimension(:), &
740  pointer, contiguous :: acharstr1d !< variable for allocation
741  call mem_allocate(intvar, idt%shape, memorypath)
742  intvar = 0
743  call parser%GetRemainingLine(line)
744  lloc = 1
745  call urdaux(intvar, parser%iuactive, iout, lloc, &
746  istart, istop, caux, line, text)
747  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
748  do i = 1, intvar
749  acharstr1d(i) = caux(i)
750  end do
751  deallocate (line)
752  deallocate (caux)
753  end subroutine load_auxvar_names
754 
755  !> @brief load type integer
756  !<
757  subroutine load_integer_type(parser, idt, memoryPath, iout)
758  type(blockparsertype), intent(inout) :: parser !< block parser
759  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
760  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
761  integer(I4B), intent(in) :: iout !< unit number for output
762  integer(I4B), pointer :: intvar
763  call mem_allocate(intvar, idt%mf6varname, memorypath)
764  intvar = parser%GetInteger()
765  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
766  end subroutine load_integer_type
767 
768  !> @brief load type 1d integer
769  !<
770  subroutine load_integer1d_type(parser, idt, mf6_input, mshape, export, &
771  nc_vars, input_fname, iout)
774  type(blockparsertype), intent(inout) :: parser !< block parser
775  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
776  type(modflowinputtype), intent(in) :: mf6_input !< description of input
777  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
778  logical(LGP), intent(in) :: export !< export to ascii layer files
779  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
780  character(len=*), intent(in) :: input_fname !< ascii input file name
781  integer(I4B), intent(in) :: iout !< unit number for output
782  integer(I4B), dimension(:), pointer, contiguous :: int1d
783  integer(I4B) :: nlay
784  integer(I4B) :: nvals
785  integer(I4B), dimension(:), allocatable :: array_shape
786  integer(I4B), dimension(:), allocatable :: layer_shape
787  character(len=LINELENGTH) :: keyword
788 
789  ! Check if it is a full grid sized array (NODES), otherwise use
790  ! idt%shape to construct shape from variables in memoryPath
791  if (idt%shape == 'NODES') then
792  nvals = product(mshape)
793  else
794  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
795  nvals = array_shape(1)
796  end if
797 
798  ! allocate memory for the array
799  call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
800 
801  ! read keyword
802  keyword = ''
803  call parser%GetStringCaps(keyword)
804 
805  ! check for "NETCDF" and "LAYERED"
806  if (keyword == 'NETCDF') then
807  call netcdf_read_array(int1d, mshape, idt, mf6_input, nc_vars, &
808  input_fname, iout)
809  else if (keyword == 'LAYERED' .and. idt%layered) then
810  call get_layered_shape(mshape, nlay, layer_shape)
811  call read_int1d_layered(parser, int1d, idt%mf6varname, nlay, layer_shape)
812  else
813  call read_int1d(parser, int1d, idt%mf6varname)
814  end if
815 
816  ! log information on the loaded array to the list file
817  call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
818 
819  ! create export file for griddata parameters if optioned
820  if (export) then
821  if (idt%blockname == 'GRIDDATA') then
822  call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
823  end if
824  end if
825  end subroutine load_integer1d_type
826 
827  !> @brief load type 2d integer
828  !<
829  subroutine load_integer2d_type(parser, idt, mf6_input, mshape, export, &
830  nc_vars, input_fname, iout)
833  type(blockparsertype), intent(inout) :: parser !< block parser
834  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
835  type(modflowinputtype), intent(in) :: mf6_input !< description of input
836  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
837  logical(LGP), intent(in) :: export !< export to ascii layer files
838  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
839  character(len=*), intent(in) :: input_fname !< ascii input file name
840  integer(I4B), intent(in) :: iout !< unit number for output
841  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
842  integer(I4B) :: nlay
843  integer(I4B) :: nsize1, nsize2
844  integer(I4B), dimension(:), allocatable :: array_shape
845  integer(I4B), dimension(:), allocatable :: layer_shape
846  character(len=LINELENGTH) :: keyword
847 
848  ! determine the array shape from the input data definition (idt%shape),
849  ! which looks like "NCOL, NROW, NLAY"
850  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
851  nsize1 = array_shape(1)
852  nsize2 = array_shape(2)
853 
854  ! create a new 3d memory managed variable
855  call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
856 
857  ! read keyword
858  keyword = ''
859  call parser%GetStringCaps(keyword)
860 
861  ! check for "NETCDF" and "LAYERED"
862  if (keyword == 'NETCDF') then
863  call netcdf_read_array(int2d, mshape, idt, mf6_input, nc_vars, &
864  input_fname, iout)
865  else if (keyword == 'LAYERED' .and. idt%layered) then
866  call get_layered_shape(mshape, nlay, layer_shape)
867  call read_int2d_layered(parser, int2d, idt%mf6varname, nlay, layer_shape)
868  else
869  call read_int2d(parser, int2d, idt%mf6varname)
870  end if
871 
872  ! log information on the loaded array to the list file
873  call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
874 
875  ! create export file for griddata parameters if optioned
876  if (export) then
877  if (idt%blockname == 'GRIDDATA') then
878  call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
879  end if
880  end if
881  end subroutine load_integer2d_type
882 
883  !> @brief load type 3d integer
884  !<
885  subroutine load_integer3d_type(parser, idt, mf6_input, mshape, export, &
886  nc_vars, input_fname, iout)
889  type(blockparsertype), intent(inout) :: parser !< block parser
890  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
891  type(modflowinputtype), intent(in) :: mf6_input !< description of input
892  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
893  logical(LGP), intent(in) :: export !< export to ascii layer files
894  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
895  character(len=*), intent(in) :: input_fname !< ascii input file name
896  integer(I4B), intent(in) :: iout !< unit number for output
897  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
898  integer(I4B) :: nlay
899  integer(I4B) :: nsize1, nsize2, nsize3
900  integer(I4B), dimension(:), allocatable :: array_shape
901  integer(I4B), dimension(:), allocatable :: layer_shape
902  integer(I4B), dimension(:), pointer, contiguous :: int1d_ptr
903  character(len=LINELENGTH) :: keyword
904 
905  ! determine the array shape from the input data definition (idt%shape),
906  ! which looks like "NCOL, NROW, NLAY"
907  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
908  nsize1 = array_shape(1)
909  nsize2 = array_shape(2)
910  nsize3 = array_shape(3)
911 
912  ! create a new 3d memory managed variable
913  call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
914  mf6_input%mempath)
915 
916  ! read keyword
917  keyword = ''
918  call parser%GetStringCaps(keyword)
919 
920  ! check for "NETCDF" and "LAYERED"
921  if (keyword == 'NETCDF') then
922  call netcdf_read_array(int3d, mshape, idt, mf6_input, nc_vars, &
923  input_fname, iout)
924  else if (keyword == 'LAYERED' .and. idt%layered) then
925  call get_layered_shape(mshape, nlay, layer_shape)
926  call read_int3d_layered(parser, int3d, idt%mf6varname, nlay, &
927  layer_shape)
928  else
929  int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
930  call read_int1d(parser, int1d_ptr, idt%mf6varname)
931  end if
932 
933  ! log information on the loaded array to the list file
934  call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
935 
936  ! create export file for griddata parameters if optioned
937  if (export) then
938  if (idt%blockname == 'GRIDDATA') then
939  call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
940  end if
941  end if
942  end subroutine load_integer3d_type
943 
944  !> @brief load type double
945  !<
946  subroutine load_double_type(parser, idt, memoryPath, iout)
947  type(blockparsertype), intent(inout) :: parser !< block parser
948  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
949  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
950  integer(I4B), intent(in) :: iout !< unit number for output
951  real(DP), pointer :: dblvar
952  call mem_allocate(dblvar, idt%mf6varname, memorypath)
953  dblvar = parser%GetDouble()
954  call idm_log_var(dblvar, idt%tagname, memorypath, iout)
955  end subroutine load_double_type
956 
957  !> @brief load type 1d double
958  !<
959  subroutine load_double1d_type(parser, idt, mf6_input, mshape, export, &
960  nc_vars, input_fname, iout)
963  type(blockparsertype), intent(inout) :: parser !< block parser
964  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
965  type(modflowinputtype), intent(in) :: mf6_input !< description of input
966  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
967  logical(LGP), intent(in) :: export !< export to ascii layer files
968  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
969  character(len=*), intent(in) :: input_fname !< ascii input file name
970  integer(I4B), intent(in) :: iout !< unit number for output
971  real(DP), dimension(:), pointer, contiguous :: dbl1d
972  integer(I4B) :: nlay
973  integer(I4B) :: nvals
974  integer(I4B), dimension(:), allocatable :: array_shape
975  integer(I4B), dimension(:), allocatable :: layer_shape
976  character(len=LINELENGTH) :: keyword
977 
978  ! Check if it is a full grid sized array (NODES)
979  if (idt%shape == 'NODES') then
980  nvals = product(mshape)
981  else
982  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
983  nvals = array_shape(1)
984  end if
985 
986  ! allocate memory for the array
987  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
988 
989  ! read keyword
990  keyword = ''
991  call parser%GetStringCaps(keyword)
992 
993  ! check for "NETCDF" and "LAYERED"
994  if (keyword == 'NETCDF') then
995  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
996  input_fname, iout)
997  else if (keyword == 'LAYERED' .and. idt%layered) then
998  call get_layered_shape(mshape, nlay, layer_shape)
999  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
1000  else
1001  call read_dbl1d(parser, dbl1d, idt%mf6varname)
1002  end if
1003 
1004  ! log information on the loaded array to the list file
1005  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
1006 
1007  ! create export file for griddata parameters if optioned
1008  if (export) then
1009  if (idt%blockname == 'GRIDDATA') then
1010  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1011  end if
1012  end if
1013  end subroutine load_double1d_type
1014 
1015  !> @brief load type 2d double
1016  !<
1017  subroutine load_double2d_type(parser, idt, mf6_input, mshape, export, &
1018  nc_vars, input_fname, iout)
1021  type(blockparsertype), intent(inout) :: parser !< block parser
1022  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
1023  type(modflowinputtype), intent(in) :: mf6_input !< description of input
1024  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1025  logical(LGP), intent(in) :: export !< export to ascii layer files
1026  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
1027  character(len=*), intent(in) :: input_fname !< ascii input file name
1028  integer(I4B), intent(in) :: iout !< unit number for output
1029  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
1030  integer(I4B) :: nlay
1031  integer(I4B) :: nsize1, nsize2
1032  integer(I4B), dimension(:), allocatable :: array_shape
1033  integer(I4B), dimension(:), allocatable :: layer_shape
1034  character(len=LINELENGTH) :: keyword
1035 
1036  ! determine the array shape from the input data definition (idt%shape),
1037  ! which looks like "NCOL, NROW, NLAY"
1038  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1039  nsize1 = array_shape(1)
1040  nsize2 = array_shape(2)
1041 
1042  ! create a new 3d memory managed variable
1043  call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1044 
1045  ! read keyword
1046  keyword = ''
1047  call parser%GetStringCaps(keyword)
1048 
1049  ! check for "NETCDF" and "LAYERED"
1050  if (keyword == 'NETCDF') then
1051  call netcdf_read_array(dbl2d, mshape, idt, mf6_input, nc_vars, &
1052  input_fname, iout)
1053  else if (keyword == 'LAYERED' .and. idt%layered) then
1054  call get_layered_shape(mshape, nlay, layer_shape)
1055  call read_dbl2d_layered(parser, dbl2d, idt%mf6varname, nlay, layer_shape)
1056  else
1057  call read_dbl2d(parser, dbl2d, idt%mf6varname)
1058  end if
1059 
1060  ! log information on the loaded array to the list file
1061  call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1062 
1063  ! create export file for griddata parameters if optioned
1064  if (export) then
1065  if (idt%blockname == 'GRIDDATA') then
1066  call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1067  end if
1068  end if
1069  end subroutine load_double2d_type
1070 
1071  !> @brief load type 3d double
1072  !<
1073  subroutine load_double3d_type(parser, idt, mf6_input, mshape, export, &
1074  nc_vars, input_fname, iout)
1077  type(blockparsertype), intent(inout) :: parser !< block parser
1078  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
1079  type(modflowinputtype), intent(in) :: mf6_input !< description of input
1080  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1081  logical(LGP), intent(in) :: export !< export to ascii layer files
1082  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
1083  character(len=*), intent(in) :: input_fname !< ascii input file name
1084  integer(I4B), intent(in) :: iout !< unit number for output
1085  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
1086  integer(I4B) :: nlay
1087  integer(I4B) :: nsize1, nsize2, nsize3
1088  integer(I4B), dimension(:), allocatable :: array_shape
1089  integer(I4B), dimension(:), allocatable :: layer_shape
1090  real(DP), dimension(:), pointer, contiguous :: dbl1d_ptr
1091  character(len=LINELENGTH) :: keyword
1092 
1093  ! determine the array shape from the input data definition (idt%shape),
1094  ! which looks like "NCOL, NROW, NLAY"
1095  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1096  nsize1 = array_shape(1)
1097  nsize2 = array_shape(2)
1098  nsize3 = array_shape(3)
1099 
1100  ! create a new 3d memory managed variable
1101  call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1102  mf6_input%mempath)
1103 
1104  ! read keyword
1105  keyword = ''
1106  call parser%GetStringCaps(keyword)
1107 
1108  ! check for "NETCDF" and "LAYERED"
1109  if (keyword == 'NETCDF') then
1110  call netcdf_read_array(dbl3d, mshape, idt, mf6_input, nc_vars, &
1111  input_fname, iout)
1112  else if (keyword == 'LAYERED' .and. idt%layered) then
1113  call get_layered_shape(mshape, nlay, layer_shape)
1114  call read_dbl3d_layered(parser, dbl3d, idt%mf6varname, nlay, &
1115  layer_shape)
1116  else
1117  dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1118  call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1119  end if
1120 
1121  ! log information on the loaded array to the list file
1122  call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1123 
1124  ! create export file for griddata parameters if optioned
1125  if (export) then
1126  if (idt%blockname == 'GRIDDATA') then
1127  call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1128  end if
1129  end if
1130  end subroutine load_double3d_type
1131 
1132  function read_control_record(parser, oc_inunit, iout) result(ibinary)
1133  use simmodule, only: store_error_unit
1134  use inputoutputmodule, only: urword
1135  use inputoutputmodule, only: openfile
1136  use openspecmodule, only: form, access
1137  use constantsmodule, only: linelength
1139  type(blockparsertype), intent(inout) :: parser
1140  integer(I4B), intent(inout) :: oc_inunit
1141  integer(I4B), intent(in) :: iout
1142  integer(I4B) :: ibinary
1143  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1144  integer(I4B) :: nunopn = 99
1145  character(len=:), allocatable :: line
1146  character(len=LINELENGTH) :: fname
1147  logical(LGP) :: exists
1148  real(dp) :: r
1149  character(len=*), parameter :: fmtocne = &
1150  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1151  character(len=*), parameter :: fmtobf = &
1152  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1153 
1154  ! initialize oc_inunit and ibinary
1155  oc_inunit = 0
1156  ibinary = 0
1157  inunit = parser%getunit()
1158 
1159  ! Read to the first non-commented line
1160  lloc = 1
1161  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1162  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1163 
1164  if (line(istart:istop) == 'OPEN/CLOSE') then
1165  ! get filename
1166  call urword(line, lloc, istart, istop, 0, idum, r, &
1167  iout, inunit)
1168  fname = line(istart:istop)
1169  ! check to see if file OPEN/CLOSE file exists
1170  inquire (file=fname, exist=exists)
1171  if (.not. exists) then
1172  write (errmsg, fmtocne) line(istart:istop)
1173  call store_error(errmsg)
1174  call store_error('Specified OPEN/CLOSE file does not exist')
1175  call store_error_unit(inunit)
1176  end if
1177 
1178  ! Check for (BINARY) keyword
1179  call urword(line, lloc, istart, istop, 1, idum, r, &
1180  iout, inunit)
1181 
1182  if (line(istart:istop) == '(BINARY)') ibinary = 1
1183  ! Open the file depending on ibinary flag
1184  if (ibinary == 1) then
1185  oc_inunit = nunopn
1186  itmp = iout
1187  if (iout > 0) then
1188  itmp = 0
1189  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1190  end if
1191  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1192  fmtarg_opt=form, accarg_opt=access)
1193  end if
1194  end if
1195 
1196  if (ibinary == 0) then
1197  call parser%line_reader%bkspc(parser%getunit())
1198  end if
1199  end function read_control_record
1200 
1201 end module loadmf6filemodule
subroutine init()
Definition: GridSorting.f90:25
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_dfn_tag1(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 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
subroutine, public read_dbl1d(parser, dbl1d, aname)
subroutine, public read_dbl2d(parser, dbl2d, aname)
Disable development features in release mode.
Definition: FeatureFlags.f90:2
subroutine, public developmode(errmsg, iunit)
Terminate if in release mode (guard development features)
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:56
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
Definition: IdmLogger.f90:44
Input definition module.
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 LoadContextModule.
Definition: LoadContext.f90:10
This module contains the LoadMf6FileModule.
Definition: LoadMf6File.f90:8
type(inputparamdefinitiontype) function block_index_dfn(this, iblk)
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_tag(this, iblk, idt)
load input keyword Load input associated with tag key into the memory manager.
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)
recursive subroutine parse_record_tag(this, iblk, inidt, recursive_call)
This module contains the LoadNCInputModule.
Definition: LoadNCInput.F90:7
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
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:73
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
Input parameter definition. Describes an input parameter.
derived type for boundary package input context
Definition: LoadContext.f90:61
Static parser based input loader.
Definition: LoadMf6File.f90:47
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:36