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
552 integer(I4B),
dimension(:),
intent(in) :: icelltype
554 integer(I4B) :: iunit, ntxt, ncpl
555 integer(I4B),
parameter :: lentxt = 100
556 character(len=50) :: txthdr
557 character(len=lentxt) :: txt
558 character(len=LINELENGTH) :: fname
559 character(len=*),
parameter :: fmtgrdsave = &
560 "(4X,'BINARY GRID INFORMATION WILL BE WRITTEN TO:', &
561 &/,6X,'UNIT NUMBER: ', I0,/,6X, 'FILE NAME: ', A)"
565 ncpl = this%nrow * this%ncol
568 fname = trim(this%input_fname)//
'.grb'
570 write (this%iout, fmtgrdsave) iunit, trim(adjustl(fname))
571 call openfile(iunit, this%iout, trim(adjustl(fname)),
'DATA(BINARY)', &
575 write (txthdr,
'(a)')
'GRID DIS'
576 txthdr(50:50) = new_line(
'a')
578 write (txthdr,
'(a)')
'VERSION 1'
579 txthdr(50:50) = new_line(
'a')
581 write (txthdr,
'(a, i0)')
'NTXT ', ntxt
582 txthdr(50:50) = new_line(
'a')
584 write (txthdr,
'(a, i0)')
'LENTXT ', lentxt
585 txthdr(50:50) = new_line(
'a')
589 write (txt,
'(3a, i0)')
'NCELLS ',
'INTEGER ',
'NDIM 0 # ', this%nodesuser
590 txt(lentxt:lentxt) = new_line(
'a')
592 write (txt,
'(3a, i0)')
'NLAY ',
'INTEGER ',
'NDIM 0 # ', this%nlay
593 txt(lentxt:lentxt) = new_line(
'a')
595 write (txt,
'(3a, i0)')
'NROW ',
'INTEGER ',
'NDIM 0 # ', this%nrow
596 txt(lentxt:lentxt) = new_line(
'a')
598 write (txt,
'(3a, i0)')
'NCOL ',
'INTEGER ',
'NDIM 0 # ', this%ncol
599 txt(lentxt:lentxt) = new_line(
'a')
601 write (txt,
'(3a, i0)')
'NJA ',
'INTEGER ',
'NDIM 0 # ', this%nja
602 txt(lentxt:lentxt) = new_line(
'a')
604 write (txt,
'(3a, 1pg24.15)')
'XORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%xorigin
605 txt(lentxt:lentxt) = new_line(
'a')
607 write (txt,
'(3a, 1pg24.15)')
'YORIGIN ',
'DOUBLE ',
'NDIM 0 # ', this%yorigin
608 txt(lentxt:lentxt) = new_line(
'a')
610 write (txt,
'(3a, 1pg24.15)')
'ANGROT ',
'DOUBLE ',
'NDIM 0 # ', this%angrot
611 txt(lentxt:lentxt) = new_line(
'a')
613 write (txt,
'(3a, i0)')
'DELR ',
'DOUBLE ',
'NDIM 1 ', this%ncol
614 txt(lentxt:lentxt) = new_line(
'a')
616 write (txt,
'(3a, i0)')
'DELC ',
'DOUBLE ',
'NDIM 1 ', this%nrow
617 txt(lentxt:lentxt) = new_line(
'a')
619 write (txt,
'(3a, i0)')
'TOP ',
'DOUBLE ',
'NDIM 1 ', ncpl
620 txt(lentxt:lentxt) = new_line(
'a')
622 write (txt,
'(3a, i0)')
'BOTM ',
'DOUBLE ',
'NDIM 1 ', this%nodesuser
623 txt(lentxt:lentxt) = new_line(
'a')
625 write (txt,
'(3a, i0)')
'IA ',
'INTEGER ',
'NDIM 1 ', this%nodesuser + 1
626 txt(lentxt:lentxt) = new_line(
'a')
628 write (txt,
'(3a, i0)')
'JA ',
'INTEGER ',
'NDIM 1 ',
size(this%con%jausr)
629 txt(lentxt:lentxt) = new_line(
'a')
631 write (txt,
'(3a, i0)')
'IDOMAIN ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
632 txt(lentxt:lentxt) = new_line(
'a')
634 write (txt,
'(3a, i0)')
'ICELLTYPE ',
'INTEGER ',
'NDIM 1 ', this%nodesuser
635 txt(lentxt:lentxt) = new_line(
'a')
639 write (iunit) this%nodesuser
640 write (iunit) this%nlay
641 write (iunit) this%nrow
642 write (iunit) this%ncol
643 write (iunit) this%nja
644 write (iunit) this%xorigin
645 write (iunit) this%yorigin
646 write (iunit) this%angrot
647 write (iunit) this%delr
648 write (iunit) this%delc
649 write (iunit) this%top2d
650 write (iunit) this%bot3d
651 write (iunit) this%con%iausr
652 write (iunit) this%con%jausr
653 write (iunit) this%idomain
654 write (iunit) icelltype
666 integer(I4B),
intent(in) :: nodeu
667 character(len=*),
intent(inout) :: str
669 integer(I4B) :: i, j, k
670 character(len=10) :: kstr, istr, jstr
672 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
673 write (kstr,
'(i10)') k
674 write (istr,
'(i10)') i
675 write (jstr,
'(i10)') j
676 str =
'('//trim(adjustl(kstr))//
','// &
677 trim(adjustl(istr))//
','// &
678 trim(adjustl(jstr))//
')'
687 integer(I4B),
intent(in) :: nodeu
688 integer(I4B),
dimension(:),
intent(inout) :: arr
690 integer(I4B) :: isize
691 integer(I4B) :: i, j, k
695 if (isize /= this%ndim)
then
696 write (
errmsg,
'(a,i0,a,i0,a)') &
697 'Program error: nodeu_to_array size of array (', isize, &
698 ') is not equal to the discretization dimension (', this%ndim,
')'
703 call get_ijk(nodeu, this%nrow, this%ncol, this%nlay, i, j, k)
716 integer(I4B) :: nodenumber
718 class(
distype),
intent(in) :: this
719 integer(I4B),
intent(in) :: nodeu
720 integer(I4B),
intent(in) :: icheck
723 if (icheck /= 0)
then
726 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
727 write (
errmsg,
'(a,i0,a)') &
728 'Node number (', nodeu, &
729 ') less than 1 or greater than the number of nodes.'
734 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
738 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
747 integer(I4B) :: nodenumber
749 class(
distype),
intent(in) :: this
750 integer(I4B),
intent(in) :: k, i, j
751 integer(I4B),
intent(in) :: icheck
753 integer(I4B) :: nodeu
755 character(len=*),
parameter :: fmterr = &
756 "('Error in structured-grid cell indices: layer = ',i0,', &
757 &row = ',i0,', column = ',i0)"
759 nodeu =
get_node(k, i, j, this%nlay, this%nrow, this%ncol)
761 write (
errmsg, fmterr) k, i, j
765 if (this%nodes < this%nodesuser) nodenumber = this%nodereduced(nodeu)
768 if (icheck /= 0)
then
770 if (k < 1 .or. k > this%nlay) &
771 call store_error(
'Layer less than one or greater than nlay')
772 if (i < 1 .or. i > this%nrow) &
773 call store_error(
'Row less than one or greater than nrow')
774 if (j < 1 .or. j > this%ncol) &
775 call store_error(
'Column less than one or greater than ncol')
778 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
779 write (
errmsg,
'(a,i0,a)') &
780 'Node number (', nodeu,
')less than 1 or greater than nodes.'
792 character(len=*),
intent(in) :: name_model
793 character(len=*),
intent(in) :: input_mempath
796 call this%DisBaseType%allocate_scalars(name_model, input_mempath)
818 call this%DisBaseType%allocate_arrays()
821 if (this%nodes < this%nodesuser)
then
822 call mem_allocate(this%nodeuser, this%nodes,
'NODEUSER', this%memoryPath)
823 call mem_allocate(this%nodereduced, this%nodesuser,
'NODEREDUCED', &
826 call mem_allocate(this%nodeuser, 1,
'NODEUSER', this%memoryPath)
827 call mem_allocate(this%nodereduced, 1,
'NODEREDUCED', this%memoryPath)
831 this%mshape(1) = this%nlay
832 this%mshape(2) = this%nrow
833 this%mshape(3) = this%ncol
844 flag_string, allow_zero)
result(nodeu)
847 integer(I4B),
intent(inout) :: lloc
848 integer(I4B),
intent(inout) :: istart
849 integer(I4B),
intent(inout) :: istop
850 integer(I4B),
intent(in) :: in
851 integer(I4B),
intent(in) :: iout
852 character(len=*),
intent(inout) :: line
853 logical,
optional,
intent(in) :: flag_string
854 logical,
optional,
intent(in) :: allow_zero
855 integer(I4B) :: nodeu
857 integer(I4B) :: k, i, j, nlay, nrow, ncol
858 integer(I4B) :: lloclocal, ndum, istat, n
861 if (
present(flag_string))
then
862 if (flag_string)
then
865 call urword(line, lloclocal, istart, istop, 1, ndum, r, iout, in)
866 read (line(istart:istop), *, iostat=istat) n
875 nlay = this%mshape(1)
876 nrow = this%mshape(2)
877 ncol = this%mshape(3)
879 call urword(line, lloc, istart, istop, 2, k, r, iout, in)
880 call urword(line, lloc, istart, istop, 2, i, r, iout, in)
881 call urword(line, lloc, istart, istop, 2, j, r, iout, in)
883 if (k == 0 .and. i == 0 .and. j == 0)
then
884 if (
present(allow_zero))
then
894 if (k < 1 .or. k > nlay)
then
895 write (
errmsg,
'(a,i0,a)') &
896 'Layer number in list (', k,
') is outside of the grid.'
898 if (i < 1 .or. i > nrow)
then
899 write (
errmsg,
'(a,1x,a,i0,a)') &
900 trim(adjustl(
errmsg)),
'Row number in list (', i, &
901 ') is outside of the grid.'
903 if (j < 1 .or. j > ncol)
then
904 write (
errmsg,
'(a,1x,a,i0,a)') &
905 trim(adjustl(
errmsg)),
'Column number in list (', j, &
906 ') is outside of the grid.'
909 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
911 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
912 write (
errmsg,
'(a,1x,a,i0,a)') &
914 "Node number in list (", nodeu,
") is outside of the grid. "// &
915 "Cell number cannot be determined in line '"// &
916 trim(adjustl(line))//
"'."
919 if (len_trim(adjustl(
errmsg)) > 0)
then
935 allow_zero)
result(nodeu)
937 integer(I4B) :: nodeu
940 character(len=*),
intent(inout) :: cellid
941 integer(I4B),
intent(in) :: inunit
942 integer(I4B),
intent(in) :: iout
943 logical,
optional,
intent(in) :: flag_string
944 logical,
optional,
intent(in) :: allow_zero
946 integer(I4B) :: lloclocal, istart, istop, ndum, n
947 integer(I4B) :: k, i, j, nlay, nrow, ncol
948 integer(I4B) :: istat
951 if (
present(flag_string))
then
952 if (flag_string)
then
955 call urword(cellid, lloclocal, istart, istop, 1, ndum, r, iout, inunit)
956 read (cellid(istart:istop), *, iostat=istat) n
965 nlay = this%mshape(1)
966 nrow = this%mshape(2)
967 ncol = this%mshape(3)
970 call urword(cellid, lloclocal, istart, istop, 2, k, r, iout, inunit)
971 call urword(cellid, lloclocal, istart, istop, 2, i, r, iout, inunit)
972 call urword(cellid, lloclocal, istart, istop, 2, j, r, iout, inunit)
974 if (k == 0 .and. i == 0 .and. j == 0)
then
975 if (
present(allow_zero))
then
985 if (k < 1 .or. k > nlay)
then
986 write (
errmsg,
'(a,i0,a)') &
987 'Layer number in list (', k,
') is outside of the grid.'
989 if (i < 1 .or. i > nrow)
then
990 write (
errmsg,
'(a,1x,a,i0,a)') &
991 trim(adjustl(
errmsg)),
'Row number in list (', i, &
992 ') is outside of the grid.'
994 if (j < 1 .or. j > ncol)
then
995 write (
errmsg,
'(a,1x,a,i0,a)') &
996 trim(adjustl(
errmsg)),
'Column number in list (', j, &
997 ') is outside of the grid.'
1000 nodeu =
get_node(k, i, j, nlay, nrow, ncol)
1002 if (nodeu < 1 .or. nodeu > this%nodesuser)
then
1003 write (
errmsg,
'(a,1x,a,i0,a)') &
1005 "Cell number cannot be determined for cellid ("// &
1006 trim(adjustl(cellid))//
") and results in a user "// &
1007 "node number (", nodeu,
") that is outside of the grid."
1010 if (len_trim(adjustl(
errmsg)) > 0)
then
1043 integer(I4B),
intent(in) :: noden
1044 integer(I4B),
intent(in) :: nodem
1045 integer(I4B),
intent(in) :: ihc
1046 real(DP),
intent(inout) :: xcomp
1047 real(DP),
intent(inout) :: ycomp
1048 real(DP),
intent(inout) :: zcomp
1049 integer(I4B),
intent(in) :: ipos
1051 integer(I4B) :: nodeu1, i1, j1, k1
1052 integer(I4B) :: nodeu2, i2, j2, k2
1058 if (nodem < noden)
then
1071 nodeu1 = this%get_nodeuser(noden)
1072 nodeu2 = this%get_nodeuser(nodem)
1073 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1074 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1077 elseif (j2 < j1)
then
1079 elseif (j2 > j1)
then
1095 xcomp, ycomp, zcomp, conlen)
1100 integer(I4B),
intent(in) :: noden
1101 integer(I4B),
intent(in) :: nodem
1102 logical,
intent(in) :: nozee
1103 real(DP),
intent(in) :: satn
1104 real(DP),
intent(in) :: satm
1105 integer(I4B),
intent(in) :: ihc
1106 real(DP),
intent(inout) :: xcomp
1107 real(DP),
intent(inout) :: ycomp
1108 real(DP),
intent(inout) :: zcomp
1109 real(DP),
intent(inout) :: conlen
1112 real(DP) :: x1, y1, x2, y2
1114 integer(I4B) :: i1, i2, j1, j2, k1, k2
1115 integer(I4B) :: nodeu1, nodeu2, ipos
1123 if (nodem < noden)
then
1128 z1 = this%bot(noden) +
dhalf * (this%top(noden) - this%bot(noden))
1129 z2 = this%bot(nodem) +
dhalf * (this%top(nodem) - this%bot(nodem))
1130 conlen = abs(z2 - z1)
1137 z1 = this%bot(noden) +
dhalf * satn * (this%top(noden) - this%bot(noden))
1138 z2 = this%bot(nodem) +
dhalf * satm * (this%top(nodem) - this%bot(nodem))
1140 ipos = this%con%getjaindex(noden, nodem)
1141 ds = this%con%cl1(this%con%jas(ipos)) + this%con%cl2(this%con%jas(ipos))
1142 nodeu1 = this%get_nodeuser(noden)
1143 nodeu2 = this%get_nodeuser(nodem)
1144 call get_ijk(nodeu1, this%nrow, this%ncol, this%nlay, i1, j1, k1)
1145 call get_ijk(nodeu2, this%nrow, this%ncol, this%nlay, i2, j2, k2)
1152 elseif (j2 < j1)
then
1154 elseif (j2 > j1)
then
1168 class(
distype),
intent(in) :: this
1169 character(len=*),
intent(out) :: dis_type
1178 class(
distype),
intent(in) :: this
1179 integer(I4B) :: dis_enum
1189 class(
distype),
intent(inout) :: this
1190 integer(I4B),
intent(in) :: ic
1191 real(DP),
allocatable,
intent(out) :: polyverts(:, :)
1192 logical(LGP),
intent(in),
optional :: closed
1194 integer(I4B) :: icu, nverts, irow, jcol, klay
1195 real(DP) :: cellx, celly, dxhalf, dyhalf
1196 logical(LGP) :: lclosed
1201 if (.not. (
present(closed)))
then
1209 allocate (polyverts(2, nverts + 1))
1211 allocate (polyverts(2, nverts))
1215 icu = this%get_nodeuser(ic)
1216 call get_ijk(icu, this%nrow, this%ncol, this%nlay, irow, jcol, klay)
1217 cellx = this%cellx(jcol)
1218 celly = this%celly(irow)
1219 dxhalf =
dhalf * this%delr(jcol)
1220 dyhalf =
dhalf * this%delc(irow)
1221 polyverts(:, 1) = (/cellx - dxhalf, celly - dyhalf/)
1222 polyverts(:, 2) = (/cellx - dxhalf, celly + dyhalf/)
1223 polyverts(:, 3) = (/cellx + dxhalf, celly + dyhalf/)
1224 polyverts(:, 4) = (/cellx + dxhalf, celly - dyhalf/)
1228 polyverts(:, nverts + 1) = polyverts(:, 1)
1237 class(
distype),
intent(inout) :: this
1238 character(len=*),
intent(inout) :: line
1239 integer(I4B),
intent(inout) :: lloc
1240 integer(I4B),
intent(inout) :: istart
1241 integer(I4B),
intent(inout) :: istop
1242 integer(I4B),
intent(in) :: in
1243 integer(I4B),
intent(in) :: iout
1244 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(inout) :: iarray
1245 character(len=*),
intent(in) :: aname
1247 integer(I4B) :: ival
1249 integer(I4B) :: nlay
1250 integer(I4B) :: nrow
1251 integer(I4B) :: ncol
1252 integer(I4B) :: nval
1253 integer(I4B),
dimension(:),
pointer,
contiguous :: itemp
1259 nlay = this%mshape(1)
1260 nrow = this%mshape(2)
1261 ncol = this%mshape(3)
1263 if (this%nodes < this%nodesuser)
then
1264 nval = this%nodesuser
1272 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1273 if (line(istart:istop) .EQ.
'LAYERED')
then
1276 call readarray(in, itemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1281 call readarray(in, itemp, aname, this%ndim, nval, iout, 0)
1285 if (this%nodes < this%nodesuser)
then
1286 call this%fill_grid_array(itemp, iarray)
1296 class(
distype),
intent(inout) :: this
1297 character(len=*),
intent(inout) :: line
1298 integer(I4B),
intent(inout) :: lloc
1299 integer(I4B),
intent(inout) :: istart
1300 integer(I4B),
intent(inout) :: istop
1301 integer(I4B),
intent(in) :: in
1302 integer(I4B),
intent(in) :: iout
1303 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1304 character(len=*),
intent(in) :: aname
1306 integer(I4B) :: ival
1308 integer(I4B) :: nlay
1309 integer(I4B) :: nrow
1310 integer(I4B) :: ncol
1311 integer(I4B) :: nval
1312 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1318 nlay = this%mshape(1)
1319 nrow = this%mshape(2)
1320 ncol = this%mshape(3)
1322 if (this%nodes < this%nodesuser)
then
1323 nval = this%nodesuser
1331 call urword(line, lloc, istart, istop, 1, ival, rval, iout, in)
1332 if (line(istart:istop) .EQ.
'LAYERED')
then
1335 call readarray(in, dtemp, aname, this%ndim, ncol, nrow, nlay, nval, &
1340 call readarray(in, dtemp, aname, this%ndim, nval, iout, 0)
1344 if (this%nodes < this%nodesuser)
then
1345 call this%fill_grid_array(dtemp, darray)
1356 icolbnd, aname, inunit, iout)
1359 integer(I4B),
intent(in) :: maxbnd
1360 integer(I4B),
dimension(maxbnd) :: nodelist
1361 integer(I4B),
intent(in) :: ncolbnd
1362 real(DP),
dimension(ncolbnd, maxbnd),
intent(inout) :: darray
1363 integer(I4B),
intent(in) :: icolbnd
1364 character(len=*),
intent(in) :: aname
1365 integer(I4B),
intent(in) :: inunit
1366 integer(I4B),
intent(in) :: iout
1368 integer(I4B) :: ir, ic, ncol, nrow, nlay, nval, ipos, nodeu
1371 nlay = this%mshape(1)
1372 nrow = this%mshape(2)
1373 ncol = this%mshape(3)
1377 call readarray(inunit, this%dbuff, aname, this%ndim, ncol, nrow, nlay, &
1387 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1388 darray(icolbnd, ipos) = this%dbuff(nodeu)
1402 cdatafmp, nvaluesp, nwidthp, editdesc, dinact)
1404 class(
distype),
intent(inout) :: this
1405 real(DP),
dimension(:),
pointer,
contiguous,
intent(inout) :: darray
1406 integer(I4B),
intent(in) :: iout
1407 integer(I4B),
intent(in) :: iprint
1408 integer(I4B),
intent(in) :: idataun
1409 character(len=*),
intent(in) :: aname
1410 character(len=*),
intent(in) :: cdatafmp
1411 integer(I4B),
intent(in) :: nvaluesp
1412 integer(I4B),
intent(in) :: nwidthp
1413 character(len=*),
intent(in) :: editdesc
1414 real(DP),
intent(in) :: dinact
1416 integer(I4B) :: k, ifirst
1417 integer(I4B) :: nlay
1418 integer(I4B) :: nrow
1419 integer(I4B) :: ncol
1420 integer(I4B) :: nval
1421 integer(I4B) :: nodeu, noder
1422 integer(I4B) :: istart, istop
1423 real(DP),
dimension(:),
pointer,
contiguous :: dtemp
1425 character(len=*),
parameter :: fmthsv = &
1426 "(1X,/1X,a,' WILL BE SAVED ON UNIT ',I4, &
1427 &' AT END OF TIME STEP',I5,', STRESS PERIOD ',I4)"
1430 nlay = this%mshape(1)
1431 nrow = this%mshape(2)
1432 ncol = this%mshape(3)
1436 if (this%nodes < this%nodesuser)
then
1439 do nodeu = 1, this%nodesuser
1440 noder = this%get_nodenumber(nodeu, 0)
1441 if (noder <= 0)
then
1442 dtemp(nodeu) = dinact
1445 dtemp(nodeu) = darray(noder)
1453 if (iprint /= 0)
then
1456 istop = istart + nrow * ncol - 1
1458 aname, cdatafmp, nvaluesp, nwidthp, editdesc)
1464 if (idataun > 0)
then
1469 istop = istart + nrow * ncol - 1
1470 if (ifirst == 1)
write (iout, fmthsv) &
1471 trim(adjustl(aname)), idataun, &
1478 elseif (idataun < 0)
then
1481 call ubdsv1(
kstp,
kper, aname, -idataun, dtemp, ncol, nrow, nlay, &
1490 dstmodel, dstpackage, naux, auxtxt, &
1491 ibdchn, nlist, iout)
1494 character(len=16),
intent(in) :: text
1495 character(len=16),
intent(in) :: textmodel
1496 character(len=16),
intent(in) :: textpackage
1497 character(len=16),
intent(in) :: dstmodel
1498 character(len=16),
intent(in) :: dstpackage
1499 integer(I4B),
intent(in) :: naux
1500 character(len=16),
dimension(:),
intent(in) :: auxtxt
1501 integer(I4B),
intent(in) :: ibdchn
1502 integer(I4B),
intent(in) :: nlist
1503 integer(I4B),
intent(in) :: iout
1505 integer(I4B) :: nlay, nrow, ncol
1507 nlay = this%mshape(1)
1508 nrow = this%mshape(2)
1509 ncol = this%mshape(3)
1512 call ubdsv06(
kstp,
kper, text, textmodel, textpackage, dstmodel, dstpackage, &
1513 ibdchn, naux, auxtxt, ncol, nrow, nlay, &
1523 integer(I4B),
intent(in) :: maxbnd
1524 integer(I4B),
dimension(:),
pointer,
contiguous :: darray
1525 integer(I4B),
dimension(maxbnd),
intent(inout) :: nodelist
1526 integer(I4B),
intent(inout) :: nbound
1527 character(len=*),
intent(in) :: aname
1529 integer(I4B) :: il, ir, ic, ncol, nrow, nlay, nval, nodeu, noder, ipos, ierr
1532 nlay = this%mshape(1)
1533 nrow = this%mshape(2)
1534 ncol = this%mshape(3)
1536 if (this%ndim > 1)
then
1545 nodeu =
get_node(1, ir, ic, nlay, nrow, ncol)
1547 if (il < 1 .or. il > nlay)
then
1548 write (
errmsg,
'(a,1x,i0)')
'Invalid layer number:', il
1551 nodeu =
get_node(il, ir, ic, nlay, nrow, ncol)
1552 noder = this%get_nodenumber(nodeu, 0)
1553 if (ipos > maxbnd)
then
1556 nodelist(ipos) = noder
1565 write (
errmsg,
'(a,1x,i0)') &
1566 'MAXBOUND dimension is too small.'// &
1567 'INCREASE MAXBOUND TO:', ierr
1572 if (nbound < maxbnd)
then
1573 do ipos = nbound + 1, maxbnd
1582 do noder = 1, maxbnd
1583 if (noder < 1 .or. noder > this%nodes)
then
1584 write (
errmsg,
'(a,1x,i0)')
'Invalid node number:', noder
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard 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.