24 integer(I4B),
pointer :: nlay => null()
25 integer(I4B),
pointer :: nrow => null()
26 integer(I4B),
pointer :: ncol => null()
27 real(dp),
dimension(:),
pointer,
contiguous :: delr => null()
28 real(dp),
dimension(:),
pointer,
contiguous :: delc => null()
29 real(dp),
dimension(:, :),
pointer,
contiguous :: top2d => null()
30 real(dp),
dimension(:, :, :),
pointer,
contiguous :: bot3d => null()
31 integer(I4B),
dimension(:, :, :),
pointer,
contiguous :: idomain => null()
32 real(dp),
dimension(:, :, :),
pointer :: botm => null()
33 real(dp),
dimension(:),
pointer,
contiguous :: cellx => null()
34 real(dp),
dimension(:),
pointer,
contiguous :: celly => null()
77 logical :: length_units = .false.
78 logical :: nogrb = .false.
79 logical :: xorigin = .false.
80 logical :: yorigin = .false.
81 logical :: angrot = .false.
82 logical :: nlay = .false.
83 logical :: nrow = .false.
84 logical :: ncol = .false.
85 logical :: delr = .false.
86 logical :: delc = .false.
87 logical :: top = .false.
88 logical :: botm = .false.
89 logical :: idomain = .false.
96 subroutine dis_cr(dis, name_model, input_mempath, inunit, iout)
99 character(len=*),
intent(in) :: name_model
100 character(len=*),
intent(in) :: input_mempath
101 integer(I4B),
intent(in) :: inunit
102 integer(I4B),
intent(in) :: iout
104 type(
distype),
pointer :: disnew
106 character(len=*),
parameter :: fmtheader = &
107 "(1X, /1X, 'DIS -- STRUCTURED GRID DISCRETIZATION PACKAGE,', &
108 &' VERSION 2 : 3/27/2014 - INPUT READ FROM MEMPATH: ', A, /)"
112 call disnew%allocate_scalars(name_model, input_mempath)
121 write (iout, fmtheader) dis%input_mempath
134 if (this%inunit /= 0)
then
137 call this%source_options()
140 call this%source_dimensions()
143 call this%source_griddata()
147 call this%grid_finalize()
161 call this%DisBaseType%dis_da()
187 character(len=LENVARNAME),
dimension(3) :: lenunits = &
188 &[character(len=LENVARNAME) ::
'FEET',
'METERS',
'CENTIMETERS']
192 call mem_set_value(this%lenuni,
'LENGTH_UNITS', this%input_mempath, &
193 lenunits, found%length_units)
194 call mem_set_value(this%nogrb,
'NOGRB', this%input_mempath, found%nogrb)
195 call mem_set_value(this%xorigin,
'XORIGIN', this%input_mempath, found%xorigin)
196 call mem_set_value(this%yorigin,
'YORIGIN', this%input_mempath, found%yorigin)
197 call mem_set_value(this%angrot,
'ANGROT', this%input_mempath, found%angrot)
200 if (this%iout > 0)
then
201 call this%log_options(found)
213 write (this%iout,
'(1x,a)')
'Setting Discretization Options'
215 if (found%length_units)
then
216 write (this%iout,
'(4x,a,i0)')
'Model length unit [0=UND, 1=FEET, &
217 &2=METERS, 3=CENTIMETERS] set as ', this%lenuni
220 if (found%nogrb)
then
221 write (this%iout,
'(4x,a,i0)')
'Binary grid file [0=GRB, 1=NOGRB] &
222 &set as ', this%nogrb
225 if (found%xorigin)
then
226 write (this%iout,
'(4x,a,G0)')
'XORIGIN = ', this%xorigin
229 if (found%yorigin)
then
230 write (this%iout,
'(4x,a,G0)')
'YORIGIN = ', this%yorigin
233 if (found%angrot)
then
234 write (this%iout,
'(4x,a,G0)')
'ANGROT = ', this%angrot
237 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Options'
247 integer(I4B) :: i, j, k
251 call mem_set_value(this%nlay,
'NLAY', this%input_mempath, found%nlay)
252 call mem_set_value(this%nrow,
'NROW', this%input_mempath, found%nrow)
253 call mem_set_value(this%ncol,
'NCOL', this%input_mempath, found%ncol)
256 if (this%iout > 0)
then
257 call this%log_dimensions(found)
261 if (this%nlay < 1)
then
263 'NLAY was not specified or was specified incorrectly.')
266 if (this%nrow < 1)
then
268 'NROW was not specified or was specified incorrectly.')
271 if (this%ncol < 1)
then
273 'NCOL was not specified or was specified incorrectly.')
278 this%nodesuser = this%nlay * this%nrow * this%ncol
281 call mem_allocate(this%delr, this%ncol,
'DELR', this%memoryPath)
282 call mem_allocate(this%delc, this%nrow,
'DELC', this%memoryPath)
283 call mem_allocate(this%idomain, this%ncol, this%nrow, this%nlay,
'IDOMAIN', &
285 call mem_allocate(this%top2d, this%ncol, this%nrow,
'TOP2D', this%memoryPath)
286 call mem_allocate(this%bot3d, this%ncol, this%nrow, this%nlay,
'BOT3D', &
288 call mem_allocate(this%cellx, this%ncol,
'CELLX', this%memoryPath)
289 call mem_allocate(this%celly, this%nrow,
'CELLY', this%memoryPath)
295 this%idomain(j, i, k) = 1
309 write (this%iout,
'(1x,a)')
'Setting Discretization Dimensions'
312 write (this%iout,
'(4x,a,i0)')
'NLAY = ', this%nlay
316 write (this%iout,
'(4x,a,i0)')
'NROW = ', this%nrow
320 write (this%iout,
'(4x,a,i0)')
'NCOL = ', this%ncol
323 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Dimensions'
335 call mem_set_value(this%delr,
'DELR', this%input_mempath, found%delr)
336 call mem_set_value(this%delc,
'DELC', this%input_mempath, found%delc)
337 call mem_set_value(this%top2d,
'TOP', this%input_mempath, found%top)
338 call mem_set_value(this%bot3d,
'BOTM', this%input_mempath, found%botm)
339 call mem_set_value(this%idomain,
'IDOMAIN', this%input_mempath, found%idomain)
342 if (this%iout > 0)
then
343 call this%log_griddata(found)
355 write (this%iout,
'(1x,a)')
'Setting Discretization Griddata'
358 write (this%iout,
'(4x,a)')
'DELR set from input file'
362 write (this%iout,
'(4x,a)')
'DELC set from input file'
366 write (this%iout,
'(4x,a)')
'TOP set from input file'
370 write (this%iout,
'(4x,a)')
'BOTM set from input file'
373 if (found%idomain)
then
374 write (this%iout,
'(4x,a)')
'IDOMAIN set from input file'
377 write (this%iout,
'(1x,a,/)')
'End Setting Discretization Griddata'
389 integer(I4B) :: n, i, j, k
391 integer(I4B) :: noder
392 integer(I4B) :: nrsize
396 character(len=*),
parameter :: fmtdz = &
397 "('CELL (',i0,',',i0,',',i0,') THICKNESS <= 0. ', &
398 &'TOP, BOT: ',2(1pg24.15))"
399 character(len=*),
parameter :: fmtnr = &
400 "(/1x, 'The specified IDOMAIN results in a reduced number of cells.',&
401 &/1x, 'Number of user nodes: ',I0,&
402 &/1X, 'Number of nodes in solution: ', I0, //)"
409 if (this%idomain(j, i, k) > 0) this%nodes = this%nodes + 1
415 if (this%nodes == 0)
then
416 call store_error(
'Model does not have any active nodes. &
417 &Ensure IDOMAIN array has some values greater &
427 if (this%idomain(j, i, k) < 1) cycle
429 top = this%bot3d(j, i, k - 1)
431 top = this%top2d(j, i)
433 dz = top - this%bot3d(j, i, k)
434 if (dz <=
dzero)
then
436 write (
errmsg, fmt=fmtdz) k, i, j, top, this%bot3d(j, i, k)
447 if (this%nodes < this%nodesuser)
then
448 write (this%iout, fmtnr) this%nodesuser, this%nodes
452 call this%allocate_arrays()
458 if (this%nodes < this%nodesuser)
then
464 if (this%idomain(j, i, k) > 0)
then
465 this%nodereduced(node) = noder
467 elseif (this%idomain(j, i, k) < 0)
then
468 this%nodereduced(node) = -1
470 this%nodereduced(node) = 0
479 if (this%nodes < this%nodesuser)
then
485 if (this%idomain(j, i, k) > 0)
then
486 this%nodeuser(noder) = node
496 this%cellx(1) =
dhalf * this%delr(1)
497 this%celly(this%nrow) =
dhalf * this%delc(this%nrow)
499 this%cellx(j) = this%cellx(j - 1) +
dhalf * this%delr(j - 1) + &
503 do i = this%nrow - 1, 1, -1
504 this%celly(i) = this%celly(i + 1) +
dhalf * this%delc(i + 1) + &
515 if (this%nodes < this%nodesuser) noder = this%nodereduced(node)
516 if (noder <= 0) cycle
518 top = this%bot3d(j, i, k - 1)
520 top = this%top2d(j, i)
522 this%top(noder) = top
523 this%bot(noder) = this%bot3d(j, i, k)
524 this%area(noder) = this%delr(j) * this%delc(i)
525 this%xc(noder) = this%cellx(j)
526 this%yc(noder) = this%celly(i)
533 if (this%nodes < this%nodesuser) nrsize = this%nodes
535 call this%con%disconnections(this%name_model, this%nodes, &
536 this%ncol, this%nrow, this%nlay, &
537 nrsize, this%delr, this%delc, &
538 this%top, this%bot, this%nodereduced, &
540 this%nja = this%con%nja
541 this%njas = this%con%njas
553 integer(I4B),
dimension(:),
intent(in) :: icelltype
555 integer(I4B) :: iunit, ntxt, ncpl, version
556 integer(I4B),
parameter :: lentxt = 100
557 character(len=50) :: txthdr
558 character(len=lentxt) :: txt
559 character(len=LINELENGTH) :: fname
560 character(len=LENBIGLINE) :: crs
561 logical(LGP) :: found_crs
562 character(len=*),
parameter :: fmtgrdsave = &
563 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
564 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
569 ncpl = this%nrow * this%ncol
571 call mem_set_value(crs,
'CRS', this%input_mempath, found_crs)
580 fname = trim(this%output_fname)
582 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
583 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
587 write (txthdr,
'(a)')
'GRID DIS'
588 txthdr(50:50) = new_line(
'a')
590 write (txthdr,
'(a, i0)')
'VERSION ', version
591 txthdr(50:50) = new_line(
'a')
593 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
594 txthdr(50:50) = new_line(
'a')
596 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
597 txthdr(50:50) = new_line(
'a')
601 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
602 txt(lentxt:lentxt) = new_line(
'a')
604 write (txt,
'(3a, i0)')
'NLAY ',
'INTEGER ',
'NDIM 0 # ', this%nlay
605 txt(lentxt:lentxt) = new_line(
'a')
607 write (txt,
'(3a, i0)')
'NROW ',
'INTEGER ',
'NDIM 0 # ', this%nrow
608 txt(lentxt:lentxt) = new_line(
'a')
610 write (txt,
'(3a, i0)')
'NCOL ',
'INTEGER ',
'NDIM 0 # ', this%ncol
611 txt(lentxt:lentxt) = new_line(
'a')
613 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%nja
614 txt(lentxt:lentxt) = new_line(
'a')
616 write (txt,
'(3a, 1pg24.15)')
'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
617 txt(lentxt:lentxt) = new_line(
'a')
619 write (txt,
'(3a, 1pg24.15)')
'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
620 txt(lentxt:lentxt) = new_line(
'a')
622 write (txt,
'(3a, 1pg24.15)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
623 txt(lentxt:lentxt) = new_line(
'a')
625 write (txt,
'(3a, i0)')
'DELR ',
'DOUBLE ',
'NDIM 1 ', this%ncol
626 txt(lentxt:lentxt) = new_line(
'a')
628 write (txt,
'(3a, i0)')
'DELC ',
'DOUBLE ',
'NDIM 1 ', this%nrow
629 txt(lentxt:lentxt) = new_line(
'a')
631 write (txt,
'(3a, i0)')
'TOP ',
'DOUBLE ',
'NDIM 1 ', ncpl
632 txt(lentxt:lentxt) = new_line(
'a')
634 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
635 txt(lentxt:lentxt) = new_line(
'a')
637 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
638 txt(lentxt:lentxt) = new_line(
'a')
640 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
641 txt(lentxt:lentxt) = new_line(
'a')
643 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
644 txt(lentxt:lentxt) = new_line(
'a')
646 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
647 txt(lentxt:lentxt) = new_line(
'a')
651 if (version == 2)
then
653 write (txt,
'(3a, i0)')
'CRS ',
'CHARACTER ',
'NDIM 1 ', &
655 txt(lentxt:lentxt) = new_line(
'a')
661 write (iunit) this%nodesuser
662 write (iunit) this%nlay
663 write (iunit) this%nrow
664 write (iunit) this%ncol
665 write (iunit) this%nja
666 write (iunit) this%xorigin
667 write (iunit) this%yorigin
668 write (iunit) this%angrot
669 write (iunit) this%delr
670 write (iunit) this%delc
671 write (iunit) this%top2d
672 write (iunit) this%bot3d
673 write (iunit) this%con%iausr
674 write (iunit) this%con%jausr
675 write (iunit) this%idomain
676 write (iunit) icelltype
679 if (version == 2)
then
680 if (found_crs)
write (iunit) trim(crs)
693 integer(I4B),
intent(in) :: nodeu
694 character(len=*),
intent(inout) :: str
696 integer(I4B) :: i, j, k
697 character(len=10) :: kstr, istr, jstr
699 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
700 write (kstr,
'(i10)') k
701 write (istr,
'(i10)') i
702 write (jstr,
'(i10)') j
703 str =
'('//trim(adjustl(kstr))//
','// &
704 trim(adjustl(istr))//
','// &
705 trim(adjustl(jstr))//
')'
714 integer(I4B),
intent(in) :: nodeu
715 integer(I4B),
dimension(:),
intent(inout) :: arr
717 integer(I4B) :: isize
718 integer(I4B) :: i, j, k
722 if (isize /= this%ndim)
then
723 write (
errmsg,
'(a,i0,a,i0,a)') &
724 'Program error: nodeu_to_array size of array (', isize, &
725 ') is not equal to the discretization dimension (', this%ndim,
')'
730 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
743 integer(I4B) :: nodenumber
745 class(
distype),
intent(in) :: this
746 integer(I4B),
intent(in) :: nodeu
747 integer(I4B),
intent(in) :: icheck
750 if (icheck /= 0)
then
753 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
754 write (
errmsg,
'(a,i0,a)') &
755 'Node number (', nodeu, &
756 ') less than 1 or greater than the number of nodes.'
761 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
765 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
774 integer(I4B) :: nodenumber
776 class(
distype),
intent(in) :: this
777 integer(I4B),
intent(in) :: k, i, j
778 integer(I4B),
intent(in) :: icheck
780 integer(I4B) :: nodeu
782 character(len=*),
parameter :: fmterr = &
783 "('Error in structured-grid cell indices: layer = ',i0,', &
784 &row = ',i0,', column = ',i0)"
786 nodeu =
get_node(k, i, j, this%nlay, this%nrow, this%ncol)
788 write (
errmsg, fmterr) k, i, j
792 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
795 if (icheck /= 0)
then
797 if (k < 1 .or. k > this%nlay) &
798 call store_error(
'Layer less than one or greater than nlay')
799 if (i < 1 .or. i > this%nrow) &
800 call store_error(
'Row less than one or greater than nrow')
801 if (j < 1 .or. j > this%ncol) &
802 call store_error(
'Column less than one or greater than ncol')
805 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
806 write (
errmsg,
'(a,i0,a)') &
807 'Node number (', nodeu,
')less than 1 or greater than nodes.'
819 character(len=*),
intent(in) :: name_model
820 character(len=*),
intent(in) :: input_mempath
823 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
845 call this%DisBaseType%allocate_arrays()
848 if (this%nodes < this%nodesuser)
then
849 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
850 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
853 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
854 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
858 this%mshape(1) = this%nlay
859 this%mshape(2) = this%nrow
860 this%mshape(3) = this%ncol
871 flag_string, allow_zero)
result(nodeu)
874 integer(I4B),
intent(inout) :: lloc
875 integer(I4B),
intent(inout) :: istart
876 integer(I4B),
intent(inout) :: istop
877 integer(I4B),
intent(in) :: in
878 integer(I4B),
intent(in) :: iout
879 character(len=*),
intent(inout) :: line
880 logical,
optional,
intent(in) :: flag_string
881 logical,
optional,
intent(in) :: allow_zero
882 integer(I4B) :: nodeu
884 integer(I4B) :: k, i, j, nlay, nrow, ncol
885 integer(I4B) :: lloclocal, ndum, istat, n
888 if (
present(flag_string))
then
889 if (flag_string)
then
892 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
893 read (line(istart:istop), *, iostat=istat) n
902 nlay = this%mshape(1)
903 nrow = this%mshape(2)
904 ncol = this%mshape(3)
906 call urword(line, lloc, istart, istop, 2, k, r, iout, in)
907 call urword(line, lloc, istart, istop, 2, i, r, iout, in)
908 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
910 if (k == 0 .and. i == 0 .and. j == 0)
then
911 if (
present(allow_zero))
then
921 if (k < 1 .or. k > nlay)
then
922 write (
errmsg,
'(a,i0,a)') &
923 'Layer number in list (', k,
') is outside of the grid.'
925 if (i < 1 .or. i > nrow)
then
926 write (
errmsg,
'(a,1x,a,i0,a)') &
927 trim(adjustl(
errmsg)),
'Row number in list (', i, &
928 ') is outside of the grid.'
930 if (j < 1 .or. j > ncol)
then
931 write (
errmsg,
'(a,1x,a,i0,a)') &
932 trim(adjustl(
errmsg)),
'Column number in list (', j, &
933 ') is outside of the grid.'
936 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
938 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
939 write (
errmsg,
'(a,1x,a,i0,a)') &
941 "Node number in list (", nodeu,
") is outside of the grid. "// &
942 "Cell number cannot be determined in line '"// &
943 trim(adjustl(line))//
"'."
946 if (len_trim(adjustl(
errmsg)) > 0)
then
962 allow_zero)
result(nodeu)
964 integer(I4B) :: nodeu
967 character(len=*),
intent(inout) :: cellid
968 integer(I4B),
intent(in) :: inunit
969 integer(I4B),
intent(in) :: iout
970 logical,
optional,
intent(in) :: flag_string
971 logical,
optional,
intent(in) :: allow_zero
973 integer(I4B) :: lloclocal, istart, istop, ndum, n
974 integer(I4B) :: k, i, j, nlay, nrow, ncol
975 integer(I4B) :: istat
978 if (
present(flag_string))
then
979 if (flag_string)
then
982 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
983 read (cellid(istart:istop), *, iostat=istat) n
992 nlay = this%mshape(1)
993 nrow = this%mshape(2)
994 ncol = this%mshape(3)
997 call urword(cellid, lloclocal, istart, istop, 2, k, r, iout, inunit)
998 call urword(cellid, lloclocal, istart, istop, 2, i, r, iout, inunit)
999 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
1001 if (k == 0 .and. i == 0 .and. j == 0)
then
1002 if (
present(allow_zero))
then
1003 if (allow_zero)
then
1012 if (k < 1 .or. k > nlay)
then
1013 write (
errmsg,
'(a,i0,a)') &
1014 'Layer number in list (', k,
') is outside of the grid.'
1016 if (i < 1 .or. i > nrow)
then
1017 write (
errmsg,
'(a,1x,a,i0,a)') &
1018 trim(adjustl(
errmsg)),
'Row number in list (', i, &
1019 ') is outside of the grid.'
1021 if (j < 1 .or. j > ncol)
then
1022 write (
errmsg,
'(a,1x,a,i0,a)') &
1023 trim(adjustl(
errmsg)),
'Column number in list (', j, &
1024 ') is outside of the grid.'
1027 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
1029 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1030 write (
errmsg,
'(a,1x,a,i0,a)') &
1032 "Cell number cannot be determined for cellid ("// &
1033 trim(adjustl(cellid))//
") and results in a user "// &
1034 "node number (", nodeu,
") that is outside of the grid."
1037 if (len_trim(adjustl(
errmsg)) > 0)
then
1070 integer(I4B),
intent(in) :: noden
1071 integer(I4B),
intent(in) :: nodem
1072 integer(I4B),
intent(in) :: ihc
1073 real(DP),
intent(inout) :: xcomp
1074 real(DP),
intent(inout) :: ycomp
1075 real(DP),
intent(inout) :: zcomp
1076 integer(I4B),
intent(in) :: ipos
1078 integer(I4B) :: nodeu1, i1, j1, k1
1079 integer(I4B) :: nodeu2, i2, j2, k2
1085 if (nodem < noden)
then
1098 nodeu1 = this%get_nodeuser(noden)
1099 nodeu2 = this%get_nodeuser(nodem)
1100 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1101 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1104 elseif (j2 < j1)
then
1106 elseif (j2 > j1)
then
1122 xcomp, ycomp, zcomp, conlen)
1127 integer(I4B),
intent(in) :: noden
1128 integer(I4B),
intent(in) :: nodem
1129 logical,
intent(in) :: nozee
1130 real(DP),
intent(in) :: satn
1131 real(DP),
intent(in) :: satm
1132 integer(I4B),
intent(in) :: ihc
1133 real(DP),
intent(inout) :: xcomp
1134 real(DP),
intent(inout) :: ycomp
1135 real(DP),
intent(inout) :: zcomp
1136 real(DP),
intent(inout) :: conlen
1139 real(DP) :: x1, y1, x2, y2
1141 integer(I4B) :: i1, i2, j1, j2, k1, k2
1142 integer(I4B) :: nodeu1, nodeu2, ipos
1150 if (nodem < noden)
then
1155 z1 = this%bot(noden) +
dhalf * (this%top(noden) - this%bot(noden))
1156 z2 = this%bot(nodem) +
dhalf * (this%top(nodem) - this%bot(nodem))
1157 conlen = abs(z2 - z1)
1164 z1 = this%bot(noden) +
dhalf * satn * (this%top(noden) - this%bot(noden))
1165 z2 = this%bot(nodem) +
dhalf * satm * (this%top(nodem) - this%bot(nodem))
1167 ipos = this%con%getjaindex(noden, nodem)
1168 ds = this%con%cl1(this%con%jas(ipos)) + this%con%cl2(this%con%jas(ipos))
1169 nodeu1 = this%get_nodeuser(noden)
1170 nodeu2 = this%get_nodeuser(nodem)
1171 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1172 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1179 elseif (j2 < j1)
then
1181 elseif (j2 > j1)
then
1195 class(
distype),
intent(in) :: this
1196 character(len=*),
intent(out) :: dis_type
1205 class(
distype),
intent(in) :: this
1206 integer(I4B) :: dis_enum
1216 class(
distype),
intent(inout) :: this
1217 integer(I4B),
intent(in) :: ic
1218 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1219 logical(LGP),
intent(in),
optional :: closed
1221 integer(I4B) :: icu, nverts, irow, jcol, klay
1222 real(DP) :: cellx, celly, dxhalf, dyhalf
1223 logical(LGP) :: lclosed
1228 if (.not. (
present(closed)))
then
1236 allocate (polyverts(2, nverts + 1))
1238 allocate (polyverts(2, nverts))
1242 icu = this%get_nodeuser(ic)
1243 call get_ijk(icu, this%nrow, this%ncol, this%nlay, irow, jcol, klay)
1244 cellx = this%cellx(jcol)
1245 celly = this%celly(irow)
1246 dxhalf =
dhalf * this%delr(jcol)
1247 dyhalf =
dhalf * this%delc(irow)
1248 polyverts(:, 1) = (/cellx - dxhalf, celly - dyhalf/)
1249 polyverts(:, 2) = (/cellx - dxhalf, celly + dyhalf/)
1250 polyverts(:, 3) = (/cellx + dxhalf, celly + dyhalf/)
1251 polyverts(:, 4) = (/cellx + dxhalf, celly - dyhalf/)
1255 polyverts(:, nverts + 1) = polyverts(:, 1)
1264 class(
distype),
intent(inout) :: this
1265 character(len=*),
intent(inout) :: line
1266 integer(I4B),
intent(inout) :: lloc
1267 integer(I4B),
intent(inout) :: istart
1268 integer(I4B),
intent(inout) :: istop
1269 integer(I4B),
intent(in) :: in
1270 integer(I4B),
intent(in) :: iout
1271 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(inout) :: iarray
1272 character(len=*),
intent(in) :: aname
1274 integer(I4B) :: ival
1276 integer(I4B) :: nlay
1277 integer(I4B) :: nrow
1278 integer(I4B) :: ncol
1279 integer(I4B) :: nval
1280 integer(I4B),
dimension(:),
pointer,
contiguous :: itemp
1286 nlay = this%mshape(1)
1287 nrow = this%mshape(2)
1288 ncol = this%mshape(3)
1290 if (this%nodes < this%nodesuser)
then
1291 nval = this%nodesuser
1299 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1300 if (line(istart:istop) .EQ.
'LAYERED')
then
1303 call readarray(in, itemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1308 call readarray(in, itemp, aname, this%ndim, nval, iout, 0)
1312 if (this%nodes < this%nodesuser)
then
1313 call this%fill_grid_array(itemp, iarray)
1323 class(
distype),
intent(inout) :: this
1324 character(len=*),
intent(inout) :: line
1325 integer(I4B),
intent(inout) :: lloc
1326 integer(I4B),
intent(inout) :: istart
1327 integer(I4B),
intent(inout) :: istop
1328 integer(I4B),
intent(in) :: in
1329 integer(I4B),
intent(in) :: iout
1330 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1331 character(len=*),
intent(in) :: aname
1333 integer(I4B) :: ival
1335 integer(I4B) :: nlay
1336 integer(I4B) :: nrow
1337 integer(I4B) :: ncol
1338 integer(I4B) :: nval
1339 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1345 nlay = this%mshape(1)
1346 nrow = this%mshape(2)
1347 ncol = this%mshape(3)
1349 if (this%nodes < this%nodesuser)
then
1350 nval = this%nodesuser
1358 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1359 if (line(istart:istop) .EQ.
'LAYERED')
then
1362 call readarray(in, dtemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1367 call readarray(in, dtemp, aname, this%ndim, nval, iout, 0)
1371 if (this%nodes < this%nodesuser)
then
1372 call this%fill_grid_array(dtemp, darray)
1383 icolbnd, aname, inunit, iout)
1386 integer(I4B),
intent(in) :: maxbnd
1387 integer(I4B),
dimension(maxbnd) :: nodelist
1388 integer(I4B),
intent(in) :: ncolbnd
1389 real(DP),
dimension(ncolbnd, maxbnd),
intent(inout) :: darray
1390 integer(I4B),
intent(in) :: icolbnd
1391 character(len=*),
intent(in) :: aname
1392 integer(I4B),
intent(in) :: inunit
1393 integer(I4B),
intent(in) :: iout
1395 integer(I4B) :: ir, ic, ncol, nrow, nlay, nval, ipos, nodeu
1398 nlay = this%mshape(1)
1399 nrow = this%mshape(2)
1400 ncol = this%mshape(3)
1404 call readarray(inunit, this%dbuff, aname, this%ndim, ncol, nrow, nlay, &
1414 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1415 darray(icolbnd, ipos) = this%dbuff(nodeu)
1429 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1431 class(
distype),
intent(inout) :: this
1432 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1433 integer(I4B),
intent(in) :: iout
1434 integer(I4B),
intent(in) :: iprint
1435 integer(I4B),
intent(in) :: idataun
1436 character(len=*),
intent(in) :: aname
1437 character(len=*),
intent(in) :: cdatafmp
1438 integer(I4B),
intent(in) :: nvaluesp
1439 integer(I4B),
intent(in) :: nwidthp
1440 character(len=*),
intent(in) :: editdesc
1441 real(DP),
intent(in) :: dinact
1443 integer(I4B) :: k, ifirst
1444 integer(I4B) :: nlay
1445 integer(I4B) :: nrow
1446 integer(I4B) :: ncol
1447 integer(I4B) :: nval
1448 integer(I4B) :: nodeu, noder
1449 integer(I4B) :: istart, istop
1450 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1452 character(len=*),
parameter :: fmthsv = &
1453 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1454 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1457 nlay = this%mshape(1)
1458 nrow = this%mshape(2)
1459 ncol = this%mshape(3)
1463 if (this%nodes < this%nodesuser)
then
1466 do nodeu = 1, this%nodesuser
1467 noder = this%get_nodenumber(nodeu, 0)
1468 if (noder <= 0)
then
1469 dtemp(nodeu) = dinact
1472 dtemp(nodeu) = darray(noder)
1480 if (iprint /= 0)
then
1483 istop = istart + nrow * ncol - 1
1485 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1491 if (idataun > 0)
then
1496 istop = istart + nrow * ncol - 1
1497 if (ifirst == 1)
write (iout, fmthsv) &
1498 trim(adjustl(aname)), idataun, &
1505 elseif (idataun < 0)
then
1508 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1517 dstmodel, dstpackage, naux, auxtxt, &
1518 ibdchn, nlist, iout)
1521 character(len=16),
intent(in) :: text
1522 character(len=16),
intent(in) :: textmodel
1523 character(len=16),
intent(in) :: textpackage
1524 character(len=16),
intent(in) :: dstmodel
1525 character(len=16),
intent(in) :: dstpackage
1526 integer(I4B),
intent(in) :: naux
1527 character(len=16),
dimension(:),
intent(in) :: auxtxt
1528 integer(I4B),
intent(in) :: ibdchn
1529 integer(I4B),
intent(in) :: nlist
1530 integer(I4B),
intent(in) :: iout
1532 integer(I4B) :: nlay, nrow, ncol
1534 nlay = this%mshape(1)
1535 nrow = this%mshape(2)
1536 ncol = this%mshape(3)
1539 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1540 ibdchn, naux, auxtxt, ncol, nrow, nlay, &
1550 integer(I4B),
intent(in) :: maxbnd
1551 integer(I4B),
dimension(:),
pointer,
contiguous :: darray
1552 integer(I4B),
dimension(maxbnd),
intent(inout) :: nodelist
1553 integer(I4B),
intent(inout) :: nbound
1554 character(len=*),
intent(in) :: aname
1556 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nval, nodeu, noder, ipos, ierr
1559 nlay = this%mshape(1)
1560 nrow = this%mshape(2)
1561 ncol = this%mshape(3)
1563 if (this%ndim > 1)
then
1572 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1574 if (il < 1 .or. il > nlay)
then
1575 write (
errmsg,
'(a,1x,i0)')
'Invalid layer number:', il
1578 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
1579 noder = this%get_nodenumber(nodeu, 0)
1580 if (ipos > maxbnd)
then
1583 nodelist(ipos) = noder
1592 write (
errmsg,
'(a,1x,i0)') &
1593 'MAXBOUND dimension is too small.'// &
1594 'INCREASE MAXBOUND TO:', ierr
1599 if (nbound < maxbnd)
then
1600 do ipos = nbound + 1, maxbnd
1609 do noder = 1, maxbnd
1610 if (noder < 1 .or. noder > this%nodes)
then
1611 write (
errmsg,
'(a,1x,i0)')
'Invalid node number:', noder
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenbigline
maximum length of a big line
@ dis
DIS6 discretization.
integer(i4b), parameter lenvarname
maximum length of a variable name
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
real(dp), parameter done
real constant 1
subroutine dis3d_df(this)
Define the discretization.
integer(i4b) function get_ncpl(this)
Return number of cells per layer (nrow * ncol)
subroutine nodeu_to_array(this, nodeu, arr)
Convert a user nodenumber to an array (nodenumber) or (k,i,j)
subroutine dis3d_da(this)
Deallocate variables.
integer(i4b) function get_dis_enum(this)
Get the discretization type enumeration.
subroutine nlarray_to_nodelist(this, darray, nodelist, maxbnd, nbound, aname)
Convert an integer array (layer numbers) to nodelist.
subroutine record_array(this, darray, iout, iprint, idataun, aname, cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
Record a double precision array.
subroutine log_options(this, found)
Write user options to list file.
integer(i4b) function nodeu_from_cellid(this, cellid, inunit, iout, flag_string, allow_zero)
Convert a cellid string to a user nodenumber.
subroutine allocate_scalars(this, name_model, input_mempath)
Allocate and initialize scalar variables.
subroutine write_grb(this, icelltype)
Write a binary grid file.
subroutine log_griddata(this, found)
Write dimensions to list file.
subroutine, public dis_cr(dis, name_model, input_mempath, inunit, iout)
Create a new structured discretization object.
integer(i4b) function get_nodenumber_idx3(this, k, i, j, icheck)
Get reduced node number from layer, row and column indices.
logical function supports_layers(this)
Indicates whether the grid discretization supports layers.
subroutine connection_vector(this, noden, nodem, nozee, satn, satm, ihc, xcomp, ycomp, zcomp, conlen)
Get unit vector components between the cell and a given neighbor.
integer(i4b) function nodeu_from_string(this, lloc, istart, istop, in, iout, line, flag_string, allow_zero)
Convert a string to a user nodenumber.
subroutine get_dis_type(this, dis_type)
Get the discretization type.
subroutine nodeu_to_string(this, nodeu, str)
Convert a user nodenumber to a string (nodenumber) or (k,i,j)
subroutine read_layer_array(this, nodelist, darray, ncolbnd, maxbnd, icolbnd, aname, inunit, iout)
Read a 2d double array into col icolbnd of darray.
subroutine allocate_arrays(this)
Allocate and initialize arrays.
subroutine source_dimensions(this)
Copy dimensions from IDM into package.
subroutine connection_normal(this, noden, nodem, ihc, xcomp, ycomp, zcomp, ipos)
Get normal vector components between the cell and a given neighbor.
integer(i4b) function get_nodenumber_idx1(this, nodeu, icheck)
Get reduced node number from user node number.
subroutine grid_finalize(this)
Finalize grid (check properties, allocate arrays, compute connections)
subroutine source_options(this)
Copy options from IDM into package.
subroutine read_int_array(this, line, lloc, istart, istop, iout, in, iarray, aname)
Read an integer array.
subroutine source_griddata(this)
Copy grid data from IDM into package.
subroutine get_polyverts(this, ic, polyverts, closed)
Get a 2D array of polygon vertices, listed in.
subroutine read_dbl_array(this, line, lloc, istart, istop, iout, in, darray, aname)
Read a double precision array.
subroutine record_srcdst_list_header(this, text, textmodel, textpackage, dstmodel, dstpackage, naux, auxtxt, ibdchn, nlist, iout)
Record list header for imeth=6.
subroutine log_dimensions(this, found)
Write dimensions to list file.
subroutine, public line_unit_vector(x0, y0, z0, x1, y1, z1, xcomp, ycomp, zcomp, vmag)
Calculate the vector components (xcomp, ycomp, and zcomp) for a line defined by two points,...
integer(i4b) function, public get_node(ilay, irow, icol, nlay, nrow, ncol)
Get node number, given layer, row, and column indices for a structured grid. If any argument is inval...
subroutine, public get_ijk(nodenumber, nrow, ncol, nlay, irow, icol, ilay)
Get row, column and layer indices from node number and grid dimensions. If nodenumber is invalid,...
This module defines variable data types.
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains simulation methods.
subroutine, public store_error(msg, terminate)
Store an error message.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
real(dp), pointer, public pertim
time relative to start of stress period
real(dp), pointer, public totim
time relative to start of simulation
integer(i4b), pointer, public kstp
current time step number
integer(i4b), pointer, public kper
current stress period number
real(dp), pointer, public delt
length of the current time step
Simplifies tracking parameters sourced from the input context.
Structured grid discretization.