MODFLOW 6  version 6.7.0.dev2
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)
449  class(loadmf6filetype) :: this
450  integer(I4B), intent(in) :: iblk
451  type(inputparamdefinitiontype), pointer, intent(in) :: idt !< input data type object describing this record
452  ! allocate and load data type
453  select case (idt%datatype)
454  case ('KEYWORD')
455  call load_keyword_type(this%parser, idt, this%mf6_input%mempath, this%iout)
456  ! check/set as dev option
457  if (idt%tagname(1:4) == 'DEV_' .and. &
458  this%mf6_input%block_dfns(iblk)%blockname == 'OPTIONS') then
459  call this%parser%DevOpt()
460  end if
461  case ('STRING')
462  if (idt%shape == 'NAUX') then
463  call load_auxvar_names(this%parser, idt, this%mf6_input%mempath, &
464  this%iout)
465  else
466  call load_string_type(this%parser, idt, this%mf6_input%mempath, this%iout)
467  end if
468  case ('INTEGER')
469  call load_integer_type(this%parser, idt, this%mf6_input%mempath, this%iout)
470  case ('INTEGER1D')
471  call load_integer1d_type(this%parser, idt, this%mf6_input, this%mshape, &
472  this%export, this%nc_vars, this%filename, &
473  this%iout)
474  case ('INTEGER2D')
475  call load_integer2d_type(this%parser, idt, this%mf6_input, this%mshape, &
476  this%export, this%nc_vars, this%filename, &
477  this%iout)
478  case ('INTEGER3D')
479  call load_integer3d_type(this%parser, idt, this%mf6_input, this%mshape, &
480  this%export, this%nc_vars, this%filename, &
481  this%iout)
482  case ('DOUBLE')
483  call load_double_type(this%parser, idt, this%mf6_input%mempath, this%iout)
484  case ('DOUBLE1D')
485  call load_double1d_type(this%parser, idt, this%mf6_input, this%mshape, &
486  this%export, this%nc_vars, this%filename, this%iout)
487  case ('DOUBLE2D')
488  call load_double2d_type(this%parser, idt, this%mf6_input, this%mshape, &
489  this%export, this%nc_vars, this%filename, this%iout)
490  case ('DOUBLE3D')
491  call load_double3d_type(this%parser, idt, this%mf6_input, this%mshape, &
492  this%export, this%nc_vars, this%filename, this%iout)
493  case default
494  write (errmsg, '(a,a)') 'Failure reading data for tag: ', trim(idt%tagname)
495  call store_error(errmsg)
496  call this%parser%StoreErrorUnit()
497  end select
498 
499  call expandarray(this%block_tags)
500  this%block_tags(size(this%block_tags)) = trim(idt%tagname)
501  end subroutine load_tag
502 
503  function block_index_dfn(this, iblk) result(idt)
504  class(loadmf6filetype) :: this
505  integer(I4B), intent(in) :: iblk
506  type(inputparamdefinitiontype) :: idt !< input data type object describing this record
507  character(len=LENVARNAME) :: varname
508  integer(I4B) :: ilen
509  character(len=3) :: block_suffix = 'NUM'
510 
511  ! assign first column as the block number
512  ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
513 
514  if (ilen > (lenvarname - len(block_suffix))) then
515  varname = &
516  this%mf6_input%block_dfns(iblk)% &
517  blockname(1:(lenvarname - len(block_suffix)))//block_suffix
518  else
519  varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
520  end if
521 
522  idt%component_type = trim(this%mf6_input%component_type)
523  idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
524  idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
525  idt%tagname = varname
526  idt%mf6varname = varname
527  idt%datatype = 'INTEGER'
528  end function block_index_dfn
529 
530  !> @brief parse a structured array record into memory manager
531  !!
532  !! A structarray is similar to a numpy recarray. It it used to
533  !! load a list of data in which each column in the list may be a
534  !! different type. Each column in the list is stored as a 1d
535  !! vector.
536  !!
537  !<
538  subroutine parse_structarray_block(this, iblk)
541  class(loadmf6filetype) :: this
542  integer(I4B), intent(in) :: iblk
543  type(loadcontexttype) :: ctx
544  character(len=LINELENGTH), dimension(:), allocatable :: param_names
545  type(inputparamdefinitiontype), pointer :: idt !< input data type object describing this record
546  type(inputparamdefinitiontype), target :: blockvar_idt
547  integer(I4B) :: blocknum
548  integer(I4B), pointer :: nrow
549  integer(I4B) :: nrows, nrowsread
550  integer(I4B) :: ibinary, oc_inunit
551  integer(I4B) :: icol, iparam
552  integer(I4B) :: ncol, nparam
553 
554  ! initialize load context
555  call ctx%init(this%mf6_input, blockname= &
556  this%mf6_input%block_dfns(iblk)%blockname)
557  ! set in scope params for load
558  call ctx%tags(param_names, nparam, this%filename)
559  ! set input definition for this block
560  idt => &
561  get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
562  this%mf6_input%component_type, &
563  this%mf6_input%subcomponent_type, &
564  this%mf6_input%block_dfns(iblk)%blockname)
565  ! if block is reloadable read the block number
566  if (this%mf6_input%block_dfns(iblk)%block_variable) then
567  blocknum = this%parser%GetInteger()
568  else
569  blocknum = 0
570  end if
571 
572  ! set ncol
573  ncol = nparam
574  ! add col if block is reloadable
575  if (blocknum > 0) ncol = ncol + 1
576  ! use shape to set the max num of rows
577  if (idt%shape /= '') then
578  call mem_setptr(nrow, idt%shape, this%mf6_input%mempath)
579  nrows = nrow
580  else
581  nrows = -1
582  end if
583 
584  ! create a structured array
585  this%structarray => constructstructarray(this%mf6_input, ncol, nrows, &
586  blocknum, this%mf6_input%mempath, &
587  this%mf6_input%component_mempath)
588  ! create structarray vectors for each column
589  do icol = 1, ncol
590  ! if block is reloadable, block number is first column
591  if (blocknum > 0) then
592  if (icol == 1) then
593  blockvar_idt = this%block_index_dfn(iblk)
594  idt => blockvar_idt
595  call this%structarray%mem_create_vector(icol, idt)
596  ! continue as this column managed by internally SA object
597  cycle
598  end if
599  ! set indexes (where first column is blocknum)
600  iparam = icol - 1
601  else
602  ! set indexes (no blocknum column)
603  iparam = icol
604  end if
605  ! set pointer to input definition for this 1d vector
606  idt => &
607  get_param_definition_type(this%mf6_input%param_dfns, &
608  this%mf6_input%component_type, &
609  this%mf6_input%subcomponent_type, &
610  this%mf6_input%block_dfns(iblk)%blockname, &
611  param_names(iparam), this%filename)
612  ! allocate variable in memory manager
613  call this%structarray%mem_create_vector(icol, idt)
614  end do
615 
616  ! finish context setup after allocating vectors
617  call ctx%allocate_arrays()
618 
619  ! read the block control record
620  ibinary = read_control_record(this%parser, oc_inunit, this%iout)
621 
622  if (ibinary == 1) then
623  ! read from binary
624  nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
625  call this%parser%terminateblock()
626  close (oc_inunit)
627  else
628  ! read from ascii
629  nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
630  this%iout)
631  end if
632 
633  ! clean up
634  call ctx%destroy()
635  end subroutine parse_structarray_block
636 
637  !> @brief load type keyword
638  !<
639  subroutine load_keyword_type(parser, idt, memoryPath, iout)
640  type(blockparsertype), intent(inout) :: parser !< block parser
641  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
642  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
643  integer(I4B), intent(in) :: iout !< unit number for output
644  integer(I4B), pointer :: intvar
645  call mem_allocate(intvar, idt%mf6varname, memorypath)
646  intvar = 1
647  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
648  end subroutine load_keyword_type
649 
650  !> @brief load type string
651  !<
652  subroutine load_string_type(parser, idt, memoryPath, iout)
653  use constantsmodule, only: lenbigline
654  type(blockparsertype), intent(inout) :: parser !< block parser
655  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
656  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
657  integer(I4B), intent(in) :: iout !< unit number for output
658  character(len=LINELENGTH), pointer :: cstr
659  character(len=LENBIGLINE), pointer :: bigcstr
660  integer(I4B) :: ilen
661  select case (idt%shape)
662  case ('LENBIGLINE')
663  ilen = lenbigline
664  call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
665  call parser%GetString(bigcstr, (.not. idt%preserve_case))
666  call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
667  case default
668  ilen = linelength
669  call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
670  call parser%GetString(cstr, (.not. idt%preserve_case))
671  call idm_log_var(cstr, idt%tagname, memorypath, iout)
672  end select
673  end subroutine load_string_type
674 
675  !> @brief load io tag
676  !<
677  subroutine load_io_tag(parser, idt, memoryPath, which, iout)
681  type(blockparsertype), intent(inout) :: parser !< block parser
682  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
683  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
684  character(len=*), intent(in) :: which
685  integer(I4B), intent(in) :: iout !< unit number for output
686  character(len=LINELENGTH) :: cstr
687  type(characterstringtype), dimension(:), pointer, contiguous :: charstr1d
688  integer(I4B) :: ilen, isize, idx
689  ilen = linelength
690  if (which == 'FILEIN') then
691  call get_isize(idt%mf6varname, memorypath, isize)
692  if (isize < 0) then
693  call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
694  idx = 1
695  else
696  call mem_setptr(charstr1d, idt%mf6varname, memorypath)
697  call mem_reallocate(charstr1d, ilen, isize + 1, idt%mf6varname, &
698  memorypath)
699  idx = isize + 1
700  end if
701  call parser%GetString(cstr, (.not. idt%preserve_case))
702  charstr1d(idx) = cstr
703  else if (which == 'FILEOUT') then
704  call load_string_type(parser, idt, memorypath, iout)
705  end if
706  end subroutine load_io_tag
707 
708  !> @brief load aux variable names
709  !!
710  !<
711  subroutine load_auxvar_names(parser, idt, memoryPath, iout)
713  use inputoutputmodule, only: urdaux
715  type(blockparsertype), intent(inout) :: parser !< block parser
716  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
717  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
718  integer(I4B), intent(in) :: iout !< unit number for output
719  character(len=:), allocatable :: line
720  character(len=LENAUXNAME), dimension(:), allocatable :: caux
721  integer(I4B) :: lloc
722  integer(I4B) :: istart
723  integer(I4B) :: istop
724  integer(I4B) :: i
725  character(len=LENPACKAGENAME) :: text = ''
726  integer(I4B), pointer :: intvar
727  type(characterstringtype), dimension(:), &
728  pointer, contiguous :: acharstr1d !< variable for allocation
729  call mem_allocate(intvar, idt%shape, memorypath)
730  intvar = 0
731  call parser%GetRemainingLine(line)
732  lloc = 1
733  call urdaux(intvar, parser%iuactive, iout, lloc, &
734  istart, istop, caux, line, text)
735  call mem_allocate(acharstr1d, lenauxname, intvar, idt%mf6varname, memorypath)
736  do i = 1, intvar
737  acharstr1d(i) = caux(i)
738  end do
739  deallocate (line)
740  deallocate (caux)
741  end subroutine load_auxvar_names
742 
743  !> @brief load type integer
744  !<
745  subroutine load_integer_type(parser, idt, memoryPath, iout)
746  type(blockparsertype), intent(inout) :: parser !< block parser
747  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
748  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
749  integer(I4B), intent(in) :: iout !< unit number for output
750  integer(I4B), pointer :: intvar
751  call mem_allocate(intvar, idt%mf6varname, memorypath)
752  intvar = parser%GetInteger()
753  call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
754  end subroutine load_integer_type
755 
756  !> @brief load type 1d integer
757  !<
758  subroutine load_integer1d_type(parser, idt, mf6_input, mshape, export, &
759  nc_vars, input_fname, iout)
762  type(blockparsertype), intent(inout) :: parser !< block parser
763  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
764  type(modflowinputtype), intent(in) :: mf6_input !< description of input
765  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
766  logical(LGP), intent(in) :: export !< export to ascii layer files
767  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
768  character(len=*), intent(in) :: input_fname !< ascii input file name
769  integer(I4B), intent(in) :: iout !< unit number for output
770  integer(I4B), dimension(:), pointer, contiguous :: int1d
771  integer(I4B) :: nlay
772  integer(I4B) :: nvals
773  integer(I4B), dimension(:), allocatable :: array_shape
774  integer(I4B), dimension(:), allocatable :: layer_shape
775  character(len=LINELENGTH) :: keyword
776 
777  ! Check if it is a full grid sized array (NODES), otherwise use
778  ! idt%shape to construct shape from variables in memoryPath
779  if (idt%shape == 'NODES') then
780  nvals = product(mshape)
781  else
782  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
783  nvals = array_shape(1)
784  end if
785 
786  ! allocate memory for the array
787  call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
788 
789  ! read keyword
790  keyword = ''
791  call parser%GetStringCaps(keyword)
792 
793  ! check for "NETCDF" and "LAYERED"
794  if (keyword == 'NETCDF') then
795  call netcdf_read_array(int1d, mshape, idt, mf6_input, nc_vars, &
796  input_fname, iout)
797  else if (keyword == 'LAYERED' .and. idt%layered) then
798  call get_layered_shape(mshape, nlay, layer_shape)
799  call read_int1d_layered(parser, int1d, idt%mf6varname, nlay, layer_shape)
800  else
801  call read_int1d(parser, int1d, idt%mf6varname)
802  end if
803 
804  ! log information on the loaded array to the list file
805  call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
806 
807  ! create export file for griddata parameters if optioned
808  if (export) then
809  if (idt%blockname == 'GRIDDATA') then
810  call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
811  end if
812  end if
813  end subroutine load_integer1d_type
814 
815  !> @brief load type 2d integer
816  !<
817  subroutine load_integer2d_type(parser, idt, mf6_input, mshape, export, &
818  nc_vars, input_fname, iout)
821  type(blockparsertype), intent(inout) :: parser !< block parser
822  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
823  type(modflowinputtype), intent(in) :: mf6_input !< description of input
824  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
825  logical(LGP), intent(in) :: export !< export to ascii layer files
826  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
827  character(len=*), intent(in) :: input_fname !< ascii input file name
828  integer(I4B), intent(in) :: iout !< unit number for output
829  integer(I4B), dimension(:, :), pointer, contiguous :: int2d
830  integer(I4B) :: nlay
831  integer(I4B) :: nsize1, nsize2
832  integer(I4B), dimension(:), allocatable :: array_shape
833  integer(I4B), dimension(:), allocatable :: layer_shape
834  character(len=LINELENGTH) :: keyword
835 
836  ! determine the array shape from the input data definition (idt%shape),
837  ! which looks like "NCOL, NROW, NLAY"
838  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
839  nsize1 = array_shape(1)
840  nsize2 = array_shape(2)
841 
842  ! create a new 3d memory managed variable
843  call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
844 
845  ! read keyword
846  keyword = ''
847  call parser%GetStringCaps(keyword)
848 
849  ! check for "NETCDF" and "LAYERED"
850  if (keyword == 'NETCDF') then
851  call netcdf_read_array(int2d, mshape, idt, mf6_input, nc_vars, &
852  input_fname, iout)
853  else if (keyword == 'LAYERED' .and. idt%layered) then
854  call get_layered_shape(mshape, nlay, layer_shape)
855  call read_int2d_layered(parser, int2d, idt%mf6varname, nlay, layer_shape)
856  else
857  call read_int2d(parser, int2d, idt%mf6varname)
858  end if
859 
860  ! log information on the loaded array to the list file
861  call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
862 
863  ! create export file for griddata parameters if optioned
864  if (export) then
865  if (idt%blockname == 'GRIDDATA') then
866  call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
867  end if
868  end if
869  end subroutine load_integer2d_type
870 
871  !> @brief load type 3d integer
872  !<
873  subroutine load_integer3d_type(parser, idt, mf6_input, mshape, export, &
874  nc_vars, input_fname, iout)
877  type(blockparsertype), intent(inout) :: parser !< block parser
878  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
879  type(modflowinputtype), intent(in) :: mf6_input !< description of input
880  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
881  logical(LGP), intent(in) :: export !< export to ascii layer files
882  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
883  character(len=*), intent(in) :: input_fname !< ascii input file name
884  integer(I4B), intent(in) :: iout !< unit number for output
885  integer(I4B), dimension(:, :, :), pointer, contiguous :: int3d
886  integer(I4B) :: nlay
887  integer(I4B) :: nsize1, nsize2, nsize3
888  integer(I4B), dimension(:), allocatable :: array_shape
889  integer(I4B), dimension(:), allocatable :: layer_shape
890  integer(I4B), dimension(:), pointer, contiguous :: int1d_ptr
891  character(len=LINELENGTH) :: keyword
892 
893  ! determine the array shape from the input data definition (idt%shape),
894  ! which looks like "NCOL, NROW, NLAY"
895  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
896  nsize1 = array_shape(1)
897  nsize2 = array_shape(2)
898  nsize3 = array_shape(3)
899 
900  ! create a new 3d memory managed variable
901  call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
902  mf6_input%mempath)
903 
904  ! read keyword
905  keyword = ''
906  call parser%GetStringCaps(keyword)
907 
908  ! check for "NETCDF" and "LAYERED"
909  if (keyword == 'NETCDF') then
910  call netcdf_read_array(int3d, mshape, idt, mf6_input, nc_vars, &
911  input_fname, iout)
912  else if (keyword == 'LAYERED' .and. idt%layered) then
913  call get_layered_shape(mshape, nlay, layer_shape)
914  call read_int3d_layered(parser, int3d, idt%mf6varname, nlay, &
915  layer_shape)
916  else
917  int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
918  call read_int1d(parser, int1d_ptr, idt%mf6varname)
919  end if
920 
921  ! log information on the loaded array to the list file
922  call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
923 
924  ! create export file for griddata parameters if optioned
925  if (export) then
926  if (idt%blockname == 'GRIDDATA') then
927  call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
928  end if
929  end if
930  end subroutine load_integer3d_type
931 
932  !> @brief load type double
933  !<
934  subroutine load_double_type(parser, idt, memoryPath, iout)
935  type(blockparsertype), intent(inout) :: parser !< block parser
936  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
937  character(len=*), intent(in) :: memoryPath !< memorypath to put loaded information
938  integer(I4B), intent(in) :: iout !< unit number for output
939  real(DP), pointer :: dblvar
940  call mem_allocate(dblvar, idt%mf6varname, memorypath)
941  dblvar = parser%GetDouble()
942  call idm_log_var(dblvar, idt%tagname, memorypath, iout)
943  end subroutine load_double_type
944 
945  !> @brief load type 1d double
946  !<
947  subroutine load_double1d_type(parser, idt, mf6_input, mshape, export, &
948  nc_vars, input_fname, iout)
951  type(blockparsertype), intent(inout) :: parser !< block parser
952  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
953  type(modflowinputtype), intent(in) :: mf6_input !< description of input
954  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
955  logical(LGP), intent(in) :: export !< export to ascii layer files
956  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
957  character(len=*), intent(in) :: input_fname !< ascii input file name
958  integer(I4B), intent(in) :: iout !< unit number for output
959  real(DP), dimension(:), pointer, contiguous :: dbl1d
960  integer(I4B) :: nlay
961  integer(I4B) :: nvals
962  integer(I4B), dimension(:), allocatable :: array_shape
963  integer(I4B), dimension(:), allocatable :: layer_shape
964  character(len=LINELENGTH) :: keyword
965 
966  ! Check if it is a full grid sized array (NODES)
967  if (idt%shape == 'NODES') then
968  nvals = product(mshape)
969  else
970  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
971  nvals = array_shape(1)
972  end if
973 
974  ! allocate memory for the array
975  call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
976 
977  ! read keyword
978  keyword = ''
979  call parser%GetStringCaps(keyword)
980 
981  ! check for "NETCDF" and "LAYERED"
982  if (keyword == 'NETCDF') then
983  call netcdf_read_array(dbl1d, mshape, idt, mf6_input, nc_vars, &
984  input_fname, iout)
985  else if (keyword == 'LAYERED' .and. idt%layered) then
986  call get_layered_shape(mshape, nlay, layer_shape)
987  call read_dbl1d_layered(parser, dbl1d, idt%mf6varname, nlay, layer_shape)
988  else
989  call read_dbl1d(parser, dbl1d, idt%mf6varname)
990  end if
991 
992  ! log information on the loaded array to the list file
993  call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
994 
995  ! create export file for griddata parameters if optioned
996  if (export) then
997  if (idt%blockname == 'GRIDDATA') then
998  call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
999  end if
1000  end if
1001  end subroutine load_double1d_type
1002 
1003  !> @brief load type 2d double
1004  !<
1005  subroutine load_double2d_type(parser, idt, mf6_input, mshape, export, &
1006  nc_vars, input_fname, iout)
1009  type(blockparsertype), intent(inout) :: parser !< block parser
1010  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
1011  type(modflowinputtype), intent(in) :: mf6_input !< description of input
1012  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1013  logical(LGP), intent(in) :: export !< export to ascii layer files
1014  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
1015  character(len=*), intent(in) :: input_fname !< ascii input file name
1016  integer(I4B), intent(in) :: iout !< unit number for output
1017  real(DP), dimension(:, :), pointer, contiguous :: dbl2d
1018  integer(I4B) :: nlay
1019  integer(I4B) :: nsize1, nsize2
1020  integer(I4B), dimension(:), allocatable :: array_shape
1021  integer(I4B), dimension(:), allocatable :: layer_shape
1022  character(len=LINELENGTH) :: keyword
1023 
1024  ! determine the array shape from the input data definition (idt%shape),
1025  ! which looks like "NCOL, NROW, NLAY"
1026  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1027  nsize1 = array_shape(1)
1028  nsize2 = array_shape(2)
1029 
1030  ! create a new 3d memory managed variable
1031  call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1032 
1033  ! read keyword
1034  keyword = ''
1035  call parser%GetStringCaps(keyword)
1036 
1037  ! check for "NETCDF" and "LAYERED"
1038  if (keyword == 'NETCDF') then
1039  call netcdf_read_array(dbl2d, mshape, idt, mf6_input, nc_vars, &
1040  input_fname, iout)
1041  else if (keyword == 'LAYERED' .and. idt%layered) then
1042  call get_layered_shape(mshape, nlay, layer_shape)
1043  call read_dbl2d_layered(parser, dbl2d, idt%mf6varname, nlay, layer_shape)
1044  else
1045  call read_dbl2d(parser, dbl2d, idt%mf6varname)
1046  end if
1047 
1048  ! log information on the loaded array to the list file
1049  call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1050 
1051  ! create export file for griddata parameters if optioned
1052  if (export) then
1053  if (idt%blockname == 'GRIDDATA') then
1054  call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1055  end if
1056  end if
1057  end subroutine load_double2d_type
1058 
1059  !> @brief load type 3d double
1060  !<
1061  subroutine load_double3d_type(parser, idt, mf6_input, mshape, export, &
1062  nc_vars, input_fname, iout)
1065  type(blockparsertype), intent(inout) :: parser !< block parser
1066  type(inputparamdefinitiontype), intent(in) :: idt !< input data type object describing this record
1067  type(modflowinputtype), intent(in) :: mf6_input !< description of input
1068  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
1069  logical(LGP), intent(in) :: export !< export to ascii layer files
1070  type(ncpackagevarstype), pointer, intent(in) :: nc_vars
1071  character(len=*), intent(in) :: input_fname !< ascii input file name
1072  integer(I4B), intent(in) :: iout !< unit number for output
1073  real(DP), dimension(:, :, :), pointer, contiguous :: dbl3d
1074  integer(I4B) :: nlay
1075  integer(I4B) :: nsize1, nsize2, nsize3
1076  integer(I4B), dimension(:), allocatable :: array_shape
1077  integer(I4B), dimension(:), allocatable :: layer_shape
1078  real(DP), dimension(:), pointer, contiguous :: dbl1d_ptr
1079  character(len=LINELENGTH) :: keyword
1080 
1081  ! determine the array shape from the input data definition (idt%shape),
1082  ! which looks like "NCOL, NROW, NLAY"
1083  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
1084  nsize1 = array_shape(1)
1085  nsize2 = array_shape(2)
1086  nsize3 = array_shape(3)
1087 
1088  ! create a new 3d memory managed variable
1089  call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1090  mf6_input%mempath)
1091 
1092  ! read keyword
1093  keyword = ''
1094  call parser%GetStringCaps(keyword)
1095 
1096  ! check for "NETCDF" and "LAYERED"
1097  if (keyword == 'NETCDF') then
1098  call netcdf_read_array(dbl3d, mshape, idt, mf6_input, nc_vars, &
1099  input_fname, iout)
1100  else if (keyword == 'LAYERED' .and. idt%layered) then
1101  call get_layered_shape(mshape, nlay, layer_shape)
1102  call read_dbl3d_layered(parser, dbl3d, idt%mf6varname, nlay, &
1103  layer_shape)
1104  else
1105  dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1106  call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1107  end if
1108 
1109  ! log information on the loaded array to the list file
1110  call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1111 
1112  ! create export file for griddata parameters if optioned
1113  if (export) then
1114  if (idt%blockname == 'GRIDDATA') then
1115  call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1116  end if
1117  end if
1118  end subroutine load_double3d_type
1119 
1120  function read_control_record(parser, oc_inunit, iout) result(ibinary)
1121  use simmodule, only: store_error_unit
1122  use inputoutputmodule, only: urword
1123  use inputoutputmodule, only: openfile
1124  use openspecmodule, only: form, access
1125  use constantsmodule, only: linelength
1127  type(blockparsertype), intent(inout) :: parser
1128  integer(I4B), intent(inout) :: oc_inunit
1129  integer(I4B), intent(in) :: iout
1130  integer(I4B) :: ibinary
1131  integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1132  integer(I4B) :: nunopn = 99
1133  character(len=:), allocatable :: line
1134  character(len=LINELENGTH) :: fname
1135  logical(LGP) :: exists
1136  real(dp) :: r
1137  character(len=*), parameter :: fmtocne = &
1138  &"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1139  character(len=*), parameter :: fmtobf = &
1140  &"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1141 
1142  ! initialize oc_inunit and ibinary
1143  oc_inunit = 0
1144  ibinary = 0
1145  inunit = parser%getunit()
1146 
1147  ! Read to the first non-commented line
1148  lloc = 1
1149  call parser%line_reader%rdcom(inunit, iout, line, ierr)
1150  call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1151 
1152  if (line(istart:istop) == 'OPEN/CLOSE') then
1153  ! get filename
1154  call urword(line, lloc, istart, istop, 0, idum, r, &
1155  iout, inunit)
1156  fname = line(istart:istop)
1157  ! check to see if file OPEN/CLOSE file exists
1158  inquire (file=fname, exist=exists)
1159  if (.not. exists) then
1160  write (errmsg, fmtocne) line(istart:istop)
1161  call store_error(errmsg)
1162  call store_error('Specified OPEN/CLOSE file does not exist')
1163  call store_error_unit(inunit)
1164  end if
1165 
1166  ! Check for (BINARY) keyword
1167  call urword(line, lloc, istart, istop, 1, idum, r, &
1168  iout, inunit)
1169 
1170  if (line(istart:istop) == '(BINARY)') ibinary = 1
1171  ! Open the file depending on ibinary flag
1172  if (ibinary == 1) then
1173  oc_inunit = nunopn
1174  itmp = iout
1175  if (iout > 0) then
1176  itmp = 0
1177  write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1178  end if
1179  call openfile(oc_inunit, itmp, fname, 'OPEN/CLOSE', &
1180  fmtarg_opt=form, accarg_opt=access)
1181  end if
1182  end if
1183 
1184  if (ibinary == 0) then
1185  call parser%line_reader%bkspc(parser%getunit())
1186  end if
1187  end function read_control_record
1188 
1189 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_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)
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
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 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
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