54 integer(I4B),
intent(in) :: iu, iout
55 integer(I4B),
intent(in) :: jj
56 integer(I4B),
dimension(jj),
intent(inout) :: iarr
57 character(len=*),
intent(in) :: aname
58 integer(I4B),
intent(in) :: ndim
59 integer(I4B),
intent(in) :: k
62 integer(I4B) :: iclose, iconst, iprn, j, locat, ncpl, ndig
63 integer(I4B) :: nval, nvalt
65 character(len=100) :: prfmt
67 character(len=30) :: arrname
68 character(len=MAXCHARLEN) :: ermsgr
70 2
format(/, 1x, a,
' = ', i0,
' FOR LAYER ', i0)
71 3
format(/, 1x, a,
' = ', i0)
84 write (iout, 2) trim(aname), iconst, k
86 write (iout, 3) trim(aname), iconst
89 elseif (locat > 0)
then
91 read (locat, *, iostat=istat, iomsg=ermsgr) (iarr(j), j=1, jj)
93 arrname = adjustl(aname)
94 errmsg =
"Error reading data for array '"//trim(arrname)// &
95 "'. "//trim(adjustl(ermsgr))
100 iarr(j) = iarr(j) * iconst
102 if (iclose == 1)
then
112 if (isok .EQV. .false.)
exit
113 read (locat, iostat=istat, iomsg=ermsgr) &
114 (iarr(j), j=nvalt + 1, nvalt + nval)
116 arrname = adjustl(aname)
117 errmsg =
"Error reading data for array '"//trim(arrname)// &
118 "'. "//trim(adjustl(ermsgr))
123 if (nvalt ==
size(iarr))
exit
128 iarr(j) = iarr(j) * iconst
132 if (iclose == 1)
then
138 if (iprn >= 0 .and. locat /= 0)
then
139 prowcolnum = (ndim == 3)
148 integer(I4B),
intent(in) :: iu, iout
149 integer(I4B),
intent(in) :: jj, ii
150 integer(I4B),
dimension(jj, ii),
intent(inout) :: iarr
151 character(len=*),
intent(in) :: aname
152 integer(I4B),
intent(in) :: ndim
153 integer(I4B),
intent(in) :: k
156 integer(I4B) :: i, iclose, iconst, iprn, j, locat, ncpl, ndig
158 logical :: prowcolnum
159 character(len=100) :: prfmt
160 integer(I4B) :: istat
161 character(len=30) :: arrname
162 character(len=MAXCHARLEN) :: ermsgr
164 2
format(/, 1x, a,
' = ', i0,
' FOR LAYER ', i0)
165 3
format(/, 1x, a,
' = ', i0)
180 write (iout, 2) trim(aname), iconst, k
182 write (iout, 3) trim(aname), iconst
185 elseif (locat > 0)
then
188 read (locat, *, iostat=istat, iomsg=ermsgr) (iarr(j, i), j=1, jj)
190 arrname = adjustl(aname)
191 errmsg =
"Error reading data for array '"//trim(arrname)// &
192 "'. "//trim(adjustl(ermsgr))
197 iarr(j, i) = iarr(j, i) * iconst
200 if (iclose == 1)
then
210 read (locat, iostat=istat, iomsg=ermsgr) (iarr(j, i), j=1, jj)
212 arrname = adjustl(aname)
213 errmsg =
"Error reading data for array '"//trim(arrname)// &
214 "'. "//trim(adjustl(ermsgr))
219 iarr(j, i) = iarr(j, i) * iconst
223 if (iclose == 1)
then
229 if (iprn >= 0 .and. locat /= 0)
then
230 prowcolnum = (ndim == 3)
239 integer(I4B),
intent(in) :: iu
240 integer(I4B),
intent(in) :: iout
241 integer(I4B),
intent(in) :: ndim
242 integer(I4B),
intent(in) :: ncol
243 integer(I4B),
intent(in) :: nrow
244 integer(I4B),
intent(in) :: nlay
245 integer(I4B),
intent(in) :: k1, k2
246 integer(I4B),
dimension(ncol, nrow, nlay),
intent(inout) :: iarr
247 character(len=*),
intent(in) :: aname
249 integer(I4B) :: k, kk
261 integer(I4B),
intent(in) :: iu
262 integer(I4B),
intent(in) :: iout
263 integer(I4B),
intent(in) :: ndim
264 integer(I4B),
intent(in) :: nvals
265 integer(I4B),
dimension(nvals, 1, 1),
intent(inout) :: iarr
266 character(len=*),
intent(in) :: aname
273 nlay, nval, iout, k1, k2)
275 integer(I4B),
intent(in) :: iu, iout
276 integer(I4B),
intent(in) :: ncol, nrow, nlay, nval
277 integer(I4B),
dimension(nval),
intent(inout) :: iarr
278 character(len=*),
intent(in) :: aname
279 integer(I4B),
intent(in) :: ndim
280 integer(I4B),
intent(in) :: k1, k2
283 call read_array_int3d(iu, iarr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
290 integer(I4B),
intent(in) :: iu, iout
291 integer(I4B),
intent(in) :: jj
292 real(DP),
dimension(jj),
intent(inout) :: darr
293 character(len=*),
intent(in) :: aname
294 integer(I4B),
intent(in) :: ndim
295 integer(I4B),
intent(in) :: k
298 integer(I4B) :: j, iclose, iprn, locat, ncpl, ndig
300 logical :: prowcolnum
301 character(len=100) :: prfmt
302 integer(I4B) :: istat
303 integer(I4B) :: nvalt, nval
304 character(len=30) :: arrname
305 character(len=MAXCHARLEN) :: ermsgr
307 2
format(/, 1x, a,
' = ', g14.7,
' FOR LAYER ', i0)
308 3
format(/, 1x, a,
' = ', g14.7)
321 write (iout, 2) trim(aname), cnstnt, k
323 write (iout, 3) trim(aname), cnstnt
326 elseif (locat > 0)
then
328 read (locat, *, iostat=istat, iomsg=ermsgr) (darr(j), j=1, jj)
330 arrname = adjustl(aname)
331 errmsg =
"Error reading data for array '"// &
332 trim(adjustl(arrname))//
"'. "//trim(adjustl(ermsgr))
337 darr(j) = darr(j) * cnstnt
339 if (iclose == 1)
then
349 if (isok .EQV. .false.)
exit
350 read (locat, iostat=istat, iomsg=ermsgr) &
351 (darr(j), j=nvalt + 1, nvalt + nval)
353 arrname = adjustl(aname)
354 errmsg =
"Error reading data for array '"// &
355 trim(adjustl(arrname))//
"'. "//trim(adjustl(ermsgr))
360 if (nvalt ==
size(darr))
exit
365 darr(j) = darr(j) * cnstnt
369 if (iclose == 1)
then
375 if (iprn >= 0 .and. locat /= 0)
then
376 prowcolnum = (ndim == 3)
385 integer(I4B),
intent(in) :: iu, iout
386 integer(I4B),
intent(in) :: jj, ii
387 real(DP),
dimension(jj, ii),
intent(inout) :: darr
388 character(len=*),
intent(in) :: aname
389 integer(I4B),
intent(in) :: ndim
390 integer(I4B),
intent(in) :: k
393 integer(I4B) :: i, iclose, iprn, j, locat, ncpl, ndig
396 logical :: prowcolnum
397 character(len=100) :: prfmt
398 integer(I4B) :: istat
399 character(len=30) :: arrname
400 character(len=MAXCHARLEN) :: ermsgr
402 2
format(/, 1x, a,
' = ', g14.7,
' FOR LAYER ', i0)
403 3
format(/, 1x, a,
' = ', g14.7)
418 write (iout, 2) trim(aname), cnstnt, k
420 write (iout, 3) trim(aname), cnstnt
423 elseif (locat > 0)
then
426 read (locat, *, iostat=istat, iomsg=ermsgr) (darr(j, i), j=1, jj)
428 arrname = adjustl(aname)
429 errmsg =
"Error reading data for array '"// &
430 trim(adjustl(arrname))//
"'. "//trim(adjustl(ermsgr))
435 darr(j, i) = darr(j, i) * cnstnt
438 if (iclose == 1)
then
448 read (locat, iostat=istat, iomsg=ermsgr) (darr(j, i), j=1, jj)
450 arrname = adjustl(aname)
451 errmsg =
"Error reading data for array '"// &
452 trim(adjustl(arrname))//
"'. "//trim(adjustl(ermsgr))
457 darr(j, i) = darr(j, i) * cnstnt
461 if (iclose == 1)
then
467 if (iprn >= 0 .and. locat /= 0)
then
468 prowcolnum = (ndim == 3)
477 integer(I4B),
intent(in) :: iu
478 integer(I4B),
intent(in) :: iout
479 integer(I4B),
intent(in) :: ndim
480 integer(I4B),
intent(in) :: ncol
481 integer(I4B),
intent(in) :: nrow
482 integer(I4B),
intent(in) :: nlay
483 integer(I4B),
intent(in) :: k1, k2
484 real(DP),
dimension(ncol, nrow, nlay),
intent(inout) :: darr
485 character(len=*),
intent(in) :: aname
487 integer(I4B) :: k, kk
500 integer(I4B),
intent(in) :: iu
501 integer(I4B),
intent(in) :: iout
502 integer(I4B),
intent(in) :: ndim
503 integer(I4B),
intent(in) :: nvals
504 real(DP),
dimension(nvals, 1, 1),
intent(inout) :: darr
505 character(len=*),
intent(in) :: aname
512 nlay, nval, iout, k1, k2)
514 integer(I4B),
intent(in) :: iu, iout
515 integer(I4B),
intent(in) :: ncol, nrow, nlay, nval
516 real(DP),
dimension(nval),
intent(inout) :: darr
517 character(len=*),
intent(in) :: aname
518 integer(I4B),
intent(in) :: ndim
519 integer(I4B),
intent(in) :: k1, k2
522 call read_array_dbl3d(iu, darr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
536 integer(I4B),
intent(in) :: iu
537 integer(I4B),
intent(in) :: iout
538 character(len=*),
intent(in) :: aname
539 integer(I4B),
intent(out) :: locat
540 integer(I4B),
intent(out) :: iconst
541 integer(I4B),
intent(out) :: iclose
542 integer(I4B),
intent(out) :: iprn
544 integer(I4B) :: icol, icol1, istart, istop, n
546 character(len=MAXCHARLEN) :: fname
547 character(len=:),
allocatable :: line
550 call read_control_1(iu, iout, aname, locat, iclose, line, icol, fname)
553 call urword(line, icol, istart, istop, 2, iconst, r, iout, iu)
561 call urword(line, icol, istart, istop, 1, n, r, iout, iu)
562 if (line(istart:istop) ==
'FACTOR')
then
563 call urword(line, icol, istart, istop, 2, iconst, r, iout, iu)
564 if (iconst == 0) iconst = 1
571 call read_control_2(iu, iout, fname, line, icol, locat, iclose, iprn)
583 integer(I4B),
intent(in) :: iu
584 integer(I4B),
intent(in) :: iout
585 character(len=*),
intent(in) :: aname
586 integer(I4B),
intent(out) :: locat
587 real(DP),
intent(out) :: cnstnt
588 integer(I4B),
intent(out) :: iclose
589 integer(I4B),
intent(out) :: iprn
592 integer(I4B) :: icol, icol1, istart, istop, n
594 character(len=MAXCHARLEN) :: fname
595 character(len=:),
allocatable :: line
598 call read_control_1(iu, iout, aname, locat, iclose, line, icol, fname)
601 call urword(line, icol, istart, istop, 3, n, cnstnt, iout, iu)
609 call urword(line, icol, istart, istop, 1, n, r, iout, iu)
610 if (line(istart:istop) ==
'FACTOR')
then
611 call urword(line, icol, istart, istop, 3, n, cnstnt, iout, iu)
619 call read_control_2(iu, iout, fname, line, icol, locat, iclose, iprn)
626 integer(I4B),
intent(in) :: iu
627 integer(I4B),
intent(in) :: iout
628 character(len=*),
intent(in) :: aname
629 integer(I4B),
intent(out) :: locat
630 integer(I4B),
intent(out) :: iclose
631 character(len=:),
allocatable,
intent(inout) :: line
632 integer(I4B),
intent(inout) :: icol
633 character(len=*),
intent(inout) :: fname
636 integer(I4B) :: istart, istop, n
642 call u9rdcom(iu, iout, line, ierr)
647 call urword(line, icol, istart, istop, 1, n, r, iout, iu)
648 if (line(istart:istop) .eq.
'CONSTANT')
then
650 elseif (line(istart:istop) .eq.
'INTERNAL')
then
652 elseif (line(istart:istop) .eq.
'OPEN/CLOSE')
then
653 call urword(line, icol, istart, istop, 0, n, r, iout, iu)
654 fname = line(istart:istop)
658 errmsg =
'READING CONTROL RECORD FOR '// &
659 trim(adjustl(aname))//
"'. "// &
660 'Use CONSTANT, INTERNAL, or OPEN/CLOSE.'
662 call store_error_unit(iu)
671 integer(I4B),
intent(in) :: iu, iout, iclose
672 character(len=*),
intent(in) :: fname
673 character(len=*),
intent(inout) :: line
674 integer(I4B),
intent(inout) :: icol, iprn, locat
676 integer(I4B) :: i, n, istart, istop, lenkey
678 character(len=MAXCHARLEN) :: keyword
684 if (locat .ne. 0)
then
688 call urword(line, icol, istart, istop, 1, n, r, iout, iu)
689 keyword = line(istart:istop)
690 lenkey = len_trim(keyword)
691 select case (keyword)
693 if (iclose == 0)
then
694 errmsg =
'"(BINARY)" option for array input is valid only if'// &
695 ' OPEN/CLOSE is also specified.'
702 call urword(line, icol, istart, istop, 2, iprn, r, iout, iu)
707 errmsg =
'Invalid option found in array-control record: "' &
714 if (iclose == 0)
then
720 call openfile(locat, iout, fname,
'OPEN/CLOSE', fmtarg_opt=
form, &
724 call openfile(locat, iout, fname,
'OPEN/CLOSE')
733 integer(I4B),
intent(inout) :: iprn
734 character(len=*),
intent(out) :: prfmt
735 logical,
intent(in) :: prowcolnum
736 integer(I4B),
intent(out) :: ncpl, ndig
738 integer(I4B) :: nwidp
745 if (iprn > 9) iprn = 0
787 integer(I4B),
intent(inout) :: iprn
788 character(len=*),
intent(out) :: prfmt
789 logical,
intent(in) :: prowcolnum
790 integer(I4B),
intent(out) :: ncpl, ndig
792 integer(I4B) :: nwidp
793 character(len=1) :: editdesc
800 if (iprn > 21) iprn = 0
915 if (editdesc ==
'F')
then
925 ncpl, ndig, prowcolnum)
927 integer(I4B),
intent(in) :: iout, jj, ii, k
928 integer(I4B),
intent(in) :: ncpl
929 integer(I4B),
intent(in) :: ndig
930 integer(I4B),
dimension(jj, ii),
intent(in) :: iarr
931 character(len=*),
intent(in) :: aname
932 character(len=*),
intent(in) :: prfmt
933 logical,
intent(in) :: prowcolnum
937 2
format(/, 1x, a, 1x,
'FOR LAYER ', i0)
940 if (iout <= 0)
return
944 write (iout, 2) trim(aname), k
946 write (iout, 3) trim(aname)
952 call ucolno(1, jj, 4, ncpl, ndig, iout)
956 write (iout, prfmt) i, (iarr(j, i), j=1, jj)
960 errmsg =
'Program error printing array '//trim(aname)// &
961 ': ii > 1 when prowcolnum is false.'
966 write (iout, prfmt) (iarr(j, 1), j=1, jj)
971 ncpl, ndig, prowcolnum)
973 integer(I4B),
intent(in) :: iout, jj, ii, k
974 integer(I4B),
intent(in) :: ncpl
975 integer(I4B),
intent(in) :: ndig
976 real(DP),
dimension(jj, ii),
intent(in) :: darr
977 character(len=*),
intent(in) :: aname
978 character(len=*),
intent(in) :: prfmt
979 logical,
intent(in) :: prowcolnum
983 2
format(/, 1x, a, 1x,
'FOR LAYER ', i0)
986 if (iout <= 0)
return
990 write (iout, 2) trim(aname), k
992 write (iout, 3) trim(aname)
998 call ucolno(1, jj, 4, ncpl, ndig, iout)
1002 write (iout, prfmt) i, (darr(j, i), j=1, jj)
1006 errmsg =
'Program error printing array '//trim(aname)// &
1007 ': ii > 1 when prowcolnum is false.'
1012 write (iout, prfmt) (darr(j, 1), j=1, jj)
1018 integer(I4B),
intent(in) :: locat
1019 integer(I4B),
intent(in) :: iout
1020 character(len=*),
intent(in) :: arrname
1021 integer,
intent(out) :: nval
1023 integer(I4B) :: istat
1024 integer(I4B) :: kstp, kper, m1, m2, m3
1025 real(dp) :: pertim, totim
1026 character(len=16) :: text
1027 character(len=MAXCHARLEN) :: ermsgr
1028 character(len=*),
parameter :: fmthdr = &
1029 "(/,1X,'HEADER FROM BINARY FILE HAS FOLLOWING ENTRIES',&
1030 &/,4X,'KSTP: ',I0,' KPER: ',I0,&
1031 &/,4x,'PERTIM: ',G0,' TOTIM: ',G0,&
1033 &/,4X,'MSIZE 1: ',I0,' MSIZE 2: ',I0,' MSIZE 3: ',I0)"
1036 read (locat, iostat=istat, iomsg=ermsgr) kstp, kper, pertim, totim, text, &
1040 if (istat /= 0)
then
1041 errmsg =
"Error reading data for array '"//adjustl(trim(arrname))// &
1042 "'. "//trim(adjustl(ermsgr))
1049 write (iout, fmthdr) kstp, kper, pertim, totim, text, m1, m2, m3
1064 integer(I4B),
intent(in) :: nval
1065 integer(I4B),
intent(in) :: nvalt
1066 integer(I4B),
intent(in) :: arrsize
1067 character(len=*),
intent(in) :: aname
1068 integer(I4B),
intent(in) :: locat
1071 logical(LGP) :: isok
1076 if (nvalt + nval > arrsize)
then
1077 write (
errmsg,
'(a,i0,a,1x,a,1x,a,i0,a,1x,i0,3(1x,a))') &
1078 'The size of the data array calculated from the binary header (', &
1079 nval,
') will exceed the remainder of the', trim(adjustl(aname)), &
1080 'data array (', arrsize,
') array by', nvalt + nval - arrsize, &
1081 'elements. This is usually caused by incorrect assignment of', &
1082 '(m1,m2,m3) in the binary header. See the mf6io.pdf document', &
1083 'for information on assigning (m1,m2,m3).'
subroutine read_array_dbl1d_layered(iu, darr, aname, ndim, ncol, nrow, nlay, nval, iout, k1, k2)
subroutine read_control_2(iu, iout, fname, line, icol, locat, iclose, iprn)
subroutine read_control_1(iu, iout, aname, locat, iclose, line, icol, fname)
subroutine read_array_dbl3d_all(iu, darr, aname, ndim, nvals, iout)
subroutine, public read_binary_header(locat, iout, arrname, nval)
subroutine print_array_dbl(darr, aname, iout, jj, ii, k, prfmt, ncpl, ndig, prowcolnum)
subroutine read_array_int2d(iu, iarr, aname, ndim, jj, ii, iout, k)
subroutine read_array_int3d(iu, iarr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
subroutine read_array_dbl2d(iu, darr, aname, ndim, jj, ii, iout, k)
subroutine read_control_dbl(iu, iout, aname, locat, cnstnt, iclose, iprn)
subroutine read_array_dbl1d(iu, darr, aname, ndim, jj, iout, k)
subroutine read_array_int1d(iu, iarr, aname, ndim, jj, iout, k)
subroutine build_format_int(iprn, prfmt, prowcolnum, ncpl, ndig)
logical(lgp) function check_binary_size(nval, nvalt, arrsize, aname, locat)
@ brief Check the binary data size
subroutine read_array_int1d_layered(iu, iarr, aname, ndim, ncol, nrow, nlay, nval, iout, k1, k2)
subroutine read_array_int3d_all(iu, iarr, aname, ndim, nvals, iout)
subroutine build_format_dbl(iprn, prfmt, prowcolnum, ncpl, ndig)
subroutine read_control_int(iu, iout, aname, locat, iconst, iclose, iprn)
subroutine read_array_dbl3d(iu, darr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
subroutine print_array_int(iarr, aname, iout, jj, ii, k, prfmt, ncpl, ndig, prowcolnum)
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter namedboundflag
named bound flag
integer(i4b), parameter lenbigline
maximum length of a big line
integer(i4b), parameter lenboundname
maximum length of a bound name
real(dp), parameter dzero
real constant zero
integer(i4b), parameter maxcharlen
maximum length of char string
real(dp), parameter done
real constant 1
This module defines variable data types.
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
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