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
96 subroutine load(this, parser, mf6_input, nc_vars, filename, iout)
101 character(len=*),
intent(in) :: filename
102 integer(I4B),
intent(in) :: iout
106 call this%init(parser, mf6_input, filename, iout)
109 this%nc_vars => nc_vars
112 do iblk = 1,
size(this%mf6_input%block_dfns)
114 if (this%mf6_input%block_dfns(iblk)%blockname ==
'PERIOD')
exit
116 call this%load_block(iblk)
128 subroutine init(this, parser, mf6_input, filename, iout)
132 character(len=*),
intent(in) :: filename
133 integer(I4B),
intent(in) :: iout
134 integer(I4B) :: isize
136 this%parser => parser
137 this%mf6_input = mf6_input
138 this%filename = filename
139 this%ts_active = .false.
140 this%export = .false.
141 this%readasarrays = .false.
142 this%readarraygrid = .false.
147 call get_isize(
'MODEL_SHAPE', mf6_input%component_mempath, isize)
149 call mem_setptr(this%mshape,
'MODEL_SHAPE', mf6_input%component_mempath)
153 allocate (this%ts_sas(0))
157 this%mf6_input%subcomponent_name, this%iout)
171 integer(I4B),
intent(in) :: iblk
174 if (
associated(this%structarray))
then
179 allocate (this%block_tags(0))
181 call this%parse_block(iblk, .false.)
183 call this%block_post_process(iblk)
185 deallocate (this%block_tags)
197 if (
associated(this%structarray))
then
203 this%mf6_input%subcomponent_name, this%iout)
212 integer(I4B),
intent(in) :: iblk
214 integer(I4B) :: iparam
215 integer(I4B),
pointer :: intptr
218 do iparam = 1,
size(this%block_tags)
219 select case (this%mf6_input%block_dfns(iblk)%blockname)
221 if (this%block_tags(iparam) ==
'AUXILIARY')
then
223 else if (this%block_tags(iparam) ==
'BOUNDNAMES')
then
225 else if (this%block_tags(iparam) ==
'READASARRAYS')
then
226 this%readasarrays = .true.
227 else if (this%block_tags(iparam) ==
'READARRAYGRID')
then
228 this%readarraygrid = .true.
229 else if (this%block_tags(iparam) ==
'TS6_FILENAME')
then
230 this%ts_active = .true.
231 else if (this%block_tags(iparam) ==
'EXPORT_ARRAY_ASCII')
then
239 select case (this%mf6_input%block_dfns(iblk)%blockname)
242 do iparam = 1,
size(this%mf6_input%param_dfns)
243 idt => this%mf6_input%param_dfns(iparam)
244 if (idt%blockname ==
'OPTIONS' .and. &
245 idt%tagname ==
'AUXILIARY')
then
246 if (this%iauxiliary == 0)
then
247 call mem_allocate(intptr,
'NAUX', this%mf6_input%mempath)
255 if (this%mf6_input%pkgtype(1:3) ==
'DIS')
then
257 this%mf6_input%component_mempath, &
258 this%mf6_input%mempath, this%mshape)
271 integer(I4B),
intent(in) :: iblk
272 logical(LGP),
intent(in) :: recursive_call
273 logical(LGP) :: isblockfound
274 logical(LGP) :: endofblock
275 logical(LGP) :: supportopenclose
277 logical(LGP) :: found, required
279 character(len=LINELENGTH) :: tag
283 if (this%mf6_input%pkgtype ==
'DISU6' .or. &
284 this%mf6_input%pkgtype ==
'DISV1D6' .or. &
285 this%mf6_input%pkgtype ==
'DISV2D6')
then
286 if (this%mf6_input%block_dfns(iblk)%blockname ==
'VERTICES' .or. &
287 this%mf6_input%block_dfns(iblk)%blockname ==
'CELL2D')
then
290 if (.not. found)
return
291 if (mt%intsclr == 0)
return
296 supportopenclose = (this%mf6_input%block_dfns(iblk)%blockname /=
'GRIDDATA')
299 required = this%mf6_input%block_dfns(iblk)%required .and. .not. recursive_call
300 call this%parser%GetBlock(this%mf6_input%block_dfns(iblk)%blockname, &
301 isblockfound, ierr, &
302 supportopenclose=supportopenclose, &
303 blockrequired=required)
305 if (isblockfound)
then
306 if (this%mf6_input%block_dfns(iblk)%aggregate)
then
308 call this%parse_structarray_block(iblk)
312 call this%parser%GetNextLine(endofblock)
315 call this%parser%GetStringCaps(tag)
317 this%mf6_input%param_dfns, &
318 this%mf6_input%component_type, &
319 this%mf6_input%subcomponent_type, &
320 this%mf6_input%block_dfns(iblk)%blockname, &
322 if (idt%in_record)
then
323 call this%parse_record_tag(iblk, idt, .false.)
325 call this%load_tag(iblk, idt)
332 if (this%mf6_input%block_dfns(iblk)%block_variable)
then
333 if (isblockfound)
then
334 call this%parse_block(iblk, .true.)
342 integer(I4B),
intent(in) :: iblk
343 character(len=*),
intent(in) :: pkgtype
344 character(len=*),
intent(in) :: which
345 character(len=*),
intent(in) :: tag
350 this%mf6_input%component_type, &
351 this%mf6_input%subcomponent_type, &
352 this%mf6_input%block_dfns(iblk)%blockname, &
355 call load_io_tag(this%parser, idt, this%mf6_input%mempath, which, this%iout)
357 this%block_tags(
size(this%block_tags)) = trim(idt%tagname)
365 integer(I4B),
intent(in) :: iblk
367 logical(LGP),
intent(in) :: recursive_call
369 character(len=40),
dimension(:),
allocatable :: words
370 integer(I4B) :: n, istart, nwords
371 character(len=LINELENGTH) :: tag
376 if (recursive_call)
then
378 this%mf6_input%component_type, &
379 this%mf6_input%subcomponent_type, &
380 inidt%tagname, nwords, words)
381 call this%load_tag(iblk, inidt)
384 call this%parser%GetStringCaps(tag)
387 this%mf6_input%component_type, &
388 this%mf6_input%subcomponent_type, &
389 inidt%tagname, tag, nwords, words)
390 if (nwords == 4 .and. &
391 (tag ==
'FILEIN' .or. &
392 tag ==
'FILEOUT'))
then
393 call this%parse_io_tag(iblk, words(2), words(3), words(4))
396 idt => get_param_definition_type( &
397 this%mf6_input%param_dfns, &
398 this%mf6_input%component_type, &
399 this%mf6_input%subcomponent_type, &
400 this%mf6_input%block_dfns(iblk)%blockname, &
403 if (tag /=
'PRINT_FORMAT')
call this%load_tag(iblk, inidt)
404 call this%load_tag(iblk, idt)
408 call this%load_tag(iblk, inidt)
413 if (istart > 1 .and. nwords == 0)
then
415 '"', trim(this%mf6_input%block_dfns(iblk)%blockname), &
416 '" block input record that includes keyword "', trim(inidt%tagname), &
417 '" is not properly formed.'
419 call this%parser%StoreErrorUnit()
422 do n = istart, nwords
423 idt => get_param_definition_type( &
424 this%mf6_input%param_dfns, &
425 this%mf6_input%component_type, &
426 this%mf6_input%subcomponent_type, &
427 this%mf6_input%block_dfns(iblk)%blockname, &
428 words(n), this%filename)
430 call this%parser%GetStringCaps(tag)
431 idt => get_param_definition_type( &
432 this%mf6_input%param_dfns, &
433 this%mf6_input%component_type, &
434 this%mf6_input%subcomponent_type, &
435 this%mf6_input%block_dfns(iblk)%blockname, &
437 call this%parse_record_tag(iblk, idt, .true.)
440 if (idt%tagname /=
'FORMAT')
then
441 call this%parser%GetStringCaps(tag)
444 else if (idt%tagname /= tag)
then
445 write (
errmsg,
'(5a)')
'Expecting record input tag "', &
446 trim(idt%tagname),
'" but instead found "', trim(tag),
'".'
448 call this%parser%StoreErrorUnit()
451 call this%load_tag(iblk, idt)
455 if (
allocated(words))
deallocate (words)
465 integer(I4B),
intent(in) :: iblk
467 character(len=LINELENGTH) :: dev_msg
470 if (idt%developmode)
then
471 dev_msg =
'Input tag "'//trim(idt%tagname)// &
472 &
'" read from file "'//trim(this%filename)// &
473 &
'" is still under development. Install the &
474 &nightly build or compile from source with IDEVELOPMODE = 1.'
479 select case (idt%datatype)
483 if (idt%tagname(1:4) ==
'DEV_' .and. &
484 this%mf6_input%block_dfns(iblk)%blockname ==
'OPTIONS')
then
485 call this%parser%DevOpt()
488 if (idt%shape ==
'NAUX')
then
498 this%export, this%nc_vars, this%filename, &
502 this%export, this%nc_vars, this%filename, &
506 this%export, this%nc_vars, this%filename, &
512 this%export, this%nc_vars, this%filename, this%iout)
515 this%export, this%nc_vars, this%filename, this%iout)
518 this%export, this%nc_vars, this%filename, this%iout)
520 write (
errmsg,
'(a,a)')
'Failure reading data for tag: ', trim(idt%tagname)
522 call this%parser%StoreErrorUnit()
526 this%block_tags(
size(this%block_tags)) = trim(idt%tagname)
531 integer(I4B),
intent(in) :: iblk
533 character(len=LENVARNAME) :: varname
535 character(len=3) :: block_suffix =
'NUM'
538 ilen = len_trim(this%mf6_input%block_dfns(iblk)%blockname)
540 if (ilen > (
lenvarname - len(block_suffix)))
then
542 this%mf6_input%block_dfns(iblk)% &
543 blockname(1:(
lenvarname - len(block_suffix)))//block_suffix
545 varname = trim(this%mf6_input%block_dfns(iblk)%blockname)//block_suffix
548 idt%component_type = trim(this%mf6_input%component_type)
549 idt%subcomponent_type = trim(this%mf6_input%subcomponent_type)
550 idt%blockname = trim(this%mf6_input%block_dfns(iblk)%blockname)
551 idt%tagname = varname
552 idt%mf6varname = varname
553 idt%datatype =
'INTEGER'
568 integer(I4B),
intent(in) :: iblk
570 character(len=LINELENGTH),
dimension(:),
allocatable :: param_names
574 integer(I4B) :: blocknum
575 integer(I4B),
pointer :: nrow
576 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
577 integer(I4B) :: nrows, nrowsread
578 integer(I4B) :: mem_rank, isize
579 integer(I4B) :: ibinary, oc_inunit
580 integer(I4B) :: icol, iparam
581 integer(I4B) :: ncol, nparam
582 logical(LGP) :: shape_found
583 logical(LGP) :: is_sum_shape
584 character(len=LINELENGTH) :: shape_name
585 integer(I4B),
pointer :: pkgdata_maxbound
590 call ctx%init(this%mf6_input, blockname= &
591 this%mf6_input%block_dfns(iblk)%blockname)
593 param_names = ctx%params
594 nparam =
size(ctx%params)
595 call ctx%check_developmode(this%filename)
599 this%mf6_input%component_type, &
600 this%mf6_input%subcomponent_type, &
601 this%mf6_input%block_dfns(iblk)%blockname)
603 if (this%mf6_input%block_dfns(iblk)%block_variable)
then
604 blocknum = this%parser%GetInteger()
612 if (blocknum > 0) ncol = ncol + 1
614 if (idt%shape /=
'')
then
618 is_sum_shape = .false.
619 shape_name = idt%shape
620 if (idt%shape(1:4) ==
'SUM(')
then
621 is_sum_shape = .true.
622 shape_name = idt%shape(5:len_trim(idt%shape) - 1)
626 this%mf6_input%component_type, &
627 this%mf6_input%subcomponent_type, &
628 'DIMENSIONS', shape_name, this%filename, &
630 if (.not. shape_found)
then
634 this%mf6_input%component_type, &
635 this%mf6_input%subcomponent_type, &
636 'PACKAGEDATA', shape_name, this%filename, &
639 if (shape_found)
then
640 call get_isize(shape_idt%mf6varname, this%mf6_input%mempath, isize)
642 if (shape_idt%required)
then
643 write (
errmsg,
'(3a)')
'Required dimension "', &
644 trim(shape_name),
'" not found.'
646 call this%parser%StoreErrorUnit()
652 call get_mem_rank(shape_idt%mf6varname, this%mf6_input%mempath, &
654 if (is_sum_shape .and. mem_rank == 1)
then
655 call mem_setptr(int1d, shape_idt%mf6varname, this%mf6_input%mempath)
658 else if (.not. is_sum_shape .and. mem_rank == 0)
then
660 call mem_setptr(nrow, shape_idt%mf6varname, this%mf6_input%mempath)
663 write (
errmsg,
'(5a)')
'Shape variable "', trim(shape_name), &
664 '" rank does not match its declared shape "', &
665 trim(idt%shape),
'".'
667 call this%parser%StoreErrorUnit()
679 blocknum, this%mf6_input%mempath, &
680 this%mf6_input%component_mempath, &
684 blocknum, this%mf6_input%mempath, &
685 this%mf6_input%component_mempath)
690 if (blocknum > 0)
then
692 blockvar_idt = this%block_index_dfn(iblk)
694 call this%structarray%mem_create_vector(icol, idt)
707 this%mf6_input%component_type, &
708 this%mf6_input%subcomponent_type, &
709 this%mf6_input%block_dfns(iblk)%blockname, &
710 param_names(iparam), this%filename)
712 call this%structarray%mem_create_vector(icol, idt)
716 call ctx%allocate_arrays()
721 if (ibinary == 1)
then
723 nrowsread = this%structarray%read_from_binary(oc_inunit, this%iout)
724 call this%parser%terminateblock()
728 nrowsread = this%structarray%read_from_parser(this%parser, this%ts_active, &
729 this%iout, this%filename)
731 if (this%ts_active)
call this%save_ts_sa()
736 if (this%mf6_input%block_dfns(iblk)%blockname ==
'PACKAGEDATA' .and. &
738 call get_isize(
'MAXBOUND', this%mf6_input%mempath, isize)
740 call mem_allocate(pkgdata_maxbound,
'MAXBOUND', this%mf6_input%mempath)
741 pkgdata_maxbound = nrowsread
754 n =
size(this%ts_sas)
761 integer(I4B),
intent(in) :: n
763 sa => this%ts_sas(n)%sa
771 character(len=*),
intent(in) :: memoryPath
772 integer(I4B),
intent(in) :: iout
773 integer(I4B),
pointer :: intvar
776 call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
785 character(len=*),
intent(in) :: memoryPath
786 integer(I4B),
intent(in) :: iout
787 character(len=LINELENGTH),
pointer :: cstr
788 character(len=LENBIGLINE),
pointer :: bigcstr
790 select case (idt%shape)
793 call mem_allocate(bigcstr, ilen, idt%mf6varname, memorypath)
794 call parser%GetString(bigcstr, (.not. idt%preserve_case))
795 call idm_log_var(bigcstr, idt%tagname, memorypath, iout)
798 call mem_allocate(cstr, ilen, idt%mf6varname, memorypath)
799 call parser%GetString(cstr, (.not. idt%preserve_case))
800 call idm_log_var(cstr, idt%tagname, memorypath, iout)
811 character(len=*),
intent(in) :: memoryPath
812 character(len=*),
intent(in) :: which
813 integer(I4B),
intent(in) :: iout
814 character(len=LINELENGTH) :: cstr
816 integer(I4B) :: ilen, isize, idx
818 if (which ==
'FILEIN')
then
819 call get_isize(idt%mf6varname, memorypath, isize)
821 call mem_allocate(charstr1d, ilen, 1, idt%mf6varname, memorypath)
824 call mem_setptr(charstr1d, idt%mf6varname, memorypath)
829 call parser%GetString(cstr, (.not. idt%preserve_case))
830 charstr1d(idx) = cstr
831 else if (which ==
'FILEOUT')
then
845 character(len=*),
intent(in) :: memoryPath
846 integer(I4B),
intent(in) :: iout
847 character(len=:),
allocatable :: line
848 character(len=LENAUXNAME),
dimension(:),
allocatable :: caux
850 integer(I4B) :: istart
851 integer(I4B) :: istop
853 character(len=LENPACKAGENAME) :: text =
''
854 integer(I4B),
pointer :: intvar
856 pointer,
contiguous :: acharstr1d
859 call parser%GetRemainingLine(line)
861 call urdaux(intvar, parser%iuactive, iout, lloc, &
862 istart, istop, caux, line, text)
865 acharstr1d(i) = caux(i)
876 character(len=*),
intent(in) :: memoryPath
877 integer(I4B),
intent(in) :: iout
878 integer(I4B),
pointer :: intvar
880 intvar = parser%GetInteger()
881 call idm_log_var(intvar, idt%tagname, memorypath, idt%datatype, iout)
887 nc_vars, input_fname, iout)
893 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
894 logical(LGP),
intent(in) :: export
896 character(len=*),
intent(in) :: input_fname
897 integer(I4B),
intent(in) :: iout
898 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d
900 integer(I4B) :: nvals
901 integer(I4B),
dimension(:),
allocatable :: array_shape
902 integer(I4B),
dimension(:),
allocatable :: layer_shape
903 character(len=LINELENGTH) :: keyword
907 if (idt%shape ==
'NODES')
then
908 nvals = product(mshape)
911 nvals = array_shape(1)
915 call mem_allocate(int1d, nvals, idt%mf6varname, mf6_input%mempath)
919 call parser%GetStringCaps(keyword)
922 if (keyword ==
'NETCDF')
then
925 else if (keyword ==
'LAYERED' .and. idt%layered)
then
929 call read_int1d(parser, int1d, idt%mf6varname)
933 call idm_log_var(int1d, idt%tagname, mf6_input%mempath, iout)
937 if (idt%blockname ==
'GRIDDATA')
then
938 call idm_export(int1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
946 nc_vars, input_fname, iout)
952 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
953 logical(LGP),
intent(in) :: export
955 character(len=*),
intent(in) :: input_fname
956 integer(I4B),
intent(in) :: iout
957 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
959 integer(I4B) :: nsize1, nsize2
960 integer(I4B),
dimension(:),
allocatable :: array_shape
961 integer(I4B),
dimension(:),
allocatable :: layer_shape
962 character(len=LINELENGTH) :: keyword
967 nsize1 = array_shape(1)
968 nsize2 = array_shape(2)
971 call mem_allocate(int2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
975 call parser%GetStringCaps(keyword)
978 if (keyword ==
'NETCDF')
then
981 else if (keyword ==
'LAYERED' .and. idt%layered)
then
985 call read_int2d(parser, int2d, idt%mf6varname)
989 call idm_log_var(int2d, idt%tagname, mf6_input%mempath, iout)
993 if (idt%blockname ==
'GRIDDATA')
then
994 call idm_export(int2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1002 nc_vars, input_fname, iout)
1008 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1009 logical(LGP),
intent(in) :: export
1011 character(len=*),
intent(in) :: input_fname
1012 integer(I4B),
intent(in) :: iout
1013 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: int3d
1014 integer(I4B) :: nlay
1015 integer(I4B) :: nsize1, nsize2, nsize3
1016 integer(I4B),
dimension(:),
allocatable :: array_shape
1017 integer(I4B),
dimension(:),
allocatable :: layer_shape
1018 integer(I4B),
dimension(:),
pointer,
contiguous :: int1d_ptr
1019 character(len=LINELENGTH) :: keyword
1024 nsize1 = array_shape(1)
1025 nsize2 = array_shape(2)
1026 nsize3 = array_shape(3)
1029 call mem_allocate(int3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1034 call parser%GetStringCaps(keyword)
1037 if (keyword ==
'NETCDF')
then
1040 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1045 int1d_ptr(1:nsize1 * nsize2 * nsize3) => int3d(:, :, :)
1046 call read_int1d(parser, int1d_ptr, idt%mf6varname)
1050 call idm_log_var(int3d, idt%tagname, mf6_input%mempath, iout)
1054 if (idt%blockname ==
'GRIDDATA')
then
1055 call idm_export(int3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1065 character(len=*),
intent(in) :: memoryPath
1066 integer(I4B),
intent(in) :: iout
1067 real(DP),
pointer :: dblvar
1069 dblvar = parser%GetDouble()
1070 call idm_log_var(dblvar, idt%tagname, memorypath, iout)
1076 nc_vars, input_fname, iout)
1082 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1083 logical(LGP),
intent(in) :: export
1085 character(len=*),
intent(in) :: input_fname
1086 integer(I4B),
intent(in) :: iout
1087 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d
1088 integer(I4B) :: nlay
1089 integer(I4B) :: nvals
1090 integer(I4B),
dimension(:),
allocatable :: array_shape
1091 integer(I4B),
dimension(:),
allocatable :: layer_shape
1092 character(len=LINELENGTH) :: keyword
1095 if (idt%shape ==
'NODES')
then
1096 nvals = product(mshape)
1099 nvals = array_shape(1)
1103 call mem_allocate(dbl1d, nvals, idt%mf6varname, mf6_input%mempath)
1107 call parser%GetStringCaps(keyword)
1110 if (keyword ==
'NETCDF')
then
1113 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1117 call read_dbl1d(parser, dbl1d, idt%mf6varname)
1121 call idm_log_var(dbl1d, idt%tagname, mf6_input%mempath, iout)
1125 if (idt%blockname ==
'GRIDDATA')
then
1126 call idm_export(dbl1d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1134 nc_vars, input_fname, iout)
1140 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1141 logical(LGP),
intent(in) :: export
1143 character(len=*),
intent(in) :: input_fname
1144 integer(I4B),
intent(in) :: iout
1145 real(DP),
dimension(:, :),
pointer,
contiguous :: dbl2d
1146 integer(I4B) :: nlay
1147 integer(I4B) :: nsize1, nsize2
1148 integer(I4B),
dimension(:),
allocatable :: array_shape
1149 integer(I4B),
dimension(:),
allocatable :: layer_shape
1150 character(len=LINELENGTH) :: keyword
1155 nsize1 = array_shape(1)
1156 nsize2 = array_shape(2)
1159 call mem_allocate(dbl2d, nsize1, nsize2, idt%mf6varname, mf6_input%mempath)
1163 call parser%GetStringCaps(keyword)
1166 if (keyword ==
'NETCDF')
then
1169 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1173 call read_dbl2d(parser, dbl2d, idt%mf6varname)
1177 call idm_log_var(dbl2d, idt%tagname, mf6_input%mempath, iout)
1181 if (idt%blockname ==
'GRIDDATA')
then
1182 call idm_export(dbl2d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1190 nc_vars, input_fname, iout)
1196 integer(I4B),
dimension(:),
contiguous,
pointer,
intent(in) :: mshape
1197 logical(LGP),
intent(in) :: export
1199 character(len=*),
intent(in) :: input_fname
1200 integer(I4B),
intent(in) :: iout
1201 real(DP),
dimension(:, :, :),
pointer,
contiguous :: dbl3d
1202 integer(I4B) :: nlay
1203 integer(I4B) :: nsize1, nsize2, nsize3
1204 integer(I4B),
dimension(:),
allocatable :: array_shape
1205 integer(I4B),
dimension(:),
allocatable :: layer_shape
1206 real(DP),
dimension(:),
pointer,
contiguous :: dbl1d_ptr
1207 character(len=LINELENGTH) :: keyword
1212 nsize1 = array_shape(1)
1213 nsize2 = array_shape(2)
1214 nsize3 = array_shape(3)
1217 call mem_allocate(dbl3d, nsize1, nsize2, nsize3, idt%mf6varname, &
1222 call parser%GetStringCaps(keyword)
1225 if (keyword ==
'NETCDF')
then
1228 else if (keyword ==
'LAYERED' .and. idt%layered)
then
1233 dbl1d_ptr(1:nsize1 * nsize2 * nsize3) => dbl3d(:, :, :)
1234 call read_dbl1d(parser, dbl1d_ptr, idt%mf6varname)
1238 call idm_log_var(dbl3d, idt%tagname, mf6_input%mempath, iout)
1242 if (idt%blockname ==
'GRIDDATA')
then
1243 call idm_export(dbl3d, idt%tagname, mf6_input%mempath, idt%shape, iout)
1256 integer(I4B),
intent(inout) :: oc_inunit
1257 integer(I4B),
intent(in) :: iout
1258 integer(I4B) :: ibinary
1259 integer(I4B) :: lloc, istart, istop, idum, inunit, itmp, ierr
1260 integer(I4B) :: nunopn = 99
1261 character(len=:),
allocatable :: line
1262 character(len=LINELENGTH) :: fname
1263 logical(LGP) :: exists
1265 character(len=*),
parameter :: fmtocne = &
1266 &
"('Specified OPEN/CLOSE file ',(A),' does not exist')"
1267 character(len=*),
parameter :: fmtobf = &
1268 &
"(1X,/1X,'OPENING BINARY FILE ON UNIT ',I0,':',/1X,A)"
1273 inunit = parser%getunit()
1277 call parser%line_reader%rdcom(inunit, iout, line, ierr)
1278 call urword(line, lloc, istart, istop, 1, idum, r, iout, inunit)
1280 if (line(istart:istop) ==
'OPEN/CLOSE')
then
1282 call urword(line, lloc, istart, istop, 0, idum, r, &
1284 fname = line(istart:istop)
1286 inquire (file=fname, exist=exists)
1287 if (.not. exists)
then
1288 write (
errmsg, fmtocne) line(istart:istop)
1290 call store_error(
'Specified OPEN/CLOSE file does not exist')
1295 call urword(line, lloc, istart, istop, 1, idum, r, &
1298 if (line(istart:istop) ==
'(BINARY)') ibinary = 1
1300 if (ibinary == 1)
then
1305 write (iout, fmtobf) oc_inunit, trim(adjustl(fname))
1307 call openfile(oc_inunit, itmp, fname,
'OPEN/CLOSE', &
1312 if (ibinary == 0)
then
1313 call parser%line_reader%bkspc(parser%getunit())
1326 logical(LGP) :: has_ts
1327 integer(I4B) :: m, n
1331 do m = 1, this%structarray%count()
1332 svect => this%structarray%get(m)
1333 if (svect%idt%timeseries .and. svect%ts_strlocs%count() > 0)
then
1340 n =
size(this%ts_sas)
1341 allocate (tmp(n + 1))
1342 tmp(1:n) = this%ts_sas
1343 tmp(n + 1)%sa => this%structarray
1344 call move_alloc(tmp, this%ts_sas)
1346 nullify (this%structarray)
1358 do n = 1,
size(this%ts_sas)
1359 if (
associated(this%ts_sas(n)%sa))
then
1361 nullify (this%ts_sas(n)%sa)
1364 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)
@ brief log the closing message
subroutine, public idm_log_header(component, subcomponent, iout)
@ brief log a header message
subroutine, public read_int1d(parser, int1d, aname)
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.
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_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
type(structarraytype) function, pointer get_ts_sa(this, n)
Return the n-th saved static StructArray pointer.
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 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
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.
integer(i4b) function ts_sa_count(this)
Return number of saved static StructArrays with deferred TS strlocs.
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
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)
@ 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
subroutine, public get_mem_rank(name, mem_path, rank)
@ brief 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
This module contains the SourceCommonModule.
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.
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