56 integer(I4B),
dimension(:),
pointer,
contiguous :: mshape => null()
61 character(len=LINELENGTH) :: filename
62 character(len=LINELENGTH),
dimension(:),
allocatable :: block_tags
63 logical(LGP) :: ts_active
64 logical(LGP) :: export
65 logical(LGP) :: readasarrays
66 logical(LGP) :: readarraygrid
67 integer(I4B) :: inamedbound
68 integer(I4B) :: iauxiliary
97 subroutine load(this, parser, mf6_input, nc_vars, filename, iout)
102 character(len=*),
intent(in) :: filename
103 integer(I4B),
intent(in) :: iout
107 call this%init(parser, mf6_input, filename, iout)
110 this%nc_vars => nc_vars
113 do iblk = 1,
size(this%mf6_input%block_dfns)
115 if (this%mf6_input%block_dfns(iblk)%blockname ==
'PERIOD')
exit
117 call this%load_block(iblk)
129 subroutine init(this, parser, mf6_input, filename, iout)
133 character(len=*),
intent(in) :: filename
134 integer(I4B),
intent(in) :: iout
135 integer(I4B) :: isize
137 this%parser => parser
138 this%mf6_input = mf6_input
139 this%filename = filename
140 this%ts_active = .false.
141 this%export = .false.
142 this%readasarrays = .false.
143 this%readarraygrid = .false.
148 call get_isize(
'MODEL_SHAPE', mf6_input%component_mempath, isize)
150 call mem_setptr(this%mshape,
'MODEL_SHAPE', mf6_input%component_mempath)
154 allocate (this%ts_sas(0))
158 this%mf6_input%subcomponent_name, this%iout)
172 integer(I4B),
intent(in) :: iblk
175 if (
associated(this%structarray))
then
180 allocate (this%block_tags(0))
182 call this%parse_block(iblk, .false.)
184 call this%block_post_process(iblk)
186 deallocate (this%block_tags)
198 if (
associated(this%structarray))
then
204 this%mf6_input%subcomponent_name, this%iout)
213 integer(I4B),
intent(in) :: iblk
215 integer(I4B) :: iparam
216 integer(I4B),
pointer :: intptr
219 do iparam = 1,
size(this%block_tags)
220 select case (this%mf6_input%block_dfns(iblk)%blockname)
222 if (this%block_tags(iparam) ==
'AUXILIARY')
then
224 else if (this%block_tags(iparam) ==
'BOUNDNAMES')
then
226 else if (this%block_tags(iparam) ==
'READASARRAYS')
then
227 this%readasarrays = .true.
228 else if (this%block_tags(iparam) ==
'READARRAYGRID')
then
229 this%readarraygrid = .true.
230 else if (this%block_tags(iparam) ==
'TS6_FILENAME')
then
231 this%ts_active = .true.
232 else if (this%block_tags(iparam) ==
'EXPORT_ARRAY_ASCII')
then
240 select case (this%mf6_input%block_dfns(iblk)%blockname)
243 do iparam = 1,
size(this%mf6_input%param_dfns)
244 idt => this%mf6_input%param_dfns(iparam)
245 if (idt%blockname ==
'OPTIONS' .and. &
246 idt%tagname ==
'AUXILIARY')
then
247 if (this%iauxiliary == 0)
then
248 call mem_allocate(intptr,
'NAUX', this%mf6_input%mempath)
256 if (this%mf6_input%pkgtype(1:3) ==
'DIS')
then
258 this%mf6_input%component_mempath, &
259 this%mf6_input%mempath, this%mshape)
272 integer(I4B),
intent(in) :: iblk
273 logical(LGP),
intent(in) :: recursive_call
274 logical(LGP) :: isblockfound
275 logical(LGP) :: endofblock
276 logical(LGP) :: supportopenclose
278 logical(LGP) :: found, required
280 character(len=LINELENGTH) :: tag
284 if (this%mf6_input%pkgtype ==
'DISU6' .or. &
285 this%mf6_input%pkgtype ==
'DISV1D6' .or. &
286 this%mf6_input%pkgtype ==
'DISV2D6')
then
287 if (this%mf6_input%block_dfns(iblk)%blockname ==
'VERTICES' .or. &
288 this%mf6_input%block_dfns(iblk)%blockname ==
'CELL2D')
then
291 if (.not. found)
return
292 if (mt%intsclr == 0)
return
297 supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /=
'GRIDDATA')
300 required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
301 call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
302 isblockfound, ierr, &
303 supportopenclose=supportopenclose, &
304 blockrequired=required)
306 if (isblockfound)
then
307 if (this%mf6_input%block_dfns(iblk)%aggregate)
then
309 call this%parse_structarray_block(iblk)
313 call this%parser%GetNextLine(endofblock)
316 call this%parser%GetStringCaps(tag)
318 this%mf6_input%param_dfns, &
319 this%mf6_input%component_type, &
320 this%mf6_input%subcomponent_type, &
321 this%mf6_input%block_dfns(iblk)%blockname, &
323 if (idt%in_record)
then
324 call this%parse_record_tag(iblk, idt, .false.)
326 call this%load_tag(iblk, idt)
333 if (this%mf6_input%block_dfns(iblk)%block_variable)
then
334 if (isblockfound)
then
335 call this%parse_block(iblk, .true.)
343 integer(I4B),
intent(in) :: iblk
344 character(len=*),
intent(in) :: pkgtype
345 character(len=*),
intent(in) :: which
346 character(len=*),
intent(in) :: tag
351 this%mf6_input%component_type, &
352 this%mf6_input%subcomponent_type, &
353 this%mf6_input%block_dfns(iblk)%blockname, &
356 call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
358 this%block_tags(
size(this%block_tags)) = trim(idt%tagname)
366 integer(I4B),
intent(in) :: iblk
368 logical(LGP),
intent(in) :: recursive_call
370 character(len=40),
dimension(:),
allocatable :: words
371 integer(I4B) :: n, istart, nwords
372 character(len=LINELENGTH) :: tag
377 if (recursive_call)
then
379 this%mf6_input%component_type, &
380 this%mf6_input%subcomponent_type, &
381 inidt%tagname, nwords, words)
382 call this%load_tag(iblk, inidt)
385 call this%parser%GetStringCaps(tag)
388 this%mf6_input%component_type, &
389 this%mf6_input%subcomponent_type, &
390 inidt%tagname, tag, nwords, words)
391 if (nwords == 4 .and. &
392 (tag ==
'FILEIN' .or. &
393 tag ==
'FILEOUT'))
then
394 call this%parse_io_tag(iblk, words(2), words(3), words(4))
398 this%mf6_input%param_dfns, &
399 this%mf6_input%component_type, &
400 this%mf6_input%subcomponent_type, &
401 this%mf6_input%block_dfns(iblk)%blockname, &
404 if (tag /=
'PRINT_FORMAT')
call this%load_tag(iblk, inidt)
405 call this%load_tag(iblk, idt)
409 call this%load_tag(iblk, inidt)
414 if (istart > 1 .and. nwords == 0)
then
416 '"', trim(this%mf6_input%block_dfns(iblk)%blockname), &
417 '" block input record that includes keyword "', trim(inidt%tagname), &
418 '" is not properly formed.'
420 call this%parser%StoreErrorUnit()
423 do n = istart, nwords
425 this%mf6_input%param_dfns, &
426 this%mf6_input%component_type, &
427 this%mf6_input%subcomponent_type, &
428 this%mf6_input%block_dfns(iblk)%blockname, &
429 words(n), this%filename)
431 call this%parser%GetStringCaps(tag)
433 this%mf6_input%param_dfns, &
434 this%mf6_input%component_type, &
435 this%mf6_input%subcomponent_type, &
436 this%mf6_input%block_dfns(iblk)%blockname, &
438 call this%parse_record_tag(iblk, idt, .true.)
441 if (idt%tagname /=
'FORMAT')
then
442 call this%parser%GetStringCaps(tag)
445 else if (idt%tagname /= tag)
then
446 write (
errmsg,
'(5a)')
'Expecting record input tag "', &
447 trim(idt%tagname),
'" but instead found "', trim(tag),
'".'
449 call this%parser%StoreErrorUnit()
452 call this%load_tag(iblk, idt)
456 if (
allocated(words))
deallocate (words)
466 integer(I4B),
intent(in) :: iblk
468 character(len=LINELENGTH) :: dev_msg
471 if (idt%developmode)
then
472 dev_msg =
'Input tag "'//trim(idt%tagname)// &
473 &
'" read from file "'//trim(this%filename)// &
474 &
'" is still under development. Install the &
475 &nightly build or compile from source with IDEVELOPMODE = 1.'
480 select case (idt%datatype)
484 if (idt%tagname(1:4) ==
'DEV_' .and. &
485 this%mf6_input%block_dfns(iblk)%blockname ==
'OPTIONS')
then
486 call this%parser%DevOpt()
489 if (idt%shape ==
'NAUX')
then
499 this%export, this%nc_vars, this%filename, &
503 this%export, this%nc_vars, this%filename, &
507 this%export, this%nc_vars, this%filename, &
513 this%export, this%nc_vars, this%filename, this%iout)
516 this%export, this%nc_vars, this%filename, this%iout)
519 this%export, this%nc_vars, this%filename, this%iout)
521 write (
errmsg,
'(a,a)')
'Failure reading data for tag: ', trim(idt%tagname)
523 call this%parser%StoreErrorUnit()
527 this%block_tags(
size(this%block_tags)) = trim(idt%tagname)
532 integer(I4B),
intent(in) :: iblk
534 character(len=LENVARNAME) :: varname
536 character(len=3) :: block_suffix =
'NUM'
539 ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
541 if (ilen > (
lenvarname - len(block_suffix)))
then
543 this%mf6_input%block_dfns(iblk)% &
544 blockname(1:(
lenvarname - len(block_suffix)))//block_suffix
546 varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
549 idt%component_type = trim(this%mf6_input%component_type)
550 idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
551 idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
552 idt%tagname = varname
553 idt%mf6varname = varname
554 idt%datatype =
'INTEGER'
569 integer(I4B),
intent(in) :: iblk
571 character(len=LINELENGTH),
dimension(:),
allocatable :: param_names
575 integer(I4B) :: blocknum
576 integer(I4B),
pointer :: nrow
577 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
578 integer(I4B) :: nrows, nrowsread
579 integer(I4B) :: mem_rank, isize
580 integer(I4B) :: ibinary, oc_inunit
581 integer(I4B) :: icol, iparam
582 integer(I4B) :: ncol, nparam
583 logical(LGP) :: shape_found
584 logical(LGP) :: is_sum_shape
585 character(len=LINELENGTH) :: shape_name
586 integer(I4B),
pointer :: pkgdata_maxbound
591 call ctx%init(this%mf6_input, blockname= &
592 this%mf6_input%block_dfns(iblk)%blockname)
594 param_names = ctx%params
595 nparam =
size(ctx%params)
596 call ctx%check_developmode(this%filename)
599 get_aggregate_definition_type(this%mf6_input%aggregate_dfns, &
600 this%mf6_input%component_type, &
601 this%mf6_input%subcomponent_type, &
602 this%mf6_input%block_dfns(iblk)%blockname)
604 if (this%mf6_input%block_dfns(iblk)%block_variable)
then
605 blocknum = this%parser%GetInteger()
613 if (blocknum > 0) ncol = ncol + 1
615 if (idt%shape /=
'')
then
619 is_sum_shape = .false.
620 shape_name = idt%shape
621 if (idt%shape(1:4) ==
'SUM(')
then
622 is_sum_shape = .true.
623 shape_name = idt%shape(5:len_trim(idt%shape) - 1)
626 get_param_definition_type(this%mf6_input%param_dfns, &
627 this%mf6_input%component_type, &
628 this%mf6_input%subcomponent_type, &
629 'DIMENSIONS', shape_name, this%filename, &
631 if (.not. shape_found)
then
634 get_param_definition_type(this%mf6_input%param_dfns, &
635 this%mf6_input%component_type, &
636 this%mf6_input%subcomponent_type, &
637 'PACKAGEDATA', shape_name, this%filename, &
640 if (shape_found)
then
641 call get_isize(shape_idt%mf6varname, this%mf6_input%mempath, isize)
643 if (shape_idt%required)
then
644 write (
errmsg,
'(3a)')
'Required dimension "', &
645 trim(shape_name),
'" not found.'
647 call this%parser%StoreErrorUnit()
653 call get_mem_rank(shape_idt%mf6varname, this%mf6_input%mempath, &
655 if (is_sum_shape .and. mem_rank == 1)
then
656 call mem_setptr(int1d, shape_idt%mf6varname, this%mf6_input%mempath)
659 else if (.not. is_sum_shape .and. mem_rank == 0)
then
661 call mem_setptr(nrow, shape_idt%mf6varname, this%mf6_input%mempath)
664 write (
errmsg,
'(5a)')
'Shape variable "', trim(shape_name), &
665 '" rank does not match its declared shape "', &
666 trim(idt%shape),
'".'
668 call this%parser%StoreErrorUnit()
680 blocknum, this%mf6_input%mempath, &
681 this%mf6_input%component_mempath, &
685 blocknum, this%mf6_input%mempath, &
686 this%mf6_input%component_mempath)
691 if (blocknum > 0)
then
693 blockvar_idt = this%block_index_dfn(iblk)
695 call this%structarray%mem_create_vector(icol, idt)
707 get_param_definition_type(this%mf6_input%param_dfns, &
708 this%mf6_input%component_type, &
709 this%mf6_input%subcomponent_type, &
710 this%mf6_input%block_dfns(iblk)%blockname, &
711 param_names(iparam), this%filename)
713 call this%structarray%mem_create_vector(icol, idt)
717 call ctx%allocate_arrays()
722 if (ibinary == 1)
then
724 nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
725 call this%parser%terminateblock()
729 nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
730 this%iout, this%filename)
734 call this%alloc_tslink(iblk)
737 if (ibinary == 0 .and. this%ts_active)
call this%save_ts_sa()
741 if (this%mf6_input%block_dfns(iblk)%blockname ==
'PACKAGEDATA' .and. &
743 call get_isize(
'MAXBOUND', this%mf6_input%mempath, isize)
745 call mem_allocate(pkgdata_maxbound,
'MAXBOUND', this%mf6_input%mempath)
746 pkgdata_maxbound = nrowsread
759 n =
size(this%ts_sas)
766 integer(I4B),
intent(in) :: n
767 type(structarraytype),
pointer :: sa
768 sa => this%ts_sas(n)%sa
776 character(len=*),
intent(in) :: memoryPath
777 integer(I4B),
intent(in) :: iout
778 integer(I4B),
pointer :: intvar
779 call mem_allocate(intvar, idt%mf6varname, memorypath)
781 call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
790 character(len=*),
intent(in) :: memoryPath
791 integer(I4B),
intent(in) :: iout
792 character(len=LINELENGTH),
pointer :: cstr
793 character(len=LENBIGLINE),
pointer :: bigcstr
795 select case (idt%shape)
798 call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
799 call parser%GetString(bigcstr, (.not. idt%preserve_case))
800 call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
803 call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
804 call parser%GetString(cstr, (.not. idt%preserve_case))
805 call idm_log_var(cstr, idt%tagname, memorypath, iout)
816 character(len=*),
intent(in) :: memoryPath
817 character(len=*),
intent(in) :: which
818 integer(I4B),
intent(in) :: iout
819 character(len=LINELENGTH) :: cstr
821 integer(I4B) :: ilen, isize, idx
823 if (which ==
'FILEIN')
then
824 call get_isize(idt%mf6varname, memorypath, isize)
826 call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
829 call mem_setptr(charstr1d, idt%mf6varname, memorypath)
834 call parser%GetString(cstr, (.not. idt%preserve_case))
835 charstr1d(idx) = cstr
836 else if (which ==
'FILEOUT')
then
850 character(len=*),
intent(in) :: memoryPath
851 integer(I4B),
intent(in) :: iout
852 character(len=:),
allocatable :: line
853 character(len=LENAUXNAME),
dimension(:),
allocatable :: caux
855 integer(I4B) :: istart
856 integer(I4B) :: istop
858 character(len=LENPACKAGENAME) :: text =
''
859 integer(I4B),
pointer :: intvar
861 pointer,
contiguous :: acharstr1d
862 call mem_allocate(intvar, idt%shape, memorypath)
864 call parser%GetRemainingLine(line)
866 call urdaux(intvar, parser%iuactive, iout, lloc, &
867 istart, istop, caux, line, text)
868 call mem_allocate(acharstr1d,
lenauxname, intvar, idt%mf6varname, memorypath)
870 acharstr1d(i) = caux(i)
881 character(len=*),
intent(in) :: memoryPath
882 integer(I4B),
intent(in) :: iout
883 integer(I4B),
pointer :: intvar
884 call mem_allocate(intvar, idt%mf6varname, memorypath)
885 intvar = parser%GetInteger()
886 call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
892 nc_vars, input_fname, iout)
898 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
899 logical(LGP),
intent(in) :: export
901 character(len=*),
intent(in) :: input_fname
902 integer(I4B),
intent(in) :: iout
903 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
905 integer(I4B) :: nvals
906 integer(I4B),
dimension(:),
allocatable :: array_shape
907 integer(I4B),
dimension(:),
allocatable :: layer_shape
908 character(len=LINELENGTH) :: keyword
912 if (idt%shape ==
'NODES')
then
913 nvals = product(mshape)
916 nvals = array_shape(1)
920 call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
924 call parser%GetStringCaps(keyword)
927 if (keyword ==
'NETCDF')
then
930 else if (keyword ==
'LAYERED' .and. idt%layered)
then
934 call read_int1d(parser, int1d, idt%mf6varname)
938 call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
942 if (idt%blockname ==
'GRIDDATA')
then
943 call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
951 nc_vars, input_fname, iout)
957 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
958 logical(LGP),
intent(in) :: export
960 character(len=*),
intent(in) :: input_fname
961 integer(I4B),
intent(in) :: iout
962 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
964 integer(I4B) :: nsize1, nsize2
965 integer(I4B),
dimension(:),
allocatable :: array_shape
966 integer(I4B),
dimension(:),
allocatable :: layer_shape
967 character(len=LINELENGTH) :: keyword
972 nsize1 = array_shape(1)
973 nsize2 = array_shape(2)
976 call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
980 call parser%GetStringCaps(keyword)
983 if (keyword ==
'NETCDF')
then
986 else if (keyword ==
'LAYERED' .and. idt%layered)
then
990 call read_int2d(parser, int2d, idt%mf6varname)
994 call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
998 if (idt%blockname ==
'GRIDDATA')
then
999 call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1007 nc_vars, input_fname, iout)
1013 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1014 logical(LGP),
intent(in) :: export
1016 character(len=*),
intent(in) :: input_fname
1017 integer(I4B),
intent(in) :: iout
1018 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
1019 integer(I4B) :: nlay
1020 integer(I4B) :: nsize1, nsize2, nsize3
1021 integer(I4B),
dimension(:),
allocatable :: array_shape
1022 integer(I4B),
dimension(:),
allocatable :: layer_shape
1023 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d_ptr
1024 character(len=LINELENGTH) :: keyword
1029 nsize1 = array_shape(1)
1030 nsize2 = array_shape(2)
1031 nsize3 = array_shape(3)
1034 call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1039 call parser%GetStringCaps(keyword)
1042 if (keyword ==
'NETCDF')
then
1045 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1050 int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
1051 call read_int1d(parser, int1d_ptr, idt%mf6varname)
1055 call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
1059 if (idt%blockname ==
'GRIDDATA')
then
1060 call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1070 character(len=*),
intent(in) :: memoryPath
1071 integer(I4B),
intent(in) :: iout
1072 real(DP),
pointer :: dblvar
1073 call mem_allocate(dblvar, idt%mf6varname, memorypath)
1074 dblvar = parser%GetDouble()
1075 call idm_log_var(dblvar, idt%tagname, memorypath, iout)
1081 nc_vars, input_fname, iout)
1087 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1088 logical(LGP),
intent(in) :: export
1090 character(len=*),
intent(in) :: input_fname
1091 integer(I4B),
intent(in) :: iout
1092 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1093 integer(I4B) :: nlay
1094 integer(I4B) :: nvals
1095 integer(I4B),
dimension(:),
allocatable :: array_shape
1096 integer(I4B),
dimension(:),
allocatable :: layer_shape
1097 character(len=LINELENGTH) :: keyword
1100 if (idt%shape ==
'NODES')
then
1101 nvals = product(mshape)
1104 nvals = array_shape(1)
1108 call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
1112 call parser%GetStringCaps(keyword)
1115 if (keyword ==
'NETCDF')
then
1118 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1122 call read_dbl1d(parser, dbl1d, idt%mf6varname)
1126 call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
1130 if (idt%blockname ==
'GRIDDATA')
then
1131 call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1139 nc_vars, input_fname, iout)
1145 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1146 logical(LGP),
intent(in) :: export
1148 character(len=*),
intent(in) :: input_fname
1149 integer(I4B),
intent(in) :: iout
1150 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
1151 integer(I4B) :: nlay
1152 integer(I4B) :: nsize1, nsize2
1153 integer(I4B),
dimension(:),
allocatable :: array_shape
1154 integer(I4B),
dimension(:),
allocatable :: layer_shape
1155 character(len=LINELENGTH) :: keyword
1160 nsize1 = array_shape(1)
1161 nsize2 = array_shape(2)
1164 call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1168 call parser%GetStringCaps(keyword)
1171 if (keyword ==
'NETCDF')
then
1174 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1178 call read_dbl2d(parser, dbl2d, idt%mf6varname)
1182 call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1186 if (idt%blockname ==
'GRIDDATA')
then
1187 call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1195 nc_vars, input_fname, iout)
1201 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1202 logical(LGP),
intent(in) :: export
1204 character(len=*),
intent(in) :: input_fname
1205 integer(I4B),
intent(in) :: iout
1206 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
1207 integer(I4B) :: nlay
1208 integer(I4B) :: nsize1, nsize2, nsize3
1209 integer(I4B),
dimension(:),
allocatable :: array_shape
1210 integer(I4B),
dimension(:),
allocatable :: layer_shape
1211 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d_ptr
1212 character(len=LINELENGTH) :: keyword
1217 nsize1 = array_shape(1)
1218 nsize2 = array_shape(2)
1219 nsize3 = array_shape(3)
1222 call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1227 call parser%GetStringCaps(keyword)
1230 if (keyword ==
'NETCDF')
then
1233 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1238 dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1239 call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1243 call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1247 if (idt%blockname ==
'GRIDDATA')
then
1248 call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1261 integer(I4B),
intent(inout) :: oc_inunit
1262 integer(I4B),
intent(in) ::
iout
1263 integer(I4B) :: ibinary
1264 integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1265 integer(I4B) :: nunopn = 99
1266 character(len=:),
allocatable :: line
1267 character(len=LINELENGTH) :: fname
1268 logical(LGP) :: exists
1270 character(len=*),
parameter :: fmtocne = &
1271 &
"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1272 character(len=*),
parameter :: fmtobf = &
1273 &
"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1278 inunit = parser%getunit()
1282 call parser%line_reader%rdcom(inunit,
iout, line, ierr)
1283 call urword(line, lloc, istart, istop, 1, idum, r,
iout, inunit)
1285 if (line(istart:istop) ==
'OPEN/CLOSE')
then
1287 call urword(line, lloc, istart, istop, 0, idum, r, &
1289 fname = line(istart:istop)
1291 inquire (file=fname, exist=exists)
1292 if (.not. exists)
then
1293 write (
errmsg, fmtocne) line(istart:istop)
1295 call store_error(
'Specified OPEN/CLOSE file does not exist')
1300 call urword(line, lloc, istart, istop, 1, idum, r, &
1303 if (line(istart:istop) ==
'(BINARY)') ibinary = 1
1305 if (ibinary == 1)
then
1310 write (
iout, fmtobf) oc_inunit, trim(adjustl(fname))
1312 call openfile(oc_inunit, itmp, fname,
'OPEN/CLOSE', &
1317 if (ibinary == 0)
then
1318 call parser%line_reader%bkspc(parser%getunit())
1331 logical(LGP) :: has_ts
1332 integer(I4B) :: m, n
1336 do m = 1, this%structarray%count()
1337 svect => this%structarray%get(m)
1338 if (svect%idt%timeseries .and. svect%ts_strlocs%count() > 0)
then
1345 n =
size(this%ts_sas)
1346 allocate (tmp(n + 1))
1347 tmp(1:n) = this%ts_sas
1348 tmp(n + 1)%sa => this%structarray
1349 call move_alloc(tmp, this%ts_sas)
1351 nullify (this%structarray)
1368 integer(I4B),
intent(in) :: iblk
1371 integer(I4B),
dimension(:, :),
pointer,
contiguous :: tslink
1373 integer(I4B),
dimension(:),
allocatable :: icols
1374 character(len=LINELENGTH) :: blockname
1375 character(len=2) :: id
1376 integer(I4B) :: m, n, ncol, nrow
1380 do m = 1, this%structarray%count()
1381 svect => this%structarray%get(m)
1382 if (svect%idt%timeseries .and. svect%memtype ==
mtype_dbl)
then
1387 if (ncol == 0)
return
1390 blockname = this%mf6_input%block_dfns(iblk)%blockname
1393 write (
errmsg,
'(a)')
'Time series link identifier not defined for &
1394 &block "'//trim(blockname)//
'".'
1396 call this%parser%StoreErrorUnit()
1401 svect => this%structarray%get(icols(1))
1402 nrow =
size(svect%dbl1d)
1403 call mem_allocate(tslink, ncol, nrow,
'TSLINK_'//id, this%mf6_input%mempath)
1404 call mem_allocate(tslinkvars, lenvarname, ncol,
'TSLINKVARS_'//id, &
1405 this%mf6_input%mempath)
1410 svect => this%structarray%get(icols(m))
1411 tslinkvars(m) = svect%idt%mf6varname
1412 do n = 1, svect%ts_strlocs%count()
1413 ts_strloc => svect%get_ts_strloc(n)
1414 tslink(m, ts_strloc%row) = 1
1427 do n = 1,
size(this%ts_sas)
1428 if (
associated(this%ts_sas(n)%sa))
then
1430 nullify (this%ts_sas(n)%sa)
1433 deallocate (this%ts_sas)
This module contains block parser methods.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenpackagename
maximum length of the package name
integer(i4b), parameter lenbigline
maximum length of a big line
integer(i4b), parameter lenvarname
maximum length of a variable name
integer(i4b), parameter lenauxname
maximum length of a aux variable
This module contains the DefinitionSelectModule.
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
type(inputparamdefinitiontype) function, pointer, public get_param_definition_type(input_definition_types, component_type, subcomponent_type, blockname, tagname, filename, found)
Return parameter definition.
subroutine, public read_dbl1d(parser, dbl1d, aname)
subroutine, public read_dbl2d(parser, dbl2d, aname)
Disable development features in release mode.
subroutine, public developmode(errmsg, iunit)
Terminate if in release mode (guard development features).
This module contains the Input Data Model Logger Module.
subroutine, public idm_log_close(component, subcomponent, iout)
log the closing message
subroutine, public idm_log_header(component, subcomponent, iout)
log a header message
subroutine, public read_int1d(parser, int1d, aname)
subroutine, public read_int1d_layered(parser, int1d, aname, nlay, layer_shape)
subroutine, public read_int2d(parser, int2d, aname)
This module defines variable data types.
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)
Load context for IDM generic dynamic loaders.
character(len=2) function, public tslink_id(blockname)
time series link identifier for a static block
logical(lgp) function, public is_feature_keystring(mf6_input)
.true. if mf6_input's PERIOD block is feature-addressed (see is_feature_tag). Block-independent,...
This module contains the LoadMf6FileModule.
subroutine cleanup(this)
Clean up saved static structarrays.
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_auxvar_names(parser, idt, memorypath, iout)
load aux variable names
subroutine load_double3d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 3d double
subroutine load_keyword_type(parser, idt, memorypath, iout)
load type keyword
type(structarraytype) function, pointer get_ts_sa(this, n)
Return the n-th saved static StructArray pointer.
subroutine load_io_tag(parser, idt, memorypath, which, iout)
load io tag
subroutine alloc_tslink(this, iblk)
Allocate time series link flags for a static block.
subroutine init(this, parser, mf6_input, filename, iout)
init
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 save_ts_sa(this)
Save structarray pointer for deferred TS linking.
subroutine load_double2d_type(parser, idt, mf6_input, mshape, export, nc_vars, input_fname, iout)
load type 2d double
recursive subroutine parse_block(this, iblk, recursive_call)
parse block
subroutine load_string_type(parser, idt, memorypath, iout)
load type string
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.
integer(i4b) function ts_sa_count(this)
Return number of saved static StructArrays with deferred TS strlocs.
subroutine load_integer_type(parser, idt, memorypath, iout)
load type integer
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_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
subroutine load_double_type(parser, idt, memorypath, iout)
load type double
integer(i4b) function, public read_control_record(parser, oc_inunit, iout)
recursive subroutine parse_record_tag(this, iblk, inidt, recursive_call)
subroutine, public get_from_memorystore(name, mem_path, mt, found, check)
Get a memory type entry from the memory list.
subroutine, public get_isize(name, mem_path, isize)
Get the number of elements for this variable.
subroutine, public get_mem_rank(name, mem_path, rank)
Get the variable rank.
This module contains the NCFileVarsModule.
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b) iout
file unit number for simulation output
This module contains the SourceCommonModule.
subroutine, public get_layered_shape(mshape, nlay, layer_shape)
subroutine, public set_model_shape(ftype, fname, model_mempath, dis_mempath, model_shape)
routine for setting the model shape
subroutine, public get_shape_from_string(shape_string, array_shape, memorypath)
This module contains the StructArrayModule.
subroutine, public destructstructarray(struct_array)
destructor for a struct_array
type(structarraytype) function, pointer, public constructstructarray(mf6_input, ncol, nrow, blocknum, mempath, component_mempath, size_init)
constructor for a struct_array
This module contains the StructVectorModule.
This class is used to store a single deferred-length character string. It was designed to work in an ...
Input load context for generic dynamic loaders and StructArray based static loads....
Static parser based input loader.
Fortran workaround for allocatable arrays of pointers; wraps a StructArray pointer for deferred TS li...
Type describing input variables for a package in NetCDF file.
type for structured array
derived type for generic vector
derived type which describes time series string field